Commit graph

26 commits

Author SHA1 Message Date
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
delthas 683cfe0615 Add support for the SEARCH extension 2022-04-12 17:58:16 +02:00
Simon Ser dc58a70794 msgstore_fs: fix direct message targets
When fetching messages via draft/chathistory from a conversation
with another user, soju would send the following:

    :sender PRIVMSG sender :hey

instead of

    :sender PRIVMSG recipient :hey

because the file-system message store format doesn't contain the
original PRIVMSG target.

Fix this by doing some guesswork.
2022-02-25 21:05:10 +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
Simon Ser 193c0afd69 msgstore_fs: abort on timeout 2021-11-03 18:21:12 +01:00
Simon Ser ce69f00e3f msgstore: add context to messageStore methods
This allows setting a hard timeout.
2021-11-03 18:21:05 +01:00
Simon Ser 2b4f0a870f msgstore: take Network as arg instead of network
The message stores don't need to access the internal network
struct, they just need network metadata such as ID and name.

This can ease moving message stores into a separate package in the
future.
2021-11-03 16:37:01 +01:00
delthas 03f8972305 Add support for draft/event-playback 2021-11-03 15:17:16 +01:00
Simon Ser 2ce97bcc12 msgstore_fs: rename log dir when network is renamed 2021-10-15 18:11:04 +02:00
Simon Ser 04d671121c msgstore_fs: add reference to ZNC 2021-10-14 20:51:03 +02:00
Simon Ser 8a0400c5cc msgstore_fs: fix ListTargets error on missing log dir
Initially, before connecting to the network, the log dir will be
empty. Return an empty list of chat history targets in this case.
2021-10-12 17:36:00 +02:00
Alex Karle 8951760733 chathistory: Fix truncated backlog due to timezones
Because msgstore_fs writes logs in localtime, the CHATHISTORY timestamps
(UTC) must be converted to localtime prior to filtering ranges ensure
the right range is sent back to the client.

Prior to this patch, the iteration back from the BEFORE time failed to
load the hours between midnight UTC and midnight localtime in each day's
logged messages. This is because the final time to be considered in a
day's log file (the "start" time) reuses the previous start time's
locale:

    start = time.Date(year, month, day, 0, 0, 0, 0, start.Location()).Add(-1)

By converting the original start and end from the CHATHISTORY commands
to localtime in Load*Time and ListTargets, we ensure we read through
midnight each day.
2021-10-07 11:57:42 +02:00
Simon Ser 2814512da7 msgstore_fs: add limit on number of opened files 2021-10-06 11:41:39 +02:00
Hubert Hirtz ba19d44cf9 msgstore_fs: escape "." and ".." 2021-09-19 16:55:12 +02:00
Gregory Anders cacbd48949 Slightly relax new log file permissions
Make new log files group-readable by default. To retain the prior
behavior, soju can be started with a umask set to 0077.
2021-06-14 17:58:36 +02:00
Simon Ser 18439f0de5 Implement CHATHISTORY TARGETS
References: https://github.com/ircv3/ircv3-specifications/pull/450
2021-06-02 20:32:11 +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
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 83a4590acc
Add store-agnostic message ID format
Allow to query the network ID and entity from the message ID regardless
of the underlying store used.
2021-01-04 16:26:30 +01:00
Simon Ser 021a4c9474
Turn messageStore into an interface
This allows for other implementations that aren't based on a filesystem.
2021-01-04 14:24:00 +01:00