From 8ffd58b4a85998a65a638d5cd7fc31f18590a16a Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 2 Mar 2009 11:21:30 +0100 Subject: [PATCH] Make channel optional in IRC command /mode (bug #25735) --- doc/de/autogen/irc_commands.xml | 42 ++++++++++++++--------------- doc/en/autogen/irc_commands.xml | 4 +-- doc/fr/autogen/irc_commands.xml | 4 +-- po/cs.po | 17 +++++++++--- po/de.po | 17 +++++++++--- po/es.po | 17 +++++++++--- po/fr.po | 37 +++++++++---------------- po/hu.po | 17 +++++++++--- po/ru.po | 17 +++++++++--- po/weechat.pot | 11 +++++--- src/plugins/irc/irc-command.c | 48 ++++++++++++++++++++++++++++----- src/plugins/irc/irc-command.h | 2 ++ src/plugins/irc/irc-protocol.c | 2 +- 13 files changed, 160 insertions(+), 75 deletions(-) diff --git a/doc/de/autogen/irc_commands.xml b/doc/de/autogen/irc_commands.xml index 86c4172b1..e6a492dfe 100644 --- a/doc/de/autogen/irc_commands.xml +++ b/doc/de/autogen/irc_commands.xml @@ -224,30 +224,30 @@ eine CTCP ACTION an den aktuellen Channel senden zu sendende Nachricht -/mode { Channel {[+|-]|o|p|s|i|t|n|b|v} [Limit] [User] [Bannmaske] } | {Nickname {[+|-]|i|w|s|o} } +/mode { [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname {[+|-]|i|w|s|o} } Channel- oder Usermode ändern -Channelmodi: - Channel: zu ändernder Channel - o: gib/nimm Operatorstatus - p: privater Channel - s: geheimer Channel - i: geschlossener Channel (Zutritt nur mit Einladung) - t: nur Operatoren dürfen das Topic setzen - n: keine Channelnachrichten von außerhalb des Channels - m: moderierter Channel (schreiben nur mit Voice) - l: maximale Anzahl an Usern im Channel festlegen - b: Bannmaske für zu sperrende User (in nick!ident@host-Form) - e: lege Ausnahmemaske fest - v: gib/nimm Voice (d.h. Schreibrecht bei moderierten Channels) - k: Channelkey/Channelpasswort festlegen -Usermodi: - Nickname: zu ändernder Nickname - i: User als unsichtbar kennzeichnen - s: User empfängt Server-Nachrichten - w: User empfängt WALLOPS - o: User ist Channeloperator +channel modes: + channel: channel name to modify (default is current one) + o: give/take channel operator privileges + p: private channel flag + s: secret channel flag + i: invite-only channel flag + t: topic settable by channel operator only flag + n: no messages to channel from clients on the outside + m: moderated channel + l: set the user limit to channel + b: set a ban mask to keep users out + e: set exception mask + v: give/take the ability to speak on a moderated channel + k: set a channel key (password) +user modes: + nickname: nickname to modify + i: mark a user as invisible + s: mark a user for receive server notices + w: user receives wallops + o: operator flag /motd [Ziel] diff --git a/doc/en/autogen/irc_commands.xml b/doc/en/autogen/irc_commands.xml index b60face1e..47a4c5553 100644 --- a/doc/en/autogen/irc_commands.xml +++ b/doc/en/autogen/irc_commands.xml @@ -224,12 +224,12 @@ send a CTCP action to the current channel message: message to send -/mode { channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname {[+|-]|i|w|s|o} } +/mode { [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname {[+|-]|i|w|s|o} } change channel or user mode channel modes: - channel: channel name to modify + channel: channel name to modify (default is current one) o: give/take channel operator privileges p: private channel flag s: secret channel flag diff --git a/doc/fr/autogen/irc_commands.xml b/doc/fr/autogen/irc_commands.xml index d62ecb902..41bceba7f 100644 --- a/doc/fr/autogen/irc_commands.xml +++ b/doc/fr/autogen/irc_commands.xml @@ -224,12 +224,12 @@ envoyer une action CTCP au canal courant message: message à envoyer -/mode { canal {[+|-]|o|p|s|i|t|n|b|v} [limite] [utilisateur] [masque de banissement] } | { pseudo {[+|-]|i|w|s|o} } +/mode { [canal] {[+|-]|o|p|s|i|t|n|b|v} [limite] [utilisateur] [masque de banissement] } | { pseudo {[+|-]|i|w|s|o} } changer le mode du canal ou de l'utilisateur modes de canaux: - canal: nom du canal à modifier + canal: nom du canal à modifier (par défaut le canal courant) o: donner/reprendre le statut privilégié d'opérateur p: indicateur de canal privé s: indicateur de canal secret diff --git a/po/cs.po b/po/cs.po index 2073674e5..0a8bf65c7 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -2481,6 +2481,11 @@ msgstr "%s \"%s\" není validní regulární výraz (%s)\n" msgid "%s%s: not enough memory for regular expression" msgstr "%s nedostatek paměti pro regulární výraz\n" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" + #, fuzzy, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -2886,16 +2891,18 @@ msgstr "poslat CTCP akci na aktuální kanál" msgid "change channel or user mode" msgstr "změní mód kanálu nebo uživatele" +#, fuzzy msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" "{ kanál {[+|-]|o|p|s|i|t|n|b|v} [limit] [uživatel] [maska k zakázání] } | " "{ přezdívka {[+|-]|i|w|s|o} }" +#, fuzzy msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" @@ -5468,6 +5475,10 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s chybí argument pro volbu \"%s\"\n" +#, fuzzy +#~ msgid "%s%s: unknown/missing channel name for \"%s\" command" +#~ msgstr "%s chybí argumenty pro příkaz \"%s\"\n" + #, fuzzy #~ msgid "" #~ "%s%s: command \"%s\" must be executed on irc buffer (server/channel/pv)" diff --git a/po/de.po b/po/de.po index 9625225ac..14b957a8f 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -2491,6 +2491,11 @@ msgstr "%s \"%s\" ist kein korrekter regulärer Ausdruck (%s)\n" msgid "%s%s: not enough memory for regular expression" msgstr "%s nicht genügend Speicher für regulären Ausdruck vorhanden\n" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" + #, fuzzy, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -2889,16 +2894,18 @@ msgstr "eine CTCP ACTION an den aktuellen Channel senden" msgid "change channel or user mode" msgstr "Channel- oder Usermode ändern" +#, fuzzy msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" "{ Channel {[+|-]|o|p|s|i|t|n|b|v} [Limit] [User] [Bannmaske] } | {Nickname " "{[+|-]|i|w|s|o} }" +#, fuzzy msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" @@ -5405,6 +5412,10 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" +#, fuzzy +#~ msgid "%s%s: unknown/missing channel name for \"%s\" command" +#~ msgstr "%s fehlende Argumente für den \"%s\"-Befehl\n" + #, fuzzy #~ msgid "" #~ "%s%s: command \"%s\" must be executed on irc buffer (server/channel/pv)" diff --git a/po/es.po b/po/es.po index b340f50ae..a1fa7176e 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -2466,6 +2466,11 @@ msgstr "%s \"%s\" no es una expresión regular válida (%s)\n" msgid "%s%s: not enough memory for regular expression" msgstr "%s no hay suficiente memoria para la expresión regular\n" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" + #, fuzzy, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -2869,16 +2874,18 @@ msgstr "enviar una acción CTCP al canal actual" msgid "change channel or user mode" msgstr "cambiar modo del canal o del usuario" +#, fuzzy msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" "{ canal {[+|-]|o|p|s|i|t|n|b|v} [limitar] [usuario] [máscara de baneo] } | " "{ usuario {[+|-]|i|w|s|o} }" +#, fuzzy msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" @@ -5401,6 +5408,10 @@ msgstr "%s no es posible crear el servidor\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s falta un argumento para la opción --dir\n" +#, fuzzy +#~ msgid "%s%s: unknown/missing channel name for \"%s\" command" +#~ msgstr "%s faltan argumentos para el comando \"%s\"\n" + #, fuzzy #~ msgid "" #~ "%s%s: command \"%s\" must be executed on irc buffer (server/channel/pv)" diff --git a/po/fr.po b/po/fr.po index a38fa3fa7..55359839b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" -"PO-Revision-Date: 2009-02-26 09:54+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" +"PO-Revision-Date: 2009-03-02 10:34+0100\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2588,6 +2588,13 @@ msgstr "%s%s: \"%s\" n'est pas une expression régulière valide (%s)" msgid "%s%s: not enough memory for regular expression" msgstr "%s%s: pas assez de mémoire pour l'expression régulière" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" +"%s%s: vous devez spécifier le canal pour la commande \"%s\" si vous n'êtes " +"pas sur un canal" + #, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -3003,15 +3010,15 @@ msgid "change channel or user mode" msgstr "changer le mode du canal ou de l'utilisateur" msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" -"{ canal {[+|-]|o|p|s|i|t|n|b|v} [limite] [utilisateur] [masque de " +"{ [canal] {[+|-]|o|p|s|i|t|n|b|v} [limite] [utilisateur] [masque de " "banissement] } | { pseudo {[+|-]|i|w|s|o} }" msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" @@ -3032,7 +3039,7 @@ msgid "" " o: operator flag" msgstr "" "modes de canaux:\n" -" canal: nom du canal à modifier\n" +" canal: nom du canal à modifier (par défaut le canal courant)\n" " o: donner/reprendre le statut privilégié d'opérateur\n" " p: indicateur de canal privé\n" " s: indicateur de canal secret\n" @@ -5580,21 +5587,3 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket" #, c-format msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s" - -#~ msgid "" -#~ "%s%s: command \"%s\" must be executed on irc buffer (server/channel/pv)" -#~ msgstr "" -#~ "%s%s: la commande \"%s\" doit être exécutée sur un tampon irc (serveur/" -#~ "canal/pv)" - -#~ msgid "nickname text" -#~ msgstr "pseudo texte" - -#~ msgid "nickname [text]" -#~ msgstr "pseudo [texte]" - -#~ msgid "data" -#~ msgstr "données" - -#~ msgid "data: raw data to send" -#~ msgstr "données: données brutes à envoyer" diff --git a/po/hu.po b/po/hu.po index a19c869e9..d729c6fed 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2498,6 +2498,11 @@ msgstr "%s a(z) \"%s\" érvénytelen reguláris kifejezés (%s)\n" msgid "%s%s: not enough memory for regular expression" msgstr "%s nincs elég memória a reguláris kifejezéshez\n" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" + #, fuzzy, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -2904,16 +2909,18 @@ msgstr "CTCP parancs küldése az aktuális szobába" msgid "change channel or user mode" msgstr "szoba vagy felhasználó állapotának változtatása" +#, fuzzy msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" "{ szoba {[+|-]|o|p|s|i|t|n|b|v} [limit] [felhasználó] [tiltási maszk] } | " "{ név {[+|-]|i|w|s|o} }" +#, fuzzy msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" @@ -5459,6 +5466,10 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" +#, fuzzy +#~ msgid "%s%s: unknown/missing channel name for \"%s\" command" +#~ msgstr "%s hiányzó argumentum a \"%s\" parancsnak\n" + #, fuzzy #~ msgid "" #~ "%s%s: command \"%s\" must be executed on irc buffer (server/channel/pv)" diff --git a/po/ru.po b/po/ru.po index 33c87104e..054c359b4 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" "PO-Revision-Date: 2009-01-03 00:42+0100\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -2502,6 +2502,11 @@ msgstr "%s \"%s\" не является регулярным выражение msgid "%s%s: not enough memory for regular expression" msgstr "%s недостаточно памяти для регулярного выражения\n" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" + #, fuzzy, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -2905,16 +2910,18 @@ msgstr "отправить CTCP-действие на текущий канал" msgid "change channel or user mode" msgstr "сменить режим канала или пользователя" +#, fuzzy msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" "{ канал {[+|-]|o|p|s|i|t|n|b|v} [лимит] [пользователь] [маска бана] } | " "{ ник {[+|-]|i|w|s|o} }" +#, fuzzy msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" @@ -5430,6 +5437,10 @@ msgstr "%s DCC: не могу установить неблокирующий р msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s нет аргумента для параметра \"%s\"\n" +#, fuzzy +#~ msgid "%s%s: unknown/missing channel name for \"%s\" command" +#~ msgstr "%s нет аргументов для \"%s\" команды\n" + #, fuzzy #~ msgid "" #~ "%s%s: command \"%s\" must be executed on irc buffer (server/channel/pv)" diff --git a/po/weechat.pot b/po/weechat.pot index 2a119d42b..9281c9710 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-02-26 09:53+0100\n" +"POT-Creation-Date: 2009-03-02 10:33+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2165,6 +2165,11 @@ msgstr "" msgid "%s%s: not enough memory for regular expression" msgstr "" +#, c-format +msgid "" +"%s%s: you must specify channel for \"%s\" command if you're not in a channel" +msgstr "" + #, c-format msgid "" "%s%s: \"%s\" command can only be executed in a channel or private buffer" @@ -2510,13 +2515,13 @@ msgid "change channel or user mode" msgstr "" msgid "" -"{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " +"{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }" msgstr "" msgid "" "channel modes:\n" -" channel: channel name to modify\n" +" channel: channel name to modify (default is current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 97361203e..44a19a968 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1898,9 +1898,22 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv, */ void -irc_command_mode_server (struct t_irc_server *server, const char *arguments) +irc_command_mode_server (struct t_irc_server *server, + struct t_irc_channel *channel, const char *arguments) { - irc_server_sendf (server, "MODE %s", arguments); + if (server && (channel || arguments)) + { + if (channel && arguments) + { + irc_server_sendf (server, "MODE %s %s", + channel->name, arguments); + } + else + { + irc_server_sendf (server, "MODE %s", + (channel) ? channel->name : arguments); + } + } } /* @@ -1911,15 +1924,35 @@ int irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("mode", 1); /* make C compiler happy */ (void) data; - (void) argv; if (argc > 1) - irc_command_mode_server (ptr_server, argv_eol[1]); + { + if ((argv[1][0] == '+') || (argv[1][0] == '-') + || !irc_channel_is_channel (argv[1])) + { + /* channel not specified, check we are on channel and use it */ + if (!ptr_channel) + { + weechat_printf (ptr_server->buffer, + _("%s%s: you must specify channel for \"%s\" " + "command if you're not in a channel"), + irc_buffer_get_server_prefix (ptr_server, "error"), + IRC_PLUGIN_NAME, "mode"); + return WEECHAT_RC_OK; + } + irc_command_mode_server (ptr_server, ptr_channel, argv_eol[1]); + } + else + { + /* user gives channel, use arguments as-is */ + irc_command_mode_server (ptr_server, NULL, argv_eol[1]); + } + } else { IRC_COMMAND_TOO_FEW_ARGUMENTS(ptr_server->buffer, "mode"); @@ -3888,11 +3921,12 @@ irc_command_init () NULL, &irc_command_me, NULL); weechat_hook_command ("mode", N_("change channel or user mode"), - N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] " + N_("{ [channel] {[+|-]|o|p|s|i|t|n|b|v} [limit] " "[user] [ban mask] } | { nickname " "{[+|-]|i|w|s|o} }"), N_("channel modes:\n" - " channel: channel name to modify\n" + " channel: channel name to modify (default is " + "current one)\n" " o: give/take channel operator privileges\n" " p: private channel flag\n" " s: secret channel flag\n" diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h index aa23fee9e..045a933bf 100644 --- a/src/plugins/irc/irc-command.h +++ b/src/plugins/irc/irc-command.h @@ -21,6 +21,7 @@ #define __WEECHAT_IRC_COMMAND_H 1 struct t_irc_server; +struct t_irc_channel; #define IRC_COMMAND_TOO_FEW_ARGUMENTS(__buffer, __command) \ weechat_printf (__buffer, \ @@ -56,6 +57,7 @@ extern void irc_command_away_server (struct t_irc_server *server, extern void irc_command_join_server (struct t_irc_server *server, const char *arguments); extern void irc_command_mode_server (struct t_irc_server *server, + struct t_irc_channel *channel, const char *arguments); extern void irc_command_part_channel (struct t_irc_server *server, const char *channel_name, diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index e395cbe97..e1173e1ab 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3963,7 +3963,7 @@ irc_protocol_cmd_366 (struct t_irc_server *server, const char *command, _("normal"), IRC_COLOR_CHAT_DELIMITERS); - irc_command_mode_server (server, ptr_channel->name); + irc_command_mode_server (server, ptr_channel, NULL); irc_channel_check_away (server, ptr_channel, 1); } else