Commit Graph

768 Commits

Author SHA1 Message Date
Simon Ser
193c0afd69 msgstore_fs: abort on timeout 2021-11-03 18:21:12 +01:00
Simon Ser
ce69f00e3f msgstore: add context to messageStore methods
This allows setting a hard timeout.
2021-11-03 18:21:05 +01:00
Simon Ser
2b4f0a870f msgstore: take Network as arg instead of network
The message stores don't need to access the internal network
struct, they just need network metadata such as ID and name.

This can ease moving message stores into a separate package in the
future.
2021-11-03 16:37:01 +01:00
delthas
03f8972305 Add support for draft/event-playback 2021-11-03 15:17:16 +01:00
Simon Ser
a6aa7f0008 Make Network.Nick optional
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
2021-11-02 23:33:17 +01:00
Simon Ser
ce3d6df6b8 db_sqlite: use TEXT instead of VARCHAR
VARCHAR(n) is pointless in SQLite and is the same as TEXT. Don't
bother with a migration since they're equivalent.

Also remove some unnecessary DEFAULT NULL statements.
2021-11-02 22:58:50 +01:00
Simon Ser
07c962018d Add title config option
Closes: https://todo.sr.ht/~emersion/soju/146
2021-11-02 22:38:07 +01:00
Simon Ser
832d8b89a2 Mark bouncer users and BouncerServ as authenticated in WHOX/WHOIS 2021-11-02 18:32:39 +01:00
Simon Ser
241e27b00e Add support for WHOX
This adds support for WHOX, without bothering about flags and mask2
because Solanum and Ergo [1] don't support it either.

The motivation is to allow clients to reliably query account names.

It's not possible to use WHOX tokens to route replies to the right
client, because RPL_ENDOFWHO doesn't contain it.

[1]: https://github.com/ergochat/ergo/pull/1184

Closes: https://todo.sr.ht/~emersion/soju/135
2021-11-02 18:25:43 +01:00
Simon Ser
8c7c907d6f Fix operator flag in RPL_WHOREPLY
@ and + indicate channel privileges. * indicates that the user is
a server operator.
2021-11-01 18:36:21 +01:00
Simon Ser
62d92c660f Mark admins as server operators in self WHO/WHOIS replies 2021-11-01 18:32:01 +01:00
Simon Ser
3ab8ef17df Mark BouncerServ as server operator
That's what some widely used IRC servers do for their own services
(e.g. NickServ and ChanServ). This adds an additional level of
trust to make sure BouncerServ isn't typo'ed or impersonated.
2021-11-01 18:28:19 +01:00
Simon Ser
4e35b4812f Fix missing imports in server.go
Oops.
2021-10-29 16:18:34 +02:00
Simon Ser
aa407a46e6 Get rid of io.EOF errors in logs
Closes: https://todo.sr.ht/~emersion/soju/150
2021-10-29 16:03:04 +02:00
Simon Ser
0cd18a78db Unify BOUNCER ADDNETWORK and CHANGENETWORK 2021-10-29 15:51:13 +02:00
Simon Ser
de38d93085 Always reply ERR_SASLABORTED on SASL abort
Some clients (Hexchat) always expect AUTHENTICATE * to succeed with
ERR_SASLABORTED even if SASL hasn't been started.
2021-10-28 11:29:34 +02:00
Simon Ser
9ec1f1a5b0 Add context args to Database interface
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.
2021-10-18 19:15:15 +02:00
Simon Ser
4be6c4b19c Remove unnecessary downstream cap checks
downstreamConn.SendMessage already performs this cap checking.
2021-10-18 09:20:11 +02:00
Simon Ser
1507e88b36 Remove incorrect AWAY TODO in downstreamConn.SendMessage
PRIVMSG/NOTICE get RPL_AWAY, not AWAY.
2021-10-18 09:08:52 +02:00
Simon Ser
324d0fb0ac Unify away-notify and account-notify handling 2021-10-17 21:54:18 +02:00
Simon Ser
455fef2421 Add support for account-notify 2021-10-17 21:54:18 +02:00
Simon Ser
2f495e9768 Remove unused REGISTRATION_IS_COMPLETED in handleMessageUnregistered
downstreamConn.handleMessageUnregistered is only called when the
user isn't registered.
2021-10-16 11:42:32 +02:00
Simon Ser
ade59beb8c Send BOUNCER REGISTRATION_IS_COMPLETED error 2021-10-16 11:41:37 +02:00
Hubert Hirtz
350057e60b Set hard timeouts on DB transactions 2021-10-15 22:39:14 +02:00
Simon Ser
2ce97bcc12 msgstore_fs: rename log dir when network is renamed 2021-10-15 18:11:04 +02:00
Simon Ser
b1d89163f8 ci: switch to alpine/latest
We don't need the bleeding edge.
2021-10-15 09:59:53 +02:00
Simon Ser
04d671121c msgstore_fs: add reference to ZNC 2021-10-14 20:51:03 +02:00
Alexey Yerin
3109340651 downstream: handle name=... in BOUNCER 2021-10-14 16:03:14 +02:00
Simon Ser
28e1ca51e7 db_postgres: remove unnecessary DEFAULT NULL in schema 2021-10-14 10:09:01 +02:00
Simon Ser
d334bb18a2 db_postgres: use tx for all queries in StoreClientDeliveryReceipts 2021-10-13 19:15:50 +02:00
Simon Ser
79dbb20f98 db_postgres: quote table name in StoreClientDeliveryReceipts 2021-10-13 17:38:20 +02:00
Simon Ser
2ed4491c17 Don't strip spaces at start of MOTD
This breaks ASCII art. Instead, just drop the final newline if any.
2021-10-13 12:53:43 +02:00
Simon Ser
a9a066faac Add bouncer MOTD
Closes: https://todo.sr.ht/~emersion/soju/137
2021-10-13 10:58:34 +02:00
Simon Ser
ca9fa9198c db_postgres: fix constraints errors
Stop using ON CONFLICT DO UPDATE.

