diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-09-16 20:21:06 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-09-16 20:21:06 +0100 |
commit | 424ba496e6affc6d9421b1ce7147b34bf5c7913b (patch) | |
tree | 95fa5b961c13a1eb671bda109f8db0ecdd633180 /message.c | |
parent | 7a3a8aa2a521f752a042ede37b81125689aa0067 (diff) |
Log user/channel mode setting in the replay and normal logs.
Diffstat (limited to 'message.c')
-rw-r--r-- | message.c | 49 |
1 files changed, 28 insertions, 21 deletions
@@ -521,31 +521,38 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int debugprint(DEBUG_FULL, "Server MODE found and it is: %s with length %zd! Next token is '%s'. Analysing...\n", tokens[1], strlen(tokens[1]), tokens[2]); - // 4 tokens could be either our initial mode or a channel mode (or something else - TODO - what else?) - if (counter == 4) { - // Might be our initial mode (e.g. ":nick MODE nick :+iwz") - char comparison[MAXDATASIZE]; - snprintf(comparison, MAXDATASIZE, ":%s MODE %s :", ircdstate->ircnick, ircdstate->ircnick); - if (strncmp(str, comparison, strlen(comparison)) == 0) { - // Looks like it! - debugprint(DEBUG_FULL, "Our initial MODE found (%s), storing for later.\n", tokens[3]); - // Store in ircdstate for when clients connect and relay to current clients. - strcpy(ircdstate->mode, tokens[3]); - - // Relay to all current clients anyway - TODO - Necessary? - sendtoallclients(clients, str, sourcefd, settings); + // Might be our initial mode (e.g. ":nick MODE nick :+iwz") + char comparison[MAXDATASIZE]; + snprintf(comparison, MAXDATASIZE, ":%s MODE %s :", ircdstate->ircnick, ircdstate->ircnick); + if (strncmp(str, comparison, strlen(comparison)) == 0) { + // Looks like it! + debugprint(DEBUG_FULL, "Our initial MODE found (%s), storing for later.\n", tokens[3]); + // Store in ircdstate for when clients connect and relay to current clients. + strcpy(ircdstate->mode, tokens[3]); + + // Relay to all current clients anyway - TODO - Necessary? + sendtoallclients(clients, str, sourcefd, settings); - return 1; - } + return 1; + } - // Might be a channel mode (e.g. ":nick!user@host MODE #channel +s") - if (tokens[2][0] == '#') { - // Looks like it! Tell all clients. - debugprint(DEBUG_FULL, "Channel MODE found (%s %s), telling all clients.\n", tokens[2], tokens[3]); - sendtoallclients(clients, str, sourcefd, settings); + // Might be a channel mode (e.g. ":nick!user@host MODE #channel +s") + if (tokens[2][0] == '#') { + // Looks like it! Tell all clients. + debugprint(DEBUG_FULL, "Channel MODE found (%s %s), telling all clients.\n", tokens[2], tokens[3]); + sendtoallclients(clients, str, sourcefd, settings); - return 1; + // Write to replay log if replay logging enabled + if (settings->replaylogging) { + writereplayline(str, settings->basedir); + } + + // Write to normal log if logging enabled + if (settings->logging) { + logline(str, ircdstate, settings->basedir, LOG_MODE); } + + return 1; } // Relay to all current clients if not processed by the above |