242 Commits

Author SHA1 Message Date
contact
3dbc059a7b Introduce formatServerTime
It's too easy to forget to convert to UTC.

git-svn-id: file:///srv/svn/repo/suika/trunk@784 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-16 13:45:09 +00:00
delthas
9b1a5bd469 Add support for the wip soju.im/read capability and READ command
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
2022-02-11 18:41:46 +00:00
contact
71a0ed4052 Fix flags variable name in RPL_WHOREPLY handler
This param doesn't contain modes, it contains user flags (such as
H/G for away status).

git-svn-id: file:///srv/svn/repo/suika/trunk@779 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-09 14:20:32 +00:00
contact
bef2bfad2b Add context to upstreamConn.register
git-svn-id: file:///srv/svn/repo/suika/trunk@777 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-08 15:38:34 +00:00
contact
6f8aa7f95a Add context to upstreamConn.runUntilRegistered
git-svn-id: file:///srv/svn/repo/suika/trunk@776 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-08 15:37:31 +00:00
contact
1793b83dc4 Add context to upstreamConn.handleCapAck
git-svn-id: file:///srv/svn/repo/suika/trunk@762 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-10 11:28:16 +00:00
contact
6de32aea34 Handle upstream multi-line SASL
References: https://todo.sr.ht/~emersion/soju/173

git-svn-id: file:///srv/svn/repo/suika/trunk@761 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-10 09:46:41 +00:00
contact
52e40a3e0e Block RPL_{CREATIONTIME,TOPICWHOTIME} for detached channels
Closes: https://todo.sr.ht/~emersion/soju/132

git-svn-id: file:///srv/svn/repo/suika/trunk@759 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-09 11:12:20 +00:00
contact
d5a071dd91 Add context to {conn,upstreamConn}.SendMessage
This avoids blocking on upstream message rate limiting for too
long.

git-svn-id: file:///srv/svn/repo/suika/trunk@757 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 17:03:40 +00:00
contact
4d4886e359 Use more descriptive errors when aborting pending commands
git-svn-id: file:///srv/svn/repo/suika/trunk@752 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 21:33:50 +00:00
contact
1059ee4607 Improve msgStore.Append log message wording
git-svn-id: file:///srv/svn/repo/suika/trunk@749 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:46:10 +00:00
contact
c74b16c19f Stop incrementing hopcount in RPL_WHOREPLY
It's extra code for something clients should ignore because it's
unreliable and useless.

git-svn-id: file:///srv/svn/repo/suika/trunk@745 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:08:53 +00:00
contact
5dd0243bb1 Read nickname from RPL_WELCOME
References: https://github.com/ircdocs/modern-irc/pull/146

git-svn-id: file:///srv/svn/repo/suika/trunk@744 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 16:58:54 +00:00
contact
f638c52c9b Fallback to alt nick
If the nickname we want is taken, fallback to another one by
appending underscores. Use MONITOR to figure out when we can request
our desired nick again.

Closes: https://todo.sr.ht/~emersion/soju/35

git-svn-id: file:///srv/svn/repo/suika/trunk@743 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-04 19:07:23 +00:00
contact
da3d8aaa8c Avoid forwarding MONITOR requests if upstream doesn't support it
Clients aren't supposed to do this, but in case they do, let's
send them an error.

git-svn-id: file:///srv/svn/repo/suika/trunk@742 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-04 18:29:39 +00:00
contact
0331e8241c Add context to upstreamConn.handleMessage
git-svn-id: file:///srv/svn/repo/suika/trunk@739 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 22:27:12 +00:00
contact
886ae69bc6 Cancel pending commands on downstream disconnect
If a client queues a high number of commands and then disconnects,
remove all of the pending commands. This avoids unnecessarily
sending commands whose results won't be used.

git-svn-id: file:///srv/svn/repo/suika/trunk@738 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 18:29:44 +00:00
contact
b9180f0b42 Mark ACCOUNT_REQUIRED error as permanent connection failure
There's no point in retrying to connect in this case.

