1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Automatically change the nick to correct case in queries (eg. you did

/QUERY nick, and the nick really was Nick, irssi would change the query to
Nick as well)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2565 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-03-10 19:23:22 +00:00 committed by cras
parent 9d423576aa
commit 9398746e61

View File

@ -40,16 +40,25 @@ QUERY_REC *irc_query_create(const char *server_tag,
return rec; return rec;
} }
static void check_address_change(IRC_SERVER_REC *server, const char *nick, static void check_query_changes(IRC_SERVER_REC *server, const char *nick,
const char *address, const char *target) const char *address, const char *target)
{ {
QUERY_REC *query; QUERY_REC *query;
if (address != NULL && !ischannel(*target)) { if (ischannel(*target))
/* save nick's address to query */ return;
query = irc_query_find(server, nick); query = irc_query_find(server, nick);
if (query != NULL && (query->address == NULL || if (query == NULL)
strcmp(query->address, address) != 0)) return;
if (strcmp(query->name, nick) != 0) {
/* upper/lowercase chars in nick changed */
query_change_nick(query, nick);
}
if (query->address == NULL || strcmp(query->address, address) != 0) {
/* host changed */
query_change_address(query, address); query_change_address(query, address);
} }
} }
@ -62,7 +71,7 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg); params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg);
check_address_change(server, nick, address, target); check_query_changes(server, nick, address, target);
g_free(params); g_free(params);
} }
@ -70,10 +79,9 @@ static void ctcp_action(IRC_SERVER_REC *server, const char *msg,
const char *nick, const char *address, const char *nick, const char *address,
const char *target) const char *target)
{ {
check_address_change(server, nick, address, target); check_query_changes(server, nick, address, target);
} }
static void event_nick(SERVER_REC *server, const char *data, static void event_nick(SERVER_REC *server, const char *data,
const char *orignick) const char *orignick)
{ {