diff options
author | LemonBoy <thatlemon@gmail.com> | 2015-10-01 22:25:40 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2015-10-02 10:52:13 +0200 |
commit | a475d57183bcbfd6e540dba5cd7894d8c38b53b7 (patch) | |
tree | ff5b072f29a846c4c7e8f5549ae587bc0d1585d2 /src | |
parent | fb6375c6f9c1191590420482aea634644aa228eb (diff) | |
download | irssi-a475d57183bcbfd6e540dba5cd7894d8c38b53b7.zip |
Save the sasl state in the session
This is seemingly required to have irssi re-authenticate after a
restart.
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/core/irc-session.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/irc/core/irc-session.c b/src/irc/core/irc-session.c index ea65d8a5..18e8e5c7 100644 --- a/src/irc/core/irc-session.c +++ b/src/irc/core/irc-session.c @@ -28,6 +28,8 @@ #include "irc-channels.h" #include "irc-nicklist.h" +#include "sasl.h" + struct _isupport_data { CONFIG_REC *config; CONFIG_NODE *node; }; static void session_isupport_foreach(char *key, char *value, struct _isupport_data *data) @@ -65,6 +67,10 @@ static void sig_session_save_server(IRC_SERVER_REC *server, CONFIG_REC *config, config_node_set_str(config, node, "away_reason", server->away_reason); config_node_set_bool(config, node, "emode_known", server->emode_known); + config_node_set_int(config, node, "sasl_mechanism", server->connrec->sasl_mechanism); + config_node_set_str(config, node, "sasl_username", server->connrec->sasl_username); + config_node_set_str(config, node, "sasl_password", server->connrec->sasl_password); + config_node_set_bool(config, node, "isupport_sent", server->isupport_sent); isupport = config_node_section(config, node, "isupport", NODE_TYPE_BLOCK); isupport_data.config = config; @@ -90,6 +96,15 @@ static void sig_session_restore_server(IRC_SERVER_REC *server, server->emode_known = config_node_get_bool(node, "emode_known", FALSE); server->isupport_sent = config_node_get_bool(node, "isupport_sent", FALSE); + server->connrec->sasl_mechanism = config_node_get_int(node, "sasl_mechanism", SASL_MECHANISM_NONE); + /* The fields below might have been filled when loading the chatnet + * description from the config and we favor the content that's been saved + * in the session file over that. */ + g_free(server->connrec->sasl_username); + server->connrec->sasl_username = g_strdup(config_node_get_str(node, "sasl_username", NULL)); + g_free(server->connrec->sasl_password); + server->connrec->sasl_password = g_strdup(config_node_get_str(node, "sasl_password", NULL)); + if (server->isupport == NULL) { server->isupport = g_hash_table_new((GHashFunc) g_istr_hash, (GCompareFunc) g_istr_equal); |