summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-04 00:14:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-04 00:14:00 +0000
commitd0a4404bdf4b43f7888525792d2f58577a1d6122 (patch)
treea01d49cc8de1bfc1afb829762514e6f496c07415 /src/irc
parent5def50c7f600f5031468435ce432844731aef0f7 (diff)
downloadirssi-d0a4404bdf4b43f7888525792d2f58577a1d6122.zip
/NAMES: -ops -halfops -voices -normal options added. /NAMES without
parameters now prints nicklist in active channel, /NAMES ** shows all nicks in all channels. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1332 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-commands.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c
index a4f63e46..a35061bf 100644
--- a/src/irc/core/irc-commands.c
+++ b/src/irc/core/irc-commands.c
@@ -237,8 +237,9 @@ static void cmd_list(const char *data, IRC_SERVER_REC *server,
server_redirect_default((SERVER_REC *) server, "bogus command list");
}
-/* SYNTAX: WHO <nicks>|<channels>|** */
-static void cmd_who(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
+/* SYNTAX: WHO [<nicks> | <channels> | **] */
+static void cmd_who(const char *data, IRC_SERVER_REC *server,
+ WI_ITEM_REC *item)
{
char *channel, *rest;
void *free_arg;
@@ -269,26 +270,36 @@ static void cmd_who(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
server_redirect_default((SERVER_REC *) server, "bogus command who");
}
-/* SYNTAX: NAMES [-yes] [<channels>] */
-static void cmd_names(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
+static void cmd_names(const char *data, IRC_SERVER_REC *server,
+ WI_ITEM_REC *item)
{
- g_return_if_fail(data != NULL);
+ GHashTable *optlist;
+ char *channel;
+ void *free_arg;
+ g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
- if (*data == '\0') cmd_return_error(CMDERR_NOT_GOOD_IDEA);
- if (strcmp(data, "*") == 0) {
+ if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
+ PARAM_FLAG_GETREST, "names", &optlist, &channel))
+ return;
+
+ if (strcmp(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item))
- cmd_return_error(CMDERR_NOT_JOINED);
+ cmd_param_error(CMDERR_NOT_JOINED);
- data = item->name;
+ channel = item->name;
}
- if (g_strcasecmp(data, "-YES") == 0)
- irc_send_cmd(server, "NAMES");
- else
- irc_send_cmdv(server, "NAMES %s", data);
+ if (strcmp(channel, "**") == 0) {
+ /* ** displays all nicks.. */
+ irc_send_cmd(server, "NAMES");
+ } else {
+ irc_send_cmdv(server, "NAMES %s", channel);
+ }
+
+ cmd_params_free(free_arg);
}
/* SYNTAX: NICK <new nick> */