Commit Graph

531 Commits

Author SHA1 Message Date
Drew DeVault
61b68d6dfb db: refactor into interface
This refactors the SQLite-specific bits into db_sqlite.go. A future
patch will add PostgreSQL support.
2021-05-25 16:35:39 +02:00
Hubert Hirtz
647fb9ed9e Don't build soju when calling "make install"
Otherwise soju would be rebuilt as the user who runs "make install"
(typically root).
2021-05-25 16:31:06 +02:00
Philip K
b3bc9614f8 Directly return self-messages to user in multi-upstream mode 2021-05-24 13:31:24 +02:00
Simon Ser
68463d3e8b Pass-through the BOT ISUPPORT token
References: https://github.com/ircv3/ircv3-specifications/pull/439
2021-05-24 11:41:04 +02:00
Simon Ser
314da0ab3e readme: link to rendered man page 2021-05-23 21:41:01 +02:00
Hubert Hirtz
03288d16f1 Don't forward label tags
We don't want to have the label tag when calling uc.produce, otherwise
downstream will end up with junk labels.
2021-05-23 12:32:27 +02:00
Simon Ser
697bdd32dd doc/soju.1: document user delete command 2021-05-22 10:44:36 +02:00
Simon Ser
95b9493310 doc/soju.1: document -connect-command 2021-05-22 10:40:36 +02:00
Simon Ser
bbc51c00be readme: add link to IRC channel 2021-05-22 00:04:22 +02:00
Simon Ser
53e876eba5 readme: move quickstart to dedicated doc page 2021-05-22 00:01:06 +02:00
Hubert Hirtz
3b41c87a41 Fix CAP LIST listing disabled capabilities 2021-05-21 10:03:39 +02:00
Simon Ser
ec26117c08 Relay self-WHO/WHOIS in single-upstream mode
In multi-upstream mode, we can't relay WHO/WHOIS messages for the
current user, because we can't decide which upstream server the
message should be relayed to.

In single-upstream server, we do know which upstream server to use,
so we can just blindly relay the message.

This allows users to send a self-WHO/WHOIS to check their cloak and
other information.
2021-05-20 11:13:14 +02:00
Simon Ser
c8a54235d0 Silence net.ErrClosed errors 2021-05-20 00:07:44 +02:00
Simon Ser
7e6ce23dac contrib/clients: add gamja and senpai 2021-05-19 16:42:03 +02:00
Simon Ser
f6875521ea Check message stores implement expected interfaces 2021-05-18 14:19:34 +02:00
Hubert Hirtz
b078ccaf7a Implement CHATHISTORY BETWEEN 2021-05-18 10:44:10 +02:00
Simon Ser
bede274f32 Add more context to chathistory errors 2021-05-11 12:42:12 +02:00
Alexey Yerin
463e234ebc contrib/weechat: fix typo 2021-05-04 00:06:02 +02:00
Simon Ser
ecf5b40d65 contrib/weechat: explain how to enable IRCv3 features 2021-05-01 18:52:28 +02:00
Hubert Hirtz
9e04b3899b Don't directly reply to network-specific NICK
The NICK must only apply to the specific network, not to the downstream
connection.
2021-04-30 12:17:23 +02:00
Hubert Hirtz
e84fad3eda Handle casemapping on BouncerServ 2021-04-30 12:10:49 +02:00
Alexey Yerin
bc74478f80 Makefile: mark soju and sojuctl as .PHONY
Otherwise running `make` didn't do anything on a non-clean state. Go
deals with changed files automatically, and there's no real need to
explicitly specify them.
2021-04-27 19:06:16 +02:00
Alexey Yerin
cc83da4cd1 db: match placeholders with columns
Soju inserts 9 columns but only with 8 placeholders. This causes
channels not being saved properly and also logging errors like this:

    downstream ...: failed to create or update channel ...: 8 values for 9 columns
2021-04-27 09:22:44 +02:00
Eyal Sawady
9b40cfe95c handleUserDelete: delete the correct user
Prior to this, we deleted the user issuing the deletion rather than the
user which should've been deleted.
2021-04-22 10:37:05 +02:00
Simon Ser
706b6e33fb
Make db and log config options more future-proof
Rename the "sql" directive to "db". Rename the "log" directive to
"log fs".

