summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 8ed8d72..41e0a47 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -13,7 +13,6 @@
// - Configurable auto channels
// - Comma separated channel list in JOINs/PARTs
// - Only send some things to the requesting client (e.g. LIST replies)
-// - Customise logging (disabling it, log file location)
// - Alert when clients connect/authenticate/disconnect
// - Perhaps rename arr_ssl and server_ssl since they may not even be OpenSSL sockets
// - Is it possible to replay JOINs/PARTs accurately?
@@ -106,6 +105,8 @@ struct settings {
int clienttls;
int servertls;
char basedir[PATH_MAX];
+ int logging;
+ int replaylogging;
};
// Return index of requested client FD within arr_clients
@@ -688,11 +689,15 @@ int processircmessage(SSL *server_ssl, int *clientsockfd, char *str, int source,
sendtoallclients(clientsockfd, fdmax, arr_clients, str, sourcefd, arr_authed, arr_ssl, settings);
- // Write to replay log
- writereplayline(str, settings->basedir);
+ // Write to replay log if replay logging enabled
+ if (settings->replaylogging) {
+ writereplayline(str, settings->basedir);
+ }
- // Write to normal log
- logprivmsg(str, settings->ircnick, settings->basedir);
+ // Write to normal log if logging enabled
+ if (settings->logging) {
+ logprivmsg(str, settings->ircnick, settings->basedir);
+ }
return 1;
}
@@ -875,11 +880,15 @@ int processircmessage(SSL *server_ssl, int *clientsockfd, char *str, int source,
// Send to all except source client
sendtoallclients(clientsockfd, fdmax, arr_clients, outgoingmsg, sourcefd, arr_authed, arr_ssl, settings);
- // Write to replay log
- writereplayline(outgoingmsg, settings->basedir);
+ // Write to replay log if replay logging enabled
+ if (settings->replaylogging) {
+ writereplayline(outgoingmsg, settings->basedir);
+ }
- // Write to normal log
- logprivmsg(outgoingmsg, settings->ircnick, settings->basedir);
+ // Write to normal log if logging enabled
+ if (settings->logging) {
+ logprivmsg(outgoingmsg, settings->ircnick, settings->basedir);
+ }
return 1;
}
@@ -1464,6 +1473,12 @@ int main(int argc, char *argv[]) {
}
}
+ // Is logging enabled?
+ settings.logging = getconfint("logging", settings.conffile);
+
+ // Is replay logging enabled?
+ settings.replaylogging = getconfint("replaylogging", settings.conffile);
+
// TODO: see if any of this can be shared (i.e. 1. avoid code duplication, and 2. see if variables can be shared between client/server sockets)
// TODO: track fdmax - kind of doing this now with arr_clients and num_clients but might be pointlessly tracking both in some places (?)