Closes: https://todo.sr.ht/~emersion/soju/138
2021-10-13 10:12:14 +02:00
Hubert Hirtz
eb41ed4171 db_postgres: handle both constraints on network updates
Closes: https://todo.sr.ht/~emersion/soju/138
2021-10-13 08:53:49 +02:00
Simon Ser
d646ffc9d6 contrib/clients: update IRCv3 caps for Weechat 3.3 2021-10-12 21:49:06 +02:00
Simon Ser
c8aba6286f doc.soju.1: fix typo and improve formatting for "certfp generate" 2021-10-12 21:34:25 +02:00
Simon Ser
8ef2de196d doc/soju.1: add descriptions for all flags for "user create" 2021-10-12 21:31:12 +02:00
Simon Ser
96f8751e3d doc/soju.1: use angle-brackets for URL
Helps a bit terminal emulators to recognize the link.
2021-10-12 21:27:48 +02:00
Simon Ser
e55d0d7552 Stop sending RPL_CREATED
There's no point in sending this numeric if it doesn't contain any
useful info.
2021-10-12 19:28:44 +02:00
Simon Ser
8a0400c5cc msgstore_fs: fix ListTargets error on missing log dir
Initially, before connecting to the network, the log dir will be
empty. Return an empty list of chat history targets in this case.
2021-10-12 17:36:00 +02:00
Simon Ser
6e8b6fa153 Fix printf formatting in error message 2021-10-12 17:36:00 +02:00
Simon Ser
5c20c4c0f4 Upgrade dependencies 2021-10-12 16:54:51 +02:00
Simon Ser
4e9ddf78ab service: allow updating other users 2021-10-12 09:11:14 +02:00
Simon Ser
96d4111be2 ci: run PostgreSQL tests 2021-10-11 16:06:37 +02:00
Simon Ser
1cd99ce2f7 Fix unused imports in tests 2021-10-11 16:01:50 +02:00
Simon Ser
2b8691ff40 Run server test with PostgreSQL too 2021-10-11 15:57:37 +02:00
Simon Ser
2b23828842 db_postgres: add migration test 2021-10-11 15:55:07 +02:00
Hubert Hirtz
6e06663615 PostgreSQL support 2021-10-11 15:21:04 +02:00
Simon Ser
a4f631f3e3 db_sqlite: add migration test 2021-10-11 12:26:51 +02:00