summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-01 18:04:34 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-01 18:04:34 +0000
commitc7fbd670e6771e54f3082db2569006c8f1d422c6 (patch)
tree3634f743c80436901977d8eef88b622205cd093a /src
parentb4a9ee1966358a560a8ba23deb84b7a4a7f4fdc9 (diff)
downloadirssi-c7fbd670e6771e54f3082db2569006c8f1d422c6.zip
/server -add messed up everything when modifying existing servers.
Now it also changes only the specified settings in the server instead of replacing it entirely. only the settings you change changed parts git-svn-id: http://svn.irssi.org/repos/irssi/trunk@266 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-irc-server.c26
-rw-r--r--src/irc/core/server-setup.c2
2 files changed, 15 insertions, 13 deletions
diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c
index 30e09886..ee0978d7 100644
--- a/src/fe-common/irc/fe-irc-server.c
+++ b/src/fe-common/irc/fe-irc-server.c
@@ -81,14 +81,14 @@ static void print_reconnects(void)
static void server_add(const char *data)
{
SETUP_SERVER_REC *rec;
- char *params, *args, *ircnet, *host, *cmdspeed, *cmdmax;
- char *addr, *portstr, *password, *nick;
+ char *params, *args, *ircnet, *host, *cmdspeed, *cmdmax, *portarg;
+ char *addr, *portstr, *password;
int port;
- args = "ircnet host cmdspeed cmdmax";
+ args = "ircnet host cmdspeed cmdmax port";
params = cmd_get_params(data, 9 | PARAM_FLAG_MULTIARGS,
&args, &ircnet, &host, &cmdspeed, &cmdmax,
- &addr, &portstr, &password, &nick);
+ &portarg, &addr, &portstr, &password);
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
port = *portstr == '\0' ? 6667 : atoi(portstr);
@@ -98,17 +98,19 @@ static void server_add(const char *data)
rec->address = g_strdup(addr);
rec->port = port;
} else {
- g_free_and_null(rec->ircnet);
- g_free_and_null(rec->password);
- g_free_and_null(rec->own_host);
+ if (*portarg != '\0') rec->port = atoi(portarg);
+ if (stristr(args, "-ircnet")) g_free_and_null(rec->ircnet);
+ if (*password != '\0') g_free_and_null(rec->password);
+ if (stristr(args, "-host")) g_free_and_null(rec->own_host);
}
- rec->autoconnect = stristr(args, "-auto") != NULL;
+ if (stristr(args, "-auto")) rec->autoconnect = TRUE;
+ if (stristr(args, "-noauto")) rec->autoconnect = FALSE;
if (*ircnet != '\0') rec->ircnet = g_strdup(ircnet);
- if (*password != '\0') rec->password = g_strdup(password);
+ if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password);
if (*host != '\0') rec->own_host = g_strdup(host);
- rec->cmd_queue_speed = atoi(cmdspeed);
- rec->max_cmds_at_once = atoi(cmdmax);
+ if (*cmdspeed != '\0') rec->cmd_queue_speed = atoi(cmdspeed);
+ if (*cmdmax != '\0') rec->max_cmds_at_once = atoi(cmdmax);
server_setup_add(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_SETUPSERVER_ADDED, addr, port);
@@ -180,7 +182,7 @@ static void cmd_server(const char *data)
return;
}
- args = "ircnet host";
+ args = "ircnet host"; /* should be same as in connect_server() in src/irc/core/irc-commands.c */
params = cmd_get_params(data, 4 | PARAM_FLAG_MULTIARGS,
&args, &ircnetarg, &hostarg, &addr);
diff --git a/src/irc/core/server-setup.c b/src/irc/core/server-setup.c
index 191d4b34..324a4575 100644
--- a/src/irc/core/server-setup.c
+++ b/src/irc/core/server-setup.c
@@ -296,7 +296,7 @@ void server_setup_add(SETUP_SERVER_REC *rec)
{
if (g_slist_find(setupservers, rec) != NULL) {
setupserver_config_remove(rec);
- setupservers = g_slist_append(setupservers, rec);
+ setupservers = g_slist_remove(setupservers, rec);
}
setupservers = g_slist_append(setupservers, rec);