... 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
- Don't print the raw IRC message, since we already show the original
error message
- Avoid double-printing "registration failed"
git-svn-id: file:///srv/svn/repo/suika/trunk@399 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Allow up to 10 outgoing messages in a burst, then throttle to 1 message
each 2 seconds.
Closes: https://todo.sr.ht/~emersion/soju/87
git-svn-id: file:///srv/svn/repo/suika/trunk@398 f0ae65fe-ee39-954e-97ec-027ff2717ef4
The time tag was causing the registration error messages to be
continuously sent to downstream connections.
git-svn-id: file:///srv/svn/repo/suika/trunk@396 f0ae65fe-ee39-954e-97ec-027ff2717ef4
base64 strings may contain characters rejected by ident clients such
as "+". Use hex encoding and shorten the string a little.
git-svn-id: file:///srv/svn/repo/suika/trunk@395 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Forgot to check in this file.
Fixes: 65302d3c1e8e ("Add an ident server")
git-svn-id: file:///srv/svn/repo/suika/trunk@388 f0ae65fe-ee39-954e-97ec-027ff2717ef4
These will get re-used for sending history to clients that don't support
the chathistory extension.
git-svn-id: file:///srv/svn/repo/suika/trunk@387 f0ae65fe-ee39-954e-97ec-027ff2717ef4
For now it's just a new field that'll be useful to generate user ident
strings. It uses the SQLite implicit rowid column. In the future the DB
interface will need to be updated to use user IDs instead of usernames.
git-svn-id: file:///srv/svn/repo/suika/trunk@382 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This defers TLS handshake until the first read or write operation. This
allows the upcoming identd server to register the connection before the
TLS handshake is complete, and is necessary because some IRC servers
send an ident request before that.
git-svn-id: file:///srv/svn/repo/suika/trunk@381 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This makes sure we don't overwrite other fields, such as Admin.
Closes: https://todo.sr.ht/~emersion/soju/85
git-svn-id: file:///srv/svn/repo/suika/trunk@380 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Let's be on the safe side and assume the user doesn't meant the union of
all directive values.
git-svn-id: file:///srv/svn/repo/suika/trunk@371 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This allows to set the list of IPs allowed to act as a proxy. This is
only used for WebSockets right now, but will be expanded to TCP as well
once the PROXY protocol is supported.
git-svn-id: file:///srv/svn/repo/suika/trunk@370 f0ae65fe-ee39-954e-97ec-027ff2717ef4
When Unix socket support will be added for listeners, unix:// will be
ambiguous. It won't be clear whether to setup an IRC server, or some
other kind of server (e.g. identd).
unix:// is still recognized to avoid breaking existing DBs.
git-svn-id: file:///srv/svn/repo/suika/trunk@369 f0ae65fe-ee39-954e-97ec-027ff2717ef4