From d6a1f4de23c45620114507ee1cf917a58a65541e Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Sat, 10 Oct 2015 23:58:18 +0200 Subject: [PATCH 01/11] Added modify commands to /network, /server and /channel --- src/fe-common/core/fe-channels.c | 2 ++ src/fe-common/core/fe-server.c | 2 ++ src/fe-common/irc/fe-ircnet.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index 046d641a..dea3b87d 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -621,6 +621,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 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); @@ -642,6 +643,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 add", (SIGNAL_FUNC) cmd_channel_add); command_unbind("channel remove", (SIGNAL_FUNC) cmd_channel_remove); command_unbind("channel list", (SIGNAL_FUNC) cmd_channel_list); diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 429e6dac..4a998aab 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -387,6 +387,7 @@ 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 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); @@ -411,6 +412,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 add", (SIGNAL_FUNC) cmd_server_add); command_unbind("server remove", (SIGNAL_FUNC) cmd_server_remove); command_unbind("server", (SIGNAL_FUNC) server_command); diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index 4d7037d5..d6ada8fb 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -205,6 +205,7 @@ 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 add", NULL, (SIGNAL_FUNC) cmd_network_add); command_bind("network remove", NULL, (SIGNAL_FUNC) cmd_network_remove); @@ -217,6 +218,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 add", (SIGNAL_FUNC) cmd_network_add); command_unbind("network remove", (SIGNAL_FUNC) cmd_network_remove); } From 9b46cc30713344b8e7dfa7ce710f376a328e7743 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Sun, 11 Oct 2015 00:15:49 +0200 Subject: [PATCH 02/11] Added help for the new subcommands --- docs/help/in/channel.in | 2 ++ docs/help/in/network.in | 5 ++--- docs/help/in/server.in | 2 ++ src/fe-common/core/fe-channels.c | 2 ++ src/fe-common/irc/fe-irc-server.c | 6 ++++++ src/fe-common/irc/fe-ircnet.c | 7 +++++++ 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/help/in/channel.in b/docs/help/in/channel.in index 01bea3c1..86e824c2 100644 --- a/docs/help/in/channel.in +++ b/docs/help/in/channel.in @@ -7,6 +7,7 @@ LIST: Displays the list of configured channels. ADD: Adds a channel to your configuration. + MODIFY: Modifies a channel in your configuration. REMOVE: Removes a channel from your configuration. -auto: Automatically join the channel. @@ -36,6 +37,7 @@ /CHANNEL ADD -auto #basementcat Quakenet secret_lair /CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout Freenode /CHANNEL ADD -auto -bots 'Q!TheQBot@CServe.quakenet.org' -botcmd '^MSG Q op #irssi' #irssi Quakenet + /CHANNEL MODIFY -noauto #irssi Freenode /CHANNEL REMOVE #hideout Freenode %9Special Example:%9 diff --git a/docs/help/in/network.in b/docs/help/in/network.in index 2918f6ae..f663d76e 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -7,6 +7,7 @@ LIST: Displays the list of configured networks. ADD: Adds a network to your configuration. + MODIFY: Modifies a network in your configuration. REMOVE: Removes a network from your configuration. -nick: Specifies the nickname to use. @@ -47,9 +48,6 @@ Displays, adds, modifies or removes the network configuration of IRC networks. - When using the ADD parameter on a network that already exists, the - configuration will be merged with each other. - We recommend using 'WAIT 2000' between the automated commands in order to prevent you from being kicked from the network due to flooding commands. @@ -59,6 +57,7 @@ /NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org Freenode /NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' Freenode /NETWORK ADD -autosendcmd '^MSG Q@CServe.quakenet.org AUTH mike WzerT8zq; WAIT 2000; OPER mike WzerT8zq; WAIT 2000; MODE mike +kXP' Quakenet + /NETWORK MODIFY -usermode +gi EFnet /NETWORK REMOVE Freenode %9See also:%9 CHANNEL, CONNECT, SERVER diff --git a/docs/help/in/server.in b/docs/help/in/server.in index e407b6a9..68a62e2d 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -8,6 +8,7 @@ LIST: Displays the list of servers you are connected to. CONNECT: Connects to the given server. ADD: Adds a server to your configuration. + MODIFY: Modifies a server in your configuration. REMOVE: Removes a server from your configuration. PURGE: Purges the commands queued to be sent to the server. @@ -62,6 +63,7 @@ /SERVER CONNECT +chat.freenode.net /SERVER ADD -network Freenode -noautosendcmd orwell.freenode.net /SERVER ADD -! -auto -host staff.irssi.org -port 6667 -4 -network Freenode -noproxy orwell.freenode.net + /SERVER MODIFY -network Freenode -noauto orwell.freenode.net /SERVER REMOVE orwell.freenode.net 6667 Freenode /SERVER PURGE /SERVER PURGE orwell.freenode.net diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index dea3b87d..2dac6975 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -248,6 +248,8 @@ static void cmd_channel(const char *data, SERVER_REC *server, WI_ITEM_REC *item) /* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots ] [-botcmd ] [] */ +/* SYNTAX: CHANNEL MODIFY [-auto | -noauto] [-bots ] [-botcmd ] + [] */ static void cmd_channel_add(const char *data) { GHashTable *optlist; diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index 2cb99a2f..0c9b9222 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -56,6 +56,12 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target) [-auto | -noauto] [-network ] [-host ] [-cmdspeed ] [-cmdmax ] [-port ]
[ []] */ +/* SYNTAX: SERVER MODIFY [-4 | -6] [-ssl] [-ssl_cert ] [-ssl_pkey ] [-ssl_pass ] + [-ssl_verify] [-ssl_cafile ] [-ssl_capath ] + [-ssl_ciphers ] + [-auto | -noauto] [-network ] [-host ] + [-cmdspeed ] [-cmdmax ] [-port ] +
[ []] */ /* NOTE: -network replaces the old -ircnet flag. */ static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec, GHashTable *optlist) diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index d6ada8fb..e6290c32 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -95,6 +95,13 @@ static void cmd_network_list(void) [-cmdmax ] [-sasl_mechanism ] [-sasl_username ] [-sasl_password ] */ +/* SYNTAX: NETWORK MODIFY [-nick ] [-user ] [-realname ] + [-host ] [-usermode ] [-autosendcmd ] + [-querychans ] [-whois ] [-msgs ] + [-kicks ] [-modes ] [-cmdspeed ] + [-cmdmax ] [-sasl_mechanism ] + [-sasl_username ] [-sasl_password ] + */ static void cmd_network_add(const char *data) { GHashTable *optlist; From 435c6552cdf286b83084d2e2df31516add8f4e62 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Sun, 11 Oct 2015 00:50:38 +0200 Subject: [PATCH 03/11] Amended help files with more explicit explanation of what MODIFY is --- docs/help/in/channel.in | 2 +- docs/help/in/network.in | 2 +- docs/help/in/server.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/help/in/channel.in b/docs/help/in/channel.in index 86e824c2..5c2fb8a4 100644 --- a/docs/help/in/channel.in +++ b/docs/help/in/channel.in @@ -7,7 +7,7 @@ LIST: Displays the list of configured channels. ADD: Adds a channel to your configuration. - MODIFY: Modifies a channel in your configuration. + MODIFY: Alias for ADD. Modifies a channel in your configuration. REMOVE: Removes a channel from your configuration. -auto: Automatically join the channel. diff --git a/docs/help/in/network.in b/docs/help/in/network.in index f663d76e..a6082fe8 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -7,7 +7,7 @@ LIST: Displays the list of configured networks. ADD: Adds a network to your configuration. - MODIFY: Modifies a network in your configuration. + MODIFY: Alias for ADD. Modifies a network in your configuration. REMOVE: Removes a network from your configuration. -nick: Specifies the nickname to use. diff --git a/docs/help/in/server.in b/docs/help/in/server.in index 68a62e2d..99a95529 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -8,7 +8,7 @@ LIST: Displays the list of servers you are connected to. CONNECT: Connects to the given server. ADD: Adds a server to your configuration. - MODIFY: Modifies a server in your configuration. + MODIFY: Alias for ADD. Modifies a server in your configuration. REMOVE: Removes a server from your configuration. PURGE: Purges the commands queued to be sent to the server. From 0afdfe7caefda9154b26da1bc63c4b71766a5e0d Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Sun, 11 Oct 2015 01:08:52 +0200 Subject: [PATCH 04/11] Make the help more clear still --- docs/help/in/channel.in | 3 +++ docs/help/in/network.in | 3 +++ docs/help/in/server.in | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/help/in/channel.in b/docs/help/in/channel.in index 5c2fb8a4..80f0f1ec 100644 --- a/docs/help/in/channel.in +++ b/docs/help/in/channel.in @@ -26,6 +26,9 @@ Adds, removes or displays the configuration of channels; this method is used to automate and simplify your workflow. + /CHANNEL ADD modifies a channel if it already exists in the configuration. + /CHANNEL MODIFY is an alias for /CHANNEL ADD to make the distinction more clear. + You can use the ADDALLCHANS command, which is a default alias, to add all the channels you are present on into the configuration. diff --git a/docs/help/in/network.in b/docs/help/in/network.in index a6082fe8..e454d13b 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -48,6 +48,9 @@ Displays, adds, modifies or removes the network configuration of IRC networks. + /NETWORK ADD modifies a network if it already exists in the configuration. + /NETWORK MODIFY is an alias for /NETWORK ADD to make the distinction more clear. + We recommend using 'WAIT 2000' between the automated commands in order to prevent you from being kicked from the network due to flooding commands. diff --git a/docs/help/in/server.in b/docs/help/in/server.in index 99a95529..d7d33f5d 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -46,8 +46,8 @@ Displays, adds, modifies or removes the network configuration of IRC servers. - When using the ADD parameter on a server that already exists, the - configuration will be merged with each other. + /SERVER ADD modifies a server if it already exists in the configuration. + /SERVER MODIFY is an alias for /SERVER ADD to make the distinction more clear. When using the command without any of the given parameters, it will connect to the specified server; the server in the active window will be From a7353b6b3af32c80ce637aeecd43c60d412aab1f Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Wed, 27 Jan 2016 12:05:07 +0100 Subject: [PATCH 05/11] MODIFY works only on existing channels/servers/networks now, ADD can still add/modify --- src/fe-common/core/fe-channels.c | 58 ++++++++++++++-- src/fe-common/core/fe-server.c | 100 +++++++++++++++++++++++++++- src/fe-common/core/module-formats.c | 2 + src/fe-common/core/module-formats.h | 2 + src/fe-common/irc/fe-irc-server.c | 35 +++++++++- src/fe-common/irc/fe-ircnet.c | 98 ++++++++++++++++++++++++--- src/fe-common/irc/module-formats.c | 1 + src/fe-common/irc/module-formats.h | 1 + 8 files changed, 279 insertions(+), 18 deletions(-) diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index 2dac6975..11f6ae25 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -248,8 +248,6 @@ static void cmd_channel(const char *data, SERVER_REC *server, WI_ITEM_REC *item) /* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots ] [-botcmd ] [] */ -/* SYNTAX: CHANNEL MODIFY [-auto | -noauto] [-bots ] [-botcmd ] - [] */ 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 ] [-botcmd ] + [] */ +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 */ 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); diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 4a998aab..e281ebaa 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -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
[] [] */ 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); diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index e6d32b6d..36b9e998 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -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 } }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 3f06bb97..790f2a14 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -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, diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index 0c9b9222..44e80825 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -56,6 +56,36 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target) [-auto | -noauto] [-network ] [-host ] [-cmdspeed ] [-cmdmax ] [-port ]
[ []] */ +/* 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 ] [-ssl_pkey ] [-ssl_pass ] [-ssl_verify] [-ssl_cafile ] [-ssl_capath ] [-ssl_ciphers ] @@ -63,7 +93,7 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target) [-cmdspeed ] [-cmdmax ] [-port ]
[ []] */ /* 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); } diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index e6290c32..b6ed5382 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -95,13 +95,6 @@ static void cmd_network_list(void) [-cmdmax ] [-sasl_mechanism ] [-sasl_username ] [-sasl_password ] */ -/* SYNTAX: NETWORK MODIFY [-nick ] [-user ] [-realname ] - [-host ] [-usermode ] [-autosendcmd ] - [-querychans ] [-whois ] [-msgs ] - [-kicks ] [-modes ] [-cmdspeed ] - [-cmdmax ] [-sasl_mechanism ] - [-sasl_username ] [-sasl_password ] - */ 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 ] [-user ] [-realname ] + [-host ] [-usermode ] [-autosendcmd ] + [-querychans ] [-whois ] [-msgs ] + [-kicks ] [-modes ] [-cmdspeed ] + [-cmdmax ] [-sasl_mechanism ] + [-sasl_username ] [-sasl_password ] + */ +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 */ 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); } diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c index f7b074ec..b79d54fa 100644 --- a/src/fe-common/irc/module-formats.c +++ b/src/fe-common/irc/module-formats.c @@ -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 }, diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h index c45f4562..fa05eb30 100644 --- a/src/fe-common/irc/module-formats.h +++ b/src/fe-common/irc/module-formats.h @@ -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, From 6a75df0b4031f7adcd7889b4f95ae8f9250ce09e Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 28 Jan 2016 13:30:40 +0100 Subject: [PATCH 06/11] refactored shared code --- src/fe-common/core/fe-channels.c | 40 +++++---- src/fe-common/core/fe-server.c | 140 +++++++++++-------------------- src/fe-common/irc/fe-ircnet.c | 123 +++++++++++---------------- 3 files changed, 122 insertions(+), 181 deletions(-) diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index 11f6ae25..9ca1a056 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -246,6 +246,23 @@ static void cmd_channel(const char *data, SERVER_REC *server, WI_ITEM_REC *item) } } +static CHANNEL_SETUP_REC *channel_setup_fill_rec(CHANNEL_SETUP_REC *rec, GHashTable *optlist) +{ + char *botarg, *botcmdarg; + + g_return_if_fail(rec != NULL); + + botarg = g_hash_table_lookup(optlist, "bots"); + botcmdarg = g_hash_table_lookup(optlist, "botcmd"); + + 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); + + return rec; +} + /* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots ] [-botcmd ] [] */ static void cmd_channel_add(const char *data) @@ -253,7 +270,7 @@ static void cmd_channel_add(const char *data) GHashTable *optlist; CHATNET_REC *chatnetrec; CHANNEL_SETUP_REC *rec; - char *botarg, *botcmdarg, *chatnet, *channel, *password; + char *chatnet, *channel, *password; void *free_arg; if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS, @@ -271,9 +288,6 @@ static void cmd_channel_add(const char *data) return; } - botarg = g_hash_table_lookup(optlist, "bots"); - botcmdarg = g_hash_table_lookup(optlist, "botcmd"); - rec = channel_setup_find(channel, chatnet); if (rec == NULL) { rec = CHAT_PROTOCOL(chatnetrec)->create_channel_setup(); @@ -284,12 +298,11 @@ static void cmd_channel_add(const char *data) 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); + rec = channel_setup_fill_rec(rec, optlist); + channel_setup_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_ADDED, channel, chatnet); @@ -304,7 +317,7 @@ static void cmd_channel_modify(const char *data) GHashTable *optlist; CHATNET_REC *chatnetrec; CHANNEL_SETUP_REC *rec; - char *botarg, *botcmdarg, *chatnet, *channel, *password; + char *chatnet, *channel, *password; void *free_arg; if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS, @@ -322,9 +335,6 @@ static void cmd_channel_modify(const char *data) 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); @@ -332,12 +342,10 @@ static void cmd_channel_modify(const char *data) 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); + rec = channel_setup_fill_rec(rec, optlist); + channel_setup_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_MODIFIED, channel, chatnet); diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index e281ebaa..64e4b842 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -104,43 +104,11 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist) return server; } -static void cmd_server_add(const char *data) + +static SERVER_SETUP_REC *server_setup_fill_rec(SERVER_SETUP_REC *rec, GHashTable *optlist) { - 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 add", &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) { - rec = create_server_setup(optlist); - if (rec == NULL) { - cmd_params_free(free_arg); - return; - } - rec->address = g_strdup(addr); - rec->port = 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; - } - } + g_return_if_fail(rec != NULL); + char *value; if (g_hash_table_lookup(optlist, "6")) rec->family = AF_INET6; @@ -189,13 +157,57 @@ static void cmd_server_add(const char *data) 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; } + return rec; +} + +static void cmd_server_add(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 add", &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) { + rec = create_server_setup(optlist); + if (rec == NULL) { + cmd_params_free(free_arg); + return; + } + rec->address = g_strdup(addr); + rec->port = 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 (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); + + rec = server_setup_fill_rec(rec, optlist); + signal_emit("server add fill", 2, rec, optlist); server_setup_add(rec); @@ -236,59 +248,9 @@ static void cmd_server_modify(const char *data) 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; - } + + rec = server_setup_fill_rec(rec, optlist); signal_emit("server modify fill", 2, rec, optlist); diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index b6ed5382..7c3ff6f3 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -88,43 +88,11 @@ static void cmd_network_list(void) printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETWORK_FOOTER); } -/* SYNTAX: NETWORK ADD [-nick ] [-user ] [-realname ] - [-host ] [-usermode ] [-autosendcmd ] - [-querychans ] [-whois ] [-msgs ] - [-kicks ] [-modes ] [-cmdspeed ] - [-cmdmax ] [-sasl_mechanism ] - [-sasl_username ] [-sasl_password ] - */ -static void cmd_network_add(const char *data) +static IRC_CHATNET_REC *network_setup_fill_rec(IRC_CHATNET_REC *rec, GHashTable *optlist) { - GHashTable *optlist; - char *name, *value; - void *free_arg; - IRC_CHATNET_REC *rec; + char *value; - if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, - "network add", &optlist, &name)) - return; - if (*name == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - - rec = ircnet_find(name); - if (rec == NULL) { - rec = g_new0(IRC_CHATNET_REC, 1); - rec->name = g_strdup(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); - } + g_return_if_fail(rec != NULL); value = g_hash_table_lookup(optlist, "kicks"); if (value != NULL) rec->max_kicks = atoi(value); @@ -168,6 +136,49 @@ static void cmd_network_add(const char *data) value = g_hash_table_lookup(optlist, "sasl_password"); if (value != NULL && *value != '\0') rec->sasl_password = g_strdup(value); + return rec; +} + +/* SYNTAX: NETWORK ADD [-nick ] [-user ] [-realname ] + [-host ] [-usermode ] [-autosendcmd ] + [-querychans ] [-whois ] [-msgs ] + [-kicks ] [-modes ] [-cmdspeed ] + [-cmdmax ] [-sasl_mechanism ] + [-sasl_username ] [-sasl_password ] + */ +static void cmd_network_add(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 add", &optlist, &name)) + return; + if (*name == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); + + rec = ircnet_find(name); + if (rec == NULL) { + rec = g_new0(IRC_CHATNET_REC, 1); + rec->name = g_strdup(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); + } + + rec = network_setup_fill_rec(rec, optlist); + ircnet_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_ADDED, name); @@ -210,47 +221,7 @@ static void cmd_network_modify(const char *data) 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); + rec = network_setup_fill_rec(rec, optlist); ircnet_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NETWORK_MODIFIED, name); From a86f7ef7d71a73ac74ae27e1e53eaf47ce4553cf Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 28 Jan 2016 15:05:28 +0100 Subject: [PATCH 07/11] Code ended up in wrong place during refactoring --- src/fe-common/core/fe-channels.c | 8 ++------ src/fe-common/core/fe-server.c | 5 ----- src/fe-common/irc/fe-ircnet.c | 13 ++++++------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c index 9ca1a056..263f44f7 100644 --- a/src/fe-common/core/fe-channels.c +++ b/src/fe-common/core/fe-channels.c @@ -250,8 +250,6 @@ static CHANNEL_SETUP_REC *channel_setup_fill_rec(CHANNEL_SETUP_REC *rec, GHashTa { char *botarg, *botcmdarg; - g_return_if_fail(rec != NULL); - botarg = g_hash_table_lookup(optlist, "bots"); botcmdarg = g_hash_table_lookup(optlist, "botcmd"); @@ -302,7 +300,6 @@ static void cmd_channel_add(const char *data) if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); rec = channel_setup_fill_rec(rec, optlist); - channel_setup_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_ADDED, channel, chatnet); @@ -336,16 +333,15 @@ static void cmd_channel_modify(const char *data) } rec = channel_setup_find(channel, chatnet); - if (rec == NULL) { + if (rec == NULL) printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_NOT_FOUND, channel, chatnet); - } else { + 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 (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); rec = channel_setup_fill_rec(rec, optlist); - channel_setup_create(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_MODIFIED, channel, chatnet); diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index 64e4b842..b1b199d1 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -107,7 +107,6 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist) static SERVER_SETUP_REC *server_setup_fill_rec(SERVER_SETUP_REC *rec, GHashTable *optlist) { - g_return_if_fail(rec != NULL); char *value; if (g_hash_table_lookup(optlist, "6")) @@ -207,9 +206,7 @@ static void cmd_server_add(const char *data) if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); rec = server_setup_fill_rec(rec, optlist); - signal_emit("server add fill", 2, rec, optlist); - server_setup_add(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_ADDED, addr, port); @@ -251,9 +248,7 @@ static void cmd_server_modify(const char *data) if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); rec = server_setup_fill_rec(rec, optlist); - signal_emit("server modify fill", 2, rec, optlist); - server_setup_add(rec); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_MODIFIED, addr, port); diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index 7c3ff6f3..10ebc968 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -92,8 +92,6 @@ static IRC_CHATNET_REC *network_setup_fill_rec(IRC_CHATNET_REC *rec, GHashTable { char *value; - g_return_if_fail(rec != NULL); - value = g_hash_table_lookup(optlist, "kicks"); if (value != NULL) rec->max_kicks = atoi(value); value = g_hash_table_lookup(optlist, "msgs"); @@ -170,13 +168,14 @@ static void cmd_network_add(const char *data) 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); } + 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); + rec = network_setup_fill_rec(rec, optlist); ircnet_create(rec); From 03f03ede864c243b82c8527c59cec228e533dcf1 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 28 Jan 2016 22:22:08 +0100 Subject: [PATCH 08/11] indentation issue --- src/fe-common/irc/fe-irc-server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index 44e80825..0dd75570 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -96,7 +96,7 @@ 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; + IRC_CHATNET_REC *ircnet; char *value; value = g_hash_table_lookup(optlist, "network"); From ea9e256954085783030fd0f813fc315f8ae12bcd Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 28 Jan 2016 22:35:01 +0100 Subject: [PATCH 09/11] Removed unused variable --- src/fe-common/irc/fe-ircnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index 10ebc968..ea5f7916 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -147,7 +147,7 @@ static IRC_CHATNET_REC *network_setup_fill_rec(IRC_CHATNET_REC *rec, GHashTable static void cmd_network_add(const char *data) { GHashTable *optlist; - char *name, *value; + char *name; void *free_arg; IRC_CHATNET_REC *rec; @@ -194,7 +194,7 @@ static void cmd_network_add(const char *data) static void cmd_network_modify(const char *data) { GHashTable *optlist; - char *name, *value; + char *name; void *free_arg; IRC_CHATNET_REC *rec; From 252829a9adb1ebff40ffc60c6185039ea70d0eb2 Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 24 Mar 2016 16:06:14 +0100 Subject: [PATCH 10/11] refactoring --- src/fe-common/irc/fe-ircnet.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index ea5f7916..2140169a 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -121,6 +121,12 @@ static IRC_CHATNET_REC *network_setup_fill_rec(IRC_CHATNET_REC *rec, GHashTable 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, "usermode"); if (value != NULL && *value != '\0') rec->usermode = g_strdup(value); value = g_hash_table_lookup(optlist, "autosendcmd"); @@ -170,12 +176,6 @@ 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); - rec = network_setup_fill_rec(rec, optlist); ircnet_create(rec); @@ -214,11 +214,6 @@ static void cmd_network_modify(const char *data) 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); rec = network_setup_fill_rec(rec, optlist); From 5d25ecb1bb70d6c932a4abbe7a751727cc506fdd Mon Sep 17 00:00:00 2001 From: Jari Matilainen Date: Thu, 24 Mar 2016 17:10:01 +0100 Subject: [PATCH 11/11] help file incorrectly said modify was alias for add --- docs/help/in/channel.in | 4 ++-- docs/help/in/network.in | 4 ++-- docs/help/in/server.in | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/help/in/channel.in b/docs/help/in/channel.in index 80f0f1ec..94fce794 100644 --- a/docs/help/in/channel.in +++ b/docs/help/in/channel.in @@ -7,7 +7,7 @@ LIST: Displays the list of configured channels. ADD: Adds a channel to your configuration. - MODIFY: Alias for ADD. Modifies a channel in your configuration. + MODIFY: Modifies a channel in your configuration. REMOVE: Removes a channel from your configuration. -auto: Automatically join the channel. @@ -27,7 +27,7 @@ used to automate and simplify your workflow. /CHANNEL ADD modifies a channel if it already exists in the configuration. - /CHANNEL MODIFY is an alias for /CHANNEL ADD to make the distinction more clear. + /CHANNEL MODIFY only modifies existing channels. You can use the ADDALLCHANS command, which is a default alias, to add all the channels you are present on into the configuration. diff --git a/docs/help/in/network.in b/docs/help/in/network.in index e454d13b..3cb3589b 100644 --- a/docs/help/in/network.in +++ b/docs/help/in/network.in @@ -7,7 +7,7 @@ LIST: Displays the list of configured networks. ADD: Adds a network to your configuration. - MODIFY: Alias for ADD. Modifies a network in your configuration. + MODIFY: Modifies a network in your configuration. REMOVE: Removes a network from your configuration. -nick: Specifies the nickname to use. @@ -49,7 +49,7 @@ networks. /NETWORK ADD modifies a network if it already exists in the configuration. - /NETWORK MODIFY is an alias for /NETWORK ADD to make the distinction more clear. + /NETWORK MODIFY only modifies existing channels. We recommend using 'WAIT 2000' between the automated commands in order to prevent you from being kicked from the network due to flooding commands. diff --git a/docs/help/in/server.in b/docs/help/in/server.in index d7d33f5d..f8a6b938 100644 --- a/docs/help/in/server.in +++ b/docs/help/in/server.in @@ -8,7 +8,7 @@ LIST: Displays the list of servers you are connected to. CONNECT: Connects to the given server. ADD: Adds a server to your configuration. - MODIFY: Alias for ADD. Modifies a server in your configuration. + MODIFY: Modifies a server in your configuration. REMOVE: Removes a server from your configuration. PURGE: Purges the commands queued to be sent to the server. @@ -47,7 +47,7 @@ servers. /SERVER ADD modifies a server if it already exists in the configuration. - /SERVER MODIFY is an alias for /SERVER ADD to make the distinction more clear. + /SERVER MODIFY only modified existing servers. When using the command without any of the given parameters, it will connect to the specified server; the server in the active window will be