summaryrefslogtreecommitdiff
path: root/message.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2024-03-31 22:23:59 +0100
committerLuke Bratch <luke@bratch.co.uk>2024-03-31 22:23:59 +0100
commit33bb47c623d1c605a5a131ef882feb6df42570b7 (patch)
tree22f972d9b6eb586c7492db59c5d9a2b5692e4f39 /message.c
parent7ac369cbe46739beac37d97642b65b98c46ffc4d (diff)
Don't bother trying to do removenickfromchannel() after a PART or a KICK if we just did removechannel() because the PARTing/KICKed nick was ours.
Diffstat (limited to 'message.c')
-rw-r--r--message.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/message.c b/message.c
index 9d85f63..07292be 100644
--- a/message.c
+++ b/message.c
@@ -240,16 +240,14 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int
// Just get the nick for comparison
extractnickfromprefix(prefixcopy, 1);
if ((strlen(prefixcopy) == strlen(ircdstate->ircnick)) && (strncmp(prefixcopy, ircdstate->ircnick, strlen(tokens[0])) == 0)) {
- debugprint(DEBUG_FULL, "Server PART: nick is ours ('%s' vs '%s').\n", prefixcopy, ircdstate->ircnick);
+ debugprint(DEBUG_FULL, "Server PART: nick is ours ('%s' vs '%s'), removing channel.\n", prefixcopy, ircdstate->ircnick);
removechannel(channels, ircdstate->maxchannelcount, tokens[2]);
} else {
- debugprint(DEBUG_FULL, "Server PART: nick is NOT ours ('%s' vs '%s').\n", prefixcopy, ircdstate->ircnick);
- }
-
- // Remove the PARTing nick from our local channel struct
- // TODO - don't bother with this if we did removechannel() above?
- if (!removenickfromchannel(tokens[0], tokens[2], channels, ircdstate->maxchannelcount)) {
- debugprint(DEBUG_CRIT, "Failed to remove nick from channel struct.\n");
+ debugprint(DEBUG_FULL, "Server PART: nick is NOT ours ('%s' vs '%s'), removing nick from channel.\n", prefixcopy, ircdstate->ircnick);
+ // Remove the PARTing nick from our local channel struct
+ if (!removenickfromchannel(tokens[0], tokens[2], channels, ircdstate->maxchannelcount)) {
+ debugprint(DEBUG_CRIT, "Failed to remove nick from channel struct.\n");
+ }
}
// And then send to all clients
@@ -276,17 +274,15 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int
// If the user being KICKed is us, then we must have left a channel, so remove it from our local channel array.
// (If it's not us, then it's another user being KICKed from a channel, so just pass straight through to letting all our clients know.)
if ((strlen(tokens[3]) == strlen(ircdstate->ircnick)) && (strncmp(tokens[3], ircdstate->ircnick, strlen(tokens[3])) == 0)) {
- debugprint(DEBUG_FULL, "Server KICK: nick is ours ('%s' vs '%s').\n", tokens[3], ircdstate->ircnick);
+ debugprint(DEBUG_FULL, "Server KICK: nick is ours ('%s' vs '%s'), removing channel.\n", tokens[3], ircdstate->ircnick);
removechannel(channels, ircdstate->maxchannelcount, tokens[2]);
} else {
- debugprint(DEBUG_FULL, "Server KICK: nick is NOT ours ('%s' vs '%s').\n", tokens[3], ircdstate->ircnick);
- }
-
- // Remove the KICKed nick from our local channel struct
- // TODO - removenickfromchannel() first argument expects ":nick!user@host" but we're passing "nick" here
- // TODO - don't bother with this if we did removechannel() above?
- if (!removenickfromchannel(tokens[3], tokens[2], channels, ircdstate->maxchannelcount)) {
- debugprint(DEBUG_CRIT, "Server KICK: Failed to remove nick from channel struct.\n");
+ debugprint(DEBUG_FULL, "Server KICK: nick is NOT ours ('%s' vs '%s'), removing nick from channel.\n", tokens[3], ircdstate->ircnick);
+ // Remove the KICKed nick from our local channel struct
+ // TODO - removenickfromchannel() first argument expects ":nick!user@host" but we're passing "nick" here
+ if (!removenickfromchannel(tokens[3], tokens[2], channels, ircdstate->maxchannelcount)) {
+ debugprint(DEBUG_CRIT, "Server KICK: Failed to remove nick from channel struct.\n");
+ }
}
// And then send to all clients