core: add base 16/32/64 encoding/decoding in evaluation of expressions

This commit is contained in:
Sébastien Helleu 2020-05-21 09:36:35 +02:00
parent 1994d5641d
commit 66d4590dab
27 changed files with 531 additions and 240 deletions

View File

@ -26,6 +26,7 @@ New features::
* core: add default key kbd:[Alt+Enter] to insert a newline (issue #1498)
* core: add flag "input_multiline" in buffer (issue #984, issue #1063)
* core: add a scalable WeeChat logo (SVG) (issue #1454, issue #1456)
* core: add base 16/32/64 encoding/decoding in evaluation of expressions with "base_encode:base,xxx" and "base_decode:base,xxx"
* core: add case sensitive wildcard matching comparison operator (`+==*+` and `+!!*+`) and case sensitive/insensitive include comparison operators (`+==-+`, `+!!-+`, `+=-+`, `+!-+`) in evaluation of expressions
* core: add default key kbd:[Alt+Shift+N] to toggle nicklist bar
* core: add command line option "--stdout" in weechat-headless binary to log to stdout rather than ~/.weechat/weechat.log (issue #1475, issue #1477)

View File

@ -1282,75 +1282,76 @@ infolists: zeigt Information über die Infolists an
/eval [-n|-s] [-d] <expression>
[-n] [-d] -c <expression1> <operator> <expression2>
-n: gibt das Ergebnis aus, ohne dass dieses in den Buffer gesendet wird (debug Modus)
-s: teilt Ausdrücke, bevor sie evaluiert werden (mehrere Befehle können durch Semikolon getrennt werden)
-d: eine Debug-Ausgabe nach Auswertung anzeigen
-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); mehrere Befehle werden durch ein Semikolon voneinander getrennt
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 POSIX Ausdruck überein
!~ stimmt NICHT mit regulärem POSIX Ausdruck überein
=* stimmt mit Maske überein (Platzhalter "*" ist erlaubt)
!* stimmt mit Maske NICHT überein (Platzhalter "*" ist erlaubt)
=* stimmt mit Maske überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
!* stimmt mit Maske NICHT überein, Groß- und Kleinschreibung wird nicht beachtet (Platzhalter "*" ist erlaubt)
==- ist enthalten, Groß- und Kleinschreibung wird beachtet
!!- ist NICHT enthalten, Groß- und Kleinschreibung wird beachtet
=- ist enthalten, Groß- und Kleinschreibung wird nicht beachtet
!- ist NICHT enthalten, Groß- und Kleinschreibung wird nicht beachtet
-n: display result without sending it to buffer (debug mode)
-s: split expression before evaluating it (many commands can be separated by semicolons)
-d: display debug output after evaluation
-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); many commands can be separated by semicolons
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 POSIX extended regex
!~ is NOT matching POSIX extended regex
==* is matching mask, case sensitive (wildcard "*" is allowed)
!!* is NOT matching mask, case sensitive (wildcard "*" is allowed)
=* is matching mask, case insensitive (wildcard "*" is allowed)
!* is NOT matching mask, case insensitive (wildcard "*" is allowed)
==- is included, case sensitive
!!- is NOT included, case sensitive
=- is included, case insensitive
!- is NOT included, case insensitive
Ein Ausdruck gilt als "wahr" sofern das Ergebnis weder NULL, nicht leer und von "0" abweichend ist.
Für einen Vergleich werden Fließkommazahlen genutzt, insofern es sich bei beiden Ausdrücken um gültige Zahlen handelt, folgende Formate werden unterstützt:
- Integer (Beispiele: 5, -7)
- Fließkommazahl (Beispiele: 5.2, -7.5, 2.83e-2)
- hexadezimale Zahl (Beispiele: 0xA3, -0xA3)
Um einen Vergleich zwischen zwei Zeichenketten zu erzwingen, müssen die Ausdrücke in Anführungszeichen gesetzt werden, zum Beispiel:
An expression is considered as "true" if it is not NULL, not empty, and different from "0".
The comparison is made using floating point numbers if the two expressions are valid numbers, with one of the following formats:
- integer (examples: 5, -7)
- floating point number (examples: 5.2, -7.5, 2.83e-2)
- hexadecimal number (examples: 0xA3, -0xA3)
To force a string comparison, you can 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 evaluierte Teilzeichenkette (Format: "eval:xxx")
2. eine Zeichenkette mit Escapesequenzen (Format: "esc:xxx" oder "\xxx")
3. Zeichen, die in einer Zeichenkette nicht dargestellt werden sollen (Format: "hide:Zeichen,Zeichenkette")
4. eine Zeichenkette mit einer maximalen Anzahl an Zeichen (Format: "cut:+Max,Suffix,Zeichenkette")
oder maximale Anzahl an Zeichen die auf dem Bildschirm angezeigt werden sollen (Format: "cutscr:Max,Suffix,Zeichenkette oder "cutscr:+Max,Suffix,Zeichenkette")
5. eine Zeichenkette umkehren (Format: "rev:xxx" oder "revscr:xxx")
6. eine Zeichenkette wiederholen (Format: "repeat:Anzahl,Zeichenkette")
7. Länge einer Zeichenkette (Format: "length:xxx" oder "lengthscr:xxx")
8. eine Farbe (Format: "color:xxx", siehe "Anleitung für API Erweiterung", Funktion "color")
9. ein Modifizierer (Format: "info:Name,Argumente", Argumente sind optional)
10. eine Info (Format: "Info:Name,Argumente", Argumente sind optional)
11. aktuelles Datum/Uhrzeit (Format: "date" oder "date:format")
12. eine Umgebungsvariable (Format: "env:XXX")
13. ein Dreifachoperand (Format: "if:Bedingung?Wert_falls_wahr:Wert_falls_unwahr")
14. Ergebnis eines Ausdrucks mit Klammern und Operatoren + - * / // % ** (Format: "calc:xxx")
15. eine Option (Format: "file.section.option")
16. eine lokale Variable eines Buffers
17. ein(e) hdata - Name/Variable (der Wert wird automatisch in eine Zeichenkette konvertiert), standardmäßig wird für "window" und "buffer" das aktuelle Fenster/Buffer verwendet.
Das Format für hdata kann wie folgt aufgebaut sein:
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
hdata[pointer].var1.var2...: startet hdata mittels einem Pointer, zum Beispiel:
${buffer[0x1234abcd].full_name}: vollständiger Name eines Buffers und des dazugehörigen Pointers (kann in triggern benutzt werden)
Die vorhandenen Namen für hdata und Variablen sind in der "Anleitung für API Erweiterung", Bereich "weechat_hdata_get". beschrieben
Some variables are replaced in expression, using the format ${variable}, variable can be, by order of priority:
1. an evaluated sub-string (format: "eval:xxx")
2. a string with escaped chars (format: "esc:xxx" or "\xxx")
3. a string with chars to hide (format: "hide:char,string")
4. a string with max chars (format: "cut:max,suffix,string" or "cut:+max,suffix,string")
or max chars displayed on screen (format: "cutscr:max,suffix,string" or "cutscr:+max,suffix,string")
5. a reversed string (format: "rev:xxx" or "revscr:xxx")
6. a repeated string (format: "repeat:count,string")
7. length of a string (format: "length:xxx" or "lengthscr:xxx")
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. 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
hdata[pointer].var1.var2...: start with a hdata using a pointer, for example:
${buffer[0x1234abcd].full_name}: full name of the buffer with this pointer (can be used in triggers)
For name of hdata and variables, please look at "Plugin API reference", function "weechat_hdata_get".
Beispiele (einfache Zeichenketten):
Examples (simple strings):
/eval -n ${info:version} ==> 0.4.3
/eval -n ${env:HOME} ==> /home/user
/eval -n ${weechat.look.scroll_amount} ==> 3
/eval -n ${sec.data.freenode_password} ==> geheim
/eval -n ${sec.data.freenode_password} ==> secret
/eval -n ${window} ==> 0x2549aa0
/eval -n ${window.buffer} ==> 0x2549320
/eval -n ${window.buffer.full_name} ==> core.weechat
@ -1365,18 +1366,20 @@ Beispiele (einfache Zeichenketten):
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Beispiele (Bedingungen):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1
/eval -n -c (8 > 12) && (5 > 2) ==> 0
/eval -n -c abcd =~ ^ABC ==> 1
/eval -n -c abcd =~ (?-i)^ABC ==> 0
/eval -n -c abcd =~ (?-i)^abc ==> 1
/eval -n -c abcd !~ abc ==> 0
/eval -n -c abcd =* a*d ==> 1
/eval -n -c abcd =- bc ==> 1
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0
/eval -n -c ${window.win_width} > 100 ==> 1
/eval -n -c (8 > 12) || (5 > 2) ==> 1
/eval -n -c (8 > 12) && (5 > 2) ==> 0
/eval -n -c abcd =~ ^ABC ==> 1
/eval -n -c abcd =~ (?-i)^ABC ==> 0
/eval -n -c abcd =~ (?-i)^abc ==> 1
/eval -n -c abcd !~ abc ==> 0
/eval -n -c abcd =* a*d ==> 1
/eval -n -c abcd =- bc ==> 1
----
[[command_weechat_filter]]

View File

@ -1330,13 +1330,14 @@ Some variables are replaced in expression, using the format ${variable}, variabl
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. current date/time (format: "date" or "date:format")
12. an environment variable (format: "env:XXX")
13. a ternary operator (format: "if:condition?value_if_true:value_if_false")
14. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
15. an option (format: "file.section.option")
16. a local variable in buffer
17. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. 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:
@ -1365,6 +1366,8 @@ Examples (simple strings):
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2594,6 +2594,26 @@ expanded to last):
`+1.0+` +
`+lightblue+`
| `+${base_encode:base,xxx}+` +
_(WeeChat ≥ 2.9)_ |
String encoded in base 16, 32 or 64. |
`+${base_encode:16,test string}+` +
`+${base_encode:32,test string}+` +
`+${base_encode:64,test string}+` |
`+7465737420737472696E67+` +
`+ORSXG5BAON2HE2LOM4======+` +
`+dGVzdCBzdHJpbmc=+`
| `+${base_decode:base,xxx}+` +
_(WeeChat ≥ 2.9)_ |
String decoded from base 16, 32 or 64. |
`+${base_decode:16,7465737420737472696E67}+` +
`+${base_decode:32,ORSXG5BAON2HE2LOM4======}+` +
`+${base_decode:64,dGVzdCBzdHJpbmc=}+` |
`+test string+` +
`+test string+` +
`+test string+`
| `+${date}+` +
`+${date:xxx}+` +
_(WeeChat ≥ 1.3)_ |

View File

@ -1330,13 +1330,14 @@ Des variables sont remplacées dans l'expression, en utilisant le format ${varia
8. une couleur (format : "color:xxx", voir la "Référence API extension", fonction "color")
9. un modificateur (format : "modifier:nom,données,chaîne")
10. une info (format : "info:nom,paramètres", les paramètres sont optionnels)
11. la date/heure courante (format : "date" ou "date:format")
12. une variable d'environnement (format : "env:XXX")
13. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
14. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % ** (format: "calc:xxx")
15. une option (format : "fichier.section.option")
16. une variable locale du tampon
17. 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.
11. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "base_encode:base,xxx" ou "base_decode:base,xxx")
12. la date/heure courante (format : "date" ou "date:format")
13. une variable d'environnement (format : "env:XXX")
14. un opérateur ternaire (format : "if:condition?valeur_si_vrai:valeur_si_faux")
15. le résultat d'une expression avec parenthèses et les opérateurs + - * / // % ** (format: "calc:xxx")
16. une option (format : "fichier.section.option")
17. une variable locale du tampon
18. 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[liste].var1.var2... : démarrer avec un hdata en utilisant une liste, par exemple :
@ -1365,6 +1366,8 @@ Exemples (chaînes simples) :
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Exemples (conditions) :
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2640,6 +2640,27 @@ première étendue à la dernière) :
`+1.0+` +
`+lightblue+`
| `+${base_encode:base,xxx}+` +
_(WeeChat ≥ 2.9)_ |
Chaîne encodée en base 16, 32 ou 64. |
`+${base_encode:16,test string}+` +
`+${base_encode:32,test string}+` +
`+${base_encode:64,test string}+` |
`+7465737420737472696E67+` +
`+ORSXG5BAON2HE2LOM4======+` +
`+dGVzdCBzdHJpbmc=+`
// TRANSLATION MISSING
| `+${base_decode:base,xxx}+` +
_(WeeChat ≥ 2.9)_ |
Chaîne décodée depuis base 16, 32 ou 64. |
`+${base_decode:16,7465737420737472696E67}+` +
`+${base_decode:32,ORSXG5BAON2HE2LOM4======}+` +
`+${base_decode:64,dGVzdCBzdHJpbmc=}+` |
`+test string+` +
`+test string+` +
`+test string+`
| `+${date}+` +
`+${date:xxx}+` +
_(WeeChat ≥ 1.3)_ |

