diff options
author | Timo Sirainen <cras@irssi.org> | 2002-07-01 20:48:03 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-07-01 20:48:03 +0000 |
commit | e1b4a2ff8ecd5486786a4bc0d181164509c1e611 (patch) | |
tree | 32d446cbec3417cf393429f442a96fc65c9343fd /src/fe-common/irc/fe-irc-queries.c | |
parent | ea24fe9aeb48de6a0348c225f020ede1abfa18b6 (diff) | |
download | irssi-e1b4a2ff8ecd5486786a4bc0d181164509c1e611.zip |
Query nick tracking: don't change query's nick if both the old and new nicks
exist in one channel.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2860 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc/fe-irc-queries.c')
-rw-r--r-- | src/fe-common/irc/fe-irc-queries.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/fe-common/irc/fe-irc-queries.c b/src/fe-common/irc/fe-irc-queries.c index fee82947..c35e283f 100644 --- a/src/fe-common/irc/fe-irc-queries.c +++ b/src/fe-common/irc/fe-irc-queries.c @@ -42,6 +42,22 @@ static QUERY_REC *query_find_address(SERVER_REC *server, const char *address) return NULL; } +static int have_channel_with_nicks(SERVER_REC *server, const char *nick1, + const char *nick2) +{ + GSList *tmp; + + for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { + CHANNEL_REC *channel = tmp->data; + + if (nicklist_find(channel, nick1) != NULL && + nicklist_find(channel, nick2) != NULL) + return TRUE; + } + + return FALSE; +} + static void event_privmsg(SERVER_REC *server, const char *data, const char *nick, const char *address) { @@ -59,8 +75,13 @@ static void event_privmsg(SERVER_REC *server, const char *data, address. it was probably a nick change or reconnect to server, so rename the query. */ query = query_find_address(server, address); - if (query != NULL) - query_change_nick(query, nick); + if (query != NULL) { + /* make sure the old and new nicks aren't on the + same channel - happens with eg. www gateways + and such.. */ + if (!have_channel_with_nicks(server, nick, query->name)) + query_change_nick(query, nick); + } } } |