From c0f66c95ff00bdc22155a8ac53d887a9c1bbc90f Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 26 Jun 2016 21:44:40 +0200 Subject: Such draft. Very wow. --- src/fe-common/irc/fe-netjoin.c | 8 +------- src/fe-common/irc/fe-netsplit.c | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c index 807a4345..22ca642c 100644 --- a/src/fe-common/irc/fe-netjoin.c +++ b/src/fe-common/irc/fe-netjoin.c @@ -248,16 +248,10 @@ static void sig_print_starting(TEXT_DEST_REC *dest) if (printing_joins) return; - /* Do not dump the netsplit stats unless: - * a) This is an IRC server - * b) The message level is high enough - * b) The message belongs to a channel - * c) There's a NETJOIN record for this server - */ if (!IS_IRC_SERVER(dest->server)) return; - if (dest->level != MSGLEVEL_MSGS) + 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 3eb30796..aa05639b 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) +static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec, const char *channel) { GString *destservers; char *sourceserver; @@ -168,6 +168,9 @@ static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec) for (tmp = rec->channels; tmp != NULL; tmp = tmp->next) { TEMP_SPLIT_CHAN_REC *chan = tmp->data; + if (channel != NULL && strcasecmp(channel, chan->name) != 0) + continue; + g_string_truncate(chan->nicks, chan->nicks->len-2); if (netsplit_max_nicks > 0 && @@ -193,7 +196,7 @@ static void temp_split_chan_free(TEMP_SPLIT_CHAN_REC *rec) g_free(rec); } -static void print_splits(IRC_SERVER_REC *server) +static void print_splits(IRC_SERVER_REC *server, const char *channel) { TEMP_SPLIT_REC temp; GSList *servers; @@ -212,7 +215,7 @@ static void print_splits(IRC_SERVER_REC *server) g_hash_table_foreach(server->splits, (GHFunc) get_server_splits, &temp); - print_server_splits(server, &temp); + print_server_splits(server, &temp, channel); g_slist_foreach(temp.channels, (GFunc) temp_split_chan_free, NULL); @@ -233,25 +236,31 @@ static int check_server_splits(IRC_SERVER_REC *server) if (time(NULL)-last < SPLIT_WAIT_TIME) return FALSE; - print_splits(server); + print_splits(server, NULL); return TRUE; } /* something is going to be printed to screen, print our current netsplit message before it. */ -static void sig_print_starting(void) +static void sig_print_starting(TEXT_DEST_REC *dest) { - GSList *tmp; + IRC_SERVER_REC *rec; if (printing_splits) return; - for (tmp = servers; tmp != NULL; tmp = tmp->next) { - IRC_SERVER_REC *rec = tmp->data; + if (IS_IRC_SERVER(dest->server) == FALSE) + return; - if (IS_IRC_SERVER(rec) && rec->split_servers != NULL) - print_splits(rec); - } + if (dest->level != MSGLEVEL_PUBLIC) + return; + + if (server_ischannel(dest->server, dest->target) == FALSE) + return; + + rec = IRC_SERVER(dest->server); + if (rec->split_servers != NULL) + print_splits(rec, dest->target); } static int sig_check_splits(void) -- cgit v1.2.3