diff options
author | Timo Sirainen <cras@irssi.org> | 2000-07-23 12:56:02 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-07-23 12:56:02 +0000 |
commit | d12c86197637e0376f4ffe40f5feb50c5a47012f (patch) | |
tree | 5f09d826dca06debb1bebd19dc9094fa3f547397 /src | |
parent | a3a066e9cf29a2542f2cf868ae4f6b14541f04ee (diff) | |
download | irssi-d12c86197637e0376f4ffe40f5feb50c5a47012f.zip |
Don't print nick changes and quit messages from same nick more than once
in the same window (if you had joined multiple channels in same window).
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@518 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/irc/fe-events.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c index e79cf122..a8548afe 100644 --- a/src/fe-common/irc/fe-events.c +++ b/src/fe-common/irc/fe-events.c @@ -240,8 +240,9 @@ static void event_part(const char *data, IRC_SERVER_REC *server, const char *nic static void event_quit(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr) { + WINDOW_REC *window; GString *chans; - GSList *tmp; + GSList *tmp, *windows; char *print_channel; int once, count; @@ -254,24 +255,30 @@ static void event_quit(const char *data, IRC_SERVER_REC *server, const char *nic print_channel = NULL; once = settings_get_bool("show_quit_once"); - count = 0; + count = 0; windows = NULL; chans = !once ? NULL : g_string_new(NULL); for (tmp = channels; tmp != NULL; tmp = tmp->next) { CHANNEL_REC *rec = tmp->data; - if (rec->server == server && nicklist_find(rec, nick) && - !ignore_check(server, nick, addr, rec->name, data, MSGLEVEL_QUITS)) { - if (print_channel == NULL || active_win->active == (WI_ITEM_REC *) rec) - print_channel = rec->name; + if (rec->server != server || !nicklist_find(rec, nick) || + ignore_check(server, nick, addr, rec->name, data, MSGLEVEL_QUITS)) + continue; - if (!once) + if (print_channel == NULL || active_win->active == (WI_ITEM_REC *) rec) + print_channel = rec->name; + + if (!once) { + window = window_item_window((WI_ITEM_REC *) rec); + if (g_slist_find(windows, window) == NULL) { + windows = g_slist_append(windows, window); printformat(server, rec->name, MSGLEVEL_QUITS, IRCTXT_QUIT, nick, addr, data); - else { - g_string_sprintfa(chans, "%s,", rec->name); - count++; } + } else { + g_string_sprintfa(chans, "%s,", rec->name); + count++; } } + g_slist_free(windows); if (once) { g_string_truncate(chans, chans->len-1); @@ -309,7 +316,7 @@ static void print_nick_change(IRC_SERVER_REC *server, const char *target, const static void event_nick(gchar *data, IRC_SERVER_REC *server, gchar *sender, gchar *addr) { - GSList *tmp; + GSList *tmp, *windows; char *params, *newnick; int ownnick, msgprint; @@ -323,10 +330,17 @@ static void event_nick(gchar *data, IRC_SERVER_REC *server, gchar *sender, gchar msgprint = FALSE; ownnick = g_strcasecmp(sender, server->nick) == 0; + /* Print to each channel/query where the nick is. + Don't print more than once to the same window. */ + windows = NULL; for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { CHANNEL_REC *channel = tmp->data; + WINDOW_REC *window = + window_item_window((WI_ITEM_REC *) channel); - if (nicklist_find(channel, sender)) { + if (nicklist_find(channel, sender) && + g_slist_find(windows, window) == NULL) { + windows = g_slist_append(windows, window); print_nick_change(server, channel->name, newnick, sender, addr, ownnick); msgprint = TRUE; } @@ -334,12 +348,17 @@ static void event_nick(gchar *data, IRC_SERVER_REC *server, gchar *sender, gchar for (tmp = server->queries; tmp != NULL; tmp = tmp->next) { QUERY_REC *query = tmp->data; + WINDOW_REC *window = + window_item_window((WI_ITEM_REC *) query); - if (g_strcasecmp(query->nick, sender) == 0) { + if (g_strcasecmp(query->nick, sender) == 0 && + g_slist_find(windows, window) == NULL) { + windows = g_slist_append(windows, window); print_nick_change(server, query->nick, newnick, sender, addr, ownnick); msgprint = TRUE; } } + g_slist_free(windows); if (!msgprint && ownnick) printformat(server, NULL, MSGLEVEL_NICKS, IRCTXT_YOUR_NICK_CHANGED, newnick); |