summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--functions.c7
-rw-r--r--functions.h3
-rw-r--r--logging.c5
4 files changed, 15 insertions, 2 deletions
diff --git a/TODO b/TODO
index b15bc9b..c21e482 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
All the TODOs sprinkled throughout the code!
User/channel mode logging.
-
-Make all log filenames lowercase since IRC nick and channel names are case insensitive.
diff --git a/functions.c b/functions.c
index 58be95f..730819f 100644
--- a/functions.c
+++ b/functions.c
@@ -1583,3 +1583,10 @@ void stripprefixesfromnick(char *nick) {
// Copy back to source string
strcpy(nick, nicktmp);
}
+
+// Convert the given 'string' into lowercase
+void strlower(char *string) {
+ for (int i = 0; string[i]; i++) {
+ string[i] = tolower(string[i]);
+ }
+}
diff --git a/functions.h b/functions.h
index 614137d..e8b03f9 100644
--- a/functions.h
+++ b/functions.h
@@ -208,4 +208,7 @@ int addnamereplytochannel(char *namereply, struct channel *channels);
// Strips all leading prefixes (colons, user modes) from a nick
void stripprefixesfromnick(char *nick);
+
+// Convert the given 'string' into lowercase
+void strlower(char *string);
#endif
diff --git a/logging.c b/logging.c
index db3fbfb..b000c28 100644
--- a/logging.c
+++ b/logging.c
@@ -114,6 +114,11 @@ int logline(char *str, struct ircdstate *ircdstate, char *basedir, int type) {
debugprint(DEBUG_CRIT, "Filename would be too long if logging either '%s', '%s' or '%s', returning!\n", from, to, ircdname);
return 0;
}
+ // Make the filename lowercase (since IRC nicks and channel names are case-insensitive,
+ // we can ensure a nick/channel with varying case always ends up in the same log file)
+ strlower(from);
+ strlower(to);
+ strlower(ircdname);
switch(type) {
case LOG_PRIVMSG: