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
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
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
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
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
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
289a4e118a
Move batch struct to upstream.go
2022-05-30 09:45:40 +02:00
Simon Ser
da8f626e51
xirc: add GenerateSASL
2022-05-30 09:41:47 +02:00
Simon Ser
f9c4ba636f
xirc: move over Membership
2022-05-30 09:12:28 +02:00
Simon Ser
9b37bd2eaa
xirc: move over CapRegistry
2022-05-29 18:33:22 +02:00
Simon Ser
c10d382a7d
xirfc: move over message generation functions
2022-05-29 17:57:21 +02:00
Simon Ser
997fe723f0
xirc: move ChannelStatus over
2022-05-29 17:28:25 +02:00
Simon Ser
4af7a1b8e5
Rename join to generateJoin
...
For consistency with other functions.
2022-05-09 17:20:17 +02:00
Simon Ser
c50fb4a26d
xirc: move command constants over
2022-05-09 17:18:51 +02:00
Simon Ser
b92afa7cca
Introduce an xirc package
2022-05-09 16:15:00 +02:00
Simon Ser
3a7dee8128
Introduce a database package
2022-05-09 15:08:04 +02:00
Simon Ser
27f21eab94
upstream: fix panic in isChannel
...
Fixes the following:
goroutine 4380762 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x65
git.sr.ht/~emersion/soju.(*Server)addUserLocked.func1.1()
git.sr.ht/~emersion/soju/server.go:318 +0x66
panic({0x563f090c4460, 0xc002bff998})
runtime/panic.go:1038 +0x215
git.sr.ht/~emersion/soju.(*upstreamConn).isChannel(...)
git.sr.ht/~emersion/soju/upstream.go:288
git.sr.ht/~emersion/soju.(*downstreamConn).handleMessageRegistered(0xc00c23a000, {0x563f0910eb20, 0xc0027539e0}, 0xc01b8d6240)
git.sr.ht/~emersion/soju/downstream.go:1836 +0xd4ec
git.s.ht/~emersion/soju.(*downstreamConn).handleMessage(0xc00c3a000, {0x563f0910eae8, 0xc000026058}, 0xc01b8d6240)
git.sr.ht/~emersion/soju/downstream.go:697 +0xde
git.sr.ht/~emersion/soju.(*user).run(0xc00be4a0b0)
git.sr.ht/~emersion/soju/user.go:675 +0xbe5
git.sr.ht/~emersion/soju.(*Server).addUserLocked.func1()
git.sr.ht/~emersion/soju/server.go:328 +0x70
2022-05-07 09:28:53 +02:00
Simon Ser
d321fcd9f0
upstream: fix missing WHOIS in abortPendingCommands
...
Fixes the following panic:
2022/05/03 08:05:32 panic serving user "asdf": Unsupported pending command "WHOIS"
goroutine 15 [running]:
runtime/debug.Stack()
/opt/go/src/runtime/debug/stack.go:24 +0x65
git.sr.ht/~emersion/soju.(*Server).addUserLocked.func1.1()
~/soju/server.go:317 +0x5d
panic({0xa18da0, 0x6815bf10})
/opt/go/src/runtime/panic.go:838 +0x207
git.sr.ht/~emersion/soju.(*upstreamConn).abortPendingCommands(0x6811c9c0)
~/soju/upstream.go:338 +0x953
git.sr.ht/~emersion/soju.(*user).handleUpstreamDisconnected(0x680b7080, 0x6811c9c0)
~/soju/user.go:744 +0x6d
git.sr.ht/~emersion/soju.(*user).updateNetwork(0x680b7080, {0xb99a00, 0x684690e0}, 0x681343c0)
~/soju/user.go:936 +0x387
git.sr.ht/~emersion/soju.handleServiceNetworkUpdate({0xb99a00, 0x684690e0}, 0x68116000, {0x681b8a20?, 0x40429108?, 0x10?})
~/soju/service.go:590 +0x14f
git.sr.ht/~emersion/soju.handleServicePRIVMSG({0xb99a00, 0x684690e0}, 0x68116000, {0x680af5d5?, 0x1?})
~/soju/service.go:146 +0x7df
git.sr.ht/~emersion/soju.(*downstreamConn).handleMessageRegistered(0x68116000, {0xb99a00, 0x684690e0}, 0x681b8940)
~/soju/downstream.go:2503 +0x9e9e
git.sr.ht/~emersion/soju.(*downstreamConn).handleMessage(0x68116000, {0xb999c8?, 0x680240a0?}, 0x681b8940)
~/soju/downstream.go:727 +0xde
git.sr.ht/~emersion/soju.(*user).run(0x680b7080)
~/soju/user.go:690 +0xe05
git.sr.ht/~emersion/soju.(*Server).addUserLocked.func1()
~/soju/server.go:327 +0x70
created by git.sr.ht/~emersion/soju.(*Server).addUserLocked
~/soju/server.go:314 +0x178
2022-05-03 08:33:20 +02:00
Simon Ser
2ba13fdefc
upstream: use context to set connectToUpstream timeout
...
This allows the timeout to apply to the whole sequence of
operations, as opposed to just Dial.
2022-04-14 19:42:02 +02:00
delthas
abe5291b62
Add support for the upstream echo-message capability
...
This adds support for upstream echo-message. This capability is
enabled when the upstream supports labeled-response.
When it is enabled, we don't echo downstream messages in the downstream
handler, but rather wait for the upstream to echo it, to produce it to
downstreams.
When it is disabled, we keep the same behaviour as before: produce the
message to all downstreams as soon as it is received from the
downstream.
In other words, the main functional difference is that when the upstream
supports labeled-response, the client will now receive an echo for its
messages when the server acknowledges them, rather than when soju acks
them.
Additionally, uc.produce was refactored to take an ID rather than a
downstream.
2022-04-11 17:27:47 +02:00
delthas
12577c10bb
upstream: handle CAP ACK -name
...
We'll need this for echo-message.
2022-04-11 17:27:47 +02:00
Simon Ser
fb20cff45b
upstream: pass context to upstreamConn.requestCaps
2022-04-04 13:43:00 +02:00
Simon Ser
846c99dedc
Queue WHOIS commands
...
This avoids having more than one in flight at a time (avoids
hitting rate limits a bit) and routes back replies to the correct
downstream connection (even if labeled-response isn't supported).
Closes: https://todo.sr.ht/~emersion/soju/193
2022-04-04 09:58:26 +02:00
Simon Ser
57eb54fb34
upstream: use labeled-response for queued commands
2022-04-04 09:55:32 +02:00
Simon Ser
747263fc2d
Simplify and improve WHOIS forwarding
...
Group together most WHOIS replies. While at it, add a few missing
replies.
2022-04-04 09:28:04 +02:00
Simon Ser
16e43ee3a3
upstream: don't populate time tag for numerics
...
Allows us to save a few bytes, e.g. in WHO replies.
2022-03-22 21:14:02 +01:00
Simon Ser
09513e63fe
Remove unnecessary zero initialization
2022-03-22 21:10:06 +01:00
Simon Ser
5defd29509
Ensure all incoming messages have a prefix set
...
Per the spec:
> If the source is missing from a message, it’s is assumed to have originated
> from the client/server on the other end of the connection the message was
> received on.
2022-03-21 17:01:15 +01:00
Simon Ser
e403b88a3d
Add support for chghost
2022-03-21 16:30:58 +01:00
Simon Ser
78d9a84a6f
Add support for RPL_VISIBLEHOST
2022-03-21 16:09:45 +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
fdf9727600
Mark BouncerServ as online in MONITOR, don't forward to upstream
2022-03-08 21:29:04 +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
1a56b2f658
Introduce formatServerTime
...
It's too easy to forget to convert to UTC.
2022-02-16 14:45:09 +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
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
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
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
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
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