summaryrefslogtreecommitdiff
path: root/replay.h
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2022-11-24 00:08:34 +0000
committerLuke Bratch <luke@bratch.co.uk>2022-11-24 00:08:34 +0000
commit2e665e03b6175b3f31f0ef1e058183417df1456e (patch)
tree32674c99ac25a3df5c166db89260c60e15764c10 /replay.h
parent680d8535a87be8aa0d5ef6432d1f87561ebfcb5f (diff)
Fix replaymode = "lastspoke" by using line numbers rather than time to calculate replay start point.
Introduce new function doreplaylastspoke() to achieve this, move doreplay() into replay.c as doreplaytime() and refactor common things into sanitisereplay().
Diffstat (limited to 'replay.h')
-rw-r--r--replay.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/replay.h b/replay.h
index 039c131..dcf6771 100644
--- a/replay.h
+++ b/replay.h
@@ -38,13 +38,25 @@
#define TIMELENF 11 // [HH:MM:SS] = 10 characters + 1 for null char
#define DATETIMELEN 50 // Should be enough for a full datetime string // TODO - Is it!? I think it will only ever be as long as [DD/MM/YY HH:MM:SS] (20 including null)
-int replaylines(int seconds, char *basedir);
+// Return the number of lines in the replay log since 'seconds' seconds ago, or -1 if there a problem.
+// 'basedir' is the directory in which to find 'replay.log'.
+int replaylinestime(int seconds, char *basedir);
int readreplayline(int seconds, int linenum, char *str, struct settings *settings, struct ircdstate *ircdstate);
-// Returns the number of seconds ago that 'nick' last spoke, or -1 if there is a problem.
+// Returns the line number in the replay log file on which 'nick' last spoke, or -1 if there is a problem.
// 'basedir' is the directory in which to find 'replay.log'.
-int lastspokesecondsago(char *nick, char *basedir);
+long lastspokelinenumber(char *nick, char *basedir);
+
+// Send the requested number of seconds worth of replay log lines to the requested client.
+// 'sourcefd' is the client to send to, and 'replayseconds' is the number of
+// seconds of replay log to replay.
+// Returns 1 for success or 0 for failure.
+int doreplaytime(int sourcefd, int replayseconds, struct client *clients, struct settings *settings, struct ircdstate *ircdstate, struct channel *channels);
+
+// Send replay log lines from line number 'linenumber' onwards, to client 'sourcefd'.
+// Returns 1 for success or 0 for failure.
+int doreplaylastspoke(int sourcefd, long linenumber, struct client *clients, struct settings *settings, struct ircdstate *ircdstate, struct channel *channels);
int writereplayline(char *str, char *basedir);