36 Commits

Author SHA1 Message Date
koizumi.aoi
cd99ccc1de Drunk as I like
Signed-off-by: Aoi K <koizumi.aoi@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/suika/trunk@804 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2023-03-21 04:45:19 +00:00
contact
d09f594aac irc: simplify isHighlight
git-svn-id: file:///srv/svn/repo/suika/trunk@786 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-25 10:32:09 +00:00
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
contact
801dc26f68 Refactor generateWHOXReply
Isolate the field letter -> value logic into a separate function.

git-svn-id: file:///srv/svn/repo/suika/trunk@778 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-02-09 14:16:54 +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
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
hubert
f4842d052b Skip list/type A mode arguments
Type-A modes always have an argument[0], but soju doesn't care about
them since it doesn't keep track of mode lists (ban/invite/.. lists).

[0] https://modern.ircdocs.horse/#mode-message
> Type A: Modes that add or remove an address to or from a list. These
> modes MUST always have a parameter when sent from the server to a
> client.

git-svn-id: file:///srv/svn/repo/suika/trunk@673 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-04 11:24:15 +00:00
contact
427638fa0d Add title config option
Closes: https://todo.sr.ht/~emersion/soju/146

git-svn-id: file:///srv/svn/repo/suika/trunk@662 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-02 21:38:07 +00:00
contact
622e22593c Mark bouncer users and BouncerServ as authenticated in WHOX/WHOIS
git-svn-id: file:///srv/svn/repo/suika/trunk@661 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-02 17:32:39 +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
afd52fc4c3 Add bouncer MOTD
Closes: https://todo.sr.ht/~emersion/soju/137

git-svn-id: file:///srv/svn/repo/suika/trunk@636 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-13 08:58:34 +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
ad0b3e4eb1 Move isHighlight to irc.go
git-svn-id: file:///srv/svn/repo/suika/trunk@498 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-13 16:54:58 +00:00
hubert
1cd4279256 Make casemapping work over bytes instead of runes
Fixes a panic in partialCasemap when the input string was invalid UTF-8.

git-svn-id: file:///srv/svn/repo/suika/trunk@492 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-13 10:48:46 +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
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
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
bca99f433a Format CTCP ACTION messages in logs
git-svn-id: file:///srv/svn/repo/suika/trunk@392 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-08-17 13:01:53 +00:00
contact
1a16d0b47a Sort and split JOIN messages
Sort channels so that channels with a key appear first. Split JOIN
messages so that we don't reach the message size limit.

git-svn-id: file:///srv/svn/repo/suika/trunk@350 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 09:06:20 +00:00
hubert
3f1ece2d19 Send compact channel name lists
This commit resolves `sendNames`' TODO.

git-svn-id: file:///srv/svn/repo/suika/trunk@346 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-30 08:28:05 +00:00
delthas
dd583107cd Add support for TAGMSG and client message tags
Previously we dropped all TAGMSG as well as any client message tag sent
from downstream.

This adds support for properly forwarding TAGMSG and client message tags
from downstreams and upstreams.

TAGMSG messages are intentionally not logged, because they are currently
typically used for +typing, which can generate a lot of traffic and is
only useful for a few seconds after it is sent.

git-svn-id: file:///srv/svn/repo/suika/trunk@303 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-05-27 21:48:08 +00:00
delthas
db16c9dde3 Fix parsing MODE messages by updating channel memberships
Previously, we only considered channel modes in the modes of a MODE
messages, which means channel membership changes were ignored. This
resulted in bugs where users channel memberships would not be properly
updated and cached with wrong values. Further, mode arguments
representing entities were not properly marshaled.

This adds support for correctly parsing and updating channel memberships
when processing MODE messages. Mode arguments corresponding to channel
memberships updates are now also properly marshaled.

MODE messages can't be easily sent from history because marshaling these
messages require knowing about the upstream available channel types and
channel membership types, which is currently only possible when
connected. For now this is not an issue since we do not send MODE
messages in history.

git-svn-id: file:///srv/svn/repo/suika/trunk@293 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-05-21 20:36:54 +00:00
delthas
e26684df0e Add support for multiple user channel memberships
User channel memberships are actually a set of memberships, not a single
value. This introduces memberships, a type representing a set of
memberships, stored as an array of memberships ordered by descending
rank.

This also adds multi-prefix to the permanent downstream and upstream
capabilities, so that we try to get all possible channel memberships.

git-svn-id: file:///srv/svn/repo/suika/trunk@292 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-05-11 10:25:49 +00:00
contact
c2083296b3 Request server-time cap
If the server didn't populate the time tag, do it ourselves.

git-svn-id: file:///srv/svn/repo/suika/trunk@193 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-31 17:45:04 +00:00
delthas
290366abfb Add upstream RPL_CREATIONTIME support
git-svn-id: file:///srv/svn/repo/suika/trunk@162 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-26 21:33:44 +00:00
delthas
bbfb4636b2 Add upstream labeled-response capability support
git-svn-id: file:///srv/svn/repo/suika/trunk@155 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-25 22:20:56 +00:00
delthas
ad61922268 Add upstream batch capability support
git-svn-id: file:///srv/svn/repo/suika/trunk@153 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-25 22:16:53 +00:00
delthas
ae9d1ebd3f Add MODE arguments support
- Add RPL_ISUPPORT support with CHANMODES, CHANTYPES, PREFIX parsing
- Add support for channel mode state with mode arguments
- Add upstream support for RPL_UMODEIS, RPL_CHANNELMODEIS
- Request channel MODE on upstream channel JOIN
- Use sane default channel mode and channel mode types

git-svn-id: file:///srv/svn/repo/suika/trunk@139 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-25 08:40:08 +00:00
delthas
94d76ebfb4 Add WHOIS support
git-svn-id: file:///srv/svn/repo/suika/trunk@128 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-20 09:11:27 +00:00
contact
b7f48f8766 Remove some IRCv3 constants
go-irc v3.1.2 adds some missing IRCv3 constants.

git-svn-id: file:///srv/svn/repo/suika/trunk@125 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-19 13:51:45 +00:00
contact
65f45675ec Add CAP support for downstream connections
git-svn-id: file:///srv/svn/repo/suika/trunk@108 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-16 14:05:24 +00:00
contact
1a9d6a58a0 Rename project to soju
git-svn-id: file:///srv/svn/repo/suika/trunk@98 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-13 17:13:03 +00:00
contact
68661c503a Update dependencies
go-irc v3.1.1 contains a breaking change.

References: https://github.com/go-irc/irc/issues/76

git-svn-id: file:///srv/svn/repo/suika/trunk@96 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-13 15:18:53 +00:00
contact
68b7b4461c Add support for SASL authentication
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
2020-03-13 14:12:44 +00:00
contact
16dd0965fb Add parseMessageParams helper
git-svn-id: file:///srv/svn/repo/suika/trunk@43 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-02-07 11:36:02 +00:00
contact
6b28c42796 Split IRC helpers to separate file
git-svn-id: file:///srv/svn/repo/suika/trunk@20 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-02-06 18:24:32 +00:00