git-svn-id: file:///srv/svn/repo/suika/trunk@737 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 16:58:56 +00:00
contact
85e0641af8 Don't retry connecting on permanent failure
Closes: https://todo.sr.ht/~emersion/soju/164

git-svn-id: file:///srv/svn/repo/suika/trunk@736 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 16:33:11 +00:00
contact
6c2a942af3 Add context to connectToUpstream
git-svn-id: file:///srv/svn/repo/suika/trunk@732 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 09:53:43 +00:00
contact
f60544b6f8 Add support for draft/account-registration proxying
This adds support for the draft/account-registration extension [1].
This allows downstreams to register on upstream networks.

[1]: https://ircv3.net/specs/extensions/account-registration

git-svn-id: file:///srv/svn/repo/suika/trunk@729 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-30 11:02:54 +00:00
contact
d8ef203c84 Remove sasl cap after registration if network doesn't support it
This will stop clients from trying to issue AUTHENTICATE requests
after connection registration.

git-svn-id: file:///srv/svn/repo/suika/trunk@725 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-21 15:28:38 +00:00
contact
756a37c778 Add support for post-connection-registration upstream SASL auth
Once the downstream connection has logged in with their bouncer
credentials, allow them to issue more SASL auths which will be
redirected to the upstream network. This allows downstream clients
to provide UIs to login to transparently login to upstream networks.

git-svn-id: file:///srv/svn/repo/suika/trunk@724 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-21 15:10:54 +00:00
contact
c9c288b749 Use RPL_LOGGEDIN/OUT to mirror upstream status
This will allow clients to properly show/hide UI to login and
register.

git-svn-id: file:///srv/svn/repo/suika/trunk@722 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-19 18:21:48 +00:00
contact
292ad7748c Add missing account-notify to permanentUpstreamCaps
git-svn-id: file:///srv/svn/repo/suika/trunk@720 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-19 10:55:22 +00:00
contact
ca58716f6c Add message counter metrics
git-svn-id: file:///srv/svn/repo/suika/trunk@711 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 14:58:19 +00:00
contact
5161f92e29 Add per-user IP addresses
The new upstream-user-ip directive allows bouncer operators to
assign one IP address per user.

git-svn-id: file:///srv/svn/repo/suika/trunk@705 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 14:07:58 +00:00
delthas
14e0806745 Add support for draft/extended-monitor
References: https://github.com/ircv3/ircv3-specifications/pull/466

git-svn-id: file:///srv/svn/repo/suika/trunk@685 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-15 13:38:19 +00:00
contact
5bb767bf62 Add support for MONITOR
Add support for MONITOR in single-upstream mode.

Each downstream has its own set of monitored targets. These sets
are merged together to compute the MONITOR commands to send to
upstream.

Each upstream has a set of monitored targets accepted by the server
alongside with their status (online/offline). This is used to
directly send replies to downstreams adding a target another
downstream has already added, and send MONITOR S[TATUS] replies.

Co-authored-by: delthas <delthas@dille.cc>

git-svn-id: file:///srv/svn/repo/suika/trunk@684 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-15 13:34:04 +00:00
contact
54c906a82c Add a queue for WHO commands
This has the following upsides:

- We can now routes WHO replies to the correct client, without
  broadcasting them to everybody.
- We are less likely to hit server rate limits when multiple downstreams
  are issuing WHO commands at the same time.

git-svn-id: file:///srv/svn/repo/suika/trunk@682 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-09 21:09:17 +00:00
contact
c652cb0188 Remove support for mixed multi-upstream LIST
Multi-upstream connections can still send LIST commands with a
network suffix.

git-svn-id: file:///srv/svn/repo/suika/trunk@681 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-09 20:32:26 +00:00
contact
2caeb0f764 Fix upstream USER command when both username and nick are empty
git-svn-id: file:///srv/svn/repo/suika/trunk@674 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-07 17:33:59 +00:00
contact
21f482684d 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@666 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-03 15:37:01 +00:00
contact
70a12fc286 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

