READ lets downstream clients share information between each other about
what messages have been read by other downstreams.
Each target/entity has an optional corresponding read receipt, which is
stored as a timestamp.
- When a downstream sends:
READ #chan timestamp=2020-01-01T01:23:45.000Z
the read receipt for that target is set to that date
- soju sends READ to downstreams:
- on JOIN, if the client uses the soju.im/read capability
- when the read receipt timestamp is set by any downstream
The read receipt date is clamped by the previous receipt date and the
current time.
git-svn-id: file:///srv/svn/repo/suika/trunk@781 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Make Network.Nick optional, default to the user's username. This
will allow adding a global setting to set the nickname in the
future, just like we have for the real name.
References: https://todo.sr.ht/~emersion/soju/110
git-svn-id: file:///srv/svn/repo/suika/trunk@664 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.
Future work involves properly wiring up the contexts when it makes
sense.
git-svn-id: file:///srv/svn/repo/suika/trunk@652 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This allows users to set a default realname used if the per-network
realname isn't set.
A new "user update" command is introduced and can be extended to edit
other user properties and other users in the future.
git-svn-id: file:///srv/svn/repo/suika/trunk@568 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This refactors the SQLite-specific bits into db_sqlite.go. A future
patch will add PostgreSQL support.
git-svn-id: file:///srv/svn/repo/suika/trunk@531 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Soju inserts 9 columns but only with 8 placeholders. This causes
channels not being saved properly and also logging errors like this:
downstream ...: failed to create or update channel ...: 8 values for 9 columns
git-svn-id: file:///srv/svn/repo/suika/trunk@509 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This avoids loosing history on restart for clients that don't
support chathistory.
Closes: https://todo.sr.ht/~emersion/soju/80
git-svn-id: file:///srv/svn/repo/suika/trunk@489 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This adds several fields to the channel database schema and struct.
These fields will be used to add support for customizable message
relaying through BouncerServ, auto-reattaching, auto-detaching.
- RelayDetached is a filter for which notices to relay through
BouncerServ for detached channels.
- ReattachOn is a filter for which messages to trigger a channel
reattach on.
- DetachAfter is the duration after which to automatically detach a
channel if no matching messages are received.
- DetachOn is a filter for which messages will reset the auto-detach
timer.
git-svn-id: file:///srv/svn/repo/suika/trunk@434 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Not really better than what we had before, however new contributors will
maybe be familiar with it.
git-svn-id: file:///srv/svn/repo/suika/trunk@422 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit changes the Network schema to use user IDs instead of
usernames. While at it, a new UNIQUE(user, name) constraint ensures
there is no conflict with custom network names.
Closes: https://todo.sr.ht/~emersion/soju/86
References: https://todo.sr.ht/~emersion/soju/29
git-svn-id: file:///srv/svn/repo/suika/trunk@421 f0ae65fe-ee39-954e-97ec-027ff2717ef4
... to allow the caller to correctly do any necessary casemapping.
git-svn-id: file:///srv/svn/repo/suika/trunk@416 f0ae65fe-ee39-954e-97ec-027ff2717ef4
For now it's just a new field that'll be useful to generate user ident
strings. It uses the SQLite implicit rowid column. In the future the DB
interface will need to be updated to use user IDs instead of usernames.
git-svn-id: file:///srv/svn/repo/suika/trunk@382 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This method was calling itself, instead of the underlying SQLite
database's Close method.
git-svn-id: file:///srv/svn/repo/suika/trunk@356 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@327 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@324 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@284 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@267 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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).
git-svn-id: file:///srv/svn/repo/suika/trunk@263 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@255 f0ae65fe-ee39-954e-97ec-027ff2717ef4
And add all the infrastructure required to stop and delete networks.
References: https://todo.sr.ht/~emersion/soju/17
git-svn-id: file:///srv/svn/repo/suika/trunk@202 f0ae65fe-ee39-954e-97ec-027ff2717ef4
We now store SASL credentials in the database and automatically populate
them on NickServ REGISTER/IDENTIFY.
References: https://todo.sr.ht/~emersion/jounce/10
git-svn-id: file:///srv/svn/repo/suika/trunk@95 f0ae65fe-ee39-954e-97ec-027ff2717ef4