244 Commits

Author SHA1 Message Date
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
a649f4acdf Unify downstream PRIVMSG and NOTICE handling
We were doing some things wrong here, e.g. not sending echo messages
for NOTICE.

git-svn-id: file:///srv/svn/repo/suika/trunk@562 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-23 16:17:30 +00:00
contact
bc5ddaefee Add support for utf8-only
git-svn-id: file:///srv/svn/repo/suika/trunk@560 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-15 13:48:10 +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
contact
17a115d060 Don't suggest users to /motd in multi-upstream mode
git-svn-id: file:///srv/svn/repo/suika/trunk@555 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-10 10:16:33 +00:00
contact
3172dbeb87 Make user MODE commands fail in multi-upstream mode
References: https://todo.sr.ht/~emersion/soju/20

git-svn-id: file:///srv/svn/repo/suika/trunk@554 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-10 09:24:10 +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
5fe3eae580 Add downstreamConn.SendBatch helper
git-svn-id: file:///srv/svn/repo/suika/trunk@551 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-05 10:38:52 +00:00
contact
f8859b0d8a Prune detached channels from CHATHISTORY TARGETS
git-svn-id: file:///srv/svn/repo/suika/trunk@550 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-04 09:27:59 +00:00
contact
522becbe30 Implement CHATHISTORY TARGETS
References: https://github.com/ircv3/ircv3-specifications/pull/450

git-svn-id: file:///srv/svn/repo/suika/trunk@549 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-06-02 18:32:11 +00:00
contact
b9249feca3 Forward unknown commands to upstream in single-upstream mode
git-svn-id: file:///srv/svn/repo/suika/trunk@547 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-28 09:15:15 +00:00
contact
048bea91ce Reject JOIN with invalid channel names
This prevents us from storing typo'ed channel names in the DB.

git-svn-id: file:///srv/svn/repo/suika/trunk@545 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-26 09:23:09 +00:00
contact
30c6e9e954 Allow networks to be disabled
git-svn-id: file:///srv/svn/repo/suika/trunk@542 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-26 08:51:02 +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
contact
ac62ccdfbc Vendor BATCH bouncer-networks type
And add the prefix throughout the spec, to make it clear the unprefixed
version is not to be used.

git-svn-id: file:///srv/svn/repo/suika/trunk@537 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 14:56:38 +00:00
contact
b736ba981b Introduce the soju.im/bouncer-networks-notify capability
git-svn-id: file:///srv/svn/repo/suika/trunk@535 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 14:42:51 +00:00
contact
8ceceb932c Send network settings in LISTNETWORKS
git-svn-id: file:///srv/svn/repo/suika/trunk@534 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 14:42:51 +00:00
contact
66c64aa42f Add pass to bouncer network attributes
git-svn-id: file:///srv/svn/repo/suika/trunk@533 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 14:42:51 +00:00
contact
f00821626a Implement the soju.im/bouncer-networks extension
git-svn-id: file:///srv/svn/repo/suika/trunk@532 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-25 14:42:51 +00:00
philipk
63e19e8add Directly return self-messages to user in multi-upstream mode
git-svn-id: file:///srv/svn/repo/suika/trunk@529 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-24 11:31:24 +00:00
contact
d5ca492750 Pass-through the BOT ISUPPORT token
References: https://github.com/ircv3/ircv3-specifications/pull/439

git-svn-id: file:///srv/svn/repo/suika/trunk@528 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-24 09:41:04 +00:00
hubert
2b8a6e1a59 Fix CAP LIST listing disabled capabilities
git-svn-id: file:///srv/svn/repo/suika/trunk@521 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-21 08:03:39 +00:00
contact
de72d133a9 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@520 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-20 09:13:14 +00:00
hubert
84c329faff Implement CHATHISTORY BETWEEN
git-svn-id: file:///srv/svn/repo/suika/trunk@516 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-18 08:44:10 +00:00
contact
0f0bc90e97 Add more context to chathistory errors
git-svn-id: file:///srv/svn/repo/suika/trunk@515 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-05-11 10:42:12 +00:00
hubert
fc31a8fa58 Don't directly reply to network-specific NICK
The NICK must only apply to the specific network, not to the downstream
connection.

git-svn-id: file:///srv/svn/repo/suika/trunk@512 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-30 10:17:23 +00:00
hubert
4c8f7cd0f3 Handle casemapping on BouncerServ
git-svn-id: file:///srv/svn/repo/suika/trunk@511 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-30 10:10:49 +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
contact
562beca198 Skip backlog logic in downstreamConn.welcome on chathistory
git-svn-id: file:///srv/svn/repo/suika/trunk@496 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-13 15:50:03 +00:00
contact
e32cf2acd9 Take msg ID in sendTargetBacklog
git-svn-id: file:///srv/svn/repo/suika/trunk@495 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-13 15:49:37 +00:00
contact
00fbbb9d0d 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@488 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-31 15:57:24 +00:00
contact
180e314a01 Make NickServ detection casemapping-aware
git-svn-id: file:///srv/svn/repo/suika/trunk@486 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-30 10:28:45 +00:00
contact
e94da85df6 Introduce deliveredStore
This hides the double-map complexity behind a dedicated type.