View File

@ -1330,13 +1330,14 @@ Some variables are replaced in expression, using the format ${variable}, variabl
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. current date/time (format: "date" or "date:format")
12. an environment variable (format: "env:XXX")
13. a ternary operator (format: "if:condition?value_if_true:value_if_false")
14. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
15. an option (format: "file.section.option")
16. a local variable in buffer
17. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. 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:
@ -1365,6 +1366,8 @@ Examples (simple strings):
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2701,6 +2701,28 @@ expanded to last):
`+1.0+` +
`+lightblue+`
// TRANSLATION MISSING
| `+${base_encode:base,xxx}+` +
_(WeeChat ≥ 2.9)_ |
String encoded in base 16, 32 or 64. |
`+${base_encode:16,test string}+` +
`+${base_encode:32,test string}+` +
`+${base_encode:64,test string}+` |
`+7465737420737472696E67+` +
`+ORSXG5BAON2HE2LOM4======+` +
`+dGVzdCBzdHJpbmc=+`
// TRANSLATION MISSING
| `+${base_decode:base,xxx}+` +
_(WeeChat ≥ 2.9)_ |
String decoded from base 16, 32 or 64. |
`+${base_decode:16,7465737420737472696E67}+` +
`+${base_decode:32,ORSXG5BAON2HE2LOM4======}+` +
`+${base_decode:64,dGVzdCBzdHJpbmc=}+` |
`+test string+` +
`+test string+` +
`+test string+`
| `+${date}+` +
`+${date:xxx}+` +
_(WeeChat ≥ 1.3)_ |

