Commit Graph

1047 Commits

Author SHA1 Message Date
Simon Ser
ae68c82fc0 contrib/clients: add goguma 2022-03-05 23:35:17 +01:00
Simon Ser
813c3d3de6 contrib/clients: warn about catgirl 2022-03-05 23:35:17 +01:00
Simon Ser
e5ec93179c doc/ext: add README
All authors have acknowledged the dual license.

The second license is the same as the one used by the IRCv3 working
group.
2022-03-04 10:36:41 +01:00
Simon Ser
a438c34489 downstream: disallow '.' in nicknames
See [1] and [2].

[1]: https://github.com/ircdocs/modern-irc/pull/148
[2]: eff6dd242b/irc/strings.go (L29)
2022-03-03 10:54:21 +01:00
Simon Ser
7b3e46a7c2 downstream: re-format illegalNickChars doc comment 2022-03-03 10:53:33 +01:00
Simon Ser
c742726316 downstream: fix network name msimatch check being too strict
The network name can be set via BOUNCER BIND. In that case we
don't want to error out when fallbackNetworkName == "".
2022-03-03 09:08:51 +01:00
Simon Ser
5ee667a2d9 Upgrade dependencies 2022-03-03 09:00:36 +01:00
Simon Ser
8421c27544 downstream: fail on client or network name mismatch
This probably indicates a mis-configuration.
2022-03-03 08:50:37 +01:00
Simon Ser
348e6da1fc downstream: be less strict when picking up client name
Allow e.g. the SASL username to contain "username/network" and the
raw username to contain "username@client", for instance.
2022-03-03 08:35:34 +01:00
Simon Ser
df4af1856a downstream: panic when registering twice
This would be a soju bug.
2022-03-03 08:33:10 +01:00
Simon Ser
dc58a70794 msgstore_fs: fix direct message targets
When fetching messages via draft/chathistory from a conversation
with another user, soju would send the following:

    :sender PRIVMSG sender :hey

instead of

    :sender PRIVMSG recipient :hey

because the file-system message store format doesn't contain the
original PRIVMSG target.

Fix this by doing some guesswork.
2022-02-25 21:05:10 +01:00
Simon Ser
379e07f7d8 irc: simplify isHighlight 2022-02-25 11:32:09 +01:00
Simon Ser
6033725eca irc: add isHighlight tests 2022-02-25 11:31:41 +01:00
Simon Ser
1a56b2f658 Introduce formatServerTime
It's too easy to forget to convert to UTC.
2022-02-16 14:45:09 +01:00
Simon Ser
155e811cd9 Ignore READ commands for service 2022-02-12 19:07:30 +01:00
Simon Ser
7e20c27332 doc: move read spec to ext/ 2022-02-11 19:49:21 +01:00
delthas
cae248f672 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.
2022-02-11 19:41:46 +01:00
delthas
17cd3b3e98 Fix echo-message for TAGMSG
A previous fix (d4b7bb02da) only fixed sending echo-message for
TAGMSG to self. We also need to send echo-message for TAGMSG to
other targets.

Closes: https://todo.sr.ht/~emersion/soju/111
2022-02-09 16:58:54 +01:00
Simon Ser
b1a83529e1 Fix flags variable name in RPL_WHOREPLY handler
This param doesn't contain modes, it contains user flags (such as
H/G for away status).
2022-02-09 15:20:32 +01:00
Simon Ser
009bc29e09 Refactor generateWHOXReply
Isolate the field letter -> value logic into a separate function.
2022-02-09 15:16:54 +01:00
Simon Ser
e72c896bb4 Add context to upstreamConn.register 2022-02-08 16:38:34 +01:00
Simon Ser
375ac53f74 Add context to upstreamConn.runUntilRegistered 2022-02-08 16:37:31 +01:00
Simon Ser
66a83e6345 makefile: switch to BSD/GNU make
Let's stop using POSIX make, it's too much of a pain.
2022-02-08 16:10:19 +01:00
Simon Ser
f858ec163c db_postgres: use enum for sasl_mechanism
Ensures only supported mechanisms get stored in the DB.
2022-02-08 15:38:41 +01:00
Simon Ser
02dac11308 Forbid empty and flag-looking network names 2022-02-07 21:39:39 +01:00
Simon Ser
3f91cfb8c3 service: make name arg optional for network commands
Makes commands less verbose.
2022-02-07 21:33:16 +01:00
Simon Ser
57715d8ce2 service: switch to -network flag for certfp and sasl commands
Instead of always requiring users to explicitly specify the network
name, guess it from the downstream connection.

