diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-11-09 15:35:54 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-11-09 15:35:54 +0100 |
commit | ff62f3edff3f2685652b09bc91f37be1f5ce1b6c (patch) | |
tree | 16a8c18803578cecc2f6a7416ef456705aa84ec5 | |
parent | 652653ff8201d61cb3d9d019a7b6f8da3daf9850 (diff) | |
download | weechat-ff62f3edff3f2685652b09bc91f37be1f5ce1b6c.zip |
api: add support of infos with format `${info:name,arguments}` in function string_eval_expression and command /eval
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/de/autogen/user/weechat_commands.txt | 68 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.txt | 10 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.txt | 10 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.txt | 10 | ||||
-rw-r--r-- | doc/ja/autogen/user/weechat_commands.txt | 66 | ||||
-rw-r--r-- | po/cs.po | 12 | ||||
-rw-r--r-- | po/de.po | 13 | ||||
-rw-r--r-- | po/es.po | 12 | ||||
-rw-r--r-- | po/fr.po | 25 | ||||
-rw-r--r-- | po/hu.po | 12 | ||||
-rw-r--r-- | po/it.po | 12 | ||||
-rw-r--r-- | po/ja.po | 13 | ||||
-rw-r--r-- | po/pl.po | 13 | ||||
-rw-r--r-- | po/pt_BR.po | 12 | ||||
-rw-r--r-- | po/ru.po | 12 | ||||
-rw-r--r-- | po/tr.po | 12 | ||||
-rw-r--r-- | po/weechat.pot | 12 | ||||
-rw-r--r-- | src/core/wee-command.c | 14 | ||||
-rw-r--r-- | src/core/wee-eval.c | 30 |
20 files changed, 218 insertions, 152 deletions
@@ -27,6 +27,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * core: fix truncated prefix when filters are toggled (bug #40204) * core: add options to customize default text search in buffers: weechat.look.buffer_search_{case_sensitive|force_default|regex|where} +* api: add support of infos with format `${info:name,arguments}` in function + string_eval_expression and command /eval * api: add support for C++ plugins * api: fix read of arrays in hdata functions hdata_<type> (bug #40354) * irc: fix groups in channel nicklist when reconnecting to a server that diff --git a/doc/de/autogen/user/weechat_commands.txt b/doc/de/autogen/user/weechat_commands.txt index bc233382f..399af1db5 100644 --- a/doc/de/autogen/user/weechat_commands.txt +++ b/doc/de/autogen/user/weechat_commands.txt @@ -217,42 +217,44 @@ infolists: zeigt Information über die Infolists an /eval [-n] <expression> [-n] -c <expression1> <operator> <expression2> - -n: zeigt das Ergebnis lokal an, ohne das dieses in den Buffer gesendet wird (debug Modus) - -c: Auswertung als Bedingung: nutzt Operatoren und runde Klammern, Rückgabewert als Boolean-Wert ("0" oder "1") -expression: Ausdruck welcher verarbeitet werden soll. Variablen im Format ${variable} werden ersetzt (siehe unten) - operator: ein logischer oder vergleichender Operand: - - logische Operanden: - && boolean "und" - || boolean "oder" - - vergleichende Operanden: - == gleich - != ungleich - <= kleiner oder gleich - < kleiner - >= größer oder gleich - > größer - =~ stimmt mit regulärem Ausdruck überein - !~ stimmt NICHT mit regulärem Ausdruck überein - -Ein Ausdruck gilt als "wahr", sofern das Ergebnis nicht NULL, nicht leer und von "0" abweichend ist. -Der Vergleich findet zwischen zwei Integer Werten statt, sofern die beiden Ausdrücke gültige Integer-Werte sind. -Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel: + -n: display result without sending it to buffer (debug mode) + -c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1") +expression: expression to evaluate, variables with format ${variable} are replaced (see below) + operator: a logical or comparison operator: + - logical operators: + && boolean "and" + || boolean "or" + - comparison operators: + == equal + != not equal + <= less or equal + < less + >= greater or equal + > greater + =~ is matching regex + !~ is NOT matching regex + +An expression is considered as "true" if it is not NULL, not empty, and different from "0". +The comparison is made using integers if the two expressions are valid integers. +To force a string comparison, add double quotes around each expression, for example: 50 > 100 ==> 0 "50" > "100" ==> 1 -Einige Variablen werden im Ausdruck, mittels der Formatierung ${Variable}, ersetzt. Mögliche Variablen sind, nach Reihenfolge ihrer Priorität: - 1. eine Farbe (Format: color:xxx) - 2. der Name einer Option (Format: file.section.option) - 3. der Name einer lokalen Variablen eines Buffer - 4. ein hdata Name/Variable (der Wert wird automatisch als Zeichenkette konvertiert), Standardmäßig wird für "window" und "buffer" das aktuelle Fenster/Buffer verwendet. -Das Format für hdata kann wie folgt lauten: - hdata.var1.var2...: startet mit hdata (der Pointer muss bekannt sein) und fragt eine Variable nach der anderen ab (weitere hdata können folgen) - hdata[list].var1.var2...: startet hdata mittels einer Liste, zum Beispiel: - ${buffer[gui_buffers].full_name}: der vollständige Name des ersten Buffers, in der verknüpften Liste aller Buffer - ${plugin[weechat_plugins].name}: Name der ersten Erweiterung, in der verknüpften Liste aller Erweiterungen -Die vorhandenen Namen für hdata und Variablen sind in der "Anleitung für API Erweiterung", Bereich "weechat_hdata_get". beschrieben - -Beispiele: +Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : + 1. a color (format: "color:xxx") + 2. an info (format: "info:name,arguments", arguments are optional) + 3. an option (format: "file.section.option") + 4. a local variable in buffer + 5. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. +Format for hdata can be one of following: + hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) + hdata[list].var1.var2...: start with a hdata using a list, for example: + ${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers + ${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins +For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". + +Examples: + /eval -n ${info:version} ==> 0.4.3 /eval -n ${weechat.look.scroll_amount} ==> 3 /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index ab2040949..e2eb66896 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -241,10 +241,11 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : - 1. a color (format: color:xxx) - 2. an option (format: file.section.option) - 3. a local variable in buffer - 4. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. a color (format: "color:xxx") + 2. an info (format: "info:name,arguments", arguments are optional) + 3. an option (format: "file.section.option") + 4. a local variable in buffer + 5. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list, for example: @@ -253,6 +254,7 @@ Format for hdata can be one of following: For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". Examples: + /eval -n ${info:version} ==> 0.4.3 /eval -n ${weechat.look.scroll_amount} ==> 3 /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index aa96dcd27..565848580 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -241,10 +241,11 @@ Pour forcer une comparaison de chaînes, ajoutez des guillemets autour de chaque "50" > "100" ==> 1 Des variables sont remplacées dans l'expression, en utilisant le format ${variable}, la variable pouvant être, par ordre de priorité : - 1. une couleur (format: color:xxx) - 2. une option (format: fichier.section.option) - 3. une variable locale du tampon - 4. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants. + 1. une couleur (format: "color:xxx") + 2. une info (format: "info:nom,paramètres", les paramètres sont optionnels) + 3. une option (format: "fichier.section.option") + 4. une variable locale du tampon + 5. un hdata/variable (la valeur est automatiquement convertie en chaîne), par défaut "window" et "buffer" pointent vers la fenêtre et le tampon courants. Le format du hdata peut être le suivant : hdata.var1.var2...: démarrer avec un hdata (le pointeur doit être connu), et demander les variables l'une après l'autre (d'autres hdata peuvent être suivis) hdata[list].var1.var2...: démarrer avec un hdata en utilisant une liste, par exemple : @@ -253,6 +254,7 @@ Le format du hdata peut être le suivant : Pour le nom du hdata et des variables, voir la "Référence API extension", fonction "weechat_hdata_get". Exemples: + /eval -n ${info:version} ==> 0.4.3 /eval -n ${weechat.look.scroll_amount} ==> 3 /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index 2ab3fb70a..c4f89bbb2 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -241,10 +241,11 @@ To force a string comparison, add double quotes around each expression, for exam "50" > "100" ==> 1 Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : - 1. a color (format: color:xxx) - 2. an option (format: file.section.option) - 3. a local variable in buffer - 4. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. + 1. a color (format: "color:xxx") + 2. an info (format: "info:name,arguments", arguments are optional) + 3. an option (format: "file.section.option") + 4. a local variable in buffer + 5. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. Format for hdata can be one of following: hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) hdata[list].var1.var2...: start with a hdata using a list, for example: @@ -253,6 +254,7 @@ Format for hdata can be one of following: For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". Examples: + /eval -n ${info:version} ==> 0.4.3 /eval -n ${weechat.look.scroll_amount} ==> 3 /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 diff --git a/doc/ja/autogen/user/weechat_commands.txt b/doc/ja/autogen/user/weechat_commands.txt index a5174ff2d..665b26754 100644 --- a/doc/ja/autogen/user/weechat_commands.txt +++ b/doc/ja/autogen/user/weechat_commands.txt @@ -217,42 +217,44 @@ infolists: infolist に関する情報を表示 /eval [-n] <expression> [-n] -c <expression1> <operator> <expression2> - -n: 結果をバッファに送信せずに表示 (デバッグモード) - -c: 条件として評価: 演算子と括弧をを使い、ブール値 ("0" または "1") を返します -expression: 評価する式、フォーマット、${variable} 型のフォーマットの変数は置換されます (以下を参照) - operator: 論理演算子や比較演算子: - - 論理演算子: - && ブール演算の "and" - || ブール演算の "or" - - 比較演算子: - == 等しい - != 等しくない - <= 以下 - < より少ない - >= 以上 - > より大きい - =~ 正規表現にマッチ - !~ 正規表現にマッチしない - -式が NULL でない場合、空でない場合、"0" でない場合、式は "真" と評価されます。 -両方の式が有効な整数である場合、比較は整数を使って行われます。 -文字列比較を強制するには、それぞれの式をダブルクォートで囲みます、例えば: + -n: display result without sending it to buffer (debug mode) + -c: evaluate as condition: use operators and parentheses, return a boolean value ("0" or "1") +expression: expression to evaluate, variables with format ${variable} are replaced (see below) + operator: a logical or comparison operator: + - logical operators: + && boolean "and" + || boolean "or" + - comparison operators: + == equal + != not equal + <= less or equal + < less + >= greater or equal + > greater + =~ is matching regex + !~ is NOT matching regex + +An expression is considered as "true" if it is not NULL, not empty, and different from "0". +The comparison is made using integers if the two expressions are valid integers. +To force a string comparison, add double quotes around each expression, for example: 50 > 100 ==> 0 "50" > "100" ==> 1 -式中の ${variable} 型のフォーマットの変数は置換さます。変数は以下の優先順位に従います。 - 1. 色の名前 (フォーマット: color:xxx) - 2. オプションの名前 (file.section.option) - 3. バッファのローカル変数の名前 - 4. hdata の名前/変数 (値は自動的に文字列に変換されます)、デフォルトでは "window" と "buffer" は現在のウィンドウ/バッファを指します。 -hdata のフォーマットは以下の 1 つです: - hdata.var1.var2...: hdata (ポインタは既知) で始まり、1 個ずつ変数を続ける (他の hdata を続けることも可能) - hdata(list).var1.var2...: リストを使って hdata を始める、例: - ${buffer[gui_buffers].full_name}: バッファリストにリンクされた最初のバッファのフルネーム - ${plugin[weechat_plugins].name}: プラグインリストにリンクされた最初のプラグインの名前 -hdata と変数の名前については、"プラグイン API リファレンス" の "weechat_hdata_get" 関数を参照してください。 +Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority : + 1. a color (format: "color:xxx") + 2. an info (format: "info:name,arguments", arguments are optional) + 3. an option (format: "file.section.option") + 4. a local variable in buffer + 5. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer. +Format for hdata can be one of following: + hdata.var1.var2...: start with a hdata (pointer must be known), and ask variables one after one (other hdata can be followed) + hdata[list].var1.var2...: start with a hdata using a list, for example: + ${buffer[gui_buffers].full_name}: full name of first buffer in linked list of buffers + ${plugin[weechat_plugins].name}: name of first plugin in linked list of plugins +For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get". -例: +Examples: + /eval -n ${info:version} ==> 0.4.3 /eval -n ${weechat.look.scroll_amount} ==> 3 /eval -n ${window} ==> 0x2549aa0 /eval -n ${window.buffer} ==> 0x2549320 @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1312,10 +1312,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1329,6 +1330,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -1331,6 +1331,7 @@ msgstr "wertet eine Expression aus und zeigt das Resultat im Buffer an" msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>" msgstr "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>" +#, fuzzy msgid "" " -n: display result without sending it to buffer (debug mode)\n" " -c: evaluate as condition: use operators and parentheses, return a " @@ -1362,10 +1363,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1379,6 +1381,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1349,10 +1349,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1366,6 +1367,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" -"PO-Revision-Date: 2013-11-09 13:08+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" +"PO-Revision-Date: 2013-11-09 15:21+0100\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -1341,10 +1341,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1358,6 +1359,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -1402,10 +1404,12 @@ msgstr "" "\n" "Des variables sont remplacées dans l'expression, en utilisant le format " "${variable}, la variable pouvant être, par ordre de priorité :\n" -" 1. une couleur (format: color:xxx)\n" -" 2. une option (format: fichier.section.option)\n" -" 3. une variable locale du tampon\n" -" 4. un hdata/variable (la valeur est automatiquement convertie en chaîne), " +" 1. une couleur (format: \"color:xxx\")\n" +" 2. une info (format: \"info:nom,paramètres\", les paramètres sont " +"optionnels)\n" +" 3. une option (format: \"fichier.section.option\")\n" +" 4. une variable locale du tampon\n" +" 5. un hdata/variable (la valeur est automatiquement convertie en chaîne), " "par défaut \"window\" et \"buffer\" pointent vers la fenêtre et le tampon " "courants.\n" "Le format du hdata peut être le suivant :\n" @@ -1422,6 +1426,7 @@ msgstr "" "fonction \"weechat_hdata_get\".\n" "\n" "Exemples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1241,10 +1241,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1258,6 +1259,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1324,10 +1324,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1341,6 +1342,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/WeeChat>\n" @@ -1279,6 +1279,7 @@ msgstr "式を評価して結果をバッファに送信" msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>" msgstr "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>" +#, fuzzy msgid "" " -n: display result without sending it to buffer (debug mode)\n" " -c: evaluate as condition: use operators and parentheses, return a " @@ -1310,10 +1311,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1327,6 +1329,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1311,6 +1311,7 @@ msgstr "przetwarza wyrażenie i wysyła wynik do buforu" msgid "[-n] <expression> || [-n] -c <expression1> <operator> <expression2>" msgstr "[-n] <wyrażenie> || [-n] -c <wyrażenie1> <operator> <wyrażenie2>" +#, fuzzy msgid "" " -n: display result without sending it to buffer (debug mode)\n" " -c: evaluate as condition: use operators and parentheses, return a " @@ -1342,10 +1343,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1359,6 +1361,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index 380dfe68c..070ffb8f7 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: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1364,10 +1364,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1381,6 +1382,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:18+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1263,10 +1263,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1280,6 +1281,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-11-09 10:13+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1105,10 +1105,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1122,6 +1123,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" diff --git a/po/weechat.pot b/po/weechat.pot index cb53825c7..8e204174c 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2013-11-09 12:20+0100\n" +"POT-Creation-Date: 2013-11-09 15:21+0100\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1111,10 +1111,11 @@ msgid "" "\n" "Some variables are replaced in expression, using the format ${variable}, " "variable can be, by order of priority :\n" -" 1. a color (format: color:xxx)\n" -" 2. an option (format: file.section.option)\n" -" 3. a local variable in buffer\n" -" 4. a hdata name/variable (the value is automatically converted to string), " +" 1. a color (format: \"color:xxx\")\n" +" 2. an info (format: \"info:name,arguments\", arguments are optional)\n" +" 3. an option (format: \"file.section.option\")\n" +" 4. a local variable in buffer\n" +" 5. a hdata name/variable (the value is automatically converted to string), " "by default \"window\" and \"buffer\" point to current window/buffer.\n" "Format for hdata can be one of following:\n" " hdata.var1.var2...: start with a hdata (pointer must be known), and ask " @@ -1128,6 +1129,7 @@ msgid "" "function \"weechat_hdata_get\".\n" "\n" "Examples:\n" +" /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 159ae457c..c58b60219 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -6410,11 +6410,14 @@ command_init () " 50 > 100 ==> 0\n" " \"50\" > \"100\" ==> 1\n\n" "Some variables are replaced in expression, using the " - "format ${variable}, variable can be, by order of priority :\n" - " 1. a color (format: color:xxx)\n" - " 2. an option (format: file.section.option)\n" - " 3. a local variable in buffer\n" - " 4. a hdata name/variable (the value is automatically " + "format ${variable}, variable can be, by order of " + "priority :\n" + " 1. a color (format: \"color:xxx\")\n" + " 2. an info (format: \"info:name,arguments\", arguments " + "are optional)\n" + " 3. an option (format: \"file.section.option\")\n" + " 4. a local variable in buffer\n" + " 5. a hdata name/variable (the value is automatically " "converted to string), by default \"window\" and \"buffer\" " "point to current window/buffer.\n" "Format for hdata can be one of following:\n" @@ -6430,6 +6433,7 @@ command_init () "For name of hdata and variables, please look at \"Plugin " "API reference\", function \"weechat_hdata_get\".\n\n" "Examples:\n" + " /eval -n ${info:version} ==> 0.4.3\n" " /eval -n ${weechat.look.scroll_amount} ==> 3\n" " /eval -n ${window} ==> 0x2549aa0\n" " /eval -n ${window.buffer} ==> 0x2549320\n" diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c index db1ae083c..074cd50b2 100644 --- a/src/core/wee-eval.c +++ b/src/core/wee-eval.c @@ -235,8 +235,8 @@ eval_replace_vars_cb (void *data, const char *text) struct t_config_option *ptr_option; struct t_gui_buffer *ptr_buffer; char str_value[64], *value, *pos, *pos1, *pos2, *hdata_name, *list_name; - char *tmp; - const char *ptr_value; + char *tmp, *info_name; + const char *ptr_value, *ptr_arguments; struct t_hdata *hdata; void *pointer; @@ -258,7 +258,27 @@ eval_replace_vars_cb (void *data, const char *text) return strdup ((ptr_value) ? ptr_value : ""); } - /* 3. look for name of option: if found, return this value */ + /* 3. look for an info */ + if (strncmp (text, "info:", 5) == 0) + { + ptr_value = NULL; + ptr_arguments = strchr (text + 5, ','); + if (ptr_arguments) + { + info_name = string_strndup (text + 5, ptr_arguments - text - 5); + ptr_arguments++; + } + else + info_name = strdup (text + 5); + if (info_name) + { + ptr_value = hook_info_get (NULL, info_name, ptr_arguments); + free (info_name); + } + return strdup ((ptr_value) ? ptr_value : ""); + } + + /* 4. look for name of option: if found, return this value */ if (strncmp (text, "sec.data.", 9) == 0) { ptr_value = hashtable_get (secure_hashtable_data, text + 9); @@ -289,7 +309,7 @@ eval_replace_vars_cb (void *data, const char *text) } } - /* 4. look for local variable in buffer */ + /* 5. look for local variable in buffer */ ptr_buffer = hashtable_get (pointers, "buffer"); if (ptr_buffer) { @@ -298,7 +318,7 @@ eval_replace_vars_cb (void *data, const char *text) return strdup (ptr_value); } - /* 5. look for hdata */ + /* 6. look for hdata */ value = NULL; hdata_name = NULL; list_name = NULL; |