View File

@ -1330,13 +1330,14 @@ Some variables are replaced in expression, using the format ${variable}, variabl
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. current date/time (format: "date" or "date:format")
12. an environment variable (format: "env:XXX")
13. a ternary operator (format: "if:condition?value_if_true:value_if_false")
14. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
15. an option (format: "file.section.option")
16. a local variable in buffer
17. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. 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:
@ -1365,6 +1366,8 @@ Examples (simple strings):
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -2619,6 +2619,28 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio
`+1.0+` +
`+lightblue+`
// TRANSLATION MISSING
| `+${base_encode:base,xxx}+` +
_(WeeChat バージョン 2.9 以上で利用可)_ |
String encoded in base 16, 32 or 64. |
`+${base_encode:16,test string}+` +
`+${base_encode:32,test string}+` +
`+${base_encode:64,test string}+` |
`+7465737420737472696E67+` +
`+ORSXG5BAON2HE2LOM4======+` +
`+dGVzdCBzdHJpbmc=+`
// TRANSLATION MISSING
| `+${base_decode:base,xxx}+` +
_(WeeChat バージョン 2.9 以上で利用可)_ |
String decoded from base 16, 32 or 64. |
`+${base_decode:16,7465737420737472696E67}+` +
`+${base_decode:32,ORSXG5BAON2HE2LOM4======}+` +
`+${base_decode:64,dGVzdCBzdHJpbmc=}+` |
`+test string+` +
`+test string+` +
`+test string+`
| `+${date}+` +
`+${date:xxx}+` +
_(WeeChat バージョン 1.3 以上で利用可)_ |

