summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-chatnets.c9
-rw-r--r--src/irc/core/sasl.c24
2 files changed, 27 insertions, 6 deletions
diff --git a/src/irc/core/irc-chatnets.c b/src/irc/core/irc-chatnets.c
index cfb7deec..b9b221b8 100644
--- a/src/irc/core/irc-chatnets.c
+++ b/src/irc/core/irc-chatnets.c
@@ -60,7 +60,7 @@ static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
return;
if (rec->usermode != NULL)
- iconfig_node_set_str(node, "usermode", rec->usermode);
+ iconfig_node_set_str(node, "usermode", rec->usermode);
if (rec->max_cmds_at_once > 0)
iconfig_node_set_int(node, "cmdmax", rec->max_cmds_at_once);
@@ -77,6 +77,13 @@ static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
iconfig_node_set_int(node, "max_modes", rec->max_modes);
if (rec->max_whois > 0)
iconfig_node_set_int(node, "max_whois", rec->max_whois);
+
+ if (rec->sasl_mechanism != NULL)
+ iconfig_node_set_str(node, "sasl_mechanism", rec->sasl_mechanism);
+ if (rec->sasl_username != NULL)
+ iconfig_node_set_str(node, "sasl_username", rec->sasl_username);
+ if (rec->sasl_password != NULL)
+ iconfig_node_set_str(node, "sasl_password", rec->sasl_password);
}
static void sig_chatnet_destroyed(IRC_CHATNET_REC *rec)
diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c
index 8bffc3d9..4b221176 100644
--- a/src/irc/core/sasl.c
+++ b/src/irc/core/sasl.c
@@ -16,7 +16,9 @@ static gboolean sasl_timeout (IRC_SERVER_REC *server)
irc_send_cmd_now(server, "AUTHENTICATE *");
cap_finish_negotiation(server);
- return G_SOURCE_REMOVE;
+ server->sasl_timeout = -1;
+
+ return FALSE;
}
static void sasl_start (IRC_SERVER_REC *server, const char *data, const char *from)
@@ -40,7 +42,10 @@ static void sasl_start (IRC_SERVER_REC *server, const char *data, const char *fr
static void sasl_fail (IRC_SERVER_REC *server, const char *data, const char *from)
{
/* Stop any pending timeout, if any */
- g_source_remove(server->sasl_timeout);
+ if (server->sasl_timeout != -1) {
+ g_source_remove(server->sasl_timeout);
+ server->sasl_timeout = -1;
+ }
g_critical("Authentication failed, make sure your credentials are correct and that the mechanism "
"you have selected is supported by this server.");
@@ -51,7 +56,10 @@ static void sasl_fail (IRC_SERVER_REC *server, const char *data, const char *fro
static void sasl_already (IRC_SERVER_REC *server, const char *data, const char *from)
{
- g_source_remove(server->sasl_timeout);
+ if (server->sasl_timeout != -1) {
+ g_source_remove(server->sasl_timeout);
+ server->sasl_timeout = -1;
+ }
/* We're already authenticated, do nothing */
cap_finish_negotiation(server);
@@ -59,7 +67,10 @@ static void sasl_already (IRC_SERVER_REC *server, const char *data, const char *
static void sasl_success (IRC_SERVER_REC *server, const char *data, const char *from)
{
- g_source_remove(server->sasl_timeout);
+ if (server->sasl_timeout != -1) {
+ g_source_remove(server->sasl_timeout);
+ server->sasl_timeout = -1;
+ }
/* The authentication succeeded, time to finish the CAP negotiation */
g_warning("SASL authentication succeeded");
@@ -75,7 +86,10 @@ static void sasl_step (IRC_SERVER_REC *server, const char *data, const char *fro
conn = server->connrec;
/* Stop the timer */
- g_source_remove(server->sasl_timeout);
+ if (server->sasl_timeout != -1) {
+ g_source_remove(server->sasl_timeout);
+ server->sasl_timeout = -1;
+ }
switch (conn->sasl_mechanism) {
case SASL_MECHANISM_PLAIN: