diff options
author | Timo Sirainen <cras@irssi.org> | 2000-06-01 18:04:34 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-06-01 18:04:34 +0000 |
commit | c7fbd670e6771e54f3082db2569006c8f1d422c6 (patch) | |
tree | 3634f743c80436901977d8eef88b622205cd093a | |
parent | b4a9ee1966358a560a8ba23deb84b7a4a7f4fdc9 (diff) | |
download | irssi-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
-rw-r--r-- | docs/manual.txt | 22 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-server.c | 26 | ||||
-rw-r--r-- | src/irc/core/server-setup.c | 2 |
3 files changed, 33 insertions, 17 deletions
diff --git a/docs/manual.txt b/docs/manual.txt index f51d3cf7..7065cfb8 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -417,20 +417,34 @@ 5.4 Server settings - /SERVER -add [-auto] [-ircnet <ircnet>] [-host <hostname>] - [-cmdspeed <ms>] [-cmdmax <count>] <address> - [<port> [<password> [<nick>]]] + /SERVER -add [-auto | -noauto] [-ircnet <ircnet>] [-host <hostname>] + [-cmdspeed <ms>] [-cmdmax <count>] [-port <port>] + <address> [<port> [<password>]] - -auto: Automatically connect to server at startup + -auto: Automatically connect to server at startup (default) + -noauto: Don't connect to server at startup -ircnet: Specify what IRC network this server belongs to -host: Specify what host name to use, if you have multiple -cmdspeed: Same as /SET cmd_queue_speed, see section 3.1 -cmdmax: Same as /SET cmd_max_at_once, see section 3.1 + -port: This is pretty much like the port argument later, except + this can be used to modify existing server's port. /SERVER -remove <address> [<port>] /SERVER -list + Servers are identified by their name and port. You can have multiple + entries for the same server name but in different ports. This is + useful for IRC proxies, in one port you could have IRCNet proxy, + another port would have EFNet, etc. + + If you wish to change existing server's port to something else, use + -port command. For example if you had irc.server.org in port 6667 + and you wanted to change it to port 6668, use command: + + /SERVER -add -port 6668 irc.server.org 6667 + After connected to server, Irssi can automatically change your user mode. You can set it with /SET usermode <mode>, default is +i. 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); |