git-svn-id: file:///srv/svn/repo/suika/trunk@485 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-29 15:49:50 +00:00
contact
10a2f92f68 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@484 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-29 15:07:39 +00:00
contact
a313a3aead Simplify network.offlineClients
Replace it with a list of all clients (online or offline).

git-svn-id: file:///srv/svn/repo/suika/trunk@482 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-29 14:55:57 +00:00
contact
2cba08b50e Introduce deliveredClientMap
Adds more semantics to map[string]string. Simplifies the complicated
mapStringStringCasemapMap type.

git-svn-id: file:///srv/svn/repo/suika/trunk@480 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-26 10:21:14 +00:00
hubert
3cad542811 Fix CHATHISTORY target not being casemapped
git-svn-id: file:///srv/svn/repo/suika/trunk@479 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-26 09:39:52 +00:00
hubert
1b73446cbb Implement casemapping
TL;DR: supports for casemapping, now logs are saved in
casemapped/canonical/tolower form
(eg. in the #channel directory instead of #Channel... or something)

== What is casemapping? ==

see <https://modern.ircdocs.horse/#casemapping-parameter>

== Casemapping and multi-upstream ==

Since each upstream does not necessarily use the same casemapping, and
since casemappings cannot coexist [0],

1. soju must also update the database accordingly to upstreams'
   casemapping, otherwise it will end up inconsistent,
2. soju must "normalize" entity names and expose only one casemapping
   that is a subset of all supported casemappings (here, ascii).

[0] On some upstreams, "emersion[m]" and "emersion{m}" refer to the same
user (upstreams that advertise rfc1459 for example), while on others
(upstreams that advertise ascii) they don't.

Once upstream's casemapping is known (default to rfc1459), entity names
in map keys are made into casemapped form, for upstreamConn,
upstreamChannel and network.

downstreamConn advertises "CASEMAPPING=ascii", and always casemap map
keys with ascii.

Some functions require the caller to casemap their argument (to avoid
needless calls to casemapping functions).

== Message forwarding and casemapping ==

downstream message handling (joins and parts basically):
When relaying entity names from downstreams to upstreams, soju uses the
upstream casemapping, in order to not get in the way of the user.  This
does not brings any issue, as long as soju replies with the ascii
casemapping in mind (solves point 1.).

marshalEntity/marshalUserPrefix:
When relaying entity names from upstreams with non-ascii casemappings,
soju *partially* casemap them: it only change the case of characters
which are not ascii letters.  ASCII case is thus kept intact, while
special symbols like []{} are the same every time soju sends them to
downstreams (solves point 2.).

== Casemapping changes ==

Casemapping changes are not fully supported by this patch and will
result in loss of history.  This is a limitation of the protocol and
should be solved by the RENAME spec.

git-svn-id: file:///srv/svn/repo/suika/trunk@478 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-24 17:15:52 +00:00
contact
1f128ff7fc Improve ERR_NOSUCHCHANNEL error messages
References: https://todo.sr.ht/~emersion/soju/63

git-svn-id: file:///srv/svn/repo/suika/trunk@464 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-16 08:13:46 +00:00
contact
aba32b60ab Passthrough some ISUPPORT tokens
git-svn-id: file:///srv/svn/repo/suika/trunk@463 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-15 22:41:37 +00:00
contact
b8b77b8f0b Use upstream ISUPPORT map for NETWORK
git-svn-id: file:///srv/svn/repo/suika/trunk@461 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-15 22:08:19 +00:00
hubert
75dee80758 Send correct CHATHISTORY error messages
git-svn-id: file:///srv/svn/repo/suika/trunk@456 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-03-05 08:53:59 +00:00
contact
6ee586ea01 Introduce downstreamConn.sendTargetBacklog
git-svn-id: file:///srv/svn/repo/suika/trunk@452 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-02-10 12:48:41 +00:00
contact
77f0241cf5 Rename network.history to network.delivered
"History" is over-loaded with e.g. CHATHISTORY support.

git-svn-id: file:///srv/svn/repo/suika/trunk@451 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-02-10 10:31:34 +00:00
contact
5c1bf5b701 Rename sendNetworkHistory to sendNetworkBacklog
"History" is a little bit over-loaded with CHATHISTORY support.

git-svn-id: file:///srv/svn/repo/suika/trunk@450 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-02-10 09:23:51 +00:00
hubert
f5d025bd79 Request invite-notify to upstreams
... and do not forward INVITEs to downstreams that do not support the
capability.

The downstream capability can be permanent because there is no way for a
client to get the list of people invited to a channel, thus no state can
be corrupted.

git-svn-id: file:///srv/svn/repo/suika/trunk@448 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-01-31 21:18:51 +00:00
contact
24d2196f8d Forward ISUPPORT NETWORK token
git-svn-id: file:///srv/svn/repo/suika/trunk@447 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-01-22 11:00:38 +00:00
contact
004e7a4a18 Send RPL_ISUPPORT CHATHISTORY token
git-svn-id: file:///srv/svn/repo/suika/trunk@446 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-01-22 10:55:06 +00:00
contact
c94290b989 Make chat history operations optional in messageStore
Some stores may want not to implement chat history operations.

git-svn-id: file:///srv/svn/repo/suika/trunk@441 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-01-04 16:17:35 +00:00