summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 0d17468..4173914 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -1,8 +1,8 @@
// TODO:
-// - Should replay log do more than PRIVMSGs?
// - Perhaps rename clients.ssl and server_ssl since they may not even be OpenSSL sockets
-// - Is it possible to replay JOINs/PARTs accurately?
+// - Is it possible to replay JOINs/PARTs?
// - Move debug output into some debug function
+// - Log TOPICs
// "server" means the real IRC server
// "client" means bouncer clients
@@ -33,6 +33,8 @@
#define SOURCE_SERVER 0
#define SOURCE_CLIENT 1
#define EXCEPT_NONE 0
+#define LOG_PRIVMSG 0
+#define LOG_JOINPART 1
// It seems to be that *message length* is max 512 bytes, but a socket read from at least UnrealIRCd seems to be up to at least 2416 (+1 for null) bytes.
// 1208 bytes with OpenSSL, 2416 bytes with plain text.
@@ -465,6 +467,7 @@ int doreplay(int sourcefd, int replayseconds, struct client *clients, struct set
// Announce the end
snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Log replay complete.", ircdstrings->ircnick);
+ sendtoclient(sourcefd, outgoingmsg, clients, settings);
return 1;
}
@@ -662,6 +665,11 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
createchannel(channels, tokens[2], "TOPIC", "TOPICWHO", "0");
}
+ // Write to normal log if logging enabled
+ if (settings->logging) {
+ logline(str, settings->ircnick, settings->basedir, LOG_JOINPART);
+ }
+
// And then send to all clients
sendtoallclients(clients, str, sourcefd, settings);
free(prefixcopy);
@@ -682,6 +690,11 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
removechannel(channels, tokens[2]);
}
+ // Write to normal log if logging enabled
+ if (settings->logging) {
+ logline(str, settings->ircnick, settings->basedir, LOG_JOINPART);
+ }
+
// And then send to all clients
sendtoallclients(clients, str, sourcefd, settings);
free(prefixcopy);
@@ -807,7 +820,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
// Write to normal log if logging enabled
if (settings->logging) {
- logprivmsg(str, settings->ircnick, settings->basedir);
+ logline(str, settings->ircnick, settings->basedir, LOG_PRIVMSG);
}
free(strcopyPtr);
@@ -1336,7 +1349,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
// Write to normal log if logging enabled
if (settings->logging) {
- logprivmsg(outgoingmsg, settings->ircnick, settings->basedir);
+ logline(outgoingmsg, settings->ircnick, settings->basedir, LOG_PRIVMSG);
}
free(strcopyPtr);