diff options
Diffstat (limited to 'src/plugins/irc/irc.c')
-rw-r--r-- | src/plugins/irc/irc.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 0c85293e7..730eed169 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -96,33 +96,37 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data, void *signal_data) { struct t_irc_server *ptr_server; - int disconnected; + int quit, ssl_disconnected; /* make C compiler happy */ (void) data; (void) signal; (void) type_data; - (void) signal_data; irc_signal_upgrade_received = 1; - /* - * FIXME: it's not possible to upgrade with SSL servers connected (GnuTLS - * lib can't reload data after upgrade), so we close connection for - * all SSL servers currently connected - */ - disconnected = 0; + quit = (signal_data && (strcmp (signal_data, "quit") == 0)); + ssl_disconnected = 0; + for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if (ptr_server->is_connected && ptr_server->ssl_connected) + /* + * FIXME: it's not possible to upgrade with SSL servers connected (GnuTLS + * lib can't reload data after upgrade), so we close connection for + * all SSL servers currently connected + */ + if (ptr_server->is_connected && (ptr_server->ssl_connected || quit)) { - disconnected++; - weechat_printf (ptr_server->buffer, - _("%s%s: disconnecting from server because upgrade " - "can't work for servers connected via SSL"), - weechat_prefix ("error"), - IRC_PLUGIN_NAME); + if (!quit) + { + ssl_disconnected++; + weechat_printf (ptr_server->buffer, + _("%s%s: disconnecting from server because upgrade " + "can't work for servers connected via SSL"), + weechat_prefix ("error"), + IRC_PLUGIN_NAME); + } irc_server_disconnect (ptr_server, 0, 0); /* * schedule reconnection: WeeChat will reconnect to this server @@ -133,15 +137,15 @@ irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data, ptr_server->reconnect_start = time (NULL) - ptr_server->reconnect_delay - 1; } } - if (disconnected > 0) + if (ssl_disconnected > 0) { weechat_printf (NULL, /* TRANSLATORS: "%s" after "%d" is "server" or "servers" */ _("%s%s: disconnected from %d %s (SSL connection " "not supported with upgrade)"), weechat_prefix ("error"), IRC_PLUGIN_NAME, - disconnected, - NG_("server", "servers", disconnected)); + ssl_disconnected, + NG_("server", "servers", ssl_disconnected)); } return WEECHAT_RC_OK; |