mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Add /network modify
This commit is contained in:
parent
1dd1dde1d4
commit
421288cf50
@ -88,14 +88,7 @@ static void cmd_network_list(void)
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETWORK_FOOTER);
|
||||
}
|
||||
|
||||
/* 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>] [-sasl_mechanism <mechanism>]
|
||||
[-sasl_username <username>] [-sasl_password <password>]
|
||||
<name> */
|
||||
static void cmd_network_add(const char *data)
|
||||
static void cmd_network_add_modify(const char *data, gboolean add)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
char *name, *value;
|
||||
@ -103,15 +96,23 @@ static void cmd_network_add(const char *data)
|
||||
IRC_CHATNET_REC *rec;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
|
||||
"network add", &optlist, &name))
|
||||
"network add", &optlist, &name))
|
||||
return;
|
||||
|
||||
if (*name == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
rec = ircnet_find(name);
|
||||
if (rec == NULL) {
|
||||
if (!add) {
|
||||
cmd_params_free(free_arg);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_NETWORK_NOT_FOUND, name);
|
||||
return;
|
||||
}
|
||||
|
||||
rec = g_new0(IRC_CHATNET_REC, 1);
|
||||
rec->name = g_strdup(name);
|
||||
} else {
|
||||
} else if (!add) {
|
||||
if (g_hash_table_lookup(optlist, "nick")) g_free_and_null(rec->nick);
|
||||
if (g_hash_table_lookup(optlist, "user")) g_free_and_null(rec->username);
|
||||
if (g_hash_table_lookup(optlist, "realname")) g_free_and_null(rec->realname);
|
||||
@ -174,6 +175,30 @@ static void cmd_network_add(const char *data)
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* 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>] [-sasl_mechanism <mechanism>]
|
||||
[-sasl_username <username>] [-sasl_password <password>]
|
||||
<name> */
|
||||
static void cmd_network_add(const char *data)
|
||||
{
|
||||
cmd_network_add_modify(data, 1);
|
||||
}
|
||||
|
||||
/* SYNTAX: NETWORK MODIFY [-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>] [-sasl_mechanism <mechanism>]
|
||||
[-sasl_username <username>] [-sasl_password <password>]
|
||||
<name> */
|
||||
static void cmd_network_modify(const char *data)
|
||||
{
|
||||
cmd_network_add_modify(data, 0);
|
||||
}
|
||||
|
||||
/* SYNTAX: NETWORK REMOVE <network> */
|
||||
static void cmd_network_remove(const char *data)
|
||||
{
|
||||
@ -206,6 +231,7 @@ void fe_ircnet_init(void)
|
||||
command_bind("network", NULL, (SIGNAL_FUNC) cmd_network);
|
||||
command_bind("network list", NULL, (SIGNAL_FUNC) cmd_network_list);
|
||||
command_bind("network add", NULL, (SIGNAL_FUNC) cmd_network_add);
|
||||
command_bind("network modify", NULL, (SIGNAL_FUNC) cmd_network_modify);
|
||||
command_bind("network remove", NULL, (SIGNAL_FUNC) cmd_network_remove);
|
||||
|
||||
command_set_options("network add", "-kicks -msgs -modes -whois -cmdspeed "
|
||||
@ -218,5 +244,6 @@ void fe_ircnet_deinit(void)
|
||||
command_unbind("network", (SIGNAL_FUNC) cmd_network);
|
||||
command_unbind("network list", (SIGNAL_FUNC) cmd_network_list);
|
||||
command_unbind("network add", (SIGNAL_FUNC) cmd_network_add);
|
||||
command_unbind("network modify", (SIGNAL_FUNC) cmd_network_modify);
|
||||
command_unbind("network remove", (SIGNAL_FUNC) cmd_network_remove);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user