View File

@ -1329,13 +1329,14 @@ Some variables are replaced in expression, using the format ${variable}, variabl
8. a color (format: "color:xxx", see "Plugin API reference", function "color")
9. a modifier (format: "modifier:name,data,string")
10. an info (format: "info:name,arguments", arguments are optional)
11. current date/time (format: "date" or "date:format")
12. an environment variable (format: "env:XXX")
13. a ternary operator (format: "if:condition?value_if_true:value_if_false")
14. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
15. an option (format: "file.section.option")
16. a local variable in buffer
17. a hdata name/variable (the value is automatically converted to string), by default "window" and "buffer" point to current window/buffer.
11. a base 16/32/64 encoded/decoded string (format: "base_encode:base,xxx" or "base_decode:base,xxx")
12. current date/time (format: "date" or "date:format")
13. an environment variable (format: "env:XXX")
14. a ternary operator (format: "if:condition?value_if_true:value_if_false")
15. result of an expression with parentheses and operators + - * / // % ** (format: "calc:xxx")
16. an option (format: "file.section.option")
17. a local variable in buffer
18. 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:
@ -1364,6 +1365,8 @@ Examples (simple strings):
/eval -n ${repeat:5,-} ==> -----
/eval -n ${length:test} ==> 4
/eval -n ${calc:(5+2)*3} ==> 21
/eval -n ${base_encode:64,test} ==> dGVzdA==
/eval -n ${base_decode:64,dGVzdA==} ==> test
Examples (conditions):
/eval -n -c ${window.buffer.number} > 2 ==> 0

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1604,15 +1604,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1649,6 +1651,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-05-08 19:58+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -1684,6 +1684,7 @@ msgstr ""
"[-n|-s] [-d] <expression> || [-n] [-d] -c <expression1> <operator> "
"<expression2>"
#, fuzzy
msgid ""
" -n: display result without sending it to buffer (debug mode)\n"
" -s: split expression before evaluating it (many commands can be "
@ -1747,15 +1748,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1792,6 +1795,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1634,15 +1634,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1679,6 +1681,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"PO-Revision-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-05-21 09:19+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -1717,15 +1717,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1762,6 +1764,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"
@ -1842,15 +1846,17 @@ msgstr ""
" 9. un modificateur (format : \"modifier:nom,données,chaîne\")\n"
" 10. une info (format : \"info:nom,paramètres\", les paramètres sont "
"optionnels)\n"
" 11. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 12. une variable d'environnement (format : \"env:XXX\")\n"
" 13. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
" 11. une chaîne encodée/decodée en base 16, 32 ou 64 (format : "
"\"base_encode:base,xxx\" ou \"base_decode:base,xxx\")\n"
" 12. la date/heure courante (format : \"date\" ou \"date:format\")\n"
" 13. une variable d'environnement (format : \"env:XXX\")\n"
" 14. un opérateur ternaire (format : \"if:condition?valeur_si_vrai:"
"valeur_si_faux\")\n"
" 14. le résultat d'une expression avec parenthèses et les opérateurs + - "
" 15. le résultat d'une expression avec parenthèses et les opérateurs + - "
"* / // % ** (format: \"calc:xxx\")\n"
" 15. une option (format : \"fichier.section.option\")\n"
" 16. une variable locale du tampon\n"
" 17. un hdata/variable (la valeur est automatiquement convertie en chaîne), "
" 16. une option (format : \"fichier.section.option\")\n"
" 17. une variable locale du tampon\n"
" 18. 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"
@ -1889,6 +1895,8 @@ msgstr ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Exemples (conditions) :\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1522,15 +1522,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1567,6 +1569,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1617,15 +1617,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1662,6 +1664,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -1674,15 +1674,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1719,6 +1721,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@ -1710,15 +1710,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1755,6 +1757,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -1676,15 +1676,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1721,6 +1723,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-18 11:34+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1680,15 +1680,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1725,6 +1727,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1544,15 +1544,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1589,6 +1591,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\n"
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1375,15 +1375,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1420,6 +1422,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2020-05-16 14:36+0200\n"
"POT-Creation-Date: 2020-05-21 09:18+0200\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"
@ -1377,15 +1377,17 @@ msgid ""
"\"color\")\n"
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
" 11. a base 16/32/64 encoded/decoded string (format: \"base_encode:base,xxx"
"\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: \"if:condition?value_if_true:value_if_false"
"\")\n"
" 14. result of an expression with parentheses and operators + - * / // % ** "
" 15. result of an expression with parentheses and operators + - * / // % ** "
"(format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted to "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -1422,6 +1424,8 @@ msgid ""
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -7435,15 +7435,17 @@ command_init ()
" 9. a modifier (format: \"modifier:name,data,string\")\n"
" 10. an info (format: \"info:name,arguments\", arguments are "
"optional)\n"
" 11. current date/time (format: \"date\" or \"date:format\")\n"
" 12. an environment variable (format: \"env:XXX\")\n"
" 13. a ternary operator (format: "
" 11. a base 16/32/64 encoded/decoded string (format: "
"\"base_encode:base,xxx\" or \"base_decode:base,xxx\")\n"
" 12. current date/time (format: \"date\" or \"date:format\")\n"
" 13. an environment variable (format: \"env:XXX\")\n"
" 14. a ternary operator (format: "
"\"if:condition?value_if_true:value_if_false\")\n"
" 14. result of an expression with parentheses and operators "
" 15. result of an expression with parentheses and operators "
"+ - * / // % ** (format: \"calc:xxx\")\n"
" 15. an option (format: \"file.section.option\")\n"
" 16. a local variable in buffer\n"
" 17. a hdata name/variable (the value is automatically converted "
" 16. an option (format: \"file.section.option\")\n"
" 17. a local variable in buffer\n"
" 18. 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"
@ -7481,6 +7483,8 @@ command_init ()
" /eval -n ${repeat:5,-} ==> -----\n"
" /eval -n ${length:test} ==> 4\n"
" /eval -n ${calc:(5+2)*3} ==> 21\n"
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
" /eval -n ${base_decode:64,dGVzdA==} ==> test\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"

