Commit Graph

964 Commits

Author SHA1 Message Date
delthas
9647711921 Fix build on systems without syscall.Rlimit
On some systems (namely Windows), syscall.Rlimit is not defined, and
makes the build fail.

This fixes the build by making the rlimit calls only run on archs where
it is defined, defaulting to a stub on other systems.

See: 8427429c59
2022-03-21 09:39:54 +01:00
Simon Ser
744c6e3f6d Enable bot mode for BouncerServ
See [1] for details.

[1]: https://ircv3.net/specs/extensions/bot-mode
2022-03-16 18:35:48 +01:00
Simon Ser
777adbd5e1 downstream: improve ERR_ERRONEUSNICKNAME message a bit 2022-03-16 12:33:23 +01:00
Simon Ser
5feae506d4 doc/soju.1: recommend using a FQDN for the hostname 2022-03-15 23:01:08 +01:00
Simon Ser
8b926be817 Warn about non-FQDN hostnames
References: https://github.com/ircdocs/modern-irc/pull/148
2022-03-15 20:45:23 +01:00
Simon Ser
c7039da54b service: limit number of -connect-command flags 2022-03-14 19:37:12 +01:00
Simon Ser
35b09f069c downstream: atomically ack/nak capabilities 2022-03-14 19:30:29 +01:00
Simon Ser
6e094b1099 Use capRegistry for upstreamConn 2022-03-14 19:25:49 +01:00
Simon Ser
74fd506fef Use capRegistry for downstreamConn 2022-03-14 19:25:49 +01:00
Simon Ser
347a4979da irc: introduce capRegistry 2022-03-14 19:25:49 +01:00
delthas
9376c8885c downstream: Enable handling READ when upstream is disconnected
Previously, when we sent READ for an upstream which was disconnected,
we would fail with an error. This is because we called unmarshalEntity,
which checked that the upstream was in the connected status.

But we don't need to be connected to update the READ timestamp, this is
a purely offline (wrt the upstream) operation.

This simply switches the call from unmarshalEntity to
unmarshalEntityNetwork to fix the issue.
2022-03-08 22:35:46 +01:00
Simon Ser
fdf9727600 Mark BouncerServ as online in MONITOR, don't forward to upstream 2022-03-08 21:29:04 +01:00
Simon Ser
d8f5f8481f downstream: set case-mapping for monitored 2022-03-08 21:28:43 +01:00
Simon Ser
9a79c66921 upstream: use network case-mapping in updateMonitor
We were using the downstream case-mapping.
2022-03-08 21:27:43 +01:00
Simon Ser
2060ae05cf downstream: drop delivery receipts when client supports chathistory
When the client supports draft/chathistory, no need to request
delivery receipts via PING messages. Let's just not leave delivery
receipts alone. They'll go stale but should be never used (or used
by a non-chathistory client).
2022-03-08 16:45:45 +01:00
Simon Ser
421d3f258a db_postgres: report network metrics with hostname label
This can help figure out when it's necessary to discuss with
network operators to request a connection limit bump.
2022-03-08 11:04:23 +01:00
Simon Ser
dac003960c db: allow registering multiple metrics collectors 2022-03-08 10:36:59 +01:00
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