mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Still some syncing fixes. Don't loop forever now if we don't find the reply
to mode/who. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2009 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
3101437f75
commit
89542ef942
@ -33,7 +33,7 @@ loop:
|
|||||||
- if not found anything -> all channels are synced
|
- if not found anything -> all channels are synced
|
||||||
- send "command #chan1,#chan2,#chan3,.." command to server
|
- send "command #chan1,#chan2,#chan3,.." command to server
|
||||||
- wait for reply from server, then check if it was last query to be sent to
|
- wait for reply from server, then check if it was last query to be sent to
|
||||||
server. If it was, send "channel sync" signal
|
channel. If it was, send "channel sync" signal
|
||||||
- check if the reply was for last channel in the command list. If so,
|
- check if the reply was for last channel in the command list. If so,
|
||||||
goto loop
|
goto loop
|
||||||
*/
|
*/
|
||||||
@ -220,9 +220,9 @@ static void query_send(IRC_SERVER_REC *server, int query)
|
|||||||
|
|
||||||
/* the stop-event is received once for each channel */
|
/* the stop-event is received once for each channel */
|
||||||
server_redirect_event(server, "mode channel", count,
|
server_redirect_event(server, "mode channel", count,
|
||||||
chanstr, -1, "chanquery mode abort",
|
chanstr, -1, "chanquery abort",
|
||||||
"event 324", "chanquery mode",
|
"event 324", "chanquery mode",
|
||||||
"", "chanquery mode abort", NULL);
|
"", "chanquery abort", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_QUERY_WHO:
|
case CHANNEL_QUERY_WHO:
|
||||||
@ -231,10 +231,10 @@ static void query_send(IRC_SERVER_REC *server, int query)
|
|||||||
server_redirect_event(server, "who",
|
server_redirect_event(server, "who",
|
||||||
server->one_endofwho ? 1 : count,
|
server->one_endofwho ? 1 : count,
|
||||||
chanstr, -1,
|
chanstr, -1,
|
||||||
"chanquery who abort",
|
"chanquery abort",
|
||||||
"event 315", "chanquery who end",
|
"event 315", "chanquery who end",
|
||||||
"event 352", "silent event who",
|
"event 352", "silent event who",
|
||||||
"", "chanquery who abort", NULL);
|
"", "chanquery abort", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_QUERY_BMODE:
|
case CHANNEL_QUERY_BMODE:
|
||||||
@ -244,28 +244,28 @@ static void query_send(IRC_SERVER_REC *server, int query)
|
|||||||
irssi could ask modes separately but afterwards
|
irssi could ask modes separately but afterwards
|
||||||
join the two b/e/I modes together */
|
join the two b/e/I modes together */
|
||||||
server_redirect_event(server, "mode b", count, chanstr, -1,
|
server_redirect_event(server, "mode b", count, chanstr, -1,
|
||||||
"chanquery mode abort",
|
"chanquery abort",
|
||||||
"event 367", "chanquery ban",
|
"event 367", "chanquery ban",
|
||||||
"event 368", "chanquery ban end",
|
"event 368", "chanquery ban end",
|
||||||
"", "chanquery mode abort", NULL);
|
"", "chanquery abort", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_QUERY_EMODE:
|
case CHANNEL_QUERY_EMODE:
|
||||||
cmd = g_strdup_printf("MODE %s e", chanstr_commas);
|
cmd = g_strdup_printf("MODE %s e", chanstr_commas);
|
||||||
server_redirect_event(server, "mode e", count, chanstr, -1,
|
server_redirect_event(server, "mode e", count, chanstr, -1,
|
||||||
"chanquery mode abort",
|
"chanquery abort",
|
||||||
"event 348", "chanquery eban",
|
"event 348", "chanquery eban",
|
||||||
"event 349", "chanquery eban end",
|
"event 349", "chanquery eban end",
|
||||||
"", "chanquery mode abort", NULL);
|
"", "chanquery abort", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_QUERY_IMODE:
|
case CHANNEL_QUERY_IMODE:
|
||||||
cmd = g_strdup_printf("MODE %s I", chanstr_commas);
|
cmd = g_strdup_printf("MODE %s I", chanstr_commas);
|
||||||
server_redirect_event(server, "mode I", count, chanstr, -1,
|
server_redirect_event(server, "mode I", count, chanstr, -1,
|
||||||
"chanquery mode abort",
|
"chanquery abort",
|
||||||
"event 346", "chanquery ilist",
|
"event 346", "chanquery ilist",
|
||||||
"event 347", "chanquery ilist end",
|
"event 347", "chanquery ilist end",
|
||||||
"", "chanquery mode abort", NULL);
|
"", "chanquery abort", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -313,29 +313,21 @@ static void query_current_error(IRC_SERVER_REC *server)
|
|||||||
|
|
||||||
rec = server->chanqueries;
|
rec = server->chanqueries;
|
||||||
|
|
||||||
/* fix the thing that went wrong */
|
/* fix the thing that went wrong - or if it was already fixed,
|
||||||
|
then all we can do is abort. */
|
||||||
abort_query = FALSE;
|
abort_query = FALSE;
|
||||||
|
|
||||||
query = rec->current_query_type;
|
query = rec->current_query_type;
|
||||||
switch (query) {
|
if (query == CHANNEL_QUERY_WHO) {
|
||||||
case CHANNEL_QUERY_WHO:
|
if (server->no_multi_who)
|
||||||
/* /WHO should work always if done with /WHO #channel */
|
abort_query = TRUE;
|
||||||
server->no_multi_who = TRUE;
|
else
|
||||||
break;
|
server->no_multi_who = TRUE;
|
||||||
case CHANNEL_QUERY_MODE:
|
} else {
|
||||||
/* /MODE #channel should also work always.. */
|
|
||||||
server->no_multi_mode = TRUE;
|
|
||||||
break;
|
|
||||||
case CHANNEL_QUERY_BMODE:
|
|
||||||
case CHANNEL_QUERY_EMODE:
|
|
||||||
case CHANNEL_QUERY_IMODE:
|
|
||||||
/* /MODE b/e/I - try without multi-mode, but if it also
|
|
||||||
fails just ignore it */
|
|
||||||
if (server->no_multi_mode)
|
if (server->no_multi_mode)
|
||||||
abort_query = TRUE;
|
abort_query = TRUE;
|
||||||
else
|
else
|
||||||
server->no_multi_mode = TRUE;
|
server->no_multi_mode = TRUE;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!abort_query) {
|
if (!abort_query) {
|
||||||
@ -522,54 +514,6 @@ static void event_end_of_invitelist(IRC_SERVER_REC *server, const char *data)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void channel_lost(IRC_SERVER_REC *server, const char *channel)
|
|
||||||
{
|
|
||||||
IRC_CHANNEL_REC *chanrec;
|
|
||||||
|
|
||||||
chanrec = irc_channel_find(server, channel);
|
|
||||||
if (chanrec != NULL) {
|
|
||||||
/* channel not found - probably created a new channel
|
|
||||||
and left it immediately. */
|
|
||||||
query_remove_all(chanrec);
|
|
||||||
}
|
|
||||||
|
|
||||||
channel_got_query(chanrec, channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void multi_command_error(IRC_SERVER_REC *server, const char *data,
|
|
||||||
int query, const char *event)
|
|
||||||
{
|
|
||||||
IRC_CHANNEL_REC *chanrec;
|
|
||||||
char *params, *channel, **chans;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
params = event_get_params(data, 2, NULL, &channel);
|
|
||||||
|
|
||||||
chans = g_strsplit(channel, ",", -1);
|
|
||||||
for (n = 0; chans[n] != NULL; n++)
|
|
||||||
{
|
|
||||||
chanrec = irc_channel_find(server, chans[n]);
|
|
||||||
if (chanrec != NULL)
|
|
||||||
query_add_channel(chanrec, query);
|
|
||||||
}
|
|
||||||
g_strfreev(chans);
|
|
||||||
g_free(params);
|
|
||||||
|
|
||||||
query_check(server);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void event_mode_abort(IRC_SERVER_REC *server, const char *data)
|
|
||||||
{
|
|
||||||
query_current_error(server);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void event_who_abort(IRC_SERVER_REC *server, const char *data)
|
|
||||||
{
|
|
||||||
query_current_error(server);
|
|
||||||
}
|
|
||||||
|
|
||||||
void channels_query_init(void)
|
void channels_query_init(void)
|
||||||
{
|
{
|
||||||
settings_add_bool("misc", "channel_sync", TRUE);
|
settings_add_bool("misc", "channel_sync", TRUE);
|
||||||
@ -585,8 +529,7 @@ void channels_query_init(void)
|
|||||||
signal_add("chanquery eban end", (SIGNAL_FUNC) event_end_of_ebanlist);
|
signal_add("chanquery eban end", (SIGNAL_FUNC) event_end_of_ebanlist);
|
||||||
signal_add("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
|
signal_add("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
|
||||||
signal_add("chanquery ilist end", (SIGNAL_FUNC) event_end_of_invitelist);
|
signal_add("chanquery ilist end", (SIGNAL_FUNC) event_end_of_invitelist);
|
||||||
signal_add("chanquery mode abort", (SIGNAL_FUNC) event_mode_abort);
|
signal_add("chanquery abort", (SIGNAL_FUNC) query_current_error);
|
||||||
signal_add("chanquery who abort", (SIGNAL_FUNC) event_who_abort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void channels_query_deinit(void)
|
void channels_query_deinit(void)
|
||||||
@ -602,6 +545,5 @@ void channels_query_deinit(void)
|
|||||||
signal_remove("chanquery eban end", (SIGNAL_FUNC) event_end_of_ebanlist);
|
signal_remove("chanquery eban end", (SIGNAL_FUNC) event_end_of_ebanlist);
|
||||||
signal_remove("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
|
signal_remove("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
|
||||||
signal_remove("chanquery ilist end", (SIGNAL_FUNC) event_end_of_invitelist);
|
signal_remove("chanquery ilist end", (SIGNAL_FUNC) event_end_of_invitelist);
|
||||||
signal_remove("chanquery mode abort", (SIGNAL_FUNC) event_mode_abort);
|
signal_remove("chanquery abort", (SIGNAL_FUNC) query_current_error);
|
||||||
signal_remove("chanquery who abort", (SIGNAL_FUNC) event_who_abort);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user