From 85dd88a180043e991c19a4c93a6ce5c7fe0a6e88 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 22 Dec 2019 16:01:16 +0000 Subject: Make full debug output optional for extractnickfromprefix() and stripprefix() to avoid huge debug logs when using replaymode = "lastspoke" combined with DEBUG_FULL. --- message.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'message.c') diff --git a/message.c b/message.c index a2c16e4..8431c31 100644 --- a/message.c +++ b/message.c @@ -185,14 +185,14 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int debugprint(DEBUG_FULL, "Server JOIN found and it is: %s with length %zd! Next token is '%s'. Adding to local channel list if it's us.\n", tokens[0], strlen(tokens[0]), tokens[2]); // Next token should be the channel name but it probably needs the leading ':' stripping debugprint(DEBUG_FULL, "processircmessage(): Channel name was '%s'\n", tokens[2]); - stripprefix(tokens[2]); + stripprefix(tokens[2], 1); debugprint(DEBUG_FULL, "processircmessage(): Channel name now '%s'\n", tokens[2]); // If the user JOINing is us, then we must have joined a channel, so add to our local channel array. // Copy to a temporary string so we still have the original in case we need it char *prefixcopy = strdup(tokens[0]); // Just get the nick for comparison - extractnickfromprefix(prefixcopy); + extractnickfromprefix(prefixcopy, 1); if (strncmp(prefixcopy, ircdstate->ircnick, strlen(tokens[0])) == 0) { debugprint(DEBUG_FULL, "Server JOIN: nick is ours ('%s' vs '%s').\n", prefixcopy, ircdstate->ircnick); // TODO - Saner way to initialise this since we don't have the variables yet? @@ -233,7 +233,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int // Copy to a temporary string so we still have the original in case we need it char *prefixcopy = strdup(tokens[0]); // Just get the nick for comparison - extractnickfromprefix(prefixcopy); + extractnickfromprefix(prefixcopy, 1); if (strncmp(prefixcopy, ircdstate->ircnick, strlen(tokens[0])) == 0) { debugprint(DEBUG_FULL, "Server PART: nick is ours ('%s' vs '%s').\n", prefixcopy, ircdstate->ircnick); removechannel(channels, tokens[2]); @@ -279,7 +279,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int if (settings->logging) { char quitnick[MAXDATASIZE]; strcpy(quitnick, tokens[0]); - extractnickfromprefix(quitnick); + extractnickfromprefix(quitnick, 1); for (int i = 0; i < MAXCHANNELS; i++) { if (channels[i].name[0]) { for (int j = 0; j < MAXCHANNICKS; j++) { @@ -396,7 +396,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int // Extract the topic setter from the prefix (Prefix of ":foo!bar@baz" means "foo" set the topic.) // Copy to a temporary string so we still have the original in case we need it char *prefixcopy = strdup(tokens[0]); - extractnickfromprefix(prefixcopy); + extractnickfromprefix(prefixcopy, 1); // Get the current time and manipulate it into a C string time_t timenow = time(NULL); @@ -456,7 +456,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int // Copy to a temporary string so we still have the original in case we need it char *svrprefixcopy = strdup(tokens[0]); // Just get the nick for comparison - extractnickfromprefix(svrprefixcopy); + extractnickfromprefix(svrprefixcopy, 1); if (strncmp(ircdstate->ircnick, svrprefixcopy, strlen(ircdstate->ircnick)) == 0) { debugprint(DEBUG_FULL, "Server NICK: nick is ours ('%s' vs '%s').\n", svrprefixcopy, ircdstate->ircnick); // Make a copy of the old nickuserhost for updategreetings() below @@ -468,7 +468,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int // Temporary copy of new nickuserhost char *prefixcopy = strdup(ircdstate->nickuserhost); // Get nick from it - extractnickfromprefix(prefixcopy); + extractnickfromprefix(prefixcopy, 1); // Update greeting strings for relaying to new clients updategreetings(ircdstate->greeting001, ircdstate->greeting002, ircdstate->greeting003, ircdstate->greeting004, ircdstate->greeting005a, ircdstate->greeting005b, ircdstate->greeting005c, ircdstate->nickuserhost, @@ -492,7 +492,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int if (settings->logging) { char oldnick[MAXDATASIZE]; strcpy(oldnick, tokens[0]); - extractnickfromprefix(oldnick); + extractnickfromprefix(oldnick, 1); for (int i = 0; i < MAXCHANNELS; i++) { if (channels[i].name[0]) { for (int j = 0; j < MAXCHANNICKS; j++) { -- cgit v1.2.3