From a9ca2987bbd40fc928fdab9c690f1d9a5f7b0903 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 19 Jul 2005 12:19:06 +0000 Subject: Commands /halfop, /voice, /deop, /dehalfop, /devoice are ok for self nick (no arg) --- src/common/command.c | 2 +- src/irc/irc-commands.c | 20 +++++++++--------- src/irc/irc-send.c | 55 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/common/command.c b/src/common/command.c index b8230af9c..28da3ce4f 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -1202,7 +1202,7 @@ weechat_cmd_debug (int argc, char **argv) irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), - WEECHAT_ERROR, "perl"); + WEECHAT_ERROR, "debug"); return -1; } diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 0a1a1a69a..135a2cf71 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -62,21 +62,21 @@ t_irc_command irc_commands[] = "file: filename (on local host)"), 1, MAX_ARGS, 1, NULL, irc_cmd_send_dcc, NULL }, { "dehalfop", N_("removes half channel operator status from nickname(s)"), - N_("nickname [nickname]"), "", - 1, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL }, + N_("[nickname [nickname]]"), "", + 0, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL }, { "deop", N_("removes channel operator status from nickname(s)"), - N_("nickname [nickname]"), "", - 1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL }, + N_("[nickname [nickname]]"), "", + 0, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL }, { "devoice", N_("removes voice from nickname(s)"), - N_("nickname [nickname]"), "", - 1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL }, + N_("[nickname [nickname]]"), "", + 0, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL }, { "die", N_("shutdown the server"), "", "", 0, 0, 1, NULL, irc_cmd_send_die, NULL }, { "error", N_("error received from IRC server"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_error }, { "halfop", N_("gives half channel operator status to nickname(s)"), - N_("nickname [nickname]"), "", - 1, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL }, + N_("[nickname [nickname]]"), "", + 0, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL }, { "info", N_("get information describing the server"), N_("[target]"), N_("target: server name"), @@ -272,8 +272,8 @@ t_irc_command irc_commands[] = "nickname: nickname"), 0, 1, 1, NULL, irc_cmd_send_version, NULL }, { "voice", N_("gives voice to nickname(s)"), - N_("nickname [nickname]"), "", - 1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL }, + N_("[nickname [nickname]]"), "", + 0, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL }, { "wallops", N_("send a message to all currently connected users who have " "set the 'w' user mode for themselves"), N_("text"), N_("text to send"), diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index c4214df0a..fa1a1bb92 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -484,10 +484,17 @@ irc_cmd_send_dehalfop (t_irc_server *server, int argc, char **argv) if (BUFFER_IS_CHANNEL(gui_current_window->buffer)) { - for (i = 0; i < argc; i++) + if (argc == 0) server_sendf (server, "MODE %s -h %s\r\n", CHANNEL(gui_current_window->buffer)->name, - argv[i]); + server->nick); + else + { + for (i = 0; i < argc; i++) + server_sendf (server, "MODE %s -h %s\r\n", + CHANNEL(gui_current_window->buffer)->name, + argv[i]); + } } else { @@ -510,10 +517,17 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv) if (BUFFER_IS_CHANNEL(gui_current_window->buffer)) { - for (i = 0; i < argc; i++) + if (argc == 0) server_sendf (server, "MODE %s -o %s\r\n", CHANNEL(gui_current_window->buffer)->name, - argv[i]); + server->nick); + else + { + for (i = 0; i < argc; i++) + server_sendf (server, "MODE %s -o %s\r\n", + CHANNEL(gui_current_window->buffer)->name, + argv[i]); + } } else { @@ -536,10 +550,17 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv) if (BUFFER_IS_CHANNEL(gui_current_window->buffer)) { - for (i = 0; i < argc; i++) + if (argc == 0) server_sendf (server, "MODE %s -v %s\r\n", CHANNEL(gui_current_window->buffer)->name, - argv[i]); + server->nick); + else + { + for (i = 0; i < argc; i++) + server_sendf (server, "MODE %s -v %s\r\n", + CHANNEL(gui_current_window->buffer)->name, + argv[i]); + } } else { @@ -577,10 +598,17 @@ irc_cmd_send_halfop (t_irc_server *server, int argc, char **argv) if (BUFFER_IS_CHANNEL(gui_current_window->buffer)) { - for (i = 0; i < argc; i++) + if (argc == 0) server_sendf (server, "MODE %s +h %s\r\n", CHANNEL(gui_current_window->buffer)->name, - argv[i]); + server->nick); + else + { + for (i = 0; i < argc; i++) + server_sendf (server, "MODE %s +h %s\r\n", + CHANNEL(gui_current_window->buffer)->name, + argv[i]); + } } else { @@ -1763,10 +1791,17 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv) if (BUFFER_IS_CHANNEL(gui_current_window->buffer)) { - for (i = 0; i < argc; i++) + if (argc == 0) server_sendf (server, "MODE %s +v %s\r\n", CHANNEL(gui_current_window->buffer)->name, - argv[i]); + server->nick); + else + { + for (i = 0; i < argc; i++) + server_sendf (server, "MODE %s +v %s\r\n", + CHANNEL(gui_current_window->buffer)->name, + argv[i]); + } } else { -- cgit v1.2.3