git-svn-id: file:///srv/svn/repo/suika/trunk@664 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-02 22:33:17 +00:00
contact
c5665ceb4a 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

git-svn-id: file:///srv/svn/repo/suika/trunk@660 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-02 17:25:43 +00:00
contact
ba0f309c71 Get rid of io.EOF errors in logs
Closes: https://todo.sr.ht/~emersion/soju/150

git-svn-id: file:///srv/svn/repo/suika/trunk@655 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-29 14:03:04 +00:00
contact
2748715183 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@652 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-18 17:15:15 +00:00
contact
7ed749a0c2 Unify away-notify and account-notify handling
git-svn-id: file:///srv/svn/repo/suika/trunk@649 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-17 19:54:18 +00:00
contact
cbf11ae498 Add support for account-notify
git-svn-id: file:///srv/svn/repo/suika/trunk@648 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-17 19:54:18 +00:00
contact
474d6e3ccd Add per-user realname setting
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
2021-06-25 18:33:13 +00:00
contact
ae0ac7c6f0 Allow admins to broadcast message to all bouncer users
Typically done via:

    /notice $<bouncer> <message>

Or, for a connection not bound to a specific network:

    /notice $* <message>

The message is broadcast as BouncerServ, because that's the only
user that can be trusted to belong to the bouncer by users. Any
other prefix would conflict with the upstream network.

git-svn-id: file:///srv/svn/repo/suika/trunk@563 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-23 17:23:09 +00:00
contact
645cae89bf Forward LUSERS and STATS messages after initial registration
git-svn-id: file:///srv/svn/repo/suika/trunk@561 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-23 09:45:14 +00:00
contact
d0fa8cd516 Add support for account-tag
git-svn-id: file:///srv/svn/repo/suika/trunk@559 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-14 19:44:38 +00:00
greg
594bd5bf30 Forward user mode changes in single-upstream mode
References: https://todo.sr.ht/~emersion/soju/20

git-svn-id: file:///srv/svn/repo/suika/trunk@553 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-10 09:17:00 +00:00
greg
be96d9078b Forward MOTD messages downstream
The first MOTD upon connection is ignored, but subsequent MOTD messages
(requested by the "MOTD" message from the client, typically using a
/motd command) are forwarded.

git-svn-id: file:///srv/svn/repo/suika/trunk@552 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-09 19:29:36 +00:00
contact
b4ffea243d Add support for IRCv3 setname
References: https://todo.sr.ht/~emersion/soju/41

git-svn-id: file:///srv/svn/repo/suika/trunk@540 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 18:24:45 +00:00
hubert
96082ecef8 Don't forward label tags
We don't want to have the label tag when calling uc.produce, otherwise
downstream will end up with junk labels.

git-svn-id: file:///srv/svn/repo/suika/trunk@526 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-23 10:32:27 +00:00
hubert
9b274dd916 Drop TAGMSG in detached channels
- Do not relay TAGMSG as notices,
- Do not reattach when a TAGMSG is received,
- Do not reset the detach timer when a TAGMSG is received.

git-svn-id: file:///srv/svn/repo/suika/trunk@505 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-20 14:17:28 +00:00
contact
edc4b60e04 Add user prefix to upstream logger
git-svn-id: file:///srv/svn/repo/suika/trunk@502 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-13 18:16:37 +00:00
contact
a958ddadee Relay detached channel backlog as BouncerServ NOTICE if necessary
Instead of ignoring detached channels wehn replaying backlog,
process them as usual and relay messages as BouncerServ NOTICEs
if necessary. Advance the delivery receipts as if the channel was
attached.

Closes: https://todo.sr.ht/~emersion/soju/98

git-svn-id: file:///srv/svn/repo/suika/trunk@499 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-13 17:11:05 +00:00