11 Commits

Author SHA1 Message Date
contact
9e9565daf0 go fmt
git-svn-id: file:///srv/svn/repo/suika/trunk@362 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-22 10:16:01 +00:00
contact
803dbabd4f Implement CHATHISTORY AFTER
References: https://todo.sr.ht/~emersion/soju/12

git-svn-id: file:///srv/svn/repo/suika/trunk@360 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-07-15 15:47:57 +00:00
delthas
a079662c1b Add support for downstream CHATHISTORY
This adds support for the WIP (at the time of this commit)
draft/chathistory extension, based on the draft at [1] and the
additional comments at [2].

This gets the history by parsing the chat logs, and is therefore only
enabled when the logs are enabled and the log path is configured.

Getting the history only from the logs adds some restrictions:
- we cannot get history by msgid (those are not logged)
- we cannot get the users masks (maybe they could be inferred from the
  JOIN etc, but it is not worth the effort and would not work every
  time)

The regular soju network history is not sent to clients that support
draft/chathistory, so that they can fetch what they need by manually
calling CHATHISTORY.

The only supported command is BEFORE for now, because that is the only
required command for an app that offers an "infinite history scrollback"
feature.

Regarding implementation, rather than reading the file from the end in
reverse, we simply start from the beginning of each log file, store each
PRIVMSG into a ring, then add the last lines of that ring into the
history we'll return later. The message parsing implementation must be
kept somewhat fast because an app could potentially request thousands of
messages in several files. Here we are using simple sscanf and indexOf
rather than regexps.

In case some log files do not contain any message (for example because
the user had not joined a channel at that time), we try up to a 100 days
of empty log files before giving up.

[1]: https://github.com/prawnsalad/ircv3-specifications/pull/3/files
[2]: https://github.com/ircv3/ircv3-specifications/pull/393/files#r350210018

git-svn-id: file:///srv/svn/repo/suika/trunk@319 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-05 21:50:31 +00:00
contact
d562150702 Parse timestamp from message tags in messageLogger.Append
git-svn-id: file:///srv/svn/repo/suika/trunk@250 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-08 08:19:33 +00:00
contact
cec36bb0e1 Make newMessageLogger take a *network instead of an *upstreamConn
There's no reason why messgeLogger needs access to the whole connection,
the network is enough.

git-svn-id: file:///srv/svn/repo/suika/trunk@248 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-07 19:54:24 +00:00
contact
2381bdc3aa Extract logic to build log filepath into a function
This will get re-used when parsing logs.

git-svn-id: file:///srv/svn/repo/suika/trunk@247 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-07 19:50:12 +00:00
contact
acc3c1c6f1 Log TOPIC messages
See [1].

[1]: 82c4ad8362/modules/log.cpp (L486)

git-svn-id: file:///srv/svn/repo/suika/trunk@235 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-06 16:49:39 +00:00
contact
005ed3bf83 Fix NOTICE log formatting
ZNC uses hyphens instead of angle brackets [1].

[1]: 82c4ad8362/modules/log.cpp (L495)

git-svn-id: file:///srv/svn/repo/suika/trunk@234 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-06 16:45:30 +00:00
contact
4531200d1b Use Network.GetName for logs path
git-svn-id: file:///srv/svn/repo/suika/trunk@225 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-05 13:24:57 +00:00
contact
f4c48f9b05 Add time tag to all messages
git-svn-id: file:///srv/svn/repo/suika/trunk@216 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-03 18:48:23 +00:00
contact
84c358d870 Introduce messageLogger
This centralizes formatting related to message logging in a single
place.

git-svn-id: file:///srv/svn/repo/suika/trunk@215 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-03 16:59:17 +00:00