diff options
author | LemonBoy <thatlemon@gmail.com> | 2015-09-26 18:53:10 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2015-09-26 18:53:10 +0200 |
commit | 1a2c479bc04cdb6758ca9f1976e235b092cc83fb (patch) | |
tree | e5ccc2c7c8b75f89a7b07eb0e1eb184484407342 /src/fe-common/irc/fe-ircnet.c | |
parent | f247a43b97731cd1d58ec765dd2d10f885ef66dc (diff) | |
download | irssi-1a2c479bc04cdb6758ca9f1976e235b092cc83fb.zip |
Allow the user to set and modify the SASL parameters
The /NETWORK ADD command now is able to modify the SASL mechanism, the
username and the password on a chatnet basis.
Diffstat (limited to 'src/fe-common/irc/fe-ircnet.c')
-rw-r--r-- | src/fe-common/irc/fe-ircnet.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index 6618edd7..dab6f57f 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -82,10 +82,12 @@ static void cmd_network_list(void) } /* SYNTAX: NETWORK ADD [-nick <nick>] [-user <user>] [-realname <name>] - [-host <host>] [-usermode <mode>] [-autosendcmd <cmd>] - [-querychans <count>] [-whois <count>] [-msgs <count>] - [-kicks <count>] [-modes <count>] - [-cmdspeed <ms>] [-cmdmax <count>] <name> */ + [-host <host>] [-usermode <mode>] [-autosendcmd <cmd>] + [-querychans <count>] [-whois <count>] [-msgs <count>] + [-kicks <count>] [-modes <count>] [-cmdspeed <ms>] + [-cmdmax <count>] [-sasl_mechanism <mechanism>] + [-sasl_username <username>] [-sasl_password <password>] + <name> */ static void cmd_network_add(const char *data) { GHashTable *optlist; @@ -112,6 +114,9 @@ static void cmd_network_add(const char *data) } if (g_hash_table_lookup(optlist, "usermode")) g_free_and_null(rec->usermode); if (g_hash_table_lookup(optlist, "autosendcmd")) g_free_and_null(rec->autosendcmd); + if (g_hash_table_lookup(optlist, "sasl_mechanism")) g_free_and_null(rec->sasl_mechanism); + if (g_hash_table_lookup(optlist, "sasl_username")) g_free_and_null(rec->sasl_username); + if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password); } value = g_hash_table_lookup(optlist, "kicks"); @@ -148,6 +153,14 @@ static void cmd_network_add(const char *data) value = g_hash_table_lookup(optlist, "autosendcmd"); if (value != NULL && *value != '\0') rec->autosendcmd = g_strdup(value); + /* the validity of the parameters is checked in sig_server_setup_fill_chatnet */ + value = g_hash_table_lookup(optlist, "sasl_mechanism"); + if (value != NULL && *value != '\0') rec->sasl_mechanism = g_strdup(value); + value = g_hash_table_lookup(optlist, "sasl_username"); + if (value != NULL && *value != '\0') rec->sasl_username = g_strdup(value); + value = g_hash_table_lookup(optlist, "sasl_password"); + if (value != NULL && *value != '\0') rec->sasl_password = g_strdup(value); + ircnet_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_ADDED, name); @@ -186,7 +199,8 @@ void fe_ircnet_init(void) command_bind("network add", NULL, (SIGNAL_FUNC) cmd_network_add); command_bind("network remove", NULL, (SIGNAL_FUNC) cmd_network_remove); - command_set_options("network add", "-kicks -msgs -modes -whois -cmdspeed -cmdmax -nick -user -realname -host -autosendcmd -querychans -usermode"); + command_set_options("network add", "-kicks -msgs -modes -whois -cmdspeed " + "-cmdmax -nick -user -realname -host -autosendcmd -querychans -usermode -sasl_mechanism -sasl_username -sasl_password"); } void fe_ircnet_deinit(void) |