mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 18:12:12 +02:00
MODIFY works only on existing channels/servers/networks now, ADD can still add/modify
This commit is contained in:
parent
0afdfe7cae
commit
a7353b6b3a
8 changed files with 279 additions and 18 deletions
|
|
@ -248,8 +248,6 @@ static void cmd_channel(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
|
||||
/* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
|
||||
<channel> <network> [<password>] */
|
||||
/* SYNTAX: CHANNEL MODIFY [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
|
||||
<channel> <network> [<password>] */
|
||||
static void cmd_channel_add(const char *data)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
|
|
@ -292,8 +290,6 @@ static void cmd_channel_add(const char *data)
|
|||
if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg);
|
||||
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
|
||||
|
||||
signal_emit("channel add fill", 2, rec, optlist);
|
||||
|
||||
channel_setup_create(rec);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_CHANSETUP_ADDED, channel, chatnet);
|
||||
|
|
@ -301,6 +297,55 @@ static void cmd_channel_add(const char *data)
|
|||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* SYNTAX: CHANNEL MODIFY [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
|
||||
<channel> <network> [<password>] */
|
||||
static void cmd_channel_modify(const char *data)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
CHATNET_REC *chatnetrec;
|
||||
CHANNEL_SETUP_REC *rec;
|
||||
char *botarg, *botcmdarg, *chatnet, *channel, *password;
|
||||
void *free_arg;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS,
|
||||
"channel modify", &optlist, &channel, &chatnet, &password))
|
||||
return;
|
||||
|
||||
if (*chatnet == '\0' || *channel == '\0')
|
||||
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
chatnetrec = chatnet_find(chatnet);
|
||||
if (chatnetrec == NULL) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_UNKNOWN_CHATNET, chatnet);
|
||||
cmd_params_free(free_arg);
|
||||
return;
|
||||
}
|
||||
|
||||
botarg = g_hash_table_lookup(optlist, "bots");
|
||||
botcmdarg = g_hash_table_lookup(optlist, "botcmd");
|
||||
|
||||
rec = channel_setup_find(channel, chatnet);
|
||||
if (rec == NULL) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_NOT_FOUND, channel, chatnet);
|
||||
} else {
|
||||
if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks);
|
||||
if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd);
|
||||
if (*password != '\0') g_free_and_null(rec->password);
|
||||
if (g_hash_table_lookup(optlist, "auto")) rec->autojoin = TRUE;
|
||||
if (g_hash_table_lookup(optlist, "noauto")) rec->autojoin = FALSE;
|
||||
if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg);
|
||||
if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg);
|
||||
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
|
||||
|
||||
channel_setup_create(rec);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_CHANSETUP_MODIFIED, channel, chatnet);
|
||||
}
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* SYNTAX: CHANNEL REMOVE <channel> <network> */
|
||||
static void cmd_channel_remove(const char *data)
|
||||
{
|
||||
|
|
@ -623,7 +668,7 @@ void fe_channels_init(void)
|
|||
|
||||
command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
|
||||
command_bind("channel", NULL, (SIGNAL_FUNC) cmd_channel);
|
||||
command_bind("channel modify", NULL, (SIGNAL_FUNC) cmd_channel_add);
|
||||
command_bind("channel modify", NULL, (SIGNAL_FUNC) cmd_channel_modify);
|
||||
command_bind("channel add", NULL, (SIGNAL_FUNC) cmd_channel_add);
|
||||
command_bind("channel remove", NULL, (SIGNAL_FUNC) cmd_channel_remove);
|
||||
command_bind("channel list", NULL, (SIGNAL_FUNC) cmd_channel_list);
|
||||
|
|
@ -631,6 +676,7 @@ void fe_channels_init(void)
|
|||
command_bind("cycle", NULL, (SIGNAL_FUNC) cmd_cycle);
|
||||
|
||||
command_set_options("channel add", "auto noauto -bots -botcmd");
|
||||
command_set_options("channel modify", "auto noauto -bots -botcmd");
|
||||
command_set_options("names", "count ops halfops voices normal");
|
||||
command_set_options("join", "invite window");
|
||||
}
|
||||
|
|
@ -645,7 +691,7 @@ void fe_channels_deinit(void)
|
|||
|
||||
command_unbind("join", (SIGNAL_FUNC) cmd_join);
|
||||
command_unbind("channel", (SIGNAL_FUNC) cmd_channel);
|
||||
command_unbind("channel modify", (SIGNAL_FUNC) cmd_channel_add);
|
||||
command_unbind("channel modify", (SIGNAL_FUNC) cmd_channel_modify);
|
||||
command_unbind("channel add", (SIGNAL_FUNC) cmd_channel_add);
|
||||
command_unbind("channel remove", (SIGNAL_FUNC) cmd_channel_remove);
|
||||
command_unbind("channel list", (SIGNAL_FUNC) cmd_channel_list);
|
||||
|
|
|
|||
|
|
@ -205,6 +205,101 @@ static void cmd_server_add(const char *data)
|
|||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
static void cmd_server_modify(const char *data)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
SERVER_SETUP_REC *rec;
|
||||
char *addr, *portstr, *password, *value, *chatnet;
|
||||
void *free_arg;
|
||||
int port;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS,
|
||||
"server modify", &optlist, &addr, &portstr, &password))
|
||||
return;
|
||||
|
||||
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
port = *portstr == '\0' ? DEFAULT_SERVER_ADD_PORT : atoi(portstr);
|
||||
|
||||
chatnet = g_hash_table_lookup(optlist, "network");
|
||||
|
||||
rec = server_setup_find(addr, port, chatnet);
|
||||
|
||||
if (rec == NULL) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_NOT_FOUND, addr, port);
|
||||
} else {
|
||||
value = g_hash_table_lookup(optlist, "port");
|
||||
if (value != NULL && *value != '\0') rec->port = atoi(value);
|
||||
|
||||
if (*password != '\0') g_free_and_null(rec->password);
|
||||
if (g_hash_table_lookup(optlist, "host")) {
|
||||
g_free_and_null(rec->own_host);
|
||||
rec->own_ip4 = rec->own_ip6 = NULL;
|
||||
}
|
||||
|
||||
if (g_hash_table_lookup(optlist, "6"))
|
||||
rec->family = AF_INET6;
|
||||
else if (g_hash_table_lookup(optlist, "4"))
|
||||
rec->family = AF_INET;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "ssl"))
|
||||
rec->use_ssl = TRUE;
|
||||
|
||||
value = g_hash_table_lookup(optlist, "ssl_cert");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->ssl_cert = g_strdup(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "ssl_pkey");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->ssl_pkey = g_strdup(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "ssl_pass");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->ssl_pass = g_strdup(value);
|
||||
|
||||
if (g_hash_table_lookup(optlist, "ssl_verify"))
|
||||
rec->ssl_verify = TRUE;
|
||||
|
||||
value = g_hash_table_lookup(optlist, "ssl_cafile");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->ssl_cafile = g_strdup(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "ssl_capath");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->ssl_capath = g_strdup(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "ssl_ciphers");
|
||||
if (value != NULL && *value != '\0')
|
||||
rec->ssl_ciphers = g_strdup(value);
|
||||
|
||||
if ((rec->ssl_cafile != NULL && rec->ssl_cafile[0] != '\0')
|
||||
|| (rec->ssl_capath != NULL && rec->ssl_capath[0] != '\0'))
|
||||
rec->ssl_verify = TRUE;
|
||||
|
||||
if ((rec->ssl_cert != NULL && rec->ssl_cert[0] != '\0') || rec->ssl_verify == TRUE)
|
||||
rec->use_ssl = TRUE;
|
||||
|
||||
if (g_hash_table_lookup(optlist, "auto")) rec->autoconnect = TRUE;
|
||||
if (g_hash_table_lookup(optlist, "noauto")) rec->autoconnect = FALSE;
|
||||
if (g_hash_table_lookup(optlist, "proxy")) rec->no_proxy = FALSE;
|
||||
if (g_hash_table_lookup(optlist, "noproxy")) rec->no_proxy = TRUE;
|
||||
|
||||
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
|
||||
value = g_hash_table_lookup(optlist, "host");
|
||||
if (value != NULL && *value != '\0') {
|
||||
rec->own_host = g_strdup(value);
|
||||
rec->own_ip4 = rec->own_ip6 = NULL;
|
||||
}
|
||||
|
||||
signal_emit("server modify fill", 2, rec, optlist);
|
||||
|
||||
server_setup_add(rec);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
TXT_SETUPSERVER_MODIFIED, addr, port);
|
||||
}
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* SYNTAX: SERVER REMOVE <address> [<port>] [<network>] */
|
||||
static void cmd_server_remove(const char *data)
|
||||
{
|
||||
|
|
@ -387,12 +482,13 @@ void fe_server_init(void)
|
|||
{
|
||||
command_bind("server", NULL, (SIGNAL_FUNC) cmd_server);
|
||||
command_bind("server connect", NULL, (SIGNAL_FUNC) cmd_server_connect);
|
||||
command_bind("server modify", NULL, (SIGNAL_FUNC) cmd_server_add);
|
||||
command_bind("server modify", NULL, (SIGNAL_FUNC) cmd_server_modify);
|
||||
command_bind("server add", NULL, (SIGNAL_FUNC) cmd_server_add);
|
||||
command_bind("server remove", NULL, (SIGNAL_FUNC) cmd_server_remove);
|
||||
command_bind_first("server", NULL, (SIGNAL_FUNC) server_command);
|
||||
command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command);
|
||||
command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
command_set_options("server modify", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
|
||||
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
|
||||
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
|
||||
|
|
@ -412,7 +508,7 @@ void fe_server_deinit(void)
|
|||
{
|
||||
command_unbind("server", (SIGNAL_FUNC) cmd_server);
|
||||
command_unbind("server connect", (SIGNAL_FUNC) cmd_server_connect);
|
||||
command_unbind("server modify", (SIGNAL_FUNC) cmd_server_add);
|
||||
command_unbind("server modify", (SIGNAL_FUNC) cmd_server_modify);
|
||||
command_unbind("server add", (SIGNAL_FUNC) cmd_server_add);
|
||||
command_unbind("server remove", (SIGNAL_FUNC) cmd_server_remove);
|
||||
command_unbind("server", (SIGNAL_FUNC) server_command);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ FORMAT_REC fecommon_core_formats[] = {
|
|||
{ "server_reconnect_removed", "Removed reconnection to server {server $0} port {hilight $1}", 3, { 0, 1, 0 } },
|
||||
{ "server_reconnect_not_found", "Reconnection tag {server $0} not found", 1, { 0 } },
|
||||
{ "setupserver_added", "Server {server $0} saved", 2, { 0, 1 } },
|
||||
{ "setupserver_modified", "Server {server $0} saved", 2, { 0, 1 } },
|
||||
{ "setupserver_removed", "Server {server $0} removed", 2, { 0, 1 } },
|
||||
{ "setupserver_not_found", "Server {server $0} not found", 2, { 0, 1 } },
|
||||
{ "your_nick", "Your nickname is {nick $0}", 1, { 0 } },
|
||||
|
|
@ -119,6 +120,7 @@ FORMAT_REC fecommon_core_formats[] = {
|
|||
{ "chanlist_line", "%#{channel $[-10]0} %|+$1 ($2): $3", 4, { 0, 0, 0, 0 } },
|
||||
{ "chansetup_not_found", "Channel {channel $0} not found", 2, { 0, 0 } },
|
||||
{ "chansetup_added", "Channel {channel $0} saved", 2, { 0, 0 } },
|
||||
{ "chansetup_modified", "Channel {channel $0} saved", 2, { 0, 0 } },
|
||||
{ "chansetup_removed", "Channel {channel $0} removed", 2, { 0, 0 } },
|
||||
{ "chansetup_header", "%#Channel Network Password Settings", 0 },
|
||||
{ "chansetup_line", "%#{channel $[15]0} %|$[10]1 $[10]2 $3", 4, { 0, 0, 0, 0 } },
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ enum {
|
|||
TXT_RECONNECT_REMOVED,
|
||||
TXT_RECONNECT_NOT_FOUND,
|
||||
TXT_SETUPSERVER_ADDED,
|
||||
TXT_SETUPSERVER_MODIFIED,
|
||||
TXT_SETUPSERVER_REMOVED,
|
||||
TXT_SETUPSERVER_NOT_FOUND,
|
||||
TXT_YOUR_NICK,
|
||||
|
|
@ -95,6 +96,7 @@ enum {
|
|||
TXT_CHANLIST_LINE,
|
||||
TXT_CHANSETUP_NOT_FOUND,
|
||||
TXT_CHANSETUP_ADDED,
|
||||
TXT_CHANSETUP_MODIFIED,
|
||||
TXT_CHANSETUP_REMOVED,
|
||||
TXT_CHANSETUP_HEADER,
|
||||
TXT_CHANSETUP_LINE,
|
||||
|
|
|
|||
|
|
@ -56,6 +56,36 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target)
|
|||
[-auto | -noauto] [-network <network>] [-host <hostname>]
|
||||
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>]
|
||||
<address> [<port> [<password>]] */
|
||||
/* NOTE: -network replaces the old -ircnet flag. */
|
||||
static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec,
|
||||
GHashTable *optlist)
|
||||
{
|
||||
IRC_CHATNET_REC *ircnet;
|
||||
char *value;
|
||||
|
||||
value = g_hash_table_lookup(optlist, "network");
|
||||
/* For backwards compatibility, also allow the old name 'ircnet'.
|
||||
But of course only if -network was not given. */
|
||||
if (!value)
|
||||
value = g_hash_table_lookup(optlist, "ircnet");
|
||||
|
||||
if (value != NULL) {
|
||||
g_free_and_null(rec->chatnet);
|
||||
if (*value != '\0') {
|
||||
ircnet = ircnet_find(value);
|
||||
rec->chatnet = ircnet != NULL ?
|
||||
g_strdup(ircnet->name) : g_strdup(value);
|
||||
}
|
||||
}
|
||||
|
||||
value = g_hash_table_lookup(optlist, "cmdspeed");
|
||||
if (value != NULL && *value != '\0') rec->cmd_queue_speed = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "cmdmax");
|
||||
if (value != NULL && *value != '\0') rec->max_cmds_at_once = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "querychans");
|
||||
if (value != NULL && *value != '\0') rec->max_query_chans = atoi(value);
|
||||
}
|
||||
|
||||
/* SYNTAX: SERVER MODIFY [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
|
||||
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
|
||||
[-ssl_ciphers <list>]
|
||||
|
|
@ -63,7 +93,7 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target)
|
|||
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>]
|
||||
<address> [<port> [<password>]] */
|
||||
/* NOTE: -network replaces the old -ircnet flag. */
|
||||
static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec,
|
||||
static void sig_server_modify_fill(IRC_SERVER_SETUP_REC *rec,
|
||||
GHashTable *optlist)
|
||||
{
|
||||
IRC_CHATNET_REC *ircnet;
|
||||
|
|
@ -154,13 +184,16 @@ static void cmd_server_list(const char *data)
|
|||
void fe_irc_server_init(void)
|
||||
{
|
||||
signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill);
|
||||
signal_add("server modify fill", (SIGNAL_FUNC) sig_server_modify_fill);
|
||||
command_bind("server list", NULL, (SIGNAL_FUNC) cmd_server_list);
|
||||
|
||||
command_set_options("server add", "-ircnet -network -cmdspeed -cmdmax -querychans");
|
||||
command_set_options("server modify", "-ircnet -network -cmdspeed -cmdmax -querychans");
|
||||
}
|
||||
|
||||
void fe_irc_server_deinit(void)
|
||||
{
|
||||
signal_remove("server add fill", (SIGNAL_FUNC) sig_server_add_fill);
|
||||
signal_remove("server modify fill", (SIGNAL_FUNC) sig_server_modify_fill);
|
||||
command_unbind("server list", (SIGNAL_FUNC) cmd_server_list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,13 +95,6 @@ static void cmd_network_list(void)
|
|||
[-cmdmax <count>] [-sasl_mechanism <mechanism>]
|
||||
[-sasl_username <username>] [-sasl_password <password>]
|
||||
<name> */
|
||||
/* 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_add(const char *data)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
|
|
@ -181,6 +174,91 @@ static void cmd_network_add(const char *data)
|
|||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
char *name, *value;
|
||||
void *free_arg;
|
||||
IRC_CHATNET_REC *rec;
|
||||
|
||||
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
|
||||
"network modify", &optlist, &name))
|
||||
return;
|
||||
if (*name == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
|
||||
rec = ircnet_find(name);
|
||||
if (rec == NULL) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_NOT_FOUND, name);
|
||||
} else {
|
||||
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);
|
||||
if (g_hash_table_lookup(optlist, "host")) {
|
||||
g_free_and_null(rec->own_host);
|
||||
rec->own_ip4 = rec->own_ip6 = NULL;
|
||||
}
|
||||
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");
|
||||
if (value != NULL) rec->max_kicks = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "msgs");
|
||||
if (value != NULL) rec->max_msgs = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "modes");
|
||||
if (value != NULL) rec->max_modes = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "whois");
|
||||
if (value != NULL) rec->max_whois = atoi(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "cmdspeed");
|
||||
if (value != NULL) rec->cmd_queue_speed = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "cmdmax");
|
||||
if (value != NULL) rec->max_cmds_at_once = atoi(value);
|
||||
value = g_hash_table_lookup(optlist, "querychans");
|
||||
if (value != NULL) rec->max_query_chans = atoi(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "nick");
|
||||
if (value != NULL && *value != '\0') rec->nick = g_strdup(value);
|
||||
value = g_hash_table_lookup(optlist, "user");
|
||||
if (value != NULL && *value != '\0') rec->username = g_strdup(value);
|
||||
value = g_hash_table_lookup(optlist, "realname");
|
||||
if (value != NULL && *value != '\0') rec->realname = g_strdup(value);
|
||||
|
||||
value = g_hash_table_lookup(optlist, "host");
|
||||
if (value != NULL && *value != '\0') {
|
||||
rec->own_host = g_strdup(value);
|
||||
rec->own_ip4 = rec->own_ip6 = NULL;
|
||||
}
|
||||
|
||||
value = g_hash_table_lookup(optlist, "usermode");
|
||||
if (value != NULL && *value != '\0') rec->usermode = g_strdup(value);
|
||||
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_MODIFIED, name);
|
||||
}
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
||||
/* SYNTAX: NETWORK REMOVE <network> */
|
||||
static void cmd_network_remove(const char *data)
|
||||
{
|
||||
|
|
@ -212,12 +290,14 @@ void fe_ircnet_init(void)
|
|||
command_bind("ircnet", NULL, (SIGNAL_FUNC) cmd_network);
|
||||
command_bind("network", NULL, (SIGNAL_FUNC) cmd_network);
|
||||
command_bind("network list", NULL, (SIGNAL_FUNC) cmd_network_list);
|
||||
command_bind("network modify", NULL, (SIGNAL_FUNC) cmd_network_add);
|
||||
command_bind("network modify", NULL, (SIGNAL_FUNC) cmd_network_modify);
|
||||
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 -sasl_mechanism -sasl_username -sasl_password");
|
||||
command_set_options("network modify", "-kicks -msgs -modes -whois -cmdspeed "
|
||||
"-cmdmax -nick -user -realname -host -autosendcmd -querychans -usermode -sasl_mechanism -sasl_username -sasl_password");
|
||||
}
|
||||
|
||||
void fe_ircnet_deinit(void)
|
||||
|
|
@ -225,7 +305,7 @@ void fe_ircnet_deinit(void)
|
|||
command_unbind("ircnet", (SIGNAL_FUNC) cmd_network);
|
||||
command_unbind("network", (SIGNAL_FUNC) cmd_network);
|
||||
command_unbind("network list", (SIGNAL_FUNC) cmd_network_list);
|
||||
command_unbind("network modify", (SIGNAL_FUNC) cmd_network_add);
|
||||
command_unbind("network modify", (SIGNAL_FUNC) cmd_network_modify);
|
||||
command_unbind("network add", (SIGNAL_FUNC) cmd_network_add);
|
||||
command_unbind("network remove", (SIGNAL_FUNC) cmd_network_remove);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ FORMAT_REC fecommon_irc_formats[] = {
|
|||
{ "netsplits_line", "%#$[9]0 $[10]1 $[20]2 $3", 4, { 0, 0, 0, 0 } },
|
||||
{ "netsplits_footer", "", 0 },
|
||||
{ "network_added", "Network $0 saved", 1, { 0 } },
|
||||
{ "network_modified", "Network $0 saved", 1, { 0 } },
|
||||
{ "network_removed", "Network $0 removed", 1, { 0 } },
|
||||
{ "network_not_found", "Network $0 not found", 1, { 0 } },
|
||||
{ "network_header", "%#Networks:", 0 },
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ enum {
|
|||
IRCTXT_NETSPLITS_LINE,
|
||||
IRCTXT_NETSPLITS_FOOTER,
|
||||
IRCTXT_NETWORK_ADDED,
|
||||
IRCTXT_NETWORK_MODIFIED,
|
||||
IRCTXT_NETWORK_REMOVED,
|
||||
IRCTXT_NETWORK_NOT_FOUND,
|
||||
IRCTXT_NETWORK_HEADER,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue