Commit Graph

428 Commits

Author SHA1 Message Date
Simon Ser
8a2f544806 downstream: drop downstreamConn.marshalEntity
This is a no-op.
2022-09-26 16:57:05 +02:00
Simon Ser
31957a9ac4 downstream: drop downstreamConn.marshalMessage
It's a no-op.
2022-09-26 16:57:05 +02:00
Simon Ser
25257b8892 downstream: drop downstreamConn.marshalUserPrefix
This is now a no-op.
2022-09-26 16:57:05 +02:00
Simon Ser
00919e9412 downstream: drop downstreamConn.unmarshalText
It's unused.
2022-09-26 16:57:05 +02:00
Simon Ser
eba7aa38d2 downstream: drop downstreamConn.isMultiUpstream
This is now always false.
2022-09-26 16:57:05 +02:00
Simon Ser
1ea3a19403 downstream: refuse to enable multi-upstream mode
References: https://todo.sr.ht/~emersion/soju/125
2022-09-26 16:57:04 +02:00
Simon Ser
c5f6a41d6c downstream: remove outdated Web Push TODO
We already do that.
2022-09-16 18:58:42 +02:00
Simon Ser
bb868eae82 downstream: fix CHATHISTORY LATEST without a bound
Fixes: 5e56cc30c5 ("downstream: fix inverted range in CHATHISTORY LATEST with a timestamp")
2022-09-16 18:55:31 +02:00
Simon Ser
5b10348957 downstream: don't echo back SASL mechanism
Some clients will queue up multiple AUTHENTICATE commands without
waiting for a reply to avoid some roundtrips. However that means
the traffic looks like so:

    AUTHENTICATE <mechanism>
    AUTHENTICATE <base64 blob containing credentials>

soju will fail the first command, and will behave as if no SASL
authentication was in progress when interpreting the second one.
This means we'll echo back the security-sensitive base64 blob to
the client in the error message, which is definitely not great.

Stop doing that.
2022-09-12 21:42:03 +02:00
Simon Ser
f4af7975d3 Pass-through ISUPPORT LINELEN
Can be used by the server to indicate support for a greater message
size limit.
2022-08-28 18:53:41 +02:00
Ember Sawady
57584c08ed Fix NICK on upstreams supporting MONITOR
Previously, uc.network.Network.Nick wasn't successfully updated on
downstream NICK. This would cause soju to immediately switch back to the
old nick when the upstream supported MONITOR, so long as the network had
a nick configured as of initialization.

In addition, stop monitoring our desired nick once we've successfully
switched to it once, in order to not immediately undo server-induced
nick changes.
2022-08-23 09:39:24 +02:00
Petr Ročkai
5e56cc30c5 downstream: fix inverted range in CHATHISTORY LATEST with a timestamp 2022-08-17 19:43:01 +02:00
Simon Ser
6fa8a1f30a downstream: add hard limit on Web Push subscriptions
Each subscription comes with the cost of a HTTP request when
broadcasting a message.
2022-08-17 17:08:23 +02:00
Simon Ser
cffdbc16b4 downstream: break findWebPushSubscription in two functions
We'll use that to count the number of existing subscriptions in
the next commit.
2022-08-17 17:04:11 +02:00
Simon Ser
65f0b2367e Broadcast Web Push subscriptions in a new goroutine 2022-08-17 16:09:12 +02:00
Simon Ser
0ef8b7d4c8 downstream: re-format doc comment with Go 1.19 style
We can use lists now.
2022-08-05 18:37:32 +02:00
Simon Ser
f37aedea79 downstream: reply to INFO 2022-07-14 15:51:26 +02:00
gildarts
48960a2992 database: upgrade bcrypt cost as needed
Closes: https://todo.sr.ht/~emersion/soju/136
2022-07-12 18:52:49 +02:00
Simon Ser
c69ea81999 downstream: fix downstream check for draft/read-marker
`dc` is the source connection, `d` is the destination for the
broadcast.

Fixes: 7e21e79eab ("downstream: fix MARKREAD/READ command name in broadcast")
2022-07-12 17:04:46 +02:00
Simon Ser
1e78e3e4b0 dowstream: remove noop WEBPUSH REGISTER
We still want to update the updated_at column when a client
refreshes the subscription.
2022-07-11 22:54:51 +02:00
Simon Ser
4e683af535 Aggregate AWAY status from all connected clients
Closes: https://todo.sr.ht/~emersion/soju/200
2022-07-11 19:36:12 +02:00
Simon Ser
84188ba644 downstream: relay SETNAME with upstreamConn.SendMessageLabeled
This makes it so any errors are only relayed to this downstream
connection.

