summaryrefslogtreecommitdiff
path: root/logging.h
blob: 726bb4db617a6972d0adc93758c769bb340c0bb5 (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
#ifndef LOGGING_H_INCLUDED
#define LOGGING_H_INCLUDED

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <sys/stat.h>

#include "functions.h"

#define MAXTOKENS 100
#define MAXDATASIZE 513 // max number of bytes we can get at once (RFC2812 says 512, plus one for null terminator)
#define MAXCHAR 1000

#define SOURCE_SERVER 0
#define SOURCE_CLIENT 1

// Write the line 'str' to the relevant log file such as
// '#channel.log' or 'nickname.log'.  'ournick' is our own
// nick and is used to determine which log file to write to.
// 'basedir' is the directory in which the 'logs' directory
// will be created in which logs are to be written.
// Expects a string in the format:
// :from!bar@baz PRIVMSG to :hello world
// With the ":foo!bar@baz "prefix being important.
// Returns 1 on success or 0 on failure.
int logprivmsg(char *str, char *ournick, char *basedir);

#endif