summaryrefslogtreecommitdiff
path: root/replay.h
blob: 5ae9994bf80da3f588d4bf0a3185300deebdce69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * This file is part of blabouncer (https://www.blatech.co.uk/l_bratch/blabouncer).
 * Copyright (C) 2019 Luke Bratch <luke@bratch.co.uk>.
 *
 * Blabouncer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3.
 *
 * Blabouncer is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with blabouncer. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef REPLAY_H_INCLUDED
#define REPLAY_H_INCLUDED

#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <limits.h>

#include "functions.h"

#define DEBUG_CRIT 0
#define DEBUG_SOME 1
#define DEBUG_FULL 2

#define MAXCHAR 1000
#define TIMELEN 11 // 32-bit unixtime is up to 10 characters (+1 for null char) // TODO - Make this Year 2038 proof
#define TIMELENF 11 // [HH:MM:SS] = 10 characters + 1 for null char

int replaylines(int seconds, char *basedir);

int readreplayline(int seconds, int linenum, char *str, char *basedir);

// Returns the number of seconds ago that '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);

int writereplayline(char *str, char *basedir);

#endif