forked from PsychoticNinja/irssi
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
@ -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);
|
iconfig_node_set_int(node, "max_modes", rec->max_modes);
|
||||||
if (rec->max_whois > 0)
|
if (rec->max_whois > 0)
|
||||||
iconfig_node_set_int(node, "max_whois", rec->max_whois);
|
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)
|
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 *");
|
irc_send_cmd_now(server, "AUTHENTICATE *");
|
||||||
cap_finish_negotiation(server);
|
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)
|
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)
|
static void sasl_fail (IRC_SERVER_REC *server, const char *data, const char *from)
|
||||||
{
|
{
|
||||||
/* Stop any pending timeout, if any */
|
/* Stop any pending timeout, if any */
|
||||||
|
if (server->sasl_timeout != -1) {
|
||||||
g_source_remove(server->sasl_timeout);
|
g_source_remove(server->sasl_timeout);
|
||||||
|
server->sasl_timeout = -1;
|
||||||
|
}
|
||||||
|
|
||||||
g_critical("Authentication failed, make sure your credentials are correct and that the mechanism "
|
g_critical("Authentication failed, make sure your credentials are correct and that the mechanism "
|
||||||
"you have selected is supported by this server.");
|
"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)
|
static void sasl_already (IRC_SERVER_REC *server, const char *data, const char *from)
|
||||||
{
|
{
|
||||||
|
if (server->sasl_timeout != -1) {
|
||||||
g_source_remove(server->sasl_timeout);
|
g_source_remove(server->sasl_timeout);
|
||||||
|
server->sasl_timeout = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* We're already authenticated, do nothing */
|
/* We're already authenticated, do nothing */
|
||||||
cap_finish_negotiation(server);
|
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)
|
static void sasl_success (IRC_SERVER_REC *server, const char *data, const char *from)
|
||||||
{
|
{
|
||||||
|
if (server->sasl_timeout != -1) {
|
||||||
g_source_remove(server->sasl_timeout);
|
g_source_remove(server->sasl_timeout);
|
||||||
|
server->sasl_timeout = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* The authentication succeeded, time to finish the CAP negotiation */
|
/* The authentication succeeded, time to finish the CAP negotiation */
|
||||||
g_warning("SASL authentication succeeded");
|
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;
|
conn = server->connrec;
|
||||||
|
|
||||||
/* Stop the timer */
|
/* Stop the timer */
|
||||||
|
if (server->sasl_timeout != -1) {
|
||||||
g_source_remove(server->sasl_timeout);
|
g_source_remove(server->sasl_timeout);
|
||||||
|
server->sasl_timeout = -1;
|
||||||
|
}
|
||||||
|
|
||||||
switch (conn->sasl_mechanism) {
|
switch (conn->sasl_mechanism) {
|
||||||
case SASL_MECHANISM_PLAIN:
|
case SASL_MECHANISM_PLAIN:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user