Commit graph

259 commits

Author SHA1 Message Date
Alexey Yerin 3109340651 downstream: handle name=... in BOUNCER 2021-10-14 16:03:14 +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 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 6e8b6fa153 Fix printf formatting in error message 2021-10-12 17:36:00 +02:00
Hubert Hirtz 3a171607e0 Correctly send back PRIVMSGs and NOTICEs to self 2021-10-10 12:05:41 +02:00
Hubert Hirtz d4b7bb02da Send back TAGMSGs to self 2021-10-10 12:05:41 +02:00
Hubert Hirtz 0fd81f38fa Dismiss TAGMSGs directed to BouncerServ 2021-10-10 12:05:40 +02:00
Simon Ser 1d56ef19e7 Add WHOIS reply for BouncerServ 2021-10-06 11:50:12 +02:00
Hubert Hirtz 2554c92df7 Allow CAP negotiation to happen with CAP REQ
See https://ircv3.net/specs/extensions/capability-negotiation

> Upon receiving either a CAP LS or CAP REQ command during connection
> registration, the server MUST not complete registration until the
> client sends a CAP END command to indicate that capability negotiation
> has ended.

This commit should prevent soju from trying to authenticate the user
prior to having received AUTHENTICATE messages, when the client eagerly
requests capabilities with CAP REQ seeing available capabilities
beforehand with CAP LS.
2021-09-19 16:50:47 +02:00
Simon Ser 0f2f4de275 Send empty history for service
Fixes error when fetching chat history for BouncerServ.
2021-09-13 11:36:25 +02:00
Simon Ser fba1fdb31e Don't require upstream to be connected for CHATHISTORY
Closes: https://todo.sr.ht/~emersion/soju/127
2021-09-13 11:25:38 +02:00
Simon Ser cd64a7ffda Split unmarshalEntity into two functions
Some command handlers need to unmarshal without requiring the
upstream to be connected.
2021-09-13 11:14:47 +02:00
Simon Ser c5d5259243 Pass-through CLIENTTAGDENY in ISUPPORT 2021-07-09 22:48:58 +02:00
Simon Ser a14f646135 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.
2021-06-25 20:33:13 +02:00
Simon Ser f3f864dddc Disallow '$' in nicks 2021-06-23 19:54:22 +02:00
Simon Ser d7b1c5a9a2 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.
2021-06-23 19:23:09 +02:00
Simon Ser eca4c41223 Unify downstream PRIVMSG and NOTICE handling
We were doing some things wrong here, e.g. not sending echo messages
for NOTICE.
2021-06-23 18:17:30 +02:00
Simon Ser faa89333bf Add support for utf8-only 2021-06-15 15:48:10 +02:00
Simon Ser b609b86f97 Add support for account-tag 2021-06-14 21:44:38 +02:00
Simon Ser 0557ca5871 Don't suggest users to /motd in multi-upstream mode 2021-06-10 12:16:33 +02:00
Simon Ser 2b3782a507 Make user MODE commands fail in multi-upstream mode
References: https://todo.sr.ht/~emersion/soju/20
2021-06-10 11:24:10 +02:00
Gregory Anders 0e9ef1f97c Forward user mode changes in single-upstream mode
References: https://todo.sr.ht/~emersion/soju/20
2021-06-10 11:17:00 +02:00
Gregory Anders 2fe0a57e43 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.
2021-06-09 21:29:36 +02:00
Simon Ser 0081c96ec0 Add downstreamConn.SendBatch helper 2021-06-05 12:38:52 +02:00
Simon Ser bd41e3bd2b Prune detached channels from CHATHISTORY TARGETS 2021-06-04 11:27:59 +02:00
Simon Ser 18439f0de5 Implement CHATHISTORY TARGETS
References: https://github.com/ircv3/ircv3-specifications/pull/450
2021-06-02 20:32:11 +02:00
Simon Ser 0f3dd2f2b1 Forward unknown commands to upstream in single-upstream mode 2021-05-28 11:15:15 +02:00
Simon Ser 517be78868 Reject JOIN with invalid channel names
This prevents us from storing typo'ed channel names in the DB.
2021-05-26 11:23:09 +02:00
Simon Ser 7d648f702e Allow networks to be disabled 2021-05-26 10:51:02 +02:00
Simon Ser 47c514a9cf Add support for IRCv3 setname
References: https://todo.sr.ht/~emersion/soju/41
2021-05-25 20:24:45 +02:00
Simon Ser 4cf9804e89 Vendor BATCH bouncer-networks type
And add the prefix throughout the spec, to make it clear the unprefixed
version is not to be used.
2021-05-25 16:56:38 +02:00
Simon Ser 31f2d28508 Introduce the soju.im/bouncer-networks-notify capability 2021-05-25 16:42:51 +02:00
Simon Ser 29ad541ac7 Send network settings in LISTNETWORKS 2021-05-25 16:42:51 +02:00
Simon Ser 60c566e721 Add pass to bouncer network attributes 2021-05-25 16:42:51 +02:00
Simon Ser db0f745193 Implement the soju.im/bouncer-networks extension 2021-05-25 16:42:51 +02:00
Philip K b3bc9614f8 Directly return self-messages to user in multi-upstream mode 2021-05-24 13:31:24 +02:00
Simon Ser 68463d3e8b Pass-through the BOT ISUPPORT token
References: https://github.com/ircv3/ircv3-specifications/pull/439
2021-05-24 11:41:04 +02:00
Hubert Hirtz 3b41c87a41 Fix CAP LIST listing disabled capabilities 2021-05-21 10:03:39 +02:00
Simon Ser ec26117c08 Relay self-WHO/WHOIS in single-upstream mode
In multi-upstream mode, we can't relay WHO/WHOIS messages for the
current user, because we can't decide which upstream server the
message should be relayed to.

