Commit graph

927 commits

Author SHA1 Message Date
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
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
jesopo 804d685ab2 contrib/clients: correct comment about catgirl 2022-06-13 15:42:53 +02:00
Simon Ser 8cbaae2b90 Upgrade dependencies 2022-06-13 11:11:15 +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 4e40b498b1 Drop casemapMap.OriginalKey
It's unused.
2022-06-06 09:20: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 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 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 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 e2e232fa9c config: add message-store memory
The old way to do this was `message-store fs ""`, which is
misleading.
2022-05-09 16:59:27 +02:00
Simon Ser 80ed0d2a6c Rename "log" config directive to "message-store"
This is more explicit and removes the ambiguity with error logging.
2022-05-09 16:41:41 +02:00
Simon Ser 95db42e645 Move identd to separate package 2022-05-09 16:36:54 +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 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