diff options
author | Timo Sirainen <cras@irssi.org> | 2000-12-17 02:20:22 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-12-17 02:20:22 +0000 |
commit | fc491c5f8dd7f4a2ece6eb46feac687b4b0022ef (patch) | |
tree | a88fb52edcabcd7ca82d1007f5497bb45df282b6 /src/irc/core/irc-queries.c | |
parent | 3011d2c01c9df4dc0da2efb2cd33b2956c09fa8d (diff) | |
download | irssi-fc491c5f8dd7f4a2ece6eb46feac687b4b0022ef.zip |
Some minor query fixes. Nick changes are also detected by checking if
query with another nick from same address if found.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@999 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/core/irc-queries.c')
-rw-r--r-- | src/irc/core/irc-queries.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/irc/core/irc-queries.c b/src/irc/core/irc-queries.c index 9314aaab..914b3308 100644 --- a/src/irc/core/irc-queries.c +++ b/src/irc/core/irc-queries.c @@ -56,47 +56,39 @@ static void sig_query_create(QUERY_REC **query, signal_stop(); } -static void event_privmsg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) +static void event_privmsg(IRC_SERVER_REC *server, const char *data, + const char *nick, const char *address) { - char *params, *target, *msg; QUERY_REC *query; + char *params, *target, *msg; g_return_if_fail(data != NULL); params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg); - if (addr != NULL && !ischannel(*target)) { + 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, addr) != 0)) { - g_free_not_null(query->address); - query->address = g_strdup(addr); - - signal_emit("query address changed", 1, query); - } + if (query != NULL && (query->address == NULL || + strcmp(query->address, address) != 0)) + query_change_address(query, address); } g_free(params); } -static void event_nick(IRC_SERVER_REC *server, const char *data, const char *orignick) +static void event_nick(SERVER_REC *server, const char *data, + const char *orignick) { + QUERY_REC *query; char *params, *nick; - GSList *tmp; - - params = event_get_params(data, 1, &nick); - for (tmp = server->queries; tmp != NULL; tmp = tmp->next) { - QUERY_REC *rec = tmp->data; - - if (g_strcasecmp(rec->name, orignick) == 0) { - g_free(rec->name); - rec->name = g_strdup(nick); - signal_emit("query nick changed", 1, rec); - } + query = query_find(server, orignick); + if (query != NULL) { + params = event_get_params(data, 1, &nick); + query_change_nick(query, nick); + g_free(params); } - - g_free(params); } void irc_queries_init(void) |