summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-17 16:14:34 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2016-03-17 16:14:34 +0100
commit49bdd179b2663d3853b38673f93df97c994f0dae (patch)
treef8d1a8cd715998b7040d4db49f436d279d3794c9 /src
parentff4d33071db09a027917dadf1977972cfb9cd2bc (diff)
parente853392f430b9635cd7e8ada28c68426c2625298 (diff)
downloadirssi-49bdd179b2663d3853b38673f93df97c994f0dae.zip
Merge pull request #438 from dequis/sasl-timeout-disconnect
Remove sasl timeout source when the server disconnects
Diffstat (limited to 'src')
-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);
}