Commit Graph

26 Commits

Author SHA1 Message Date
Simon Ser
7ebe47ad4a
Fix deadlock in DB.Close
This method was calling itself, instead of the underlying SQLite
database's Close method.
2020-07-09 11:23:51 +02:00
delthas
d1b4faa529 Add an admin flag to users
This is preparatory work for letting some users access admin-exclusive
service commands, such as creating new users.

This adds a boolean admin flag to the User schema. Old users will stay
non-admin after the DB migration.
2020-06-08 22:30:09 +02:00
Simon Ser
998546cdc3
Introduce User.Created
For Network and Channel, the database only needed to define one Store
operation to create/update a record. However since User is missing an ID
we couldn't have a single StoreUser function like other types. We had
CreateUser and UpdatePassword. As new User fields get added (e.g. the
upcoming Admin flag) this isn't sustainable.

We could have CreateUser and UpdateUser, but this wouldn't be consistent
with other types. Instead, introduce User.Created which indicates
whether the record is already stored in the DB. This can be used in a
new StoreUser function to decide whether we need to UPDATE or INSERT
without relying on SQL constraints and INSERT OR UPDATE.

The ListUsers and GetUser functions set User.Created to true.
2020-06-08 11:59:03 +02:00
fox.cpp
203dc3df6a
Implement upstream SASL EXTERNAL support
Closes: https://todo.sr.ht/~emersion/soju/47
2020-06-02 11:24:22 +02:00
Simon Ser
d9186e994d
Add support for detached channels
Channels can now be detached by leaving them with the reason "detach",
and re-attached by joining them again. Upon detaching the channel is
no longer forwarded to downstream connections. Upon re-attaching the
history buffer is sent.
2020-05-01 15:18:14 +02:00
Simon Ser
276ce12e7c
Add network.channels, remove DB.GetChannel
Store the list of configured channels in the network data structure.
This removes the need for a database lookup and will be useful for
detached channels.
2020-04-23 16:36:20 +02:00
delthas
7f74055380 Add support for custom network on-connect commands
Some servers use custom IRC bots with custom commands for registering to
specific services after connection.

This adds support for setting custom raw IRC messages, that will be
sent after registering to a network.

It also adds support for a custom flag.Value type for string
slice flags (flags taking several string values).
2020-04-16 17:38:47 +02:00
Simon Ser
2194259124
Set up DB migration infrastructure
The database is now initialized automatically on first run. The schema
version is stored in SQLite's user_version special field. Migrations are
stored in an array and applied based on the schema version.
2020-04-10 22:45:02 +02:00
Thorben Günther
148bbc8102
Add ability to change password 2020-04-10 10:09:02 +02:00
Simon Ser
7c10535bfd
Fix SQL error logged on JOIN
Closes: https://todo.sr.ht/~emersion/soju/40
2020-04-01 17:34:22 +02:00
Simon Ser
96039320b6
Add "network delete" service command
And add all the infrastructure required to stop and delete networks.

References: https://todo.sr.ht/~emersion/soju/17
2020-04-01 15:40:20 +02:00
Simon Ser
2fff645129
Stop accessing user data in downstreamConn.authenticate
This becomes racy once user.Password is updated on-the-fly.
2020-03-27 22:38:38 +01:00
Simon Ser
04dd9d51f3
Correctly set Channel.ID in DB.StoreChannel 2020-03-25 14:23:41 +01:00
Simon Ser
02c3bdde20
Error out when storing unsupported SASL mechanism in DB 2020-03-25 14:15:25 +01:00
Simon Ser
33dacc4fb0
Add support for channel keys 2020-03-25 11:54:08 +01:00
delthas
1c41576988 schema: add Network.name 2020-03-19 00:06:48 +01:00
Simon Ser
f3940117d1
Rename project to soju 2020-03-13 18:13:03 +01:00
Simon Ser
03d5600da6
Add support for SASL authentication
We now store SASL credentials in the database and automatically populate
them on NickServ REGISTER/IDENTIFY.

References: https://todo.sr.ht/~emersion/jounce/10
2020-03-13 15:12:44 +01:00
Simon Ser
fee8fc79c6
Add support for upstream PASS command 2020-03-13 12:06:02 +01:00
Simon Ser
0ef08dfbb5
Store NICK changes in the DB 2020-03-12 19:17:06 +01:00
Simon Ser
0c4e9b539c
Update DB on JOIN and PART 2020-03-12 18:33:03 +01:00
Simon Ser
f3656028f6
Add support for PASS to downstream 2020-03-11 19:09:32 +01:00
Simon Ser
a572b24702
cmd/jouncectl: new command
Allows to create users.
2020-03-11 19:01:03 +01:00
Simon Ser
660e4c035d
Use a RWMutex for DB 2020-03-04 20:15:38 +01:00
Simon Ser
9db953c7e5
go fmt 2020-03-04 19:23:24 +01:00
Simon Ser
84fe3ae255
Add SQLite database
Closes: https://todo.sr.ht/~emersion/jounce/9
2020-03-04 18:22:58 +01:00