19 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
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
e1f09398b1 Don't send RPL_NOTOPIC on JOIN
As per https://modern.ircdocs.horse/#join-message

git-svn-id: file:///srv/svn/repo/suika/trunk@764 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2022-01-10 09:37:55 +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
hubert
4fcc1638f0 Forward RPL_TOPICWHOTIME to downstreams
git-svn-id: file:///srv/svn/repo/suika/trunk@405 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-08-20 09:12:54 +00:00
contact
0a87ae1452 Make length check clearer in sendNames
git-svn-id: file:///srv/svn/repo/suika/trunk@349 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-06 08:59:34 +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
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
e7cc0a7f2e Make downstreamConn.marshal{Entity,UserPrefix} take a network
This will be used when sending history while upstream is disconnected.

git-svn-id: file:///srv/svn/repo/suika/trunk@260 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-16 15:19:00 +00:00
contact
7c7a1d3326 Kill downstreamConn.marshal{Nick,Channel}
We can just use downstreamConn.marshalEntity instead.

git-svn-id: file:///srv/svn/repo/suika/trunk@259 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-16 14:57:33 +00:00
delthas
9ba13fd38b Add downstream TOPIC support
git-svn-id: file:///srv/svn/repo/suika/trunk@160 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-26 21:27:46 +00:00
delthas
b551c53872 Add downstream NAMES support
NAMES reply for channels currently joined will be returned from cache;
requests for channels not joined will be forwarded from upstream.

git-svn-id: file:///srv/svn/repo/suika/trunk@140 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-25 08:47:26 +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
contact
a29ce6fc7d Avoid sending JOIN twice for the same channel
git-svn-id: file:///srv/svn/repo/suika/trunk@132 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-20 21:53:05 +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
c52d54edc7 Add functions to translate between upstream and downstream names
git-svn-id: file:///srv/svn/repo/suika/trunk@69 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-02-19 17:25:19 +00:00
contact
b6dfb5b24a Don't write to downstreamConn.messages directly
Use a helper function instead. This will allow us to change
downstreamConn implementation details without having to update the whole
codebase.

git-svn-id: file:///srv/svn/repo/suika/trunk@54 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-02-17 11:27:48 +00:00
contact
9e545decc7 Add missing bridge.go, oops
git-svn-id: file:///srv/svn/repo/suika/trunk@32 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-02-06 21:45:54 +00:00