diff options
50 files changed, 668 insertions, 562 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 58b5c7220..07b11f0db 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -27,6 +27,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] of status bar * core: allow incomplete commands if unambiguous, new option weechat.look.command_incomplete (task #5419) +* api: send value returned by command callback in function command(), remove + WeeChat error after command callback if return code is WEECHAT_RC_ERROR * api: add regex replace feature in function string_eval_expression * api: use microseconds instead of milliseconds in functions util_timeval_diff and util_timeval_add diff --git a/ReleaseNotes.asciidoc b/ReleaseNotes.asciidoc index 67726aa45..c17097aaf 100644 --- a/ReleaseNotes.asciidoc +++ b/ReleaseNotes.asciidoc @@ -56,6 +56,18 @@ You can restore the default "beep" trigger with the following command: /trigger restore beep ---- +=== Return code of commands + +The API function 'weechat_command' now sends the value returned return by +command callback. + +WeeChat does not display any more an error when a command returns +'WEECHAT_RC_ERROR'. Consequently, all plugins/scripts should display an +explicit error message before returning 'WEECHAT_RC_ERROR'. + +For C plugins, two macros have been added in weechat-plugin.h: +'WEECHAT_COMMAND_MIN_ARGS' and 'WEECHAT_COMMAND_ERROR'. + === Completion of inline commands WeeChat now completes by default inline commands (not only at beginning of diff --git a/doc/en/weechat_plugin_api.en.asciidoc b/doc/en/weechat_plugin_api.en.asciidoc index 60f38f86b..4a3b26f15 100644 --- a/doc/en/weechat_plugin_api.en.asciidoc +++ b/doc/en/weechat_plugin_api.en.asciidoc @@ -12472,13 +12472,15 @@ Functions for executing WeeChat commands. ==== weechat_command +_Updated in 1.1._ + Execute a command. Prototype: [source,C] ---- -void weechat_command (struct t_gui_buffer *buffer, const char *command); +int weechat_command (struct t_gui_buffer *buffer, const char *command); ---- Arguments: @@ -12488,12 +12490,18 @@ Arguments: * 'command': command to execute (if beginning with a "/"), or text to send to buffer +Return value: (_WeeChat ≥ 1.1_) + +* 'WEECHAT_RC_OK' if successful +* 'WEECHAT_RC_ERROR' if error + C example: [source,C] ---- -weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), - "/whois FlashCode"); +int rc; +rc = weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), + "/whois FlashCode"); ---- Script (Python): @@ -12504,7 +12512,7 @@ Script (Python): weechat.command(buffer, command) # example -weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") +rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") ---- [[network]] diff --git a/doc/fr/weechat_plugin_api.fr.asciidoc b/doc/fr/weechat_plugin_api.fr.asciidoc index cb073f653..07cd32ec9 100644 --- a/doc/fr/weechat_plugin_api.fr.asciidoc +++ b/doc/fr/weechat_plugin_api.fr.asciidoc @@ -12719,13 +12719,15 @@ Fonctions pour exécuter des commandes WeeChat. ==== weechat_command +_Mis à jour dans la 1.1._ + Exécuter une commande. Prototype : [source,C] ---- -void weechat_command (struct t_gui_buffer *buffer, const char *command); +int weechat_command (struct t_gui_buffer *buffer, const char *command); ---- Paramètres : @@ -12735,12 +12737,18 @@ Paramètres : * 'command' : commande à exécuter (si elle commence par "/"), ou texte à envoyer au tampon +Valeur de retour : (_WeeChat ≥ 1.1_) + +* 'WEECHAT_RC_OK' si ok +* 'WEECHAT_RC_ERROR' si erreur + Exemple en C : [source,C] ---- -weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), - "/whois FlashCode"); +int rc; +rc = weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), + "/whois FlashCode"); ---- Script (Python) : @@ -12751,7 +12759,7 @@ Script (Python) : weechat.command(buffer, command) # exemple -weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") +rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") ---- [[network]] diff --git a/doc/it/weechat_plugin_api.it.asciidoc b/doc/it/weechat_plugin_api.it.asciidoc index 01318a8a2..b7367d5c6 100644 --- a/doc/it/weechat_plugin_api.it.asciidoc +++ b/doc/it/weechat_plugin_api.it.asciidoc @@ -12838,13 +12838,16 @@ Funzioni per eseguire comandi di WeeChat. ==== weechat_command +// TRANSLATION MISSING +_Updated in 1.1._ + Esegue un comando. Prototipo: [source,C] ---- -void weechat_command (struct t_gui_buffer *buffer, const char *command); +int weechat_command (struct t_gui_buffer *buffer, const char *command); ---- Argomenti: @@ -12854,12 +12857,18 @@ Argomenti: * 'command': comando da eseguire (se preceduto da "/"), oppure il testo viene inviato sul buffer +Valori restituiti: (_WeeChat ≥ 1.1_) + +* 'WEECHAT_RC_OK' se l'operazione ha successo +* 'WEECHAT_RC_ERROR' se c'è un errore + Esempio in C: [source,C] ---- -weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), - "/whois FlashCode"); +int rc; +rc = weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), + "/whois FlashCode"); ---- Script (Python): @@ -12870,7 +12879,7 @@ Script (Python): weechat.command(buffer, command) # esempio -weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") +rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") ---- [[network]] diff --git a/doc/ja/weechat_plugin_api.ja.asciidoc b/doc/ja/weechat_plugin_api.ja.asciidoc index b5199cc7d..88190bb28 100644 --- a/doc/ja/weechat_plugin_api.ja.asciidoc +++ b/doc/ja/weechat_plugin_api.ja.asciidoc @@ -12463,13 +12463,15 @@ WeeChat コマンドを実行する関数。 ==== weechat_command +_バージョン 1.1 で更新。_ + コマンドを実行。 プロトタイプ: [source,C] ---- -void weechat_command (struct t_gui_buffer *buffer, const char *command); +int weechat_command (struct t_gui_buffer *buffer, const char *command); ---- 引数: @@ -12479,12 +12481,19 @@ void weechat_command (struct t_gui_buffer *buffer, const char *command); * 'command': 実行するコマンド ("/" で始まっている場合)、またはバッファに送信するテキスト +// TRANSLATION MISSING +Return value: (_WeeChat ≥ 1.1_) + +* 'WEECHAT_RC_OK' if successful +* 'WEECHAT_RC_ERROR' if error + C 言語での使用例: [source,C] ---- -weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), - "/whois FlashCode"); +int rc; +rc = weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), + "/whois FlashCode"); ---- スクリプト (Python) での使用例: @@ -12495,7 +12504,7 @@ weechat_command (weechat_buffer_search ("irc", "freenode.#weechat"), weechat.command(buffer, command) # 例 -weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") +rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode") ---- [[network]] @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2545,6 +2545,14 @@ msgstr "" " posunout na začátek aktuálního dne:\n" " /window scroll -d" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%sChyba s příkazem \"%s\" (zkuste /help %s)" + +#, fuzzy, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%sChyba s příkazem \"%s\" (zkuste /help %s)" + msgid "names of buffers" msgstr "jména bufferů" @@ -3800,10 +3808,6 @@ msgstr "" msgid "%sYou can not write text in this buffer" msgstr "%sDo tohoto bufferu nemůžete zapisovat text" -#, fuzzy, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%sChyba s příkazem \"%s\" (zkuste /help %s)" - #, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%sChyba: neznámý příkaz \"%s\" (napište /help pro nápovědu)" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-15 19:32+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -167,8 +167,8 @@ msgstr "" " --upgrade führt ein WeeChat Upgrade mittels " "Sitzungsdateien, die mit dem Befehl `/upgrade -quit` erstellt wurden, durch\n" " -v, --version zeigt die Version von WeeChat an\n" -" plugin:option Einstellungen für Erweiterungen (siehe man weechat-" -"curses)\n" +" plugin:option Einstellungen für Erweiterungen (siehe man " +"weechat-curses)\n" #, c-format msgid "Error: missing argument for \"%s\" option\n" @@ -466,7 +466,8 @@ msgstr "Farbe" #, c-format msgid "%sNo help available, \"%s\" is not a command or an option" -msgstr "%sKeine Hilfe verfügbar. \"%s\" ist weder ein Befehl noch eine Einstellung" +msgstr "" +"%sKeine Hilfe verfügbar. \"%s\" ist weder ein Befehl noch eine Einstellung" msgid "Buffer command history:" msgstr "Befehlsverlauf des Buffers:" @@ -755,7 +756,8 @@ msgstr "Proxy gelöscht" #, c-format msgid "%sError: unable to set option \"%s\" for proxy \"%s\"" -msgstr "%sFehler: Einstellung \"%s\" kann für den Proxy \"%s\" nicht gesetzt werden" +msgstr "" +"%sFehler: Einstellung \"%s\" kann für den Proxy \"%s\" nicht gesetzt werden" #, c-format msgid "" @@ -843,8 +845,8 @@ msgid "" "%sOption \"%s\" not found (tip: you can use wildcard \"*\" in option to see " "a sublist)" msgstr "" -"%sEinstellung \"%s\" nicht gefunden (Tipp: Der Platzhalter \"*\" kann verwendet " -"werden um sich eine Teilliste anzeigen zu lassen)" +"%sEinstellung \"%s\" nicht gefunden (Tipp: Der Platzhalter \"*\" kann " +"verwendet werden um sich eine Teilliste anzeigen zu lassen)" msgid "No option found" msgstr "Keine Einstellungen gefunden" @@ -854,7 +856,8 @@ msgid "%s%d%s option with value changed (matching with \"%s\")" msgid_plural "%s%d%s options with value changed (matching with \"%s\")" msgstr[0] "%s%d%s Einstellungen mit abweichendem Wert (Suchmuster: \"%s\")" msgstr[1] "" -"%s%d%s Einstellungen, bei denen die Werte abweichend sind (Suchmuster: \"%s\")" +"%s%d%s Einstellungen, bei denen die Werte abweichend sind (Suchmuster: \"%s" +"\")" #, c-format msgid "%s%d%s option (matching with \"%s\")" @@ -1108,8 +1111,8 @@ msgstr "" " item1,...: Items die in der Infobar genutzt werden sollen (Items können " "durch Kommata oder Leerzeichen getrennt werden (\"+\" (verbindet Items))\n" " default: erstellt standardisierte Infobars\n" -" del: entfernt eine Infobar (alle Infobars können mit dem Argument \"-" -"all\" entfernt werden).\n" +" del: entfernt eine Infobar (alle Infobars können mit dem Argument " +"\"-all\" entfernt werden).\n" " set: setzt einen Wert für Infobar\n" " option: Option die verändert werden soll (für eine Liste aller " "möglichen Optionen, bitte folgenden Befehl nutzen: /set weechat.bar." @@ -1781,7 +1784,8 @@ msgstr "" "-listfull: zeigt alle Befehle mit Beschreibung, nach Erweiterung\n" " plugin: zeigt Befehle explizit für diese Erweiterung an\n" " command: Name eines Befehls\n" -" option: Name einer Einstellung (nutze /set um Einstellungen anzeigen zu lassen)" +" option: Name einer Einstellung (nutze /set um Einstellungen anzeigen zu " +"lassen)" msgid "show buffer command history" msgstr "Zeigt den Befehlsverlauf des Buffers" @@ -2139,7 +2143,8 @@ msgstr "" "wiederhergestellt wird (sinnvoll um die Mausunterstützung zeitabhängig zu " "deaktivieren)\n" "\n" -"Die Mausunterstützung wird in der Einstellung \"weechat.look.mouse\" gesichert.\n" +"Die Mausunterstützung wird in der Einstellung \"weechat.look.mouse\" " +"gesichert.\n" "\n" "Beispiele:\n" " Mausunterstützung aktivieren:\n" @@ -2308,8 +2313,8 @@ msgstr "" "-stderr: Text wird an stderr geschickt (Escapesequenzen werden umgewandelt)\n" " -beep: Alias für \"-stderr \\a\"\n" "\n" -"Das Argument -action ... -quit nutzt den Präfix der in der Einstellung \"weechat." -"look.prefix_*\" definiert ist.\n" +"Das Argument -action ... -quit nutzt den Präfix der in der Einstellung " +"\"weechat.look.prefix_*\" definiert ist.\n" "\n" "Folgende Escapesequenzen werden unterstützt:\n" " \\\" \\\\ \\a \\b \\e \\f \\n \\r \\t \\v \\0ooo \\xhh \\uhhhh " @@ -2607,8 +2612,8 @@ msgid "" " unset environment variable ABC:\n" " /set env ABC \"\"" msgstr "" -"option: Name der zu ändernden Einstellung (um mehrere Einstellungen anzuzeigen, kann " -"der Platzhalter \"*\" verwendet werden)\n" +"option: Name der zu ändernden Einstellung (um mehrere Einstellungen " +"anzuzeigen, kann der Platzhalter \"*\" verwendet werden)\n" " value: neuer Wert den die Einstellung erhalten soll. Abhängig von der " "ausgewählten Einstellung, kann die Variable folgenden Inhalt haben:\n" " boolean: on, off oder toggle\n" @@ -2666,9 +2671,9 @@ msgstr "" "verwendet werden um viele Optionen in einem Arbeitsschritt zurückzusetzen. " "Nutzen Sie diese Funktion mit äußerster Sorgfalt!)\n" "\n" -"Gemäß der jeweiligen Einstellung wird diese zurückgesetzt (bei Standardeinstellungen) " -"oder komplett entfernt (bei optionalen Einstellungen, zum Beispiel die " -"Server-Einstellungen).\n" +"Gemäß der jeweiligen Einstellung wird diese zurückgesetzt (bei " +"Standardeinstellungen) oder komplett entfernt (bei optionalen Einstellungen, " +"zum Beispiel die Server-Einstellungen).\n" "\n" "Beispiele:\n" " Eine Einstellung zurücksetzen:\n" @@ -2970,6 +2975,14 @@ msgstr "" " aktiviert den einfachen Anzeigemodus für zwei Sekunden:\n" " /window bare 2" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%sFehler mit dem Befehl \"%s\" aufgetreten (nutze: /help %s)" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%sFehler mit dem Befehl \"%s\" aufgetreten (nutze: /help %s)" + msgid "names of buffers" msgstr "Auflistung der vorhandenen Buffer" @@ -3091,8 +3104,9 @@ msgid "" "WARNING: this option can cause serious display bugs, if you have such " "problems, you must turn off this option." msgstr "" -"WARNUNG: Diese Einstellung kann schwerwiegende Grafikfehler verursachen. Sollten " -"Grafikfehler auftreten dann ist es ratsam diese Einstellung zu deaktivieren." +"WARNUNG: Diese Einstellung kann schwerwiegende Grafikfehler verursachen. " +"Sollten Grafikfehler auftreten dann ist es ratsam diese Einstellung zu " +"deaktivieren." #, c-format msgid "" @@ -3114,7 +3128,8 @@ msgstr "%sFehler: Wert bei Einstellung für Palette muss numerisch sein" #, c-format msgid "%sWarning: unknown option for section \"%s\": %s (value: \"%s\")" -msgstr "%sWarnung: unbekannte Einstellung für Sektion \"%s\": %s (Wert: \"%s\")" +msgstr "" +"%sWarnung: unbekannte Einstellung für Sektion \"%s\": %s (Wert: \"%s\")" msgid "Notify level for buffer" msgstr "Benachrichtigungsstufe für Buffer" @@ -3169,16 +3184,16 @@ msgid "" "\"horizontal\")" msgstr "" "Zeichen welches anzeigt, dass die Bar nach links gescrollt werden kann (dies " -"trifft nur auf Bars zu bei denen die Einstellung \"/set *.filling_*\" nicht auf " -"\"horizontal\" eingestellt ist)" +"trifft nur auf Bars zu bei denen die Einstellung \"/set *.filling_*\" nicht " +"auf \"horizontal\" eingestellt ist)" msgid "" "string displayed when bar can be scrolled to the right (for bars with " "filling \"horizontal\")" msgstr "" "Zeichen welches anzeigt, dass die Bar nach rechts gescrollt werden kann " -"(dies trifft nur auf Bars zu bei denen die Einstellung \"/set *.filling_*\" nicht " -"auf \"horizontal\" eingestellt ist)" +"(dies trifft nur auf Bars zu bei denen die Einstellung \"/set *.filling_*\" " +"nicht auf \"horizontal\" eingestellt ist)" msgid "" "string displayed when bar can be scrolled up (for bars with filling " @@ -3193,8 +3208,8 @@ msgid "" "different from \"horizontal\")" msgstr "" "Zeichen welches anzeigt, dass die Bar nach unten gescrollt werden kann (dies " -"trifft nur auf Bars zu bei denen die Einstellung \"/set *.filling_*\" nicht auf " -"\"horizontal\" eingestellt ist)" +"trifft nur auf Bars zu bei denen die Einstellung \"/set *.filling_*\" nicht " +"auf \"horizontal\" eingestellt ist)" msgid "" "automatically renumber buffers to have only consecutive numbers and start " @@ -3202,9 +3217,9 @@ msgid "" "first buffer can have a number greater than 1" msgstr "" "automatisches nummerieren von Buffern um ausschließlich eine aufeinander " -"folgende Durchnummerierung zu besitzen, die bei 1 beginnt; ist diese Einstellung " -"deaktiviert sind Lücken zwischen den Buffern möglich und der erste Buffer " -"muss nicht mit der Zahl 1 beginnen" +"folgende Durchnummerierung zu besitzen, die bei 1 beginnt; ist diese " +"Einstellung deaktiviert sind Lücken zwischen den Buffern möglich und der " +"erste Buffer muss nicht mit der Zahl 1 beginnen" msgid "" "default notify level for buffers (used to tell WeeChat if buffer must be " @@ -3349,9 +3364,9 @@ msgstr "" "falls diese Einstellung aktiviert ist, wird echtes weiß als Farbe genutzt. " "Standardmäßig ist diese Einstellung deaktiviert, damit keine Probleme bei " "Terminals auftreten, die einen weißen Hintergrund nutzen (falls man keinen " -"weißen Hintergrund nutzt, dann ist es ratsam diese Einstellung zu aktivieren. " -"Andernfalls wird die voreingestellte Vordergrundfarbe des Terminals " -"verwendet)" +"weißen Hintergrund nutzt, dann ist es ratsam diese Einstellung zu " +"aktivieren. Andernfalls wird die voreingestellte Vordergrundfarbe des " +"Terminals verwendet)" msgid "" "chars used to determine if input string is a command or not: input must " @@ -3373,8 +3388,8 @@ msgid "" "if set, /quit command must be confirmed with extra argument \"-yes\" (see /" "help quit)" msgstr "" -"ist diese Einstellung aktiviert, muss der \"/quit\" Befehl mit dem Argument \"-yes" -"\" ausgeführt werden (siehe /help quit)" +"ist diese Einstellung aktiviert, muss der \"/quit\" Befehl mit dem Argument " +"\"-yes\" ausgeführt werden (siehe /help quit)" msgid "display special message when day changes" msgstr "bei einem Datumswechsel wird eine entsprechende Nachricht angezeigt" @@ -3413,11 +3428,12 @@ msgid "" "text from WeeChat to another application (this option is disabled by default " "because it can cause serious display bugs)" msgstr "" -"aktiviert man diese Einstellung, dann wird \"eat_newline_glitch\" auf 0 gesetzt; " -"dies bedeutet, dass am Ende einer Zeile kein Zeilenumbruch an gehangen wird " -"und somit der Text beim kopieren aus WeeChat und beim einfügen in einer " -"anderen Applikation nicht umgebrochen wird (diese Einstellung ist standardmäßig " -"deaktiviert, da es zu schwerwiegenden Grafikfehlern kommen kann)" +"aktiviert man diese Einstellung, dann wird \"eat_newline_glitch\" auf 0 " +"gesetzt; dies bedeutet, dass am Ende einer Zeile kein Zeilenumbruch an " +"gehangen wird und somit der Text beim kopieren aus WeeChat und beim einfügen " +"in einer anderen Applikation nicht umgebrochen wird (diese Einstellung ist " +"standardmäßig deaktiviert, da es zu schwerwiegenden Grafikfehlern kommen " +"kann)" msgid "" "attributes for emphasized text: one or more attribute chars (\"*\" for bold, " @@ -3528,8 +3544,8 @@ msgstr "" msgid "if set, force display of names in hotlist for merged buffers" msgstr "" -"ist diese Einstellung aktiviert, werden die Namen der zusammengefügten Buffer in " -"der Hotlist dargestellt" +"ist diese Einstellung aktiviert, werden die Namen der zusammengefügten " +"Buffer in der Hotlist dargestellt" msgid "text displayed at the beginning of the hotlist" msgstr "Text der vor der Hotlist angezeigt werden soll" @@ -3545,9 +3561,9 @@ msgid "" "if set, uses short names to display buffer names in hotlist (start after " "first '.' in name)" msgstr "" -"ist diese Einstellung aktiviert, wird der Kurzname der zusammengefügten Buffer in " -"der Hotlist dargestellt (die Darstellung geschieht nach dem ersten '.' im " -"Namen)" +"ist diese Einstellung aktiviert, wird der Kurzname der zusammengefügten " +"Buffer in der Hotlist dargestellt (die Darstellung geschieht nach dem ersten " +"'.' im Namen)" msgid "" "sort of hotlist: group_time_*: group by notify level (highlights first) then " @@ -3814,8 +3830,8 @@ msgstr "" msgid "always show read marker, even if it is after last buffer line" msgstr "" -"ist diese Einstellung gesetzt wird das Lesezeichen immer im Buffer dargestellt, " -"auch wenn noch keine neue Nachricht geschrieben wurde" +"ist diese Einstellung gesetzt wird das Lesezeichen immer im Buffer " +"dargestellt, auch wenn noch keine neue Nachricht geschrieben wurde" msgid "" "string used to draw read marker line (string is repeated until end of line)" @@ -4087,8 +4103,8 @@ msgid "" "(default value)" msgstr "" "Hintergrundfarbe um Textpassagen hervorzuheben (zum Beispiel bei der " -"Textsuche); wird ausschließlich dann genutzt, falls die Einstellung weechat.look." -"emphasized_attributes keinen Eintrag besitzt (Standardwert)" +"Textsuche); wird ausschließlich dann genutzt, falls die Einstellung weechat." +"look.emphasized_attributes keinen Eintrag besitzt (Standardwert)" msgid "text color for actions in input line" msgstr "" @@ -4454,10 +4470,6 @@ msgid "%sYou can not write text in this buffer" msgstr "%sIn diesen Buffer kann nicht geschrieben werden" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%sFehler mit dem Befehl \"%s\" aufgetreten (nutze: /help %s)" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "" "%sFehler: Der Befehl \"%s\" ist nicht bekannt. Für eine Hilfe nutze /help" @@ -4585,14 +4597,14 @@ msgid "" "example: \"~/.weechat-passphrase\"" msgstr "" "Pfad zu einer Datei die die Passphrase enthält um damit schutzwürdige Daten " -"zu ver- und entschlüsseln. Diese Einstellung findet nur Anwendung, wenn die Datei " -"sec.conf gelesen wird. Es wird auch nur die erste Zeile eingelesen. Diese " -"Datei wird nur verwendet, falls die Umgebungsvariable \"WEECHAT_PASSPHRASE\" " -"nicht genutzt wird (die Umgebungsvariable besitzt eine höhere Priorität). " -"Sicherheitshinweis: Es ist anzuraten dieser Datei nur für die eigene Person " -"Leserechte zu gewähren und die Datei nicht im Heimatverzeichnis von WeeChat " -"zu sichern (zum Beispiel im /home/ Order); Beispiel: \"~/.weechat-passphrase" -"\"" +"zu ver- und entschlüsseln. Diese Einstellung findet nur Anwendung, wenn die " +"Datei sec.conf gelesen wird. Es wird auch nur die erste Zeile eingelesen. " +"Diese Datei wird nur verwendet, falls die Umgebungsvariable " +"\"WEECHAT_PASSPHRASE\" nicht genutzt wird (die Umgebungsvariable besitzt " +"eine höhere Priorität). Sicherheitshinweis: Es ist anzuraten dieser Datei " +"nur für die eigene Person Leserechte zu gewähren und die Datei nicht im " +"Heimatverzeichnis von WeeChat zu sichern (zum Beispiel im /home/ Order); " +"Beispiel: \"~/.weechat-passphrase\"" msgid "" "use salt when generating key used in encryption (recommended for maximum " @@ -5268,9 +5280,9 @@ msgid "" "option for aspell (for list of available options and format, run command " "\"aspell config\" in a shell)" msgstr "" -"Einstellung für Aspell (um eine detaillierte Liste aller verfügbaren Einstellungen und " -"Formate zu erhalten, muss der Befehl \"aspell config\" in einer Shell " -"ausgeführt werden)" +"Einstellung für Aspell (um eine detaillierte Liste aller verfügbaren " +"Einstellungen und Formate zu erhalten, muss der Befehl \"aspell config\" in " +"einer Shell ausgeführt werden)" #, c-format msgid "%s%s: error creating aspell option \"%s\" => \"%s\"" @@ -5471,7 +5483,8 @@ msgstr "%s%s: Befehl mit ID \"%s\" wird nicht mehr ausgeführt" #, c-format msgid "%s%s: invalid options in option exec.command.default_options" -msgstr "%s%s: ungültige Einstellungen in Einstellung exec.command.default_options" +msgstr "" +"%s%s: ungültige Einstellungen in Einstellung exec.command.default_options" #, c-format msgid "%s%s: failed to run command \"%s\"" @@ -5585,9 +5598,9 @@ msgid "" " /exec -kill 0" msgstr "" " -list: zeigt laufende Befehle an\n" -" -sh: es wird die shell verwendet um Befehle auszuführen (WARNUNG: Dieses " -"Argument sollte nur verwendet werden, falls alle Argumente unbedenklich sind, " -"siehe Argument -nosh)\n" +" -sh: es wird die shell verwendet um Befehle auszuführen (WARNUNG: " +"Dieses Argument sollte nur verwendet werden, falls alle Argumente " +"unbedenklich sind, siehe Argument -nosh)\n" " -nosh: die shell wird nicht verwendet um Befehle auszuführen (wird " "benötigt, falls der Befehl mit sensiblen Daten hantiert. Zum Beispiel der " "Inhalt einer Nachricht eines anderen Users)\n" @@ -5661,8 +5674,8 @@ msgstr "" " -del: entfernt einen beendeten Befehl\n" " -all: entfernt alle beendeten Befehle\n" "\n" -"Standardoptionen können in der Einstellung exec.command.default_options bestimmt " -"werden.\n" +"Standardoptionen können in der Einstellung exec.command.default_options " +"bestimmt werden.\n" "\n" "Beispiele:\n" " /exec -n ls -l /tmp\n" @@ -5905,8 +5918,8 @@ msgid "" msgstr "" "%s%s: soll ein Standardserver erstellt werden, muss der Befehl \"/server add" "\" (siehe /help server) verwendet werden; soll ein temporärer Server (WIRD " -"NICHT GESICHERT) erstellt werden, muss die Einstellung irc.look.temporary_servers " -"aktiviert werden" +"NICHT GESICHERT) erstellt werden, muss die Einstellung irc.look." +"temporary_servers aktiviert werden" #, c-format msgid "%sCTCP query to %s%s%s: %s%s%s%s%s" @@ -6355,8 +6368,8 @@ msgstr "" " Hinweis: bei einer Adresse/IP/URL, wird ein temporärer Server " "erstellt (DIESER WIRD NICHT GESPEICHERT), siehe /help irc.look." "temporary_servers\n" -" option: legt Einstellung für den Server fest (die Boolean-Einstellungen können " -"weggelassen werden)\n" +" option: legt Einstellung für den Server fest (die Boolean-Einstellungen " +"können weggelassen werden)\n" " nooption: deaktiviert eine Boolean Einstellung (Beispiel: -nossl)\n" " -all: Verbindung wird zu den Servern hergestellt, für die eine " "Konfiguration vorhanden ist\n" @@ -7397,9 +7410,9 @@ msgstr "" "- den Nick des Gesprächspartners, falls es sich um einen privaten Buffer " "handelt.\n" "\n" -"Sollte die Einstellung irc.network.whois_double_nick aktiviert sein dann wird ein " -"Nick zweimal verwendet (sofern der Nick nur einmal angegeben wurde), um die " -"Idle-Zeit zu erhalten." +"Sollte die Einstellung irc.network.whois_double_nick aktiviert sein dann " +"wird ein Nick zweimal verwendet (sofern der Nick nur einmal angegeben " +"wurde), um die Idle-Zeit zu erhalten." msgid "ask for information about a nick which no longer exists" msgstr "Informationen über einen nicht mehr angemeldeten Nicknamen abfragen" @@ -7581,8 +7594,8 @@ msgstr "" "und für diesen Server akzeptiert wird (hier müssen exakt 40 hexadezimale " "Zeichen, ohne Trennung, angegeben werden); mehrere Fingerprints können durch " "Kommata voneinander getrennt werden; wenn diese Einstellung verwendet wird, " -"dann werden andere Einstellungen, die eine Überprüfung von Zertifikaten vornehmen, " -"NICHT berücksichtigt (Einstellung \"ssl_verify\")" +"dann werden andere Einstellungen, die eine Überprüfung von Zertifikaten " +"vornehmen, NICHT berücksichtigt (Einstellung \"ssl_verify\")" msgid "check that the SSL connection is fully trusted" msgstr "überprüft ob die SSL-Verbindung vertrauenswürdig ist" @@ -7695,11 +7708,11 @@ msgid "" "and key2) (note: content is evaluated, see /help eval)" msgstr "" "durch Kommata getrennte Liste von Channels, die beim Verbinden mit dem " -"Server automatisch betreten werden (nachdem die Einstellungen command + delay " -"ausgeführt wurden). Channels die einen Schlüssel benötigen müssen in der " -"Auflistung als erstes aufgeführt werden. Die Schlüssel, zu den jeweiligen " -"Channels, werden nach den Channels aufgeführt (eine Trennung von Channels " -"und Schlüssel erfolgt mittels einem Leerzeichen. Schlüssel werden " +"Server automatisch betreten werden (nachdem die Einstellungen command + " +"delay ausgeführt wurden). Channels die einen Schlüssel benötigen müssen in " +"der Auflistung als erstes aufgeführt werden. Die Schlüssel, zu den " +"jeweiligen Channels, werden nach den Channels aufgeführt (eine Trennung von " +"Channels und Schlüssel erfolgt mittels einem Leerzeichen. Schlüssel werden " "untereinander auch durch Kommata voneinander getrennt) (Beispiel: " "\"#channel1,#channel2,#channnel3 key1,key2\", #channel1 und #channel2 sind " "durch jeweils einen Schlüssel, key1 und key2, geschützt) (Hinweis: Inhalt " @@ -7896,8 +7909,8 @@ msgstr "" "zu Beginn \"(?-i)\" genutzt werden; des weiteren können folgende Variablen " "genutzt werden: $nick, $channel und $server). Wird ein Buffer geöffnet, dann " "werden die angegeben Wörter dem Buffer-Merkmal \"highlight_words\" " -"hinzugefügt. Dies bedeutet, dass diese Einstellung keinen direkten Einfluss auf " -"schon geöffnete Buffer hat. Eine leere Zeichenkette deaktiviert ein " +"hinzugefügt. Dies bedeutet, dass diese Einstellung keinen direkten Einfluss " +"auf schon geöffnete Buffer hat. Eine leere Zeichenkette deaktiviert ein " "Highlight für den Nick. Beispiel: \"$nick\", \"(?-i)$nick\"" msgid "" @@ -7915,8 +7928,8 @@ msgstr "" "zu Beginn \"(?-i)\" genutzt werden; des weiteren können folgende Variablen " "genutzt werden: $nick, $channel und $server). Wird ein Buffer geöffnet, dann " "werden die angegeben Wörter dem Buffer-Merkmal \"highlight_words\" " -"hinzugefügt. Dies bedeutet, dass diese Einstellung keinen direkten Einfluss auf " -"schon geöffnete Buffer hat. Eine leere Zeichenkette deaktiviert ein " +"hinzugefügt. Dies bedeutet, dass diese Einstellung keinen direkten Einfluss " +"auf schon geöffnete Buffer hat. Eine leere Zeichenkette deaktiviert ein " "Highlight für den Nick. Beispiel: \"$nick\", \"(?-i)$nick\"" msgid "" @@ -7934,8 +7947,8 @@ msgstr "" "zu Beginn \"(?-i)\" genutzt werden; des weiteren können folgende Variablen " "genutzt werden: $nick, $channel und $server). Wird ein Buffer geöffnet, dann " "werden die angegeben Wörter dem Buffer-Merkmal \"highlight_words\" " -"hinzugefügt. Dies bedeutet, dass diese Einstellung keinen direkten Einfluss auf " -"schon geöffnete Buffer hat. Eine leere Zeichenkette deaktiviert ein " +"hinzugefügt. Dies bedeutet, dass diese Einstellung keinen direkten Einfluss " +"auf schon geöffnete Buffer hat. Eine leere Zeichenkette deaktiviert ein " "Highlight für den Nick. Beispiel: \"$nick\", \"(?-i)$nick\"" msgid "" @@ -8091,8 +8104,8 @@ msgstr "" msgid "" "display notices as private messages (if auto, use private buffer if found)" msgstr "" -"zeigt Notizen als private Nachricht an (wird die \"auto\" Einstellung verwendet " -"dann wird ein privater Buffer genutzt, falls vorhanden)" +"zeigt Notizen als private Nachricht an (wird die \"auto\" Einstellung " +"verwendet dann wird ein privater Buffer genutzt, falls vorhanden)" msgid "" "automatically redirect channel welcome notices to the channel buffer; such " @@ -9181,8 +9194,8 @@ msgid "" "%s%s: you should play with option irc.server.%s.ssl_dhkey_size (current " "value is %d, try a lower value like %d or %d)" msgstr "" -"%s%s: der Wert für die Einstellung irc.server.%s.ssl_dhkey_size sollte verändert " -"werden (zur Zeit genutzter Wert: %d, es sollte ein kleinerer Wert " +"%s%s: der Wert für die Einstellung irc.server.%s.ssl_dhkey_size sollte " +"verändert werden (zur Zeit genutzter Wert: %d, es sollte ein kleinerer Wert " "ausprobiert werden, z.B. %d oder %d)" #, c-format @@ -9442,9 +9455,9 @@ msgstr "" "disable: die Protokollierung wird für den aktuellen Buffer ausgeschaltet " "(der Level wird auf 0 gestellt)\n" "\n" -"Die Einstellungen \"logger.level.*\" und \"logger.mask.*\" können genutzt werden " -"um den Level der Protokollierung festzulegen und um eine Maske für einen " -"oder mehrere Buffer zu definieren.\n" +"Die Einstellungen \"logger.level.*\" und \"logger.mask.*\" können genutzt " +"werden um den Level der Protokollierung festzulegen und um eine Maske für " +"einen oder mehrere Buffer zu definieren.\n" "\n" "Level der Protokollierung, die die IRC Erweiterung unterstützt:\n" " 1: Nachrichten von Usern, private Nachrichten und Bemerkungen\n" @@ -9517,9 +9530,10 @@ msgid "" "specifiers are permitted (see man strftime)" msgstr "" "Standardmaske für Protokolldateien (Format: \"Verzeichnis/zur/Datei\" oder " -"\"Datei\", ohne ein führendes \"/\", da die \"Verzeichnis\" Einstellung genutzt " -"wird um vollständige Verzeichnisstrukturen zu erstellen); lokale Buffer " -"Variablen und Datumsspezifikationen (siehe: man strftime) sind zulässig" +"\"Datei\", ohne ein führendes \"/\", da die \"Verzeichnis\" Einstellung " +"genutzt wird um vollständige Verzeichnisstrukturen zu erstellen); lokale " +"Buffer Variablen und Datumsspezifikationen (siehe: man strftime) sind " +"zulässig" msgid "use only lower case for log filenames" msgstr "Protokolldateien werden ausschließlich in Kleinschreibung erstellt" @@ -9779,7 +9793,8 @@ msgid "list of options" msgstr "Auflistung der Einstellungen" msgid "option name (wildcard \"*\" is allowed) (optional)" -msgstr "Name einer Einstellung (Platzhalter \"*\" kann verwendet werden) (optional)" +msgstr "" +"Name einer Einstellung (Platzhalter \"*\" kann verwendet werden) (optional)" msgid "list of plugins" msgstr "Auflistung der Erweiterungen" @@ -10210,8 +10225,8 @@ msgid "" "%s%s: warning: no SSL certificate/key found (option relay.network." "ssl_cert_key)" msgstr "" -"%s%s: Warnung: kein SSL Zertifikat/Schlüssel gefunden (Einstellung relay.network." -"ssl_cert_key)" +"%s%s: Warnung: kein SSL Zertifikat/Schlüssel gefunden (Einstellung relay." +"network.ssl_cert_key)" #, c-format msgid "%s: new client on port %d: %s%s%s" @@ -10350,8 +10365,8 @@ msgstr "" " name: Name des Relays (siehe Format weiter unten)\n" " port: Port der für Relay genutzt werden soll\n" " raw: öffnet einen Buffer mit Relay-Rohdaten\n" -" sslcertkey: setzt SSL Zertifikat/Schlüssel mittels Pfad in Einstellung relay." -"network.ssl_cert_key\n" +" sslcertkey: setzt SSL Zertifikat/Schlüssel mittels Pfad in Einstellung " +"relay.network.ssl_cert_key\n" "\n" "Aufbau des Relay-Namens: [ipv4.][ipv6.][ssl.]<Protokoll.Name>\n" " ipv4: erzwingt die Nutzung von IPv4\n" @@ -10610,8 +10625,8 @@ msgstr "%s%s: IP Adresse \"%s\" für Relay nicht gültig" #, c-format msgid "%s%s: cannot set socket option \"%s\" to %d: error %d %s" msgstr "" -"%s%s: Die Socket-Einstellung \"%s\" kann nicht auf %d geändert werden: Fehler %d " -"%s" +"%s%s: Die Socket-Einstellung \"%s\" kann nicht auf %d geändert werden: " +"Fehler %d %s" #. TRANSLATORS: second "%s" is "IPv4" or "IPv6" #, c-format @@ -11111,9 +11126,9 @@ msgid "" "alt+r = remove, ...); if disabled, only the input is allowed: i, r, ..." msgstr "" "Um Tastenkurzbefehle im Skript-Buffer direkt nutzen zu können (zum Beispiel: " -"alt+i = installieren, alt+r = entfernen, ...), muss diese Einstellung aktiviert " -"werden. Andernfalls können Aktionen nur über die Eingabezeile durchgeführt " -"werden: i,r..." +"alt+i = installieren, alt+r = entfernen, ...), muss diese Einstellung " +"aktiviert werden. Andernfalls können Aktionen nur über die Eingabezeile " +"durchgeführt werden: i,r..." msgid "color for status \"autoloaded\" (\"a\")" msgstr "Farbe in der der Status \"autoloaded\" (\"a\") dargestellt werden soll" @@ -11626,10 +11641,10 @@ msgstr "" " recreate: wie \"input\", allerdings wird die Einstellung \"addreplace\" " "anstelle von \"add\" genutzt\n" " set: definiert, innerhalb eines Triggers, eine Einstellung neu\n" -" option: Name einer Einstellung: name, hook, arguments, conditions, regex, " -"command, return_code\n" -" (um Hilfe über eine Einstellung zu erhalten: /help trigger.trigger." -"<name>.<option>)\n" +" option: Name einer Einstellung: name, hook, arguments, conditions, " +"regex, command, return_code\n" +" (um Hilfe über eine Einstellung zu erhalten: /help trigger." +"trigger.<name>.<option>)\n" " value: neuer Wert für Einstellung\n" " rename: benennt einen Trigger um\n" " copy: kopiert einen Trigger\n" @@ -11720,16 +11735,16 @@ msgstr "Standardrückgabewerte für einen Hook-Callback" msgid "" "%s%s: invalid format for option \"regex\", see /help trigger.trigger.%s.regex" msgstr "" -"%s%s: ungültiges Format in Einstellung \"regex\", siehe /help trigger.trigger.%s." -"regex" +"%s%s: ungültiges Format in Einstellung \"regex\", siehe /help trigger." +"trigger.%s.regex" #, c-format msgid "" "%s%s: invalid regular expression in option \"regex\", see /help trigger." "trigger.%s.regex" msgstr "" -"%s%s: ungültiger regulärer Ausdruck in Einstellung \"regex\", siehe /help trigger." -"trigger.%s.regex" +"%s%s: ungültiger regulärer Ausdruck in Einstellung \"regex\", siehe /help " +"trigger.trigger.%s.regex" msgid "" "if disabled, the hooks are removed from trigger, so it is not called any more" @@ -12259,8 +12274,8 @@ msgstr "" #, c-format msgid "%s%s: unable to set option \"nonblock\" for socket: error %d %s" msgstr "" -"%s%s: Die \"nonblock\"-Einstellung für den Socket kann nicht festlegt werden: " -"Fehler %d %s" +"%s%s: Die \"nonblock\"-Einstellung für den Socket kann nicht festlegt " +"werden: Fehler %d %s" #, c-format msgid "%s%s: timeout for \"%s\" with %s" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2681,6 +2681,14 @@ msgstr "" " aumentar la ventana #2:\n" " /window zoom -window 2" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%sError con el comando \"%s\" (trata con /help %s)" + +#, fuzzy, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%sError con el comando \"%s\" (trata con /help %s)" + msgid "names of buffers" msgstr "nombres de los buffers" @@ -4015,10 +4023,6 @@ msgstr "" msgid "%sYou can not write text in this buffer" msgstr "%sNo es posible escribir texto en este buffer" -#, fuzzy, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%sError con el comando \"%s\" (trata con /help %s)" - #, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%sError: comando \"%s\" desconocido (use /help para ver la ayuda)" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" -"PO-Revision-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" +"PO-Revision-Date: 2014-11-22 07:54+0100\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -2902,6 +2902,16 @@ msgstr "" " activer le mode d'affichage dépouillé pendant 2 secondes :\n" " /window bare 2" +#, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "" +"%sPas assez de paramètres pour la commande \"%s%s%s\" (aide sur la " +"commande : /help %s)" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%sErreur avec la commande \"%s\" (aide sur la commande : /help %s)" + msgid "names of buffers" msgstr "noms des tampons" @@ -4356,10 +4366,6 @@ msgid "%sYou can not write text in this buffer" msgstr "%sVous ne pouvez pas écrire de texte dans ce tampon" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%sErreur avec la commande \"%s\" (aide sur la commande : /help %s)" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%sErreur : commande \"%s\" inconnue (tapez /help pour l'aide)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2203,6 +2203,14 @@ msgstr "" "hogy az új ablak hány százaléka lesz a szülőablaknak. Például 25 esetén a " "szülőablak negyedét kapjuk." +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%s a \"%s\" aliasz vagy parancs nem található\n" + +#, fuzzy, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%s a \"%s\" aliasz vagy parancs nem található\n" + #, fuzzy msgid "names of buffers" msgstr "puffer betöltése sikertelen" @@ -3423,10 +3431,6 @@ msgid "%sYou can not write text in this buffer" msgstr "%s az utolsó puffert nem lehet bezárni\n" #, fuzzy, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%s a \"%s\" aliasz vagy parancs nem található\n" - -#, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%s a \"%s\" aliasz vagy parancs nem található\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2768,6 +2768,14 @@ msgstr "" " zoom sulla finestra #2:\n" " /window zoom -window 2" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%sErrore con il comando \"%s\" (digita /help %s)" + +#, fuzzy, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%sErrore con il comando \"%s\" (digita /help %s)" + msgid "names of buffers" msgstr "nomi dei buffer" @@ -4126,10 +4134,6 @@ msgstr "" msgid "%sYou can not write text in this buffer" msgstr "%sNon è possibile scrivere del testo in questo buffer" -#, fuzzy, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%sErrore con il comando \"%s\" (digita /help %s)" - #, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%sErrore: comando \"%s\" sconosciuto (digita /help per l'aiuto)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-10 06:29+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" @@ -2826,6 +2826,16 @@ msgstr "" " 最小限表示を 2 秒間有効にする:\n" " /window bare 2" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "" +"%sコマンド \"%s\" にエラーがあります (コマンドに関するヘルプ: /help %s)" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "" +"%sコマンド \"%s\" にエラーがあります (コマンドに関するヘルプ: /help %s)" + msgid "names of buffers" msgstr "バッファの名前" @@ -4176,11 +4186,6 @@ msgid "%sYou can not write text in this buffer" msgstr "%sこのバッファに書き込むことは出来ません" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "" -"%sコマンド \"%s\" にエラーがあります (コマンドに関するヘルプ: /help %s)" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%sエラー: 未定義のコマンド \"%s\" (ヘルプを見るには /help)" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2879,6 +2879,14 @@ msgstr "" " włączenie trybu niesformatowanego na 2 sekundy:\n" " /window bare 2" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%sBłąd komendy \"%s\" (pomoc dla komendy: /help %s)" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%sBłąd komendy \"%s\" (pomoc dla komendy: /help %s)" + msgid "names of buffers" msgstr "nazwy buforów" @@ -4269,10 +4277,6 @@ msgid "%sYou can not write text in this buffer" msgstr "%s nie możesz nic pisać w tym buforze" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%sBłąd komendy \"%s\" (pomoc dla komendy: /help %s)" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%sBłąd: nieznana komenda \"%s\" (wpisz /help , aby uzyskać pomoc)" diff --git a/po/pt_BR.po b/po/pt_BR.po index 7f1a52879..98e30f323 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2635,6 +2635,14 @@ msgstr "" " rola para o começo do dia atual:\n" " /window scroll -d" +#, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "" + msgid "names of buffers" msgstr "nomes dos buffers" @@ -3910,10 +3918,6 @@ msgid "%sYou can not write text in this buffer" msgstr "" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-11-09 16:23+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -2226,6 +2226,14 @@ msgstr "" "Для splith и splitv <прцт> - процент размера создаваемого окна относительно " "текущего. Например, 25 означает создать окно в 4 раза меньше текущего" +#, fuzzy, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "%s сокращение или команда \"%s\" не найдены\n" + +#, fuzzy, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "%s сокращение или команда \"%s\" не найдены\n" + #, fuzzy msgid "names of buffers" msgstr "загрузка буфера не удалась" @@ -3449,10 +3457,6 @@ msgid "%sYou can not write text in this buffer" msgstr "%s невозможно закрыть единственный буфер\n" #, fuzzy, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "%s сокращение или команда \"%s\" не найдены\n" - -#, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "%s сокращение или команда \"%s\" не найдены\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1993,6 +1993,14 @@ msgid "" " /window bare 2" msgstr "" +#, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "" + msgid "names of buffers" msgstr "" @@ -3073,10 +3081,6 @@ msgid "%sYou can not write text in this buffer" msgstr "" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 7f1f6f142..72b82baa8 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-11-15 18:20+0100\n" +"POT-Creation-Date: 2014-11-21 18:33+0100\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1991,6 +1991,14 @@ msgid "" " /window bare 2" msgstr "" +#, c-format +msgid "%sToo few arguments for command \"%s%s%s\" (help on command: /help %s)" +msgstr "" + +#, c-format +msgid "%sError with command \"%s\" (help on command: /help %s)" +msgstr "" + msgid "names of buffers" msgstr "" @@ -3068,10 +3076,6 @@ msgid "%sYou can not write text in this buffer" msgstr "" #, c-format -msgid "%sError with command \"%s\" (help on command: /help %s)" -msgstr "" - -#, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 128477b6d..922eb8221 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -224,8 +224,7 @@ COMMAND_CALLBACK(bar) /* add a new bar */ if (string_strcasecmp (argv[1], "add") == 0) { - if (argc < 8) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(8, "add"); pos_condition = strchr (argv[3], ','); if (pos_condition) { @@ -329,8 +328,7 @@ COMMAND_CALLBACK(bar) /* delete a bar */ if (string_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "del"); if (string_strcasecmp (argv[2], "-all") == 0) { gui_bar_free_all (); @@ -361,8 +359,7 @@ COMMAND_CALLBACK(bar) /* set a bar property */ if (string_strcasecmp (argv[1], "set") == 0) { - if (argc < 5) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(5, "set"); ptr_bar = gui_bar_search (argv[2]); if (!ptr_bar) { @@ -387,8 +384,7 @@ COMMAND_CALLBACK(bar) /* hide a bar */ if (string_strcasecmp (argv[1], "hide") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "hide"); ptr_bar = gui_bar_search (argv[2]); if (!ptr_bar) { @@ -406,8 +402,7 @@ COMMAND_CALLBACK(bar) /* show a bar */ if (string_strcasecmp (argv[1], "show") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "show"); ptr_bar = gui_bar_search (argv[2]); if (!ptr_bar) { @@ -425,8 +420,7 @@ COMMAND_CALLBACK(bar) /* toggle a bar visible/hidden */ if (string_strcasecmp (argv[1], "toggle") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "toggle"); ptr_bar = gui_bar_search (argv[2]); if (!ptr_bar) { @@ -444,8 +438,7 @@ COMMAND_CALLBACK(bar) /* scroll in a bar */ if (string_strcasecmp (argv[1], "scroll") == 0) { - if (argc < 5) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(5, "scroll"); ptr_bar = gui_bar_search (argv[2]); if (ptr_bar) { @@ -478,7 +471,7 @@ COMMAND_CALLBACK(bar) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -644,8 +637,7 @@ COMMAND_CALLBACK(buffer) /* move buffer to another number in the list */ if (string_strcasecmp (argv[1], "move") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "move"); if (strcmp (argv[2], "-") == 0) { gui_buffer_move_to_number (buffer, gui_buffers->number); @@ -689,8 +681,7 @@ COMMAND_CALLBACK(buffer) /* swap buffers */ if (string_strcasecmp (argv[1], "swap") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "swap"); ptr_buffer = NULL; ptr_buffer2 = NULL; @@ -716,8 +707,7 @@ COMMAND_CALLBACK(buffer) /* merge buffer with another number in the list */ if (string_strcasecmp (argv[1], "merge") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "merge"); error = NULL; number = strtol (argv[2], &error, 10); if (error && !error[0]) @@ -762,7 +752,7 @@ COMMAND_CALLBACK(buffer) return WEECHAT_RC_OK; } if (!command_buffer_check_number ((int)number)) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } } gui_buffer_unmerge (buffer, (int)number); @@ -939,7 +929,7 @@ COMMAND_CALLBACK(buffer) if (!error || error[0]) { free (str_number1); - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } } else @@ -1013,8 +1003,7 @@ COMMAND_CALLBACK(buffer) /* set notify level */ if (string_strcasecmp (argv[1], "notify") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "notify"); if (!config_weechat_notify_set (buffer, argv_eol[2])) { gui_chat_printf (NULL, @@ -1048,8 +1037,7 @@ COMMAND_CALLBACK(buffer) /* set a property on buffer */ if (string_strcasecmp (argv[1], "set") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "set"); value = string_remove_quotes (argv_eol[3], "'\""); gui_buffer_set (buffer, argv[2], (value) ? value : argv_eol[3]); if (value) @@ -1060,8 +1048,7 @@ COMMAND_CALLBACK(buffer) /* get a buffer property */ if (string_strcasecmp (argv[1], "get") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "get"); if (gui_buffer_property_in_list (gui_buffer_properties_get_integer, argv[2])) { @@ -1288,7 +1275,7 @@ COMMAND_CALLBACK(buffer) } } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -1319,15 +1306,14 @@ COMMAND_CALLBACK(color) if (string_strcasecmp (argv[1], "-o") == 0) { gui_color_info_term_colors (str_color, sizeof (str_color)); - input_data (buffer, str_color); + (void) input_data (buffer, str_color); return WEECHAT_RC_OK; } /* add a color alias */ if (string_strcasecmp (argv[1], "alias") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "alias"); /* check color number */ error = NULL; @@ -1379,7 +1365,7 @@ COMMAND_CALLBACK(color) "/set weechat.palette.%d \"%s\"", (int)number, (str_color[0]) ? str_color + 1 : ""); - input_exec_command (buffer, 1, NULL, str_command); + (void) input_exec_command (buffer, 1, NULL, str_command); return WEECHAT_RC_OK; } @@ -1387,8 +1373,7 @@ COMMAND_CALLBACK(color) /* delete a color alias */ if (string_strcasecmp (argv[1], "unalias") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "unalias"); /* check color number */ error = NULL; @@ -1427,7 +1412,7 @@ COMMAND_CALLBACK(color) snprintf (str_command, sizeof (str_command), "/unset weechat.palette.%d", (int)number); - input_exec_command (buffer, 1, NULL, str_command); + (void) input_exec_command (buffer, 1, NULL, str_command); return WEECHAT_RC_OK; } @@ -1449,12 +1434,11 @@ COMMAND_CALLBACK(color) /* convert terminal color to RGB color */ if (string_strcasecmp (argv[1], "term2rgb") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "term2rgb"); error = NULL; number = strtol (argv[2], &error, 10); if (!error || error[0] || (number < 0) || (number > 255)) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; gui_chat_printf (NULL, "%ld -> #%06x", number, @@ -1465,19 +1449,18 @@ COMMAND_CALLBACK(color) /* convert RGB color to terminal color */ if (string_strcasecmp (argv[1], "rgb2term") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "rgb2term"); if (sscanf ((argv[2][0] == '#') ? argv[2] + 1 : argv[2], "%x", &rgb) != 1) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; if (rgb > 0xFFFFFF) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; limit = 256; if (argc > 3) { error = NULL; limit = strtol (argv[3], &error, 10); if (!error || error[0] || (limit < 1) || (limit > 256)) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } gui_chat_printf (NULL, "#%06x -> %d", @@ -1486,7 +1469,7 @@ COMMAND_CALLBACK(color) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -1503,8 +1486,7 @@ COMMAND_CALLBACK(command) /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, ""); ptr_buffer = buffer; index_args = 1; @@ -1537,8 +1519,8 @@ COMMAND_CALLBACK(command) } if (string_is_command_char (argv_eol[index_args + 1])) { - input_exec_command (ptr_buffer, any_plugin, ptr_plugin, - argv_eol[index_args + 1]); + (void) input_exec_command (ptr_buffer, any_plugin, ptr_plugin, + argv_eol[index_args + 1]); } else { @@ -1547,7 +1529,8 @@ COMMAND_CALLBACK(command) if (command) { snprintf (command, length, "/%s", argv_eol[index_args + 1]); - input_exec_command (ptr_buffer, any_plugin, ptr_plugin, command); + (void) input_exec_command (ptr_buffer, any_plugin, ptr_plugin, + command); free (command); } } @@ -1639,7 +1622,7 @@ COMMAND_CALLBACK(cursor) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -1792,8 +1775,7 @@ COMMAND_CALLBACK(debug) if (string_strcasecmp (argv[1], "set") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "set"); if (strcmp (argv[3], "0") == 0) { /* disable debug for a plugin */ @@ -1823,7 +1805,7 @@ COMMAND_CALLBACK(debug) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -1844,8 +1826,7 @@ COMMAND_CALLBACK(eval) print_only = 0; condition = 0; - if (argc < 2) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(2, ""); ptr_args = argv_eol[1]; for (i = 1; i < argc; i++) @@ -1930,7 +1911,7 @@ COMMAND_CALLBACK(eval) { for (i = 0; commands[i]; i++) { - input_data (buffer, commands[i]); + (void) input_data (buffer, commands[i]); } string_free_split_command (commands); } @@ -2173,8 +2154,7 @@ COMMAND_CALLBACK(filter) /* add filter */ if (string_strcasecmp (argv[1], "add") == 0) { - if (argc < 6) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(6, "add"); if (gui_filter_search_by_name (argv[2])) { gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, @@ -2215,8 +2195,7 @@ COMMAND_CALLBACK(filter) /* rename a filter */ if (string_strcasecmp (argv[1], "rename") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "rename"); ptr_filter = gui_filter_search_by_name (argv[2]); if (ptr_filter) { @@ -2250,8 +2229,7 @@ COMMAND_CALLBACK(filter) /* delete filter */ if (string_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "del"); if (string_strcasecmp (argv[2], "-all") == 0) { if (gui_filters) @@ -2290,7 +2268,7 @@ COMMAND_CALLBACK(filter) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -2916,8 +2894,7 @@ COMMAND_CALLBACK(input) /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(2, ""); if (string_strcasecmp (argv[1], "clipboard_paste") == 0) gui_input_clipboard_paste (buffer); @@ -2981,7 +2958,7 @@ COMMAND_CALLBACK(input) gui_input_jump_smart (buffer); /* not used any more in WeeChat >= 1.0 (replaced by "/buffer ++") */ else if (string_strcasecmp (argv[1], "jump_last_buffer") == 0) - input_data (buffer, "/buffer +"); + (void) input_data (buffer, "/buffer +"); else if (string_strcasecmp (argv[1], "jump_last_buffer_displayed") == 0) gui_input_jump_last_buffer_displayed (buffer); else if (string_strcasecmp (argv[1], "jump_previously_visited_buffer") == 0) @@ -3014,7 +2991,7 @@ COMMAND_CALLBACK(input) gui_input_insert (buffer, argv_eol[2]); } else if (string_strcasecmp (argv[1], "send") == 0) - input_data (buffer, argv_eol[2]); + (void) input_data (buffer, argv_eol[2]); else if (string_strcasecmp (argv[1], "undo") == 0) gui_input_undo (buffer); else if (string_strcasecmp (argv[1], "redo") == 0) @@ -3028,7 +3005,9 @@ COMMAND_CALLBACK(input) /* do nothing here */ } else - return WEECHAT_RC_ERROR; + { + COMMAND_ERROR; + } return WEECHAT_RC_OK; } @@ -3341,8 +3320,7 @@ COMMAND_CALLBACK(key) /* bind a key (or display binding) */ if (string_strcasecmp (argv[1], "bind") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "bind"); /* display a key binding */ if (argc == 3) @@ -3402,8 +3380,7 @@ COMMAND_CALLBACK(key) /* bind a key for given context (or display binding) */ if (string_strcasecmp (argv[1], "bindctxt") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "bindctxt"); /* search context */ context = gui_key_search_context (argv[2]); @@ -3474,8 +3451,7 @@ COMMAND_CALLBACK(key) /* unbind a key */ if (string_strcasecmp (argv[1], "unbind") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "unbind"); gui_key_verbose = 1; rc = gui_key_unbind (NULL, GUI_KEY_CONTEXT_DEFAULT, argv[2]); @@ -3495,8 +3471,7 @@ COMMAND_CALLBACK(key) /* unbind a key for a given context */ if (string_strcasecmp (argv[1], "unbindctxt") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "unbindctxt"); /* search context */ context = gui_key_search_context (argv[2]); @@ -3527,17 +3502,14 @@ COMMAND_CALLBACK(key) /* reset a key to default binding */ if (string_strcasecmp (argv[1], "reset") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; - + COMMAND_MIN_ARGS(3, "reset"); return command_key_reset (GUI_KEY_CONTEXT_DEFAULT, argv[2]); } /* reset a key to default binding for a given context */ if (string_strcasecmp (argv[1], "resetctxt") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "resetctxt"); /* search context */ context = gui_key_search_context (argv[2]); @@ -3608,7 +3580,7 @@ COMMAND_CALLBACK(key) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -3753,7 +3725,7 @@ COMMAND_CALLBACK(layout) { ptr_layout = gui_layout_alloc ((layout_name) ? layout_name : GUI_LAYOUT_DEFAULT_NAME); if (!ptr_layout) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; gui_layout_add (ptr_layout); } if (flag_buffers) @@ -3858,8 +3830,7 @@ COMMAND_CALLBACK(layout) /* rename layout */ if (string_strcasecmp (argv[1], "rename") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "rename"); ptr_layout = gui_layout_search (argv[2]); if (!ptr_layout) { @@ -3885,7 +3856,7 @@ COMMAND_CALLBACK(layout) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -3979,7 +3950,7 @@ COMMAND_CALLBACK(mouse) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -4023,8 +3994,7 @@ COMMAND_CALLBACK(mute) } else if (string_strcasecmp (argv[1], "-buffer") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "-buffer"); ptr_buffer = gui_buffer_search_by_full_name (argv[2]); if (ptr_buffer) { @@ -4049,7 +4019,7 @@ COMMAND_CALLBACK(mute) if (string_is_command_char (ptr_command)) { - input_exec_command (buffer, 1, NULL, ptr_command); + (void) input_exec_command (buffer, 1, NULL, ptr_command); } else { @@ -4058,7 +4028,7 @@ COMMAND_CALLBACK(mute) if (command) { snprintf (command, length, "/%s", ptr_command); - input_exec_command (buffer, 1, NULL, command); + (void) input_exec_command (buffer, 1, NULL, command); free (command); } } @@ -4416,8 +4386,7 @@ COMMAND_CALLBACK(plugin) if (string_strcasecmp (argv[1], "load") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "load"); plugin_argv = NULL; plugin_argc = 0; if (argc > 3) @@ -4466,7 +4435,7 @@ COMMAND_CALLBACK(plugin) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -4500,11 +4469,11 @@ COMMAND_CALLBACK(print) if (string_strcasecmp (argv[i], "-buffer") == 0) { if (i + 1 >= argc) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; i++; ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]); if (!ptr_buffer) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } else if (string_strcasecmp (argv[i], "-current") == 0) { @@ -4521,14 +4490,14 @@ COMMAND_CALLBACK(print) else if (string_strcasecmp (argv[i], "-date") == 0) { if (i + 1 >= argc) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; i++; if ((argv[i][0] == '-') || (argv[i][0] == '+')) { error = NULL; value = strtol (argv[i] + 1, &error, 10); if (!error || error[0]) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; date = (argv[i][0] == '-') ? time (NULL) - value : time (NULL) + value; } @@ -4566,7 +4535,7 @@ COMMAND_CALLBACK(print) else if (string_strcasecmp (argv[i], "-tags") == 0) { if (i + 1 >= argc) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; i++; tags = argv[i]; } @@ -4606,7 +4575,7 @@ COMMAND_CALLBACK(print) else if (argv[i][0] == '-') { /* unknown argument starting with "-", exit */ - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } else break; @@ -4726,8 +4695,7 @@ COMMAND_CALLBACK(proxy) /* add a new proxy */ if (string_strcasecmp (argv[1], "add") == 0) { - if (argc < 6) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(6, "add"); type = proxy_search_type (argv[3]); if (type < 0) { @@ -4774,8 +4742,7 @@ COMMAND_CALLBACK(proxy) /* delete a proxy */ if (string_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "del"); if (string_strcasecmp (argv[2], "-all") == 0) { proxy_free_all (); @@ -4801,8 +4768,7 @@ COMMAND_CALLBACK(proxy) /* set a proxy property */ if (string_strcasecmp (argv[1], "set") == 0) { - if (argc < 5) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(5, "set"); ptr_proxy = proxy_search (argv[2]); if (!ptr_proxy) { @@ -4824,7 +4790,7 @@ COMMAND_CALLBACK(proxy) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -4974,7 +4940,7 @@ command_repeat_timer_cb (void *data, int remaining_calls) /* execute command */ if (ptr_buffer) - input_exec_command (ptr_buffer, 1, NULL, repeat_args[1]); + (void) input_exec_command (ptr_buffer, 1, NULL, repeat_args[1]); } if (remaining_calls == 0) @@ -5002,8 +4968,7 @@ COMMAND_CALLBACK(repeat) /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, ""); arg_count = 1; interval = 0; @@ -5040,14 +5005,14 @@ COMMAND_CALLBACK(repeat) if (command) { - input_exec_command (buffer, 1, NULL, command); + (void) input_exec_command (buffer, 1, NULL, command); if (count > 1) { if (interval == 0) { for (i = 0; i < count - 1; i++) { - input_exec_command (buffer, 1, NULL, command); + (void) input_exec_command (buffer, 1, NULL, command); } free (command); } @@ -5185,8 +5150,7 @@ COMMAND_CALLBACK(secure) /* decrypt data still encrypted */ if (string_strcasecmp (argv[1], "decrypt") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "decrypt"); if (count_encrypted == 0) { gui_chat_printf (NULL, _("There is no encrypted data")); @@ -5227,8 +5191,7 @@ COMMAND_CALLBACK(secure) /* set the passphrase */ if (string_strcasecmp (argv[1], "passphrase") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "passphrase"); passphrase_was_set = 0; if (secure_passphrase) { @@ -5264,8 +5227,7 @@ COMMAND_CALLBACK(secure) /* set a secured data */ if (string_strcasecmp (argv[1], "set") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(4, "set"); hashtable_set (secure_hashtable_data, argv[2], argv_eol[3]); gui_chat_printf (NULL, _("Secured data \"%s\" set"), argv[2]); command_save_file (secure_config_file); @@ -5276,8 +5238,7 @@ COMMAND_CALLBACK(secure) /* delete a secured data */ if (string_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, "del"); if (hashtable_has_key (secure_hashtable_data, argv[2])) { hashtable_remove (secure_hashtable_data, argv[2]); @@ -5306,7 +5267,7 @@ COMMAND_CALLBACK(secure) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -5704,7 +5665,7 @@ COMMAND_CALLBACK(set) /* display a sorted list of all environment variables */ list = weelist_new (); if (!list) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; for (i = 0; environ[i]; i++) { weelist_add (list, environ[i], WEECHAT_LIST_POS_SORT, NULL); @@ -5926,8 +5887,7 @@ COMMAND_CALLBACK(unset) (void) data; (void) buffer; - if (argc < 2) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(2, ""); mask = 0; ptr_name = argv_eol[1]; @@ -5936,9 +5896,8 @@ COMMAND_CALLBACK(unset) if (string_strcasecmp (argv[1], "-mask") == 0) { + COMMAND_MIN_ARGS(3, "-mask"); mask = 1; - if (argc < 3) - return WEECHAT_RC_ERROR; ptr_name = argv_eol[2]; } @@ -6161,7 +6120,7 @@ COMMAND_CALLBACK(upgrade) exit (EXIT_FAILURE); /* never executed */ - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -6195,7 +6154,7 @@ COMMAND_CALLBACK(uptime) sec, ctime (&weechat_first_start_time)); string[strlen (string) - 1] = '\0'; - input_data (buffer, string); + (void) input_data (buffer, string); } else if ((argc >= 2) && (string_strcasecmp (argv[1], "-ol") == 0)) { @@ -6208,7 +6167,7 @@ COMMAND_CALLBACK(uptime) min, sec, util_get_time_string (&weechat_first_start_time)); - input_data (buffer, string); + (void) input_data (buffer, string); } else { @@ -6259,7 +6218,7 @@ command_version_display (struct t_gui_buffer *buffer, _("compiled on"), version_get_compilation_date (), version_get_compilation_time ()); - input_data (buffer, string); + (void) input_data (buffer, string); if (weechat_upgrade_count > 0) { snprintf (string, sizeof (string), @@ -6268,7 +6227,7 @@ command_version_display (struct t_gui_buffer *buffer, /* TRANSLATORS: text is: "upgraded xx times" */ NG_("time", "times", weechat_upgrade_count), util_get_time_string (&weechat_first_start_time)); - input_data (buffer, string); + (void) input_data (buffer, string); } } else @@ -6279,7 +6238,7 @@ command_version_display (struct t_gui_buffer *buffer, "compiled on", version_get_compilation_date (), version_get_compilation_time ()); - input_data (buffer, string); + (void) input_data (buffer, string); if (weechat_upgrade_count > 0) { snprintf (string, sizeof (string), @@ -6288,7 +6247,7 @@ command_version_display (struct t_gui_buffer *buffer, (weechat_upgrade_count > 1) ? "times" : "time", ctime (&weechat_first_start_time)); string[strlen (string) - 1] = '\0'; - input_data (buffer, string); + (void) input_data (buffer, string); } } } @@ -6375,7 +6334,7 @@ command_wait_timer_cb (void *data, int remaining_calls) /* execute command */ if (ptr_buffer) - input_data (ptr_buffer, timer_args[1]); + (void) input_data (ptr_buffer, timer_args[1]); } for (i = 0; i < 2; i++) @@ -6401,8 +6360,7 @@ COMMAND_CALLBACK(wait) /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + COMMAND_MIN_ARGS(3, ""); pos = argv[1]; while (pos[0] && isdigit ((unsigned char)pos[0])) @@ -6425,20 +6383,20 @@ COMMAND_CALLBACK(wait) else if (strcmp (pos, "h") == 0) factor = 1000 * 60 * 60; else - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } else str_number = strdup (argv[1]); if (!str_number) - return WEECHAT_RC_ERROR; + COMMAND_ERROR; error = NULL; number = strtol (str_number, &error, 10); if (!error || error[0]) { free (str_number); - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } free (str_number); @@ -6713,7 +6671,7 @@ COMMAND_CALLBACK(window) if (string_strcasecmp (argv[win_args], "all") == 0) gui_window_merge_all (ptr_win); else - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } else { @@ -6786,7 +6744,7 @@ COMMAND_CALLBACK(window) else if (string_strcasecmp (argv[win_args], "right") == 0) gui_window_swap (ptr_win, 2); else - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } else { @@ -6830,7 +6788,7 @@ COMMAND_CALLBACK(window) return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + COMMAND_ERROR; } /* @@ -8038,7 +7996,7 @@ command_exec_list (const char *command_list) weechat_buffer = gui_buffer_search_main (); for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++) { - input_data (weechat_buffer, *ptr_cmd); + (void) input_data (weechat_buffer, *ptr_cmd); } string_free_split_command (commands); } diff --git a/src/core/wee-command.h b/src/core/wee-command.h index aae1241b5..d2c595f8c 100644 --- a/src/core/wee-command.h +++ b/src/core/wee-command.h @@ -45,6 +45,39 @@ return WEECHAT_RC_OK; \ } +/* + * macro to return error in case of missing arguments in callback of + * hook_command + */ +#define COMMAND_MIN_ARGS(__min_args, __option) \ + if (argc < __min_args) \ + { \ + gui_chat_printf_date_tags ( \ + NULL, 0, GUI_FILTER_TAG_NO_FILTER, \ + _("%sToo few arguments for command \"%s%s%s\" " \ + "(help on command: /help %s)"), \ + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], \ + argv[0], \ + (__option && __option[0]) ? " " : "", \ + (__option && __option[0]) ? __option : "", \ + argv[0] + 1); \ + return WEECHAT_RC_ERROR; \ + } + +/* macro to return error in callback of hook_command */ +#define COMMAND_ERROR \ + { \ + gui_chat_printf_date_tags ( \ + NULL, 0, GUI_FILTER_TAG_NO_FILTER, \ + _("%sError with command \"%s\" " \ + "(help on command: /help %s)"), \ + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], \ + argv_eol[0], \ + argv[0] + 1); \ + return WEECHAT_RC_ERROR; \ + } + + struct t_gui_buffer; extern int command_reload (void *data, struct t_gui_buffer *buffer, diff --git a/src/core/wee-input.c b/src/core/wee-input.c index 3c1a5bd29..1e12b2f4e 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -61,22 +61,27 @@ input_exec_data (struct t_gui_buffer *buffer, const char *data) /* * Executes a command. + * + * Returns: + * WEECHAT_RC_OK: command executed + * WEECHAT_RC_ERROR: error, command not executed */ -void +int input_exec_command (struct t_gui_buffer *buffer, int any_plugin, struct t_weechat_plugin *plugin, const char *string) { char *command, *command_name, *pos; + int rc; if ((!string) || (!string[0])) - return; + return WEECHAT_RC_ERROR; command = strdup (string); if (!command) - return; + return WEECHAT_RC_ERROR; /* ignore spaces at the end of command */ pos = &command[strlen (command) - 1]; @@ -94,10 +99,11 @@ input_exec_command (struct t_gui_buffer *buffer, if (!command_name) { free (command); - return; + return WEECHAT_RC_ERROR; } /* execute command */ + rc = WEECHAT_RC_OK; switch (hook_command_exec (buffer, any_plugin, plugin, command)) { case HOOK_COMMAND_EXEC_OK: @@ -105,11 +111,7 @@ input_exec_command (struct t_gui_buffer *buffer, break; case HOOK_COMMAND_EXEC_ERROR: /* command hooked, error */ - gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("%sError with command \"%s\" (help on " - "command: /help %s)"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - command, command_name + 1); + rc = WEECHAT_RC_ERROR; break; case HOOK_COMMAND_EXEC_NOT_FOUND: /* @@ -128,6 +130,7 @@ input_exec_command (struct t_gui_buffer *buffer, "(type /help for help)"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], command_name); + rc = WEECHAT_RC_ERROR; } break; case HOOK_COMMAND_EXEC_AMBIGUOUS_PLUGINS: @@ -139,6 +142,7 @@ input_exec_command (struct t_gui_buffer *buffer, gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], command_name, plugin_get_name (plugin)); + rc = WEECHAT_RC_ERROR; break; case HOOK_COMMAND_EXEC_AMBIGUOUS_INCOMPLETE: /* @@ -151,6 +155,7 @@ input_exec_command (struct t_gui_buffer *buffer, "this name"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], command_name); + rc = WEECHAT_RC_ERROR; break; case HOOK_COMMAND_EXEC_RUNNING: /* command is running */ @@ -159,34 +164,44 @@ input_exec_command (struct t_gui_buffer *buffer, "\"%s\" (looping)"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], command_name); + rc = WEECHAT_RC_ERROR; break; default: break; } + free (command); free (command_name); + + return rc; } /* * Reads user input and sends data to buffer's callback. + * + * Returns: + * WEECHAT_RC_OK: data properly sent (or command executed successfully) + * WEECHAT_RC_ERROR: error */ -void +int input_data (struct t_gui_buffer *buffer, const char *data) { char *pos, *buf, str_buffer[128], *new_data, *buffer_full_name; const char *ptr_data, *ptr_data_for_buffer; - int length, char_size, first_command; + int length, char_size, first_command, rc; + + rc = WEECHAT_RC_OK; if (!buffer || !gui_buffer_valid (buffer) || !data || !data[0] || (data[0] == '\r') || (data[0] == '\n')) { - return; + return WEECHAT_RC_ERROR; } buffer_full_name = strdup (buffer->full_name); if (!buffer_full_name) - return; + return WEECHAT_RC_ERROR; /* execute modifier "input_text_for_buffer" */ snprintf (str_buffer, sizeof (str_buffer), @@ -252,7 +267,7 @@ input_data (struct t_gui_buffer *buffer, const char *data) else { /* input string is a command */ - input_exec_command (buffer, 1, buffer->plugin, ptr_data); + rc = input_exec_command (buffer, 1, buffer->plugin, ptr_data); } if (pos) @@ -271,4 +286,6 @@ end: free (new_data); if (buffer_full_name) free (buffer_full_name); + + return rc; } diff --git a/src/core/wee-input.h b/src/core/wee-input.h index 1234c9865..dddf591b9 100644 --- a/src/core/wee-input.h +++ b/src/core/wee-input.h @@ -23,10 +23,10 @@ struct t_gui_buffer; struct t_weechat_plugin; -extern void input_exec_command (struct t_gui_buffer *buffer, - int any_plugin, - struct t_weechat_plugin *plugin, - const char *string); -extern void input_data (struct t_gui_buffer *buffer, const char *data); +extern int input_exec_command (struct t_gui_buffer *buffer, + int any_plugin, + struct t_weechat_plugin *plugin, + const char *string); +extern int input_data (struct t_gui_buffer *buffer, const char *data); #endif /* WEECHAT_INPUT_H */ diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index e7824dcd8..ef6acfed5 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -437,7 +437,7 @@ gui_input_return (struct t_gui_buffer *buffer) gui_input_text_changed_modifier_and_signal (window->buffer, 0, /* save undo */ 1); /* stop completion */ - input_data (window->buffer, command); + (void) input_data (window->buffer, command); free (command); } } diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 4cbaaea52..24f914da7 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1148,7 +1148,7 @@ gui_key_focus_command (const char *key, int context, command, ptr_buffer->full_name); } - input_data (ptr_buffer, command); + (void) input_data (ptr_buffer, command); } free (command); } @@ -1377,7 +1377,8 @@ gui_key_pressed (const char *key_str) { for (i = 0; commands[i]; i++) { - input_data (gui_current_window->buffer, commands[i]); + (void) input_data (gui_current_window->buffer, + commands[i]); } string_free_split (commands); } diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index fad87ab7b..374523091 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -815,8 +815,7 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, (void) buffer; (void) argv_eol; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); for (i = 1; i < argc; i++) { diff --git a/src/plugins/aspell/weechat-aspell-command.c b/src/plugins/aspell/weechat-aspell-command.c index 0f06dfcd4..c9c12439a 100644 --- a/src/plugins/aspell/weechat-aspell-command.c +++ b/src/plugins/aspell/weechat-aspell-command.c @@ -420,8 +420,7 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer, /* set dictionary for current buffer */ if (weechat_strcasecmp (argv[1], "setdict") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "setdict"); dicts = weechat_string_replace (argv_eol[2], " ", ""); weechat_aspell_command_set_dict (buffer, (dicts) ? dicts : argv[2]); @@ -440,8 +439,7 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer, /* add word to personal dictionary */ if (weechat_strcasecmp (argv[1], "addword") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "addword"); if (argc > 3) { /* use a given dict */ @@ -455,7 +453,7 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index b16252c1f..1d21c549c 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -488,7 +488,7 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc, length = strlen (plugin_name) + 1 + strlen (name) + 1; option_name = malloc (length); if (!option_name) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; snprintf (option_name, length, "%s.%s", plugin_name, name); } diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c index 0b54c7cb1..9e211bfa5 100644 --- a/src/plugins/exec/exec-command.c +++ b/src/plugins/exec/exec-command.c @@ -627,8 +627,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, /* send text to a running process */ if (weechat_strcasecmp (argv[1], "-in") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "-in"); ptr_exec_cmd = exec_command_search_running_id (argv[2]); if (ptr_exec_cmd && ptr_exec_cmd->hook) { @@ -647,8 +646,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, /* send text to a running process (if given), then close stdin */ if (weechat_strcasecmp (argv[1], "-inclose") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "-inclose"); ptr_exec_cmd = exec_command_search_running_id (argv[2]); if (ptr_exec_cmd && ptr_exec_cmd->hook) { @@ -671,8 +669,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, /* send a signal to a running process */ if (weechat_strcasecmp (argv[1], "-signal") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "-signal"); ptr_exec_cmd = exec_command_search_running_id (argv[2]); if (ptr_exec_cmd) weechat_hook_set (ptr_exec_cmd->hook, "signal", argv[3]); @@ -682,8 +679,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, /* send a KILL signal to a running process */ if (weechat_strcasecmp (argv[1], "-kill") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "-kill"); ptr_exec_cmd = exec_command_search_running_id (argv[2]); if (ptr_exec_cmd) weechat_hook_set (ptr_exec_cmd->hook, "signal", "kill"); @@ -707,8 +703,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, /* set a hook property */ if (weechat_strcasecmp (argv[1], "-set") == 0) { - if (argc < 5) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(5, "-set"); ptr_exec_cmd = exec_command_search_running_id (argv[2]); if (ptr_exec_cmd) weechat_hook_set (ptr_exec_cmd->hook, argv[3], argv_eol[4]); @@ -718,8 +713,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc, /* delete terminated command(s) */ if (weechat_strcasecmp (argv[1], "-del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "-del"); if (weechat_strcasecmp (argv[2], "-all") == 0) { count = 0; diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index fa0536697..bfc48cc19 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -3875,16 +3875,18 @@ weechat_guile_api_bar_remove (SCM bar) SCM weechat_guile_api_command (SCM buffer, SCM command) { + int rc; + API_FUNC(1, "command", API_RETURN_ERROR); if (!scm_is_string (buffer) || !scm_is_string (command)) API_WRONG_ARGS(API_RETURN_ERROR); - plugin_script_api_command (weechat_guile_plugin, - guile_current_script, - API_STR2PTR(API_SCM_TO_STRING(buffer)), - API_SCM_TO_STRING(command)); + rc = plugin_script_api_command (weechat_guile_plugin, + guile_current_script, + API_STR2PTR(API_SCM_TO_STRING(buffer)), + API_SCM_TO_STRING(command)); - API_RETURN_OK; + API_RETURN_INT(rc); } SCM diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 7d4304d9f..008c1438c 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -630,7 +630,7 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer, weechat_guile_unload_all (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } else { @@ -691,7 +691,7 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer, weechat_guile_stdout_flush (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 87e9c6cf0..46a885bfd 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -373,8 +373,7 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); current_server = 0; ptr_exclude_channels = NULL; @@ -425,8 +424,7 @@ irc_command_allpv (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); current_server = 0; ptr_exclude_channels = NULL; @@ -547,8 +545,7 @@ irc_command_allserv (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) buffer; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); ptr_exclude_servers = NULL; ptr_command = argv_eol[1]; @@ -1277,12 +1274,11 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); irc_cmd = strdup (argv[2]); if (!irc_cmd) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; weechat_string_toupper (irc_cmd); @@ -1462,8 +1458,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); /* use the local interface, from the server socket */ memset (&addr, 0, sizeof (addr)); @@ -1484,8 +1479,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, /* DCC SEND file */ if (weechat_strcasecmp (argv[1], "send") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "send"); infolist = weechat_infolist_new (); if (infolist) { @@ -1513,8 +1507,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, /* DCC CHAT */ if (weechat_strcasecmp (argv[1], "chat") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "chat"); infolist = weechat_infolist_new (); if (infolist) { @@ -1539,7 +1532,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* @@ -1948,8 +1941,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc, /* add ignore */ if (weechat_strcasecmp (argv[1], "add") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "add"); mask = argv[2]; server = (argc > 3) ? argv[3] : NULL; @@ -2015,8 +2007,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc, /* delete ignore */ if (weechat_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "del"); if (weechat_strcasecmp (argv[2], "-all") == 0) { @@ -2069,7 +2060,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* @@ -2119,8 +2110,7 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv_eol; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (argc > 2) { @@ -2182,8 +2172,7 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "ISON :%s", argv_eol[1]); @@ -2345,10 +2334,10 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[i], "-server") == 0) { if (argc <= i + 1) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; ptr_server = irc_server_search (argv[i + 1]); if (!ptr_server) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; arg_channels = i + 2; i++; } @@ -2380,7 +2369,7 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc, 1, noswitch); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; @@ -2437,13 +2426,11 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (irc_channel_is_channel (ptr_server, argv[1])) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); pos_channel = argv[1]; pos_nick = argv[2]; pos_comment = argv_eol[3]; @@ -2488,13 +2475,11 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (irc_channel_is_channel (ptr_server, argv[1])) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); pos_channel = argv[1]; pos_nick = argv[2]; pos_comment = argv_eol[3]; @@ -2518,7 +2503,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc, /* kick nick from channel */ nick_only = strdup (pos_nick); if (!nick_only) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; pos = strchr (nick_only, '@'); if (pos) @@ -2582,8 +2567,7 @@ irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (argc < 3) { @@ -2951,8 +2935,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); arg_target = 1; arg_text = 2; @@ -2970,7 +2953,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, targets = weechat_string_split (argv[arg_target], ",", 0, 0, &num_targets); if (!targets) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; for (i = 0; i < num_targets; i++) { @@ -3222,13 +3205,12 @@ irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv_eol; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (argc > 2) { if (weechat_strcasecmp (argv[1], "-all") != 0) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { @@ -3259,8 +3241,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); arg_target = 1; arg_text = 2; @@ -3356,8 +3337,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, /* add notify */ if (weechat_strcasecmp (argv[1], "add") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "add"); check_away = 0; @@ -3440,8 +3420,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, /* delete notify */ if (weechat_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "del"); if (argc > 3) { @@ -3514,7 +3493,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* @@ -3572,8 +3551,7 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "OPER %s", argv_eol[1]); @@ -3693,8 +3671,7 @@ irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PING %s", argv_eol[1]); @@ -3717,8 +3694,7 @@ irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "PONG %s", argv_eol[1]); @@ -3742,8 +3718,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); arg_nick = 1; arg_text = 2; @@ -3758,7 +3733,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, nicks = weechat_string_split (argv[arg_nick], ",", 0, 0, &num_nicks); if (!nicks) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; for (i = 0; i < num_nicks; i++) { @@ -3901,21 +3876,20 @@ irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if ((argc >= 4) && (weechat_strcasecmp (argv[1], "-server") == 0)) { ptr_server = irc_server_search (argv[2]); if (!ptr_server || (ptr_server->sock < 0)) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "%s", argv_eol[3]); } else { if (!ptr_server || (ptr_server->sock < 0)) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "%s", argv_eol[1]); } @@ -4102,16 +4076,14 @@ irc_command_remove (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); ptr_channel_name = (ptr_channel) ? ptr_channel->name : NULL; index_nick = 1; if (irc_channel_is_channel (ptr_server, argv[1])) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); ptr_channel_name = argv[1]; index_nick = 2; } @@ -4192,8 +4164,7 @@ irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "SAJOIN %s %s", argv[1], argv_eol[2]); @@ -4276,8 +4247,7 @@ irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "SANICK %s %s", argv[1], argv_eol[2]); @@ -4299,8 +4269,7 @@ irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "SAPART %s %s", argv[1], argv_eol[2]); @@ -4322,8 +4291,7 @@ irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "SAQUIT %s :%s", argv[1], argv_eol[2]); @@ -4784,8 +4752,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "add") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "add"); ptr_server2 = irc_server_casesearch (argv[2]); if (ptr_server2) { @@ -4829,8 +4796,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "copy") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "copy"); /* look for server by name */ server_found = irc_server_search (argv[2]); @@ -4873,13 +4839,12 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } if (weechat_strcasecmp (argv[1], "rename") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "rename"); /* look for server by name */ server_found = irc_server_search (argv[2]); @@ -4921,13 +4886,12 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } if (weechat_strcasecmp (argv[1], "keep") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "keep"); /* look for server by name */ server_found = irc_server_search (argv[2]); @@ -4968,8 +4932,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "del"); /* look for server by name */ server_found = irc_server_search (argv[2]); @@ -5040,8 +5003,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "fakerecv") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "fakerecv"); IRC_COMMAND_CHECK_SERVER("server fakerecv", 1); length = strlen (argv_eol[2]); if (length > 0) @@ -5060,7 +5022,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* @@ -5078,8 +5040,7 @@ irc_command_service (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "SERVICE %s", argv_eol[1]); @@ -5131,8 +5092,7 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (argc > 2) { @@ -5163,8 +5123,7 @@ irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, 0, NULL, "SQUIT %s", argv_eol[1]); @@ -5216,8 +5175,7 @@ irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "SUMMON %s", argv_eol[1]); @@ -5379,8 +5337,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv_eol; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (irc_channel_is_channel (ptr_server, argv[1])) { @@ -5438,8 +5395,7 @@ irc_command_unquiet (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv_eol; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (irc_channel_is_channel (ptr_server, argv[1])) { @@ -5505,8 +5461,7 @@ irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "USERHOST %s", argv_eol[1]); @@ -5641,8 +5596,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc, /* make C compiler happy */ (void) data; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); if (irc_channel_is_channel (ptr_server, argv[1])) { @@ -5750,8 +5704,7 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "WALLOPS :%s", argv_eol[1]); @@ -5829,7 +5782,7 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc, } if (!ptr_nick) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "WHOIS %s%s%s", @@ -5856,8 +5809,7 @@ irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc, (void) data; (void) argv; - if (argc < 2) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(2, ""); irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, "WHOWAS %s", argv_eol[1]); diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 7c8ab50fd..f67bcbc47 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -906,7 +906,7 @@ logger_command_cb (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 7e9d4b02c..4e7847d50 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -4249,6 +4249,7 @@ static int weechat_lua_api_command (lua_State *L) { const char *buffer, *command; + int rc; API_FUNC(1, "command", API_RETURN_ERROR); if (lua_gettop (L) < 2) @@ -4257,12 +4258,12 @@ weechat_lua_api_command (lua_State *L) buffer = lua_tostring (L, -2); command = lua_tostring (L, -1); - plugin_script_api_command (weechat_lua_plugin, - lua_current_script, - API_STR2PTR(buffer), - command); + rc = plugin_script_api_command (weechat_lua_plugin, + lua_current_script, + API_STR2PTR(buffer), + command); - API_RETURN_OK; + API_RETURN_INT(rc); } static int diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c index 7f3b5ae3f..bff220509 100644 --- a/src/plugins/lua/weechat-lua.c +++ b/src/plugins/lua/weechat-lua.c @@ -645,7 +645,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer, weechat_lua_unload_all (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } else { @@ -695,7 +695,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer, lua_quiet = 0; } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index b6af4654d..02a8c3784 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -4019,6 +4019,7 @@ XS (XS_weechat_api_bar_remove) XS (XS_weechat_api_command) { char *buffer, *command; + int rc; dXSARGS; API_FUNC(1, "command", API_RETURN_ERROR); @@ -4028,12 +4029,12 @@ XS (XS_weechat_api_command) buffer = SvPV_nolen (ST (0)); command = SvPV_nolen (ST (1)); - plugin_script_api_command (weechat_perl_plugin, - perl_current_script, - API_STR2PTR(buffer), - command); + rc = plugin_script_api_command (weechat_perl_plugin, + perl_current_script, + API_STR2PTR(buffer), + command); - API_RETURN_OK; + API_RETURN_INT(rc); } XS (XS_weechat_api_info_get) diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index 6ab7c59f3..4422bdef1 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -674,7 +674,7 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer, weechat_perl_unload_all (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } else { @@ -724,7 +724,7 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer, perl_quiet = 0; } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 661939251..cc27a69e2 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -260,21 +260,24 @@ plugin_api_color (const char *color_name) * Executes a command on a buffer (simulates user entry). */ -void +int plugin_api_command (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer, const char *command) { char *command2; + int rc; if (!plugin || !command) - return; + return WEECHAT_RC_ERROR; command2 = string_iconv_to_internal (plugin->charset, command); if (!buffer) buffer = gui_current_window->buffer; - input_data (buffer, (command2) ? command2 : command); + rc = input_data (buffer, (command2) ? command2 : command); if (command2) free (command2); + + return rc; } /* diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h index 50eb62685..b1ef8fd2e 100644 --- a/src/plugins/plugin-api.h +++ b/src/plugins/plugin-api.h @@ -53,8 +53,9 @@ extern const char *plugin_api_prefix (const char *prefix); extern const char *plugin_api_color (const char *color_name); /* command */ -extern void plugin_api_command (struct t_weechat_plugin *plugin, - struct t_gui_buffer *buffer, const char *command); +extern int plugin_api_command (struct t_weechat_plugin *plugin, + struct t_gui_buffer *buffer, + const char *command); /* infolist */ extern int plugin_api_infolist_next (struct t_infolist *infolist); diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c index ee5938d33..259f7205c 100644 --- a/src/plugins/plugin-script-api.c +++ b/src/plugins/plugin-script-api.c @@ -1331,20 +1331,23 @@ plugin_script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin, * Executes a command on a buffer (simulates user entry). */ -void +int plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script *script, struct t_gui_buffer *buffer, const char *command) { char *command2; + int rc; command2 = (script->charset && script->charset[0]) ? weechat_iconv_to_internal (script->charset, command) : NULL; - weechat_command (buffer, (command2) ? command2 : command); + rc = weechat_command (buffer, (command2) ? command2 : command); if (command2) free (command2); + + return rc; } /* diff --git a/src/plugins/plugin-script-api.h b/src/plugins/plugin-script-api.h index e278f8217..fc48d995d 100644 --- a/src/plugins/plugin-script-api.h +++ b/src/plugins/plugin-script-api.h @@ -330,10 +330,10 @@ extern struct t_gui_bar_item *plugin_script_api_bar_item_new (struct t_weechat_p extern void plugin_script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script *script, struct t_gui_bar_item *item); -extern void plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, - struct t_plugin_script *script, - struct t_gui_buffer *buffer, - const char *command); +extern int plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script *script, + struct t_gui_buffer *buffer, + const char *command); extern const char *plugin_script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script *script, const char *option); diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index c79196ad5..d2611ead1 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -4198,6 +4198,7 @@ static PyObject * weechat_python_api_command (PyObject *self, PyObject *args) { char *buffer, *command; + int rc; API_FUNC(1, "command", API_RETURN_ERROR); buffer = NULL; @@ -4205,12 +4206,12 @@ weechat_python_api_command (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &command)) API_WRONG_ARGS(API_RETURN_ERROR); - plugin_script_api_command (weechat_python_plugin, - python_current_script, - API_STR2PTR(buffer), - command); + rc = plugin_script_api_command (weechat_python_plugin, + python_current_script, + API_STR2PTR(buffer), + command); - API_RETURN_OK; + API_RETURN_INT(rc); } static PyObject * diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index aaf6f9210..5e2c10eeb 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -960,7 +960,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer, weechat_python_unload_all (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } else { @@ -1010,7 +1010,7 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer, python_quiet = 0; } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c index fb4432394..2807154ab 100644 --- a/src/plugins/relay/relay-command.c +++ b/src/plugins/relay/relay-command.c @@ -216,8 +216,7 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "add") == 0) { - if (argc < 4) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(4, "add"); if (relay_config_create_option_port (NULL, relay_config_file, relay_config_section_port, @@ -234,8 +233,7 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "del") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "del"); ptr_server = relay_server_search (argv_eol[2]); if (ptr_server) { @@ -264,8 +262,7 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "stop") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "stop"); ptr_server = relay_server_search (argv_eol[2]); if (ptr_server) { @@ -284,8 +281,7 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "restart") == 0) { - if (argc < 3) - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_MIN_ARGS(3, "restart"); ptr_server = relay_server_search (argv_eol[2]); if (ptr_server) { @@ -315,7 +311,7 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } if (!relay_buffer) diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 752a17861..23958253d 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -4897,6 +4897,7 @@ static VALUE weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command) { char *c_buffer, *c_command; + int rc; API_FUNC(1, "command", API_RETURN_ERROR); if (NIL_P (buffer) || NIL_P (command)) @@ -4908,12 +4909,12 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command) c_buffer = StringValuePtr (buffer); c_command = StringValuePtr (command); - plugin_script_api_command (weechat_ruby_plugin, - ruby_current_script, - API_STR2PTR(c_buffer), - c_command); + rc = plugin_script_api_command (weechat_ruby_plugin, + ruby_current_script, + API_STR2PTR(c_buffer), + c_command); - API_RETURN_OK; + API_RETURN_INT(rc); } static VALUE diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index d92b180b7..b519ce237 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -814,7 +814,7 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer, weechat_ruby_unload_all (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } else { @@ -864,7 +864,7 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer, ruby_quiet = 0; } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c index 6cc8edbf2..fd67083f7 100644 --- a/src/plugins/script/script-command.c +++ b/src/plugins/script/script-command.c @@ -275,7 +275,7 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } /* diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 7ba8689e3..395be4870 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -4663,7 +4663,7 @@ weechat_tcl_api_command (ClientData clientData, Tcl_Interp *interp, { Tcl_Obj *objp; char *buffer, *command; - int i; + int i, rc; API_FUNC(1, "command", API_RETURN_ERROR); if (objc < 3) @@ -4672,12 +4672,12 @@ weechat_tcl_api_command (ClientData clientData, Tcl_Interp *interp, buffer = Tcl_GetStringFromObj (objv[1], &i); command = Tcl_GetStringFromObj (objv[2], &i); - plugin_script_api_command (weechat_tcl_plugin, - tcl_current_script, - API_STR2PTR(buffer), - command); + rc = plugin_script_api_command (weechat_tcl_plugin, + tcl_current_script, + API_STR2PTR(buffer), + command); - API_RETURN_OK; + API_RETURN_INT(rc); } static int diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c index 4fe36cfdd..547105bc4 100644 --- a/src/plugins/tcl/weechat-tcl.c +++ b/src/plugins/tcl/weechat-tcl.c @@ -550,7 +550,7 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer, weechat_tcl_unload_all (); } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } else { @@ -600,7 +600,7 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer, tcl_quiet = 0; } else - return WEECHAT_RC_ERROR; + WEECHAT_COMMAND_ERROR; } return WEECHAT_RC_OK; diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index d24e3069f..e99e7126a 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -1049,6 +1049,9 @@ end: if (sargv) weechat_string_free_split (sargv); + if (rc == WEECHAT_RC_ERROR) + WEECHAT_COMMAND_ERROR; + return rc; } diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 67668be72..0ea4e58cf 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -57,7 +57,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20140829-01" +#define WEECHAT_PLUGIN_API_VERSION "20141122-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -192,6 +192,38 @@ struct timeval; } \ } +/* + * macro to return error in case of missing arguments in callback of + * hook_command + */ +#define WEECHAT_COMMAND_MIN_ARGS(__min_args, __option) \ + if (argc < __min_args) \ + { \ + weechat_printf_date_tags ( \ + NULL, 0, "no_filter", \ + _("%sToo few arguments for command \"%s%s%s\" " \ + "(help on command: /help %s)"), \ + weechat_prefix ("error"), \ + argv[0], \ + (__option && __option[0]) ? " " : "", \ + (__option && __option[0]) ? __option : "", \ + argv[0] + 1); \ + return WEECHAT_RC_ERROR; \ + } + +/* macro to return error in callback of hook_command */ +#define WEECHAT_COMMAND_ERROR \ + { \ + weechat_printf_date_tags ( \ + NULL, 0, "no_filter", \ + _("%sError with command \"%s\" " \ + "(help on command: /help %s)"), \ + weechat_prefix ("error"), \ + argv_eol[0], \ + argv[0] + 1); \ + return WEECHAT_RC_ERROR; \ + } + struct t_weechat_plugin { /* plugin variables */ @@ -813,8 +845,8 @@ struct t_weechat_plugin void (*bar_remove) (struct t_gui_bar *bar); /* command */ - void (*command) (struct t_weechat_plugin *plugin, - struct t_gui_buffer *buffer, const char *command); + int (*command) (struct t_weechat_plugin *plugin, + struct t_gui_buffer *buffer, const char *command); /* network */ int (*network_pass_proxy) (const char *proxy, int sock, |