~emersion/soju

Update dependencies

In particular, go-irc v3.1.4 should fix empty IRC message handling.
Don't forward batch tags

We don't want to have the batch tag when calling uc.produce, otherwise
downstream will end up with junk batch ids.
Add in-memory message store

Uses an in-memory ring buffer.

Closes: https://todo.sr.ht/~emersion/soju/96
Make chat history operations optional in messageStore

Some stores may want not to implement chat history operations.
Add store-agnostic message ID format

Allow to query the network ID and entity from the message ID regardless
of the underlying store used.
Turn messageStore into an interface

This allows for other implementations that aren't based on a filesystem.
Improve dc.authenticate()'s error messages
Advertise all caps, CAP DEL them on registration

... so that the JOIN/history batch takes into account all capabilities.
Without this commit for example, enabling multi-prefix after the batch
makes the client send NAMES requests for all channels, which generate
needless traffic.
service: Introduce `channel update`

This adds the `channel update` service command, which is used to set the
auto-detach, auto-reattach, and message relaying settings of a channel.

Of note is that currently the parser parses `#` as a comment, which
means any `channel update #foo ...` will actually need to be escaped to
`channel update "#foo" ...`
Add customizable auto-detaching, auto-reattaching, relaying.

This uses the fields added previously to the Channel struct to implement
the actual detaching/reattaching/relaying logic.

The `FilterDefault` values of the messages filters are currently
hardcoded.

The values of the message filters are not currently user-settable.

This introduces a new user event, eventChannelDetach, which stores an
upstreamConn (which might become invalid at the time of processing), and
a channel name, used for auto-detaching. Every time the channel detach
timer is refreshed (by receveing a message, etc.), a new timer is
created on the upstreamChannel, which will dispatch this event after the
duration (and discards the previous timer, if any).
Introduce Channel.{RelayDetached,ReattachOn,DetachAfter,DetachOn}

This adds several fields to the channel database schema and struct.
These fields will be used to add support for customizable message
relaying through BouncerServ, auto-reattaching, auto-detaching.

- RelayDetached is a filter for which notices to relay through
  BouncerServ for detached channels.
- ReattachOn is a filter for which messages to trigger a channel
  reattach on.
- DetachAfter is the duration after which to automatically detach a
  channel if no matching messages are received.
- DetachOn is a filter for which messages will reset the auto-detach
  timer.
Add .editorconfig
586c7ee3 — Kalyan Sriram a month ago
sojuctl: change-password: check if user exists

When changing the password, checks if the user exists *before* prompting
for a password change, instead of after.
Uphold echo-message even with BouncerServ

Fixes <https://todo.sr.ht/~emersion/soju/74>
Fix nickname in ERR_ERRONEOUSNICKNAME
Prevent downstreams from changing their nick to service's

This commit prevents downstream from sending those commands:
- NICK BouncerServ
- NICK BouncerServ/<network>

The later is necessary because soju would otherwise save the nick change
and, in the event that the downstream connects in single-upstream mode
to <network>, it will end up with the nickname "BouncerServ".
Implement delivery receipts via PING messages

This patch implements basic message delivery receipts via PING and PONG.

When a PRIVMSG or NOTICE message is sent, a PING message with a token is
also sent. The history cursor isn't immediately advanced, instead the
bouncer will wait for a PONG message before doing so.

Self-messages trigger a PING for simplicity's sake. We can't immediately
advance the history cursor in this case, because a prior message might
still have an outstanding PING.

Future work may include optimizations such as removing the need to send
a PING after a self-message, or groupping multiple PING messages
together.

Closes: https://todo.sr.ht/~emersion/soju/11
Don't send TAGMSG to upstreams that don't support it

TAGMSG are (in current specs and drafts from IRCv3) only used for
client tags. These are optional information by design (since they are
not distributed to all users), therefore it is preferable to discard
them accordingly to upstream, instead of waiting for all upstreams to
support the capability to advertise it.
Don't accept any IP as a proxy by default

It's too easy to setup a reverse proxy which doesn't support the PROXY
protocol, or lets the X-Forwarded-For header fields pass through.
Disable this by default.

To restore the previous behaviour, add `accept-proxy-ip localhost` to
the config file.
Upgrade dependencies
Next