diff options
Diffstat (limited to 'src/fe-common/irc/fe-netsplit.c')
-rw-r--r-- | src/fe-common/irc/fe-netsplit.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c index 3eb30796..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) +static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec, const char *filter_channel) { GString *destservers; char *sourceserver; @@ -168,6 +168,10 @@ 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 (filter_channel != NULL && + strcasecmp(chan->name, filter_channel) != 0) + continue; + g_string_truncate(chan->nicks, chan->nicks->len-2); if (netsplit_max_nicks > 0 && @@ -193,7 +197,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 +216,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 +237,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)) + 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)) + return; + + rec = IRC_SERVER(dest->server); + if (rec->split_servers != NULL) + print_splits(rec, dest->target); } static int sig_check_splits(void) |