diff options
author | Timo Sirainen <cras@irssi.org> | 2000-08-12 02:16:52 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-08-12 02:16:52 +0000 |
commit | 308e84bbc44db92fbb1fe0c2e177ae981865b788 (patch) | |
tree | 999d7f2daadda55483c4ccf3df3d938095d7429d /src/fe-common/irc/fe-irc-commands.c | |
parent | 81af47808b0d9ef1a0a7637ae3e296054215a2a2 (diff) | |
download | irssi-308e84bbc44db92fbb1fe0c2e177ae981865b788.zip |
WJOIN -> /JOIN -window
WQUERY -> /QUERY -window.
Added support for /QUERY -<server tag>.
Added aliases for WJOIN and WQUERY to default config file.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@590 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc/fe-irc-commands.c')
-rw-r--r-- | src/fe-common/irc/fe-irc-commands.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index d539ac70..260acbba 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -63,8 +63,11 @@ static void cmd_unquery(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *it /* SYNTAX: QUERY <nick> */ static void cmd_query(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) { + GHashTable *optlist; WINDOW_REC *window; QUERY_REC *query; + char *nick; + void *free_arg; g_return_if_fail(data != NULL); @@ -74,21 +77,33 @@ static void cmd_query(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item return; } - if (*data != '=' && (server == NULL || !server->connected)) - cmd_return_error(CMDERR_NOT_CONNECTED); + if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS | + PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_GETREST, + "query", &optlist, &nick)) + return; + if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); + server = irccmd_options_get_server("query", optlist, server); + if (server == NULL) { + cmd_params_free(free_arg); + return; + } + + if (*nick != '=' && (server == NULL || !server->connected)) + cmd_param_error(CMDERR_NOT_CONNECTED); - query = query_find(server, data); - if (query != NULL) { + query = query_find(server, nick); + if (query == NULL) + query_create(server, nick, FALSE); + else { /* query already existed - change to query window */ window = window_item_window((WI_ITEM_REC *) query); g_return_if_fail(window != NULL); window_set_active(window); window_item_set_active(window, (WI_ITEM_REC *) query); - return; } - query_create(server, data, FALSE); + cmd_params_free(free_arg); } static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) @@ -109,7 +124,7 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) "msg", &optlist, &target, &msg)) return; if (*target == '\0' || *msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - server = irccmd_options_get_server(optlist, server); + server = irccmd_options_get_server("msg", optlist, server); if (*target == '=') { |