mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Address all the points outlined in the first review
Replace G_SOURCE_REMOVE with FALSE for the compatibility sake. Zero the timeout id after g_source_remove and when exipred. Save the sasl_* options in sig_chatnet_saved().
This commit is contained in:
parent
b8d3301d34
commit
c90c7deac3
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user