Simon Ser
d27880e03e
config: use structs to group DB/MsgAuth
2022-09-11 13:50:34 +02:00
Ember Sawady
aee65cd269
Fix labeled-response without downstream echo-message
...
Previously, receiving labeled responses to messages sent from a
downstream without echo-message would fail, because soju would filter
out the responses under the assumption that it was an echoed message.
Only do this filtering when msg.Prefix.Name != uc.nick in order to avoid
this issue.
2022-09-06 15:15:34 +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
Simon Ser
6ba63aec4f
go fmt
2022-08-23 09:53:11 +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
05a382ef16
Downgrade Web Push urgency for unimportant messages
...
For instance TAGMSG and MARKREAD aren't really high urgency.
2022-08-17 16:04:11 +02:00
Simon Ser
1ee5dc062d
upstream: add timeout for pending commands
...
References: https://todo.sr.ht/~emersion/soju/194
2022-08-17 15:45:05 +02:00
Jeff Martin
a662091a9d
server: fix panic stacktrace print formatting
...
This change uses string formatting for the output of debug.Stack. The
output of debug.Stack is []byte, which isn't human readable.
2022-08-08 15:27:04 +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
Reto Brunner
ac01ac0143
Use output given to NewLogger
...
Previously the output param was ignored
2022-08-02 10:11:25 +02:00
Simon Ser
ce19f76673
database/postgres: fix inverted networkID check in ListWebPushSubscriptions
...
Same as 02844ca9df
("database/postgres: fix inverted networkID
check in StoreWebPushSubscription").
2022-07-27 09:48:52 +02:00
Simon Ser
02844ca9df
database/postgres: fix inverted networkID check in StoreWebPushSubscription
...
Presented without comment.
2022-07-25 19:32:09 +02:00
Simon Ser
8849669d61
database/postgres: set max open conns
...
Open at most 25 connections. Should fix errors such as
"pq: sorry, too many clients already".
2022-07-25 19:00:14 +02:00
Simon Ser
d0868722cd
database/postgres: make WebPushSubscription.user NOT NULL
...
Also see 6734464b72
("database/postgres: fix inverted network and
user in StoreWebPushSubscription").
2022-07-25 18:55:22 +02:00
Simon Ser
6734464b72
database/postgres: fix inverted network and user in StoreWebPushSubscription
2022-07-25 18:49:21 +02:00
Simon Ser
f37aedea79
downstream: reply to INFO
2022-07-14 15:51:26 +02:00
Simon Ser
af95bc3a4f
upstream: regain desired nick when MONITOR is missing
...
We already have logic to regain our desired nick when the upstream
server supports MONITOR. However some networks (e.g. OFTC, Rizon)
don't support MONITOR. Also try to regain our desired nick in that
case, by periodically sending NICK commands.
Closes: https://todo.sr.ht/~emersion/soju/197
2022-07-14 12:25:47 +02:00
Simon Ser
a24cc5c969
upstream: pre-registration NOTICEs come from servers
...
There's no way another user is aware that we exist before
RPL_WELCOME.
2022-07-13 09:02:03 +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
gildarts
0777ca0d29
Add ability for a user to delete themselves
...
Adds user self delete
Adds confirmation of user deletion
2022-07-12 18:14:11 +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
9ba03b9095
upstream: ignore RPL_ENDOFWHO without pending command
2022-07-11 11:25:19 +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
7db1be44fa
upstream: compare service nick with case-mapping
2022-07-08 14:47:43 +02:00
Simon Ser
dc356200c2
upstream: fix server message detection for wildcard targets
...
Prior to connection registration, NOTICE messages are sent to "*".
2022-07-08 14:41:18 +02:00
Simon Ser
739adf7eb9
upstream: handle ERR_UNKNOWNERROR and ERR_NEEDMOREPARAMS for queued commands
...
We need to dequeue the commands when we receive these messages.
2022-07-04 17:13:31 +02:00
Simon Ser
689dc8a632
upstream: unset SASL state on RPL_TRYAGAIN
...
SASL would get stuck otherwise.
2022-07-04 17:12:02 +02:00
Simon Ser
5ef7e07061
contrib/znc-import: move to subdir
...
Go isn't happy when multiple scripts share the same directory.
2022-07-04 15:52:09 +02:00
gildarts
7ba3cba1e6
contrib/migrate-db: new script
...
This utility will migrate data between any two soju databases.
Sqlite to postgres or postgres to sqlite.
2022-07-04 15:50:35 +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
f5d57e415f
upstream: add support for @+draft/channel-context
...
References: https://github.com/ircv3/ircv3-specifications/pull/498
2022-06-28 15:57:54 +02:00
Simon Ser
695cd2eaa5
readme: copy over updated description from website
2022-06-27 14:30:28 +02:00
gildarts
4bc9aaf659
Add detach option to channel update
...
Add `-detached` to `channel update` command
Co-authored-by: Simon Ser <contact@emersion.fr>
Closes: https://todo.sr.ht/~emersion/soju/140
2022-06-24 22:04:12 +02:00
Simon Ser
ca3557d9ef
upstream: improve server message detection
...
Stop relying on user/host being unset: this is fragile, some servers
send messages coming from users without these.
2022-06-24 13:41:37 +02:00
Simon Ser
ebe209b3a4
upstream: rename variables to clear up target confusion
...
"target" is documented by the spec to be the first argument of the
PRIVMSG. Use a more explicit name for the message store destination.
2022-06-24 13:29:56 +02:00
Simon Ser
27b8547572
database/sqlite: add migration for WebPushSubscription.user
...
This should be enough to fixup the user column for subscriptions
with a network specified.
2022-06-16 19:46:59 +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