Commit Graph

1127 Commits

Author SHA1 Message Date
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
Simon Ser
2b92e4ecd4 contrib/casemap-logs.sh: new utility script
Previous soju versions were storing log without converting the channel
and nick names to their canonical lower-case representation. This could
result in two log directories for the same channel/nick.

This script fixes old log dirs.
2021-03-26 15:31:54 +01:00
Simon Ser
6e5a307dc7 Introduce deliveredClientMap
Adds more semantics to map[string]string. Simplifies the complicated
mapStringStringCasemapMap type.
2021-03-26 11:21:14 +01:00
Hubert Hirtz
5014673aae Fix CHATHISTORY target not being casemapped 2021-03-26 10:39:52 +01:00
Hubert Hirtz
bdd0c7bc06
Implement casemapping
TL;DR: supports for casemapping, now logs are saved in
casemapped/canonical/tolower form
(eg. in the #channel directory instead of #Channel... or something)

== What is casemapping? ==

see <https://modern.ircdocs.horse/#casemapping-parameter>

== Casemapping and multi-upstream ==

Since each upstream does not necessarily use the same casemapping, and
since casemappings cannot coexist [0],

1. soju must also update the database accordingly to upstreams'
   casemapping, otherwise it will end up inconsistent,
2. soju must "normalize" entity names and expose only one casemapping
   that is a subset of all supported casemappings (here, ascii).

[0] On some upstreams, "emersion[m]" and "emersion{m}" refer to the same
user (upstreams that advertise rfc1459 for example), while on others
(upstreams that advertise ascii) they don't.

Once upstream's casemapping is known (default to rfc1459), entity names
in map keys are made into casemapped form, for upstreamConn,
upstreamChannel and network.

downstreamConn advertises "CASEMAPPING=ascii", and always casemap map
keys with ascii.

Some functions require the caller to casemap their argument (to avoid
needless calls to casemapping functions).

== Message forwarding and casemapping ==

downstream message handling (joins and parts basically):
When relaying entity names from downstreams to upstreams, soju uses the
upstream casemapping, in order to not get in the way of the user.  This
does not brings any issue, as long as soju replies with the ascii
casemapping in mind (solves point 1.).

marshalEntity/marshalUserPrefix:
When relaying entity names from upstreams with non-ascii casemappings,
soju *partially* casemap them: it only change the case of characters
which are not ascii letters.  ASCII case is thus kept intact, while
special symbols like []{} are the same every time soju sends them to
downstreams (solves point 2.).

== Casemapping changes ==

Casemapping changes are not fully supported by this patch and will
result in loss of history.  This is a limitation of the protocol and
should be solved by the RENAME spec.
2021-03-24 18:15:52 +01:00