summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2016-03-11 14:55:31 -0300
committerdequis <dx@dxzone.com.ar>2016-03-11 14:55:31 -0300
commite853392f430b9635cd7e8ada28c68426c2625298 (patch)
treefdf4604de9c75c4dd10af3146eba80d9e80cc41b /src/irc
parent66e9c4bb39ed5c0b2d9b81e8610e894af82abd8e (diff)
downloadirssi-e853392f430b9635cd7e8ada28c68426c2625298.zip
Remove sasl timeout source when the server disconnects
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/sasl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c
index 8fba9ba2..db099368 100644
--- a/src/irc/core/sasl.c
+++ b/src/irc/core/sasl.c
@@ -153,6 +153,20 @@ static void sasl_step(IRC_SERVER_REC *server, const char *data, const char *from
server->sasl_timeout = g_timeout_add(SASL_TIMEOUT, (GSourceFunc) sasl_timeout, server);
}
+static void sasl_disconnected(IRC_SERVER_REC *server)
+{
+ g_return_if_fail(server != NULL);
+
+ if (!IS_IRC_SERVER(server)) {
+ return;
+ }
+
+ if (server->sasl_timeout != -1) {
+ g_source_remove(server->sasl_timeout);
+ server->sasl_timeout = -1;
+ }
+}
+
void sasl_init(void)
{
signal_add_first("server cap ack sasl", (SIGNAL_FUNC) sasl_start);
@@ -163,6 +177,7 @@ void sasl_init(void)
signal_add_first("event 905", (SIGNAL_FUNC) sasl_fail);
signal_add_first("event 906", (SIGNAL_FUNC) sasl_fail);
signal_add_first("event 907", (SIGNAL_FUNC) sasl_already);
+ signal_add_first("server disconnected", (SIGNAL_FUNC) sasl_disconnected);
}
void sasl_deinit(void)
@@ -175,4 +190,5 @@ void sasl_deinit(void)
signal_remove("event 905", (SIGNAL_FUNC) sasl_fail);
signal_remove("event 906", (SIGNAL_FUNC) sasl_fail);
signal_remove("event 907", (SIGNAL_FUNC) sasl_already);
+ signal_remove("server disconnected", (SIGNAL_FUNC) sasl_disconnected);
}