In single-upstream server, we do know which upstream server to use,
so we can just blindly relay the message.

This allows users to send a self-WHO/WHOIS to check their cloak and
other information.
2021-05-20 11:13:14 +02:00
Hubert Hirtz b078ccaf7a Implement CHATHISTORY BETWEEN 2021-05-18 10:44:10 +02:00
Simon Ser bede274f32 Add more context to chathistory errors 2021-05-11 12:42:12 +02:00
Hubert Hirtz 9e04b3899b Don't directly reply to network-specific NICK
The NICK must only apply to the specific network, not to the downstream
connection.
2021-04-30 12:17:23 +02:00
Hubert Hirtz e84fad3eda Handle casemapping on BouncerServ 2021-04-30 12:10:49 +02:00
Simon Ser a2c207d357 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
2021-04-13 19:11:05 +02:00
Simon Ser 45e2c0023a Skip backlog logic in downstreamConn.welcome on chathistory 2021-04-13 17:50:03 +02:00
Simon Ser 65c58adbd9 Take msg ID in sendTargetBacklog 2021-04-13 17:49:37 +02:00
Simon Ser 5b4469fcb7 Use BARE for internal message IDs
This allows to have shorter and more future-proof IDs. This also
guarantees the IDs will only use reasonable ASCII characters (no
spaces), removing the need to encode them for PING/PONG tokens.
2021-03-31 17:57:24 +02:00
Simon Ser ecf35187fa Make NickServ detection casemapping-aware 2021-03-30 12:28:45 +02:00
Simon Ser 3237bde9f3 Introduce deliveredStore
This hides the double-map complexity behind a dedicated type.
2021-03-29 17:49:50 +02:00
Simon Ser 07519da768 Ensure targets are case-mapped before being passed to messageStore
messageStore isn't aware of the network's case-mapping. We need
to canonicalize the names before passing them to messageStore.
2021-03-29 17:07:39 +02:00