From 7574bed26c98069945b3fbc3938819c10e65b045 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 23 Nov 2016 16:11:38 +0100 Subject: [PATCH 1/2] Minor corrections to the netsplit code. --- src/fe-common/irc/fe-netjoin.c | 2 +- src/fe-common/irc/fe-netsplit.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c index 22ca642c..79a8d5ec 100644 --- a/src/fe-common/irc/fe-netjoin.c +++ b/src/fe-common/irc/fe-netjoin.c @@ -251,7 +251,7 @@ static void sig_print_starting(TEXT_DEST_REC *dest) if (!IS_IRC_SERVER(dest->server)) return; - if (dest->level != MSGLEVEL_PUBLIC) + if (!(dest->level & MSGLEVEL_PUBLIC)) return; if (!server_ischannel(dest->server, dest->target)) diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c index aa05639b..b44fa249 100644 --- a/src/fe-common/irc/fe-netsplit.c +++ b/src/fe-common/irc/fe-netsplit.c @@ -249,13 +249,13 @@ static void sig_print_starting(TEXT_DEST_REC *dest) if (printing_splits) return; - if (IS_IRC_SERVER(dest->server) == FALSE) + if (!IS_IRC_SERVER(dest->server)) return; - if (dest->level != MSGLEVEL_PUBLIC) + if (!(dest->level & MSGLEVEL_PUBLIC)) return; - if (server_ischannel(dest->server, dest->target) == FALSE) + if (!server_ischannel(dest->server, dest->target)) return; rec = IRC_SERVER(dest->server); From 5f0e755a00c7cb0e85e167cd455bb3ce16b4d14b Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 23 Nov 2016 22:22:37 +0100 Subject: [PATCH 2/2] Don't shadow the 'channel' variable when printing the netjoins. This is the root cause of #567 --- src/fe-common/irc/fe-netjoin.c | 6 ++++-- src/fe-common/irc/fe-netsplit.c | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c index 79a8d5ec..4eb388c0 100644 --- a/src/fe-common/irc/fe-netjoin.c +++ b/src/fe-common/irc/fe-netjoin.c @@ -164,7 +164,7 @@ static void print_channel_netjoins(char *channel, TEMP_PRINT_REC *rec, g_free(channel); } -static void print_netjoins(NETJOIN_SERVER_REC *server, const char *channel) +static void print_netjoins(NETJOIN_SERVER_REC *server, const char *filter_channel) { TEMP_PRINT_REC *temp; GHashTable *channels; @@ -189,7 +189,9 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *channel) next2 = g_slist_next(tmp2); - if (channel != NULL && strcasecmp(realchannel, channel) != 0) + /* Filter the results by channel if asked to do so */ + if (filter_channel != NULL && + strcasecmp(realchannel, filter_channel) != 0) continue; temp = g_hash_table_lookup(channels, realchannel); diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c index b44fa249..17fb1994 100644 --- a/src/fe-common/irc/fe-netsplit.c +++ b/src/fe-common/irc/fe-netsplit.c @@ -142,7 +142,7 @@ static void get_server_splits(void *key, NETSPLIT_REC *split, } } -static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec, const char *channel) +static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec, const char *filter_channel) { GString *destservers; char *sourceserver; @@ -168,7 +168,8 @@ static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec, con for (tmp = rec->channels; tmp != NULL; tmp = tmp->next) { TEMP_SPLIT_CHAN_REC *chan = tmp->data; - if (channel != NULL && strcasecmp(channel, chan->name) != 0) + if (filter_channel != NULL && + strcasecmp(chan->name, filter_channel) != 0) continue; g_string_truncate(chan->nicks, chan->nicks->len-2);