The upstream handler for SETNAME handles the broadcasting to all
downstream connections already.
2022-07-08 18:17:24 +02:00
Simon Ser
b1b4541a53 downstream: simplify NICK handling when disconnected 2022-07-08 18:14:10 +02:00
Simon Ser
dc0a847240 Add per-user default nickname
The soju username is immutable. Add a separate nickname setting so
that users can change their nickname for all networks.

References: https://todo.sr.ht/~emersion/soju/110
2022-07-08 18:01:05 +02:00
Simon Ser
14cbd63412 Send MARKREAD push notifications
Allows clients to dismiss notifications when another client marks
the conversation as read.
2022-07-08 16:55:29 +02:00
Simon Ser
7e21e79eab downstream: fix MARKREAD/READ command name in broadcast
We wouldn't send a MARKREAD message to draft/read-marker downstreams
when receiving a READ command.
2022-07-08 15:17:30 +02:00
Simon Ser
0d44413e85 upstream: drop upstreamConn.nickCM
Removes an unnecessary source of truth.
2022-07-08 14:52:10 +02:00
Simon Ser
e2e3e2731b Fix draft/read-marker entry in permanentDownstreamCaps
Oops.

Fixes: 71d639699e ("Add support for draft/read-marker")
2022-07-01 15:58:11 +02:00
Simon Ser
71d639699e Add support for draft/read-marker
References: https://github.com/ircv3/ircv3-specifications/pull/489
2022-07-01 13:33:28 +02:00
Simon Ser
f0db261fc0 database: add missing user column to WebPushSubscription table
Some WebPushSubscription entries aren't tried to a network, in
which case the "network" column is NULL. But then all users share
the same row. Oops.

Fortunately network-less subscriptions aren't used for anything
yet, they're just stored. So the impact should be minimal.
2022-06-16 19:33:39 +02:00
Simon Ser
de0992d41e downstream: fix panic in findWebPushSubscription for unbound conns
This code has been missed when adding webpush support for downstream
connections without an upstream network bound.
2022-06-15 09:09:28 +02:00
Simon Ser
3863b8cb6b Add webpush extension
References: https://github.com/ircv3/ircv3-specifications/pull/471
Co-authored-by: delthas <delthas@dille.cc>
2022-06-14 16:16:12 +02:00
Simon Ser
fe40c51ff0 database: add User.{Check,Set}Password 2022-06-08 13:27:33 +02:00
Simon Ser
09f2cf8489 Don't provide name in channel casemapMap Set and ForEach
The name is already provided in the struct.
2022-06-06 10:05:31 +02:00
Simon Ser
657e25b25c Make casemapMap more type-safe
In addition to a type-safe getter, also define type-safe setters
and iterators.

References: https://lists.sr.ht/~emersion/soju-dev/patches/32777
2022-06-06 09:58:39 +02:00
Simon Ser
c8f9728ff6 Drop size arg from newCasemapMap
It's unused.
2022-06-06 09:23:17 +02:00
Simon Ser
22b235602b Add soju.im/account-required
References: https://github.com/ircv3/ircv3-specifications/pull/492
2022-06-04 10:52:28 +02:00
Simon Ser
3c5e603192 Remove bridge.go
All of its functions belong to downstream.go.
2022-05-30 09:51:36 +02:00
Simon Ser
da8f626e51 xirc: add GenerateSASL 2022-05-30 09:41:47 +02:00
Simon Ser
f3b06f4236 xirc: move over WHOX helpers 2022-05-29 18:33:29 +02:00
Simon Ser
9b37bd2eaa xirc: move over CapRegistry 2022-05-29 18:33:22 +02:00
Simon Ser
fa6f52ed08 xirc: encode tokens in GenerateIsupport 2022-05-29 18:24:10 +02:00
Simon Ser
c10d382a7d xirfc: move over message generation functions 2022-05-29 17:57:21 +02:00
Simon Ser
c50fb4a26d xirc: move command constants over 2022-05-09 17:18:51 +02:00
Simon Ser
620a8789b0 Add msgstore package 2022-05-09 16:25:57 +02:00
Simon Ser
b92afa7cca Introduce an xirc package 2022-05-09 16:15:00 +02:00
Simon Ser
89412187d4 msgstore: rename searchMessageOptions, export fields
Preparation for splitting msgstore into a separate package.
2022-05-09 15:44:41 +02:00
Simon Ser
f508d36c38 msgstore: add loadMessageOptions
A struct containing common parameters for all messageStore.Load*
functions returning messages.
2022-05-09 15:36:39 +02:00
Simon Ser
3a7dee8128 Introduce a database package 2022-05-09 15:08:04 +02:00
Simon Ser
d37f946e83 downstream: fix setting tls=0 in bouncer-networks
The old code resulted in URLs like "irc+insecure://0".
2022-05-03 10:43:02 +02:00