View File

@ -423,6 +423,7 @@ eval_string_info (const char *text)
char *value, *info_name;
value = NULL;
ptr_arguments = strchr (text, ',');
if (ptr_arguments)
{
@ -430,7 +431,10 @@ eval_string_info (const char *text)
ptr_arguments++;
}
else
{
info_name = strdup (text);
}
if (info_name)
{
value = hook_info_get (NULL, info_name, ptr_arguments);
@ -440,6 +444,104 @@ eval_string_info (const char *text)
return (value) ? value : strdup ("");
}
/*
* Encodes a string in base 16, 32, or 64.
*
* Note: result must be freed after use.
*/
char *
eval_string_base_encode (const char *text)
{
const char *ptr_string;
char *value, *base, *error, *result;
long number;
int length;
base = NULL;
result = NULL;
ptr_string = strchr (text, ',');
if (!ptr_string)
goto end;
base = string_strndup (text, ptr_string - text);
if (!base)
goto end;
number = strtol (base, &error, 10);
if (!error || error[0])
goto end;
ptr_string++;
length = strlen (ptr_string);
result = malloc ((length * 4) + 1);
if (!result)
goto end;
if (string_base_encode (number, ptr_string, length, result) < 0)
{
free (result);
result = NULL;
}
end:
value = strdup ((result) ? result : "");
if (base)
free (base);
if (result)
free (result);
return value;
}
/*
* Decodes a string encoded in base 16, 32, or 64.
*
* Note: result must be freed after use.
*/
char *
eval_string_base_decode (const char *text)
{
const char *ptr_string;
char *value, *base, *error, *result;
long number;
base = NULL;
result = NULL;
ptr_string = strchr (text, ',');
if (!ptr_string)
goto end;
base = string_strndup (text, ptr_string - text);
if (!base)
goto end;
number = strtol (base, &error, 10);
if (!error || error[0])
goto end;
ptr_string++;
result = malloc (strlen (ptr_string) + 1);
if (!result)
goto end;
if (string_base_decode (number, ptr_string, result) < 0)
{
free (result);
result = NULL;
}
end:
value = strdup ((result) ? result : "");
if (base)
free (base);
if (result)
free (result);
return value;
}
/*
* Returns a date.
*
@ -805,13 +907,15 @@ end:
* 10. a color (format: color:xxx)
* 11. a modifier (format: modifier:name,data,xxx)
* 12. an info (format: info:name,arguments)
* 13. current date/time (format: date or date:xxx)
* 14. an environment variable (format: env:XXX)
* 15. a ternary operator (format: if:condition?value_if_true:value_if_false)
* 16. calculate result of an expression (format: calc:xxx)
* 17. an option (format: file.section.option)
* 18. a buffer local variable
* 19. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* 13. a base 16/32/64 encoded/decoded string (format: base_encode:base,xxx
* or base_decode:base,xxx)
* 14. current date/time (format: date or date:xxx)
* 15. an environment variable (format: env:XXX)
* 16. a ternary operator (format: if:condition?value_if_true:value_if_false)
* 17. calculate result of an expression (format: calc:xxx)
* 18. an option (format: file.section.option)
* 19. a buffer local variable
* 20. a hdata variable (format: hdata.var1.var2 or hdata[list].var1.var2
* or hdata[ptr].var1.var2)
*
* See /help in WeeChat for examples.
@ -931,11 +1035,17 @@ eval_replace_vars_cb (void *data, const char *text)
if (strncmp (text, "info:", 5) == 0)
return eval_string_info (text + 5);
/* 13. current date/time */
/* 13. base_encode/base_decode */
if (strncmp (text, "base_encode:", 12) == 0)
return eval_string_base_encode (text + 12);
if (strncmp (text, "base_decode:", 12) == 0)
return eval_string_base_decode (text + 12);
/* 14. current date/time */
if ((strncmp (text, "date", 4) == 0) && (!text[4] || (text[4] == ':')))
return eval_string_date (text + 4);
/* 14. environment variable */
/* 15. environment variable */
if (strncmp (text, "env:", 4) == 0)
{
ptr_value = getenv (text + 4);
@ -943,18 +1053,18 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
/* 15: ternary operator: if:condition?value_if_true:value_if_false */
/* 16: ternary operator: if:condition?value_if_true:value_if_false */
if (strncmp (text, "if:", 3) == 0)
return eval_string_if (text + 3, eval_context);
/*
* 16. calculate the result of an expression
* 17. calculate the result of an expression
* (with number, operators and parentheses)
*/
if (strncmp (text, "calc:", 5) == 0)
return calc_expression (text + 5);
/* 17. option: if found, return this value */
/* 18. option: if found, return this value */
if (strncmp (text, "sec.data.", 9) == 0)
{
ptr_value = hashtable_get (secure_hashtable_data, text + 9);
@ -984,7 +1094,7 @@ eval_replace_vars_cb (void *data, const char *text)
}
}
/* 18. local variable in buffer */
/* 19. local variable in buffer */
ptr_buffer = hashtable_get (eval_context->pointers, "buffer");
if (ptr_buffer)
{
@ -993,7 +1103,7 @@ eval_replace_vars_cb (void *data, const char *text)
return strdup (ptr_value);
}
/* 19. hdata */
/* 20. hdata */
return eval_string_hdata (text, eval_context);
}

