mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
nick tracking change: now it renames the query only if the old nick doesn't
exist in any channel with you git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2861 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
e1b4a2ff8e
commit
ac86432503
@ -42,16 +42,14 @@ static QUERY_REC *query_find_address(SERVER_REC *server, const char *address)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int have_channel_with_nicks(SERVER_REC *server, const char *nick1,
|
static int server_has_nick(SERVER_REC *server, const char *nick)
|
||||||
const char *nick2)
|
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
|
||||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||||
CHANNEL_REC *channel = tmp->data;
|
CHANNEL_REC *channel = tmp->data;
|
||||||
|
|
||||||
if (nicklist_find(channel, nick1) != NULL &&
|
if (nicklist_find(channel, nick) != NULL)
|
||||||
nicklist_find(channel, nick2) != NULL)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,10 +74,8 @@ static void event_privmsg(SERVER_REC *server, const char *data,
|
|||||||
server, so rename the query. */
|
server, so rename the query. */
|
||||||
query = query_find_address(server, address);
|
query = query_find_address(server, address);
|
||||||
if (query != NULL) {
|
if (query != NULL) {
|
||||||
/* make sure the old and new nicks aren't on the
|
/* make sure the old nick doesn't exist anymore */
|
||||||
same channel - happens with eg. www gateways
|
if (!server_has_nick(server, query->name))
|
||||||
and such.. */
|
|
||||||
if (!have_channel_with_nicks(server, nick, query->name))
|
|
||||||
query_change_nick(query, nick);
|
query_change_nick(query, nick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user