In the future, we'll maybe support more databases and more message
stores. Make it so it's easy to integrate these new festures to the
config file format.
2021-04-21 18:15:04 +02:00
Simon Ser
fd365f9480
Add default configuration file 2021-04-21 16:39:51 +02:00
Hubert Hirtz
0f6bac30b8 Drop TAGMSG in detached channels
- Do not relay TAGMSG as notices,
- Do not reattach when a TAGMSG is received,
- Do not reset the detach timer when a TAGMSG is received.
2021-04-20 16:17:28 +02:00
Simon Ser
c8ccc641d9 readme: mention Makefile, assume soju is installed system-wide 2021-04-19 16:35:18 +02:00
Simon Ser
c994ce7092 sojuctl: don't use log.Fatalf in readPassword 2021-04-19 14:11:25 +02:00
Simon Ser
0d6d297027 Add user prefix to upstream logger 2021-04-13 20:16:37 +02:00
Simon Ser
fb4a01b023 Add per-network logger 2021-04-13 20:12:49 +02:00
Simon Ser
be2825595d Error out on network name conflict
Closes: https://todo.sr.ht/~emersion/soju/29
2021-04-13 19:33:06 +02:00
Simon Ser
a2c207d357 Relay detached channel backlog as BouncerServ NOTICE if necessary
Instead of ignoring detached channels wehn replaying backlog,
process them as usual and relay messages as BouncerServ NOTICEs
if necessary. Advance the delivery receipts as if the channel was
attached.

Closes: https://todo.sr.ht/~emersion/soju/98
2021-04-13 19:11:05 +02:00
Simon Ser
76e332b50a Move isHighlight to irc.go 2021-04-13 18:54:58 +02:00
Simon Ser
424f676254 Store last internal msg ID in DB when detaching
References: https://todo.sr.ht/~emersion/soju/98
2021-04-13 18:15:30 +02:00
Simon Ser
45e2c0023a Skip backlog logic in downstreamConn.welcome on chathistory 2021-04-13 17:50:03 +02:00
Simon Ser
65c58adbd9 Take msg ID in sendTargetBacklog 2021-04-13 17:49:37 +02:00
Simon Ser
ef902fdc28 Panic on unknown user event type
This should never happen. Complain loudly if it does.
2021-04-13 13:08:48 +02:00
Simon Ser
adb4b300dc Introduce per-user logger
Adds the username to log lines.
2021-04-13 13:04:23 +02:00
Hubert Hirtz
70e5ed05b6 Make casemapping work over bytes instead of runes
Fixes a panic in partialCasemap when the input string was invalid UTF-8.
2021-04-13 12:48:46 +02:00
Simon Ser
c375c7d922 cmd/soju: allow specifying -listen multiple times
Closes: https://todo.sr.ht/~emersion/soju/67
2021-03-31 19:02:40 +02:00
Simon Ser
bc7123f486 Update dependencies 2021-03-31 18:18:16 +02:00
Simon Ser
1e4ff49472 Save delivery receipts in DB
This avoids loosing history on restart for clients that don't
support chathistory.

Closes: https://todo.sr.ht/~emersion/soju/80
2021-03-31 18:04:13 +02:00
Simon Ser
5b4469fcb7 Use BARE for internal message IDs
This allows to have shorter and more future-proof IDs. This also
guarantees the IDs will only use reasonable ASCII characters (no
spaces), removing the need to encode them for PING/PONG tokens.
2021-03-31 17:57:24 +02:00
Simon Ser
5e11e717f1 Rename user.clients to clientNames
This doesn't contain anything other than just the names. Make this
clearer.
2021-03-30 12:44:56 +02:00
Simon Ser
ecf35187fa Make NickServ detection casemapping-aware 2021-03-30 12:28:45 +02:00
Simon Ser
3237bde9f3 Introduce deliveredStore
This hides the double-map complexity behind a dedicated type.
2021-03-29 17:49:50 +02:00
Simon Ser
07519da768 Ensure targets are case-mapped before being passed to messageStore
messageStore isn't aware of the network's case-mapping. We need
to canonicalize the names before passing them to messageStore.
2021-03-29 17:07:39 +02:00
Simon Ser
55274d7213 Move network.clients to user
No need to have this list per-network.
2021-03-29 16:58:56 +02:00
Simon Ser
5a899abaab Simplify network.offlineClients
Replace it with a list of all clients (online or offline).
2021-03-29 16:55:57 +02:00