View File

@ -563,6 +563,22 @@ TEST(CoreEval, EvalExpression)
/* test info */
WEE_CHECK_EVAL(version_get_version (), "${info:version}");
/* test base_encode */
WEE_CHECK_EVAL("", "${base_encode:}");
WEE_CHECK_EVAL("", "${base_encode:0,xxx}");
WEE_CHECK_EVAL("", "${base_encode:100,test string}");
WEE_CHECK_EVAL("7465737420737472696E67", "${base_encode:16,test string}");
WEE_CHECK_EVAL("ORSXG5BAON2HE2LOM4======", "${base_encode:32,test string}");
WEE_CHECK_EVAL("dGVzdCBzdHJpbmc=", "${base_encode:64,test string}");
/* test base_decode */
WEE_CHECK_EVAL("", "${base_decode:}");
WEE_CHECK_EVAL("", "${base_decode:0,xxx}");
WEE_CHECK_EVAL("", "${base_decode:100,test string}");
WEE_CHECK_EVAL("test string", "${base_decode:16,7465737420737472696E67}");
WEE_CHECK_EVAL("test string", "${base_decode:32,ORSXG5BAON2HE2LOM4======}");
WEE_CHECK_EVAL("test string", "${base_decode:64,dGVzdCBzdHJpbmc=}");
/* test date */
WEE_CHECK_EVAL("", "${date:}");
value = eval_expression ("${date}", pointers, extra_vars, options);