From 8ce1d773aa212a88c416d4953bdbf63036674602 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 16 Nov 2001 14:39:33 +0000 Subject: [PATCH] If the last query fails we should make the channel synced. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2031 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/channels-query.c | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index 24895a95..8b29b45a 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -304,6 +304,27 @@ static void query_check(IRC_SERVER_REC *server) query_send(server, query); } +/* if there's no more queries in queries in buffer, send the sync signal */ +static void channel_checksync(IRC_CHANNEL_REC *channel) +{ + SERVER_QUERY_REC *rec; + int n; + + g_return_if_fail(channel != NULL); + + if (channel->synced) + return; /* already synced */ + + rec = channel->server->chanqueries; + for (n = 0; n < CHANNEL_QUERIES; n++) { + if (g_slist_find(rec->queries[n], channel)) + return; + } + + channel->synced = TRUE; + signal_emit("channel sync", 1, channel); +} + /* Error occured when trying to execute query - abort and try again. */ static void query_current_error(IRC_SERVER_REC *server) { @@ -336,6 +357,10 @@ static void query_current_error(IRC_SERVER_REC *server) rec->queries[query] = g_slist_append(rec->queries[query], tmp->data); } + } else { + /* check if failed channels are synced after this error */ + g_slist_foreach(rec->current_queries, + (GFunc) channel_checksync, NULL); } g_slist_free(rec->current_queries); @@ -367,27 +392,6 @@ static void sig_channel_joined(IRC_CHANNEL_REC *channel) query_check(channel->server); } -/* if there's no more queries in queries in buffer, send the sync signal */ -static void channel_checksync(IRC_CHANNEL_REC *channel) -{ - SERVER_QUERY_REC *rec; - int n; - - g_return_if_fail(channel != NULL); - - if (channel->synced) - return; /* already synced */ - - rec = channel->server->chanqueries; - for (n = 0; n < CHANNEL_QUERIES; n++) { - if (g_slist_find(rec->queries[n], channel)) - return; - } - - channel->synced = TRUE; - signal_emit("channel sync", 1, channel); -} - static void channel_got_query(IRC_CHANNEL_REC *chanrec, int query_type) { SERVER_QUERY_REC *rec;