summaryrefslogtreecommitdiff
path: root/logging.h
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-19 18:20:33 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-19 18:20:33 +0100
commita5880d645c2bbf8dfae6daabb1d3c3c66e3c310b (patch)
treeb9ecd641458038dc1ae09cfbd2cbc61f7fbd9d2d /logging.h
parent1b3539a50d29a8956aa0bd2e668681e8afb968c0 (diff)
Rewrite logging function to enable logging JOINs/PARTs as well as PRIVMSGs.
Diffstat (limited to 'logging.h')
-rw-r--r--logging.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/logging.h b/logging.h
index 726bb4d..75e6553 100644
--- a/logging.h
+++ b/logging.h
@@ -6,6 +6,7 @@
#include <time.h>
#include <limits.h>
#include <sys/stat.h>
+#include <ctype.h>
#include "functions.h"
@@ -15,16 +16,29 @@
#define SOURCE_SERVER 0
#define SOURCE_CLIENT 1
+#define LOG_PRIVMSG 0
+#define LOG_JOINPART 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.
+// nick and is used to determine which log file to write to
+// if the type is LOG_PRIVMSG.
// '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:
+//
+// If LOG_PRIVMSG then it expects a string in the format:
// :from!bar@baz PRIVMSG to :hello world
-// With the ":foo!bar@baz "prefix being important.
+//
+// If LOG_JOINPART then
+// Expects a string in the format:
+// :nick!bar@baz JOIN :#blabouncer
+// or
+// :nick!bar@baz PART #blabouncer
+//
+// With the ":foo!bar@baz "prefix being important for either
+// type.
+//
// Returns 1 on success or 0 on failure.
-int logprivmsg(char *str, char *ournick, char *basedir);
+int logline(char *str, char *ournick, char *basedir, int type);
#endif