/* * This file is part of blabouncer (https://www.blatech.co.uk/l_bratch/blabouncer). * Copyright (C) 2019 Luke Bratch . * * 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 . */ #ifndef LOGGING_H_INCLUDED #define LOGGING_H_INCLUDED #include #include #include #include #include #include #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 #define LOG_PRIVMSG 0 #define LOG_JOINPART 1 #define LOG_TOPIC 2 #define DEBUG_CRIT 0 #define DEBUG_SOME 1 #define DEBUG_FULL 2 // 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 // 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. // // If LOG_PRIVMSG then it expects a string in the format: // :from!bar@baz PRIVMSG to :hello world // // LOG_PRIVMSG is also used for NOTICEs. // // If LOG_JOINPART then it expects a string in the format: // :nick!bar@baz JOIN :#channel // or // :nick!bar@baz PART #channel // // If LOG_TOPIC then it expects a string in the format: // :nick!bar@baz TOPIC #channel :bla bla bla // // With the ":foo!bar@baz "prefix being important for either // type. // // Returns 1 on success or 0 on failure. int logline(char *str, char *ournick, char *basedir, int type); #endif