From f850204479e84c3112b6353da48a5a1ec81bb1fe Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 13 Oct 2000 22:34:19 +0000 Subject: [PATCH] "/WHOIS *" requires -yes option to work. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@738 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/irc-commands.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 170921c4..6a7bb25f 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -410,6 +410,7 @@ static char *get_redirect_nicklist(const char *nicks, int *free) /* SYNTAX: WHOIS [] [] */ static void cmd_whois(const char *data, IRC_SERVER_REC *server) { + GHashTable *optlist; char *qserver, *query; void *free_arg; int free_nick; @@ -418,15 +419,19 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server) if (!IS_IRC_SERVER(server) || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED); - if (!cmd_get_params(data, &free_arg, 2, &qserver, &query)) + if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS, + "whois", &optlist, &qserver, &query)) return; if (*query == '\0') { - cmd_params_free(free_arg); - if (!cmd_get_params(data, &free_arg, 1, &query)) return; + query = qserver; qserver = ""; } - if (*query == '\0') query = server->nick; + if (*query == '\0') query = server->nick; + + if (strcmp(query, "*") == 0 && + g_hash_table_lookup(optlist, "yes") == NULL) + cmd_param_error(CMDERR_NOT_GOOD_IDEA); if (*qserver == '\0') g_string_sprintf(tmpstr, "WHOIS %s", query); @@ -985,6 +990,7 @@ void irc_commands_init(void) command_set_options("topic", "delete"); command_set_options("list", "yes"); command_set_options("away", "one all"); + command_set_options("whois", "yes"); } void irc_commands_deinit(void)