diff options
author | Timo Sirainen <cras@irssi.org> | 2002-03-10 19:23:22 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-03-10 19:23:22 +0000 |
commit | 9398746e617c2c39558c1cf1e5a01a0a2efcc2c5 (patch) | |
tree | 60489bc0bdb78c06ecad4ae1c8bcbedaa4a5e629 | |
parent | 9d423576aa9bf1d6792214a3b7d498dc187c8e51 (diff) | |
download | irssi-9398746e617c2c39558c1cf1e5a01a0a2efcc2c5.zip |
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
-rw-r--r-- | src/irc/core/irc-queries.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/irc/core/irc-queries.c b/src/irc/core/irc-queries.c index 50fed22b..49868e6a 100644 --- a/src/irc/core/irc-queries.c +++ b/src/irc/core/irc-queries.c @@ -40,17 +40,26 @@ QUERY_REC *irc_query_create(const char *server_tag, return rec; } -static void check_address_change(IRC_SERVER_REC *server, const char *nick, - const char *address, const char *target) +static void check_query_changes(IRC_SERVER_REC *server, const char *nick, + const char *address, const char *target) { QUERY_REC *query; - if (address != NULL && !ischannel(*target)) { - /* save nick's address to query */ - query = irc_query_find(server, nick); - if (query != NULL && (query->address == NULL || - strcmp(query->address, address) != 0)) - query_change_address(query, address); + if (ischannel(*target)) + return; + + query = irc_query_find(server, nick); + if (query == NULL) + 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); } } @@ -62,7 +71,7 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data, g_return_if_fail(data != NULL); 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); } @@ -70,10 +79,9 @@ static void ctcp_action(IRC_SERVER_REC *server, const char *msg, const char *nick, const char *address, 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, const char *orignick) { |