Commit Graph

1151 Commits

Author SHA1 Message Date
Simon Ser
4f7b577734 database: add NewUser 2023-11-01 00:04:57 +01:00
Simon Ser
38e32ddd6c database: fix default value for Network.AutoAway 2023-10-31 23:51:32 +01:00
Simon Ser
e19dd8f0da database: add NewNetwork 2023-10-31 23:51:04 +01:00
Calvin Lee
bb8397057e Fix saving +draft/react is msgstores
This commit fixes a bug where only TAGMSGs with a `+react` tag would be
stored, when a `+draft/react` tag is normative. I have kept messages
containing `+react` as well, as they will most likely be used in the
future.

I have also reversed the order of tag inspection, as I found the new
order to be more readable.
2023-10-25 16:57:11 +02:00
Calvin Lee
48f81f0b2d contrib/migrate-db: use explicit src/dest network
This commit makes the source and destination network distinction
explicit. This is necessary, as the source and destination network may
not have the same ID in the database, and thus associations will be broken
when migrated.
2023-10-25 16:06:48 +02:00
Calvin Lee
d137c69131 database: batch msg inserts
This commit takes insert query compilation and transaction creation out
of the critical loop for migrating message logs. I have tested with
the sqlite backend, and a speedup of approximately 40x has been achieved
for log migration.
2023-10-25 16:03:00 +02:00
Simon Ser
8a2a9706f7 go fmt 2023-10-24 16:54:19 +02:00
Simon Ser
d85424fe01 doc: add openssl command to fetch server fingerprint
This is not very pretty, but oh well.
2023-10-24 16:53:56 +02:00
Simon Ser
467f8cd187 service: convert network certfp to lower-case
In tls.Config.VerifyPeerCertificate, we compare it against the
result of hex.EncodeToString.
2023-10-24 16:53:56 +02:00
Simon Ser
d93251e714 build: improve readability of Go -ldflags 2023-10-21 18:22:56 +02:00
Simon Ser
5475a41917 build: cleanup all man pages 2023-10-21 18:21:06 +02:00
Calvin Lee
072e15d1e8 fix empty CHATHISTORY TARGETS
Currently, if times sent to `CHATHISTORY TARGETS` are reversed (e.g.
current time occurs first, and initial time occurs second) then no
targets will be returned from the database backend.

Changes have been tested with the sqlite backend.
2023-10-12 09:48:54 +02:00
Simon Ser
b49552ed5b Don't send bouncer-networks updates for removed networks
We may asynchronously receive an upstream's connection status after
the network has been removed.

Sending an update is pretty bad since it's interpreted by clients
as a new network.
2023-10-03 12:01:59 +02:00
Simon Ser
73e594d59d Remove remnant comments about multi-upstream mode 2023-10-03 10:14:55 +02:00
Eric Mertens
60b041419a Only log unhandled messages in debug mode 2023-09-22 23:31:02 +09:00
Simon Ser
fe64c795cd Use downstreamConn.upstreamForCommand when handling user MODE
Provides uniform error messages.
2023-08-31 00:09:57 +09:00
Eric Mertens
d6fc01e44a Forward complete MODE message to upstream when changing modes 2023-08-31 00:06:35 +09:00
Simon Ser
1558816a7e server: drop TODO about configurable vars
It might make sense to make some of these configurable, some not.
We'll decide on a case-by-case basis if/when good use-cases come
up.
2023-08-26 21:39:34 +02:00
Eric Mertens
be3c6d72c1
Add support for STATUSMSG
This passes the STATUSMSG isupport through, and it ignores statusmsg prefix when routing messages through the PRIVMSG, NOTICE, and TAGMSG handler so they will show up in the correct history. Because it doesn't modify the message the statusmsg sigils show up correctly for the user on receipt.

Without this PR the statusmsg messages still come through to the client, but they get misrouted by clients expecting STATUSMSG to be specified in 005 and they don't go into the right channel history.

