summaryrefslogtreecommitdiff
path: root/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'message.c')
-rw-r--r--message.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/message.c b/message.c
index e7139bc..95ffb3a 100644
--- a/message.c
+++ b/message.c
@@ -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