summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2016-07-12 13:59:46 +0200
committerLemonBoy <thatlemon@gmail.com>2016-12-12 21:41:06 +0100
commit91c9e871c78e203aed834edd1e1f558680a6ccfa (patch)
treed0136017e7f33ae84dd4d2cc5f4f36a3519bd505 /src/irc
parent955cf622a558022fbd952e07b7462206743562e8 (diff)
downloadirssi-91c9e871c78e203aed834edd1e1f558680a6ccfa.zip
Add an option to stop the connection when SASL fails.
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-servers.h1
-rw-r--r--src/irc/core/sasl.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h
index bb100f86..09f3f81d 100644
--- a/src/irc/core/irc-servers.h
+++ b/src/irc/core/irc-servers.h
@@ -68,6 +68,7 @@ struct _IRC_SERVER_REC {
unsigned int motd_got:1; /* We've received MOTD */
unsigned int isupport_sent:1; /* Server has sent us an isupport reply */
unsigned int cap_complete:1; /* We've done the initial CAP negotiation */
+ unsigned int sasl_success:1; /* Did we authenticate successfully ? */
int max_kicks_in_cmd; /* max. number of people to kick with one /KICK command */
int max_modes_in_cmd; /* max. number of mode changes in one /MODE command */
diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c
index a1c16cdd..1021bea4 100644
--- a/src/irc/core/sasl.c
+++ b/src/irc/core/sasl.c
@@ -48,6 +48,7 @@ static gboolean sasl_timeout(IRC_SERVER_REC *server)
cap_finish_negotiation(server);
server->sasl_timeout = 0;
+ server->sasl_success = FALSE;
signal_emit("server sasl failure", 2, server, "The authentication timed out");
@@ -84,6 +85,8 @@ static void sasl_fail(IRC_SERVER_REC *server, const char *data, const char *from
params = event_get_params(data, 2, NULL, &error);
+ server->sasl_success = FALSE;
+
signal_emit("server sasl failure", 2, server, error);
/* Terminate the negotiation */
@@ -99,6 +102,8 @@ static void sasl_already(IRC_SERVER_REC *server, const char *data, const char *f
server->sasl_timeout = 0;
}
+ server->sasl_success = TRUE;
+
signal_emit("server sasl success", 1, server);
/* We're already authenticated, do nothing */
@@ -112,6 +117,8 @@ static void sasl_success(IRC_SERVER_REC *server, const char *data, const char *f
server->sasl_timeout = 0;
}
+ server->sasl_success = TRUE;
+
signal_emit("server sasl success", 1, server);
/* The authentication succeeded, time to finish the CAP negotiation */