Closes: https://todo.sr.ht/~emersion/soju/124
2023-08-26 12:37:20 +02:00
Simon Ser
01b28fa85d Use * instead of nick in some numeric replies
This argument is supposed to be the destination client, but is
useless. Simplify our functions by sending * instead.
2023-08-23 19:50:37 +02:00
Eric Mertens
3650446156 Pass MODE and TOPIC through for unjoined channels 2023-08-23 19:44:55 +02:00
Simon Ser
33a83b3b41 contrib/clients: drop mention of single-upstream mode
We no longer have multi-upstream mode, so no need to specify
explicitly the mode anymore.
2023-08-23 09:54:27 +02:00
Simon Ser
2e131cda6d doc: remove mention of dropped multi-upstream mode 2023-08-17 18:27:46 +02:00
Simon Ser
c06d97ab9b doc: clarify that client suffixes are not required for chathistory 2023-08-17 18:25:07 +02:00
Simon Ser
1a1610c1ce doc: expand on message store specificities 2023-08-17 18:13:11 +02:00
Simon Ser
00877b50c5 Upgrade dependencies 2023-08-16 21:04:37 +02:00
Eric Mertens
15e31e629a ERR_NOSUCHSERVER unqueues WHOIS 2023-08-16 20:58:02 +02:00
Eric Mertens
d9db48d879 Don't drop RPL_LISTSTART - passthrough to downstream 2023-08-13 20:28:55 +02:00
Eric Mertens
e43e472c53 Fix capability associated with account message-tag 2023-08-13 09:38:01 +02:00
Simon Ser
fc1151326c service: add a way to reset a network certfp 2023-08-09 18:04:30 +02:00
Simon Ser
97cfb366b0 Replace soju.im/pre-away with draft/pre-away
The IRCv3 draft spec ended up being merged!
2023-08-03 20:14:46 +02:00
Simon Ser
c36bb342fb Introduce soju.im/pre-away
The IRCv3 spec is stalled, so let's just ship a vendored extension
for now.

References: https://github.com/ircv3/ircv3-specifications/pull/514
2023-08-03 19:38:31 +02:00
delthas
0ee94759f7 Fix SEARCH queries with special characters on SQLite
Previously, we would pass SQLite FTS5 MATCH queries as is from the
SEARCH parameter, when searching for messages.

By default FTS5 queries follow a specific syntax, e.g. AND, OR, ...
can be used to filter searches logically.

Passing special characters in these unescaped queries, like `.`,
would be rejected by SQLite, failing the SEARCH request.

Here, in order to replicate PostgreSQL and FS behavior, we simply
want to search for the string as is, and not give it glob or logic
operators semantics.

To do that, we quote each token of the string, skipping over
separators.
2023-08-02 15:19:38 +02:00
Simon Ser
2351fc8b83 server: add metric for goroutine panics
This is useful to setup an alert when a panic occurs.
2023-06-02 11:03:21 +02:00
Simon Ser
64196d5b6e Upgrade dependencies 2023-06-01 13:07:39 +02:00
Simon Ser
c8d5c90d9d downstream: improve SASL error logging 2023-06-01 11:37:03 +02:00
Simon Ser
40a40566f4 msgstore/znclog: fix error message
err may be nil.

Fixes: 2b2a2fd479 ("msgstore/znclog: fix panic on malformed input line")
2023-05-23 23:11:05 +02:00
Simon Ser
2b2a2fd479 msgstore/znclog: fix panic on malformed input line
If the line is "[01:02:03]" without a trailing space, we trip on
a "slice bounds out of range" panic.

Closes: https://todo.sr.ht/~emersion/soju/214
2023-05-23 23:08:44 +02:00
Simon Ser
fa33ce986c downstream: fix nick in auth error message
We were always printing "*" here.
2023-05-23 18:28:50 +02:00
Simon Ser
9659de8ff3 Add CHATHISTORY test 2023-05-23 13:06:22 +02:00
Simon Ser
9b9fc60f62 Rename Config.Log{Driver,Path} to MsgStore 2023-05-23 11:23:38 +02:00
Simon Ser
cbdaf46592 service: reject params for commands that don't take any
We were already rejecting extraneous params for commands that take
one or more.
2023-04-25 09:51:37 +02:00
Simon Ser
582ac97c24 Use database.GetNick in network.isHighlight
The network nickname can be empty, and defaults to the global nick
setting.
2023-04-16 21:24:27 +02:00
Simon Ser
e5bce700a9 Panic if isHighlight is called with empty nick
Let's make sure callers never do this. We'd go into an infinite
loop previously.
2023-04-16 21:22:08 +02:00
Simon Ser
0548fdfa09 database/sqlite: fix missing argument in DeleteUser 2023-04-14 17:37:53 +02:00
Simon Ser
f6421c3498 doc/packaging: add section about binding to privileged ports 2023-04-14 17:35:51 +02:00
Simon Ser
662e3f3afe contrib/systemd: add AmbientCapabilities=CAP_NET_BIND_SERVICE
soju needs to bind to port 113 for identd.
2023-04-13 12:40:12 +02:00
Simon Ser
6f01bd86c3 downstream: pass context to SendMessage
Just like upstream does.
2023-04-06 13:23:20 +02:00
Simon Ser
51768c256a upstream: introduce upstreamConn.forwardMessage 2023-04-06 13:10:18 +02:00
Simon Ser
43e6febc15 downstream: error out if SASL PLAIN identity is specified 2023-04-05 21:18:57 +02:00