diff options
author | Timo Sirainen <cras@irssi.org> | 2002-09-14 23:14:04 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-09-14 23:14:04 +0000 |
commit | a83366069fd5e31a123bd402a92d25ad62fed11e (patch) | |
tree | 55f47e0443b586da81e9b4965eb137c3bb19bab8 /src/fe-common/irc/fe-irc-server.c | |
parent | 930dd40815f09378369d02d5a77e0597eb5f7620 (diff) | |
download | irssi-a83366069fd5e31a123bd402a92d25ad62fed11e.zip |
window->active_server used to hold non-connected servers, but that was
removed before because it created several problems, especially with scripts.
however that change made /server and /disconnect annoying to use with
non-connected servers.
so, now we have window->connect_server as well. either active_server or
connect_server is set, but never both. commands that can deal properly with
non-connected servers can now use the connect_server, while everyone else
happily thinks that no server is active.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2921 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc/fe-irc-server.c')
-rw-r--r-- | src/fe-common/irc/fe-irc-server.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index 44563000..a3253cec 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -119,9 +119,22 @@ static void cmd_server_list(const char *data) g_string_free(str, TRUE); } +static void server_command(const char *data, SERVER_REC *server, + WI_ITEM_REC *item) +{ + if (server == NULL) { + /* this command accepts non-connected server too */ + server = active_win->connect_server; + } + + signal_continue(3, data, server, item); +} + void fe_irc_server_init(void) { signal_add("server add fill", (SIGNAL_FUNC) sig_server_add_fill); + command_bind_first("server", NULL, (SIGNAL_FUNC) server_command); + command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command); command_bind("server list", NULL, (SIGNAL_FUNC) cmd_server_list); command_set_options("server add", "-ircnet -cmdspeed -cmdmax -querychans"); @@ -130,5 +143,7 @@ void fe_irc_server_init(void) void fe_irc_server_deinit(void) { signal_remove("server add fill", (SIGNAL_FUNC) sig_server_add_fill); + command_unbind("server", (SIGNAL_FUNC) server_command); + command_unbind("disconnect", (SIGNAL_FUNC) server_command); command_unbind("server list", (SIGNAL_FUNC) cmd_server_list); } |