mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
/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
This commit is contained in:
parent
b4a9ee1966
commit
c7fbd670e6
@ -417,20 +417,34 @@
|
|||||||
|
|
||||||
5.4 Server settings
|
5.4 Server settings
|
||||||
|
|
||||||
/SERVER -add [-auto] [-ircnet <ircnet>] [-host <hostname>]
|
/SERVER -add [-auto | -noauto] [-ircnet <ircnet>] [-host <hostname>]
|
||||||
[-cmdspeed <ms>] [-cmdmax <count>] <address>
|
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>]
|
||||||
[<port> [<password> [<nick>]]]
|
<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
|
-ircnet: Specify what IRC network this server belongs to
|
||||||
-host: Specify what host name to use, if you have multiple
|
-host: Specify what host name to use, if you have multiple
|
||||||
-cmdspeed: Same as /SET cmd_queue_speed, see section 3.1
|
-cmdspeed: Same as /SET cmd_queue_speed, see section 3.1
|
||||||
-cmdmax: Same as /SET cmd_max_at_once, 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 -remove <address> [<port>]
|
||||||
|
|
||||||
/SERVER -list
|
/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
|
After connected to server, Irssi can automatically change your user
|
||||||
mode. You can set it with /SET usermode <mode>, default is +i.
|
mode. You can set it with /SET usermode <mode>, default is +i.
|
||||||
|
|
||||||
|
@ -81,14 +81,14 @@ static void print_reconnects(void)
|
|||||||
static void server_add(const char *data)
|
static void server_add(const char *data)
|
||||||
{
|
{
|
||||||
SETUP_SERVER_REC *rec;
|
SETUP_SERVER_REC *rec;
|
||||||
char *params, *args, *ircnet, *host, *cmdspeed, *cmdmax;
|
char *params, *args, *ircnet, *host, *cmdspeed, *cmdmax, *portarg;
|
||||||
char *addr, *portstr, *password, *nick;
|
char *addr, *portstr, *password;
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
args = "ircnet host cmdspeed cmdmax";
|
args = "ircnet host cmdspeed cmdmax port";
|
||||||
params = cmd_get_params(data, 9 | PARAM_FLAG_MULTIARGS,
|
params = cmd_get_params(data, 9 | PARAM_FLAG_MULTIARGS,
|
||||||
&args, &ircnet, &host, &cmdspeed, &cmdmax,
|
&args, &ircnet, &host, &cmdspeed, &cmdmax,
|
||||||
&addr, &portstr, &password, &nick);
|
&portarg, &addr, &portstr, &password);
|
||||||
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
port = *portstr == '\0' ? 6667 : atoi(portstr);
|
port = *portstr == '\0' ? 6667 : atoi(portstr);
|
||||||
|
|
||||||
@ -98,17 +98,19 @@ static void server_add(const char *data)
|
|||||||
rec->address = g_strdup(addr);
|
rec->address = g_strdup(addr);
|
||||||
rec->port = port;
|
rec->port = port;
|
||||||
} else {
|
} else {
|
||||||
g_free_and_null(rec->ircnet);
|
if (*portarg != '\0') rec->port = atoi(portarg);
|
||||||
g_free_and_null(rec->password);
|
if (stristr(args, "-ircnet")) g_free_and_null(rec->ircnet);
|
||||||
g_free_and_null(rec->own_host);
|
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 (*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);
|
if (*host != '\0') rec->own_host = g_strdup(host);
|
||||||
rec->cmd_queue_speed = atoi(cmdspeed);
|
if (*cmdspeed != '\0') rec->cmd_queue_speed = atoi(cmdspeed);
|
||||||
rec->max_cmds_at_once = atoi(cmdmax);
|
if (*cmdmax != '\0') rec->max_cmds_at_once = atoi(cmdmax);
|
||||||
|
|
||||||
server_setup_add(rec);
|
server_setup_add(rec);
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_SETUPSERVER_ADDED, addr, port);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_SETUPSERVER_ADDED, addr, port);
|
||||||
@ -180,7 +182,7 @@ static void cmd_server(const char *data)
|
|||||||
return;
|
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,
|
params = cmd_get_params(data, 4 | PARAM_FLAG_MULTIARGS,
|
||||||
&args, &ircnetarg, &hostarg, &addr);
|
&args, &ircnetarg, &hostarg, &addr);
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ void server_setup_add(SETUP_SERVER_REC *rec)
|
|||||||
{
|
{
|
||||||
if (g_slist_find(setupservers, rec) != NULL) {
|
if (g_slist_find(setupservers, rec) != NULL) {
|
||||||
setupserver_config_remove(rec);
|
setupserver_config_remove(rec);
|
||||||
setupservers = g_slist_append(setupservers, rec);
|
setupservers = g_slist_remove(setupservers, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
setupservers = g_slist_append(setupservers, rec);
|
setupservers = g_slist_append(setupservers, rec);
|
||||||
|
Loading…
Reference in New Issue
Block a user