... 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
In particular, go-irc v3.1.4 should fix empty IRC message handling.
git-svn-id: file:///srv/svn/repo/suika/trunk@445 f0ae65fe-ee39-954e-97ec-027ff2717ef4
We don't want to have the batch tag when calling uc.produce, otherwise
downstream will end up with junk batch ids.
git-svn-id: file:///srv/svn/repo/suika/trunk@443 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Uses an in-memory ring buffer.
Closes: https://todo.sr.ht/~emersion/soju/96
git-svn-id: file:///srv/svn/repo/suika/trunk@442 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Allow to query the network ID and entity from the message ID regardless
of the underlying store used.
git-svn-id: file:///srv/svn/repo/suika/trunk@440 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This allows for other implementations that aren't based on a filesystem.
git-svn-id: file:///srv/svn/repo/suika/trunk@439 f0ae65fe-ee39-954e-97ec-027ff2717ef4
... 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.
git-svn-id: file:///srv/svn/repo/suika/trunk@437 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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" ...`
git-svn-id: file:///srv/svn/repo/suika/trunk@436 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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).
git-svn-id: file:///srv/svn/repo/suika/trunk@435 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@434 f0ae65fe-ee39-954e-97ec-027ff2717ef4
When changing the password, checks if the user exists *before* prompting
for a password change, instead of after.
git-svn-id: file:///srv/svn/repo/suika/trunk@432 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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".
git-svn-id: file:///srv/svn/repo/suika/trunk@429 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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
git-svn-id: file:///srv/svn/repo/suika/trunk@428 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@427 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@426 f0ae65fe-ee39-954e-97ec-027ff2717ef4
We don't use child directives yet, but likely will in the future.
git-svn-id: file:///srv/svn/repo/suika/trunk@424 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Introduce a messageStore type, which will allow for multiple
implementations (e.g. in the DB or in-memory instead of on-disk).
The message store is per-user so that we don't need to deal with locking
and it's easier to implement per-user limits.
git-svn-id: file:///srv/svn/repo/suika/trunk@423 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Not really better than what we had before, however new contributors will
maybe be familiar with it.
git-svn-id: file:///srv/svn/repo/suika/trunk@422 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit changes the Network schema to use user IDs instead of
usernames. While at it, a new UNIQUE(user, name) constraint ensures
there is no conflict with custom network names.
Closes: https://todo.sr.ht/~emersion/soju/86
References: https://todo.sr.ht/~emersion/soju/29
git-svn-id: file:///srv/svn/repo/suika/trunk@421 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This simple implementation only advertises extended-join to downstreams
when all upstreams support it.
In the future, it could be modified so that soju buffers incoming
upstream JOINs, sends a WHO, waits for the reply, and sends an extended
join to the downstream; so that soju could advertise that capability
even when some or all upstreams do not support it. This is not the case
in this commit.
git-svn-id: file:///srv/svn/repo/suika/trunk@419 f0ae65fe-ee39-954e-97ec-027ff2717ef4
IPs whitelisted in accept-proxy-ip can now use the PROXY protocol to
indicate the original source/destination addresses.
Closes: https://todo.sr.ht/~emersion/soju/81
git-svn-id: file:///srv/svn/repo/suika/trunk@418 f0ae65fe-ee39-954e-97ec-027ff2717ef4
... to allow the caller to correctly do any necessary casemapping.
git-svn-id: file:///srv/svn/repo/suika/trunk@416 f0ae65fe-ee39-954e-97ec-027ff2717ef4
... by replacing invalid bytes with the REPLACEMENT CHARACTER U+FFFD
This is better than:
- discarding the whole message, since the user would not see it...
- removing invalid bytes, since the user would not see their presence,
- converting the encoding (this is actually not possible).
Contrary to its documentation, strings.ToValidUTF8 doesn't copy the
string if it's valid UTF-8:
<https://golang.org/src/strings/strings.go?s=15815:15861#L623>
git-svn-id: file:///srv/svn/repo/suika/trunk@415 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Log files don't record all message types. If the message isn't inserted
in the log file, don't update the history cursors for downstream
connections.
git-svn-id: file:///srv/svn/repo/suika/trunk@414 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This panic happens when sending history to a multi-upstream client.
sendNetworkHistory is called on each network, but dc.network is nil.
Closes: https://todo.sr.ht/~emersion/soju/93
git-svn-id: file:///srv/svn/repo/suika/trunk@413 f0ae65fe-ee39-954e-97ec-027ff2717ef4
The PONG message should have these arguments:
- Our server name
- The PING message's source name
Closes: https://todo.sr.ht/~emersion/soju/92
git-svn-id: file:///srv/svn/repo/suika/trunk@412 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This allows to specify a network name in the nickname.
Closes: https://todo.sr.ht/~emersion/soju/91
git-svn-id: file:///srv/svn/repo/suika/trunk@411 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Instead, always read chat history from logs. Unify the implicit chat
history (pushing history to clients) and explicit chat history
(via the CHATHISTORY command).
Instead of keeping track of ring buffer cursors for each client, use
message IDs.
If necessary, the ring buffer could be re-introduced behind a
common MessageStore interface (could be useful when on-disk logs are
disabled).
References: https://todo.sr.ht/~emersion/soju/80
git-svn-id: file:///srv/svn/repo/suika/trunk@409 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This loads latest messages from logs up to a given message ID. This is
similar to the IRCv3 CHATHISTORY LATEST command [1].
[1]: 0c271a5f1d/extensions/chathistory.md (latest)
git-svn-id: file:///srv/svn/repo/suika/trunk@408 f0ae65fe-ee39-954e-97ec-027ff2717ef4
For now, these can be used as cursors in the logs. Future patches will
introduce functions that perform log queries with message IDs.
The IDs are state-less tokens containing all the required information to
refer to an on-disk log line: network name, entity name, date and byte
offset. The byte offset doesn't need to point to the first byte of the
line, any byte will do (note, this makes it so message IDs aren't
necessarily unique, we may want to change that in the future).
These internal message IDs are not exposed to clients because we don't
support upstream message IDs yet.
git-svn-id: file:///srv/svn/repo/suika/trunk@407 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Keep the ring buffer alive even if all clients are connected. Keep the
ID of the latest delivered message even for online clients.
As-is, this is a net downgrade: memory usage increases because ring
buffers aren't free'd anymore. However upcoming commits will replace the
ring buffer with log files. This change makes reading from log files
easier.
git-svn-id: file:///srv/svn/repo/suika/trunk@406 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This should avoid confusion when mixing up nickname and user name.
Also it avoid breaking downstreams (since '@' and '!' are used for host
masks).
git-svn-id: file:///srv/svn/repo/suika/trunk@404 f0ae65fe-ee39-954e-97ec-027ff2717ef4