Network commands are left as-is because it's not yet clear how to
handle them.
2022-02-04 16:47:34 +01:00
Simon Ser
64ad2164de Fix capitalization of handleServiceSASLStatus 2022-02-04 15:41:40 +01:00
Simon Ser
49b77d630a Ensure consistent network ordering
Right now there is no consistent ordering in the network list:
no ORDER BY in the DB, and network updates move entries to the end.

Let's always sort by network ID so that users don't see the entries
move around.

I've contemplated sorting by Network.GetName() instead, but:

- Clients have now way to figure out dynamic order changes, e.g.
  when renaming a network.
- Some clients might use ISUPPORT NETWORK when a user hasn't
  explicitly named a network, but soju won't use that for ordering,
  leading to non-alphabetic ordering in the client.

Let's leave it to clients to sort the networks by display name if
they want to.
2022-02-04 15:03:13 +01:00
Simon Ser
0b5da29916 Drop user.forEachNetwork
It's a trivial for loop.
2022-02-04 14:01:27 +01:00
Simon Ser
f2a03cf7a1 Fix incorrect listen addr in error message
The various server goroutines would always capture the last listen
addr in the loop.
2022-01-19 22:38:13 +01:00
Simon Ser
69e9b6a439 Retry on temporary net.Listener failure
Instead of stopping to listen, retry on temporary failure. This
can happen when running out of FDs.

Closes: https://todo.sr.ht/~emersion/soju/183
2022-01-19 22:35:46 +01:00
Theodor Thornhill
950198a2b7 contrib/clients: Add information about emacs irc clients 2022-01-13 16:06:54 +01:00
Simon Ser
7060547809 Don't send RPL_NOTOPIC on JOIN
As per https://modern.ircdocs.horse/#join-message
2022-01-10 10:37:55 +01:00
Chris Howey
bc727496d0 bump required go version to 1.15
requires functions added to the stdlib in 1.15

downstream.go references tls.Dialer
user.go references Resolver.LookupIP
2022-01-03 21:01:44 +01:00
Simon Ser
de7d1f7784 Add context to upstreamConn.handleCapAck 2021-12-10 12:28:16 +01:00
Simon Ser
fe564af756 Handle upstream multi-line SASL
References: https://todo.sr.ht/~emersion/soju/173
2021-12-10 10:46:41 +01:00
Simon Ser
e7f9d2332b Add support for downstream multi-line AUTHENTICATE commands
Useful for long passwords.
2021-12-09 23:21:08 +01:00
Simon Ser
e397cc2a1f Block RPL_{CREATIONTIME,TOPICWHOTIME} for detached channels
Closes: https://todo.sr.ht/~emersion/soju/132
2021-12-09 12:12:20 +01:00
Simon Ser
bad8154da8 Don't forward duplicate JOIN commands
Closes: https://todo.sr.ht/~emersion/soju/171
2021-12-08 18:23:46 +01:00
Simon Ser
66aea1b4a2 Add context to {conn,upstreamConn}.SendMessage
This avoids blocking on upstream message rate limiting for too
long.
2021-12-08 18:03:40 +01:00
Simon Ser
d21fc06d88 server: cleanup user in defer
If a user goroutine panics, this correctly removes it from the
global map instead of leaving a dangling entry behind.
2021-12-08 15:00:02 +01:00
Simon Ser
9caa6f9ca0 service: send summary when executing "server notice"
Sometimes this command times out. Display the number of skipped
users.
2021-12-08 14:55:31 +01:00
Simon Ser
f7e151396d Use dc.nick instead of "*" for RPL_* messages
Makes it clearer what these fields are used for. The default value
for dc.nick is "*".
2021-12-07 09:42:32 +01:00
Simon Ser
aae0fb9f22 Improve error message when downstream doesn't authenticate 2021-12-07 09:40:02 +01:00
Simon Ser
b6c47a517c Use more descriptive errors when aborting pending commands 2021-12-06 22:33:50 +01:00
Simon Ser
5c819a2c6c Disallow ',' in nicknames
It breaks lists as in `PRIVMSG a,b,c :foo`.
2021-12-06 19:23:28 +01:00
Simon Ser
1a78b3d905 Add username to downstreamConn log messages 2021-12-06 18:56:00 +01:00
Simon Ser
d7f7e351af Improve msgStore.Append log message wording 2021-12-06 18:46:10 +01:00
Simon Ser
8b7df6dd46 Downgrade conn log messages to debug 2021-12-06 18:40:37 +01:00