diff options
Diffstat (limited to 'doc/en/weechat_plugin_api.en.adoc')
-rw-r--r-- | doc/en/weechat_plugin_api.en.adoc | 170 |
1 files changed, 67 insertions, 103 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 8869bb504..213bc9561 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -2385,18 +2385,18 @@ str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, optio List of logical operators that can be used in conditions (by order of priority, from first used to last): -[width="100%",cols="2,8,4,4",options="header"] +[width="100%",cols="2,1,8,4,4",options="header"] |=== -| Operator | Description | Examples | Results +| Operator | Min WeeChat | Description | Examples | Results -| `+&&+` | +| `+&&+` | | Logical "and" | `+25 && 77+` + `+25 && 0+` | `+1+` + `+0+` -| `+\|\|+` | +| `+\|\|+` | | Logical "or" | `+25 \|\| 0+` + `+0 \|\| 0+` | @@ -2407,103 +2407,95 @@ from first used to last): List of comparison operators that can be used in conditions (by order of priority, from first used to last): -[width="100%",cols="2,8,4,4",options="header"] +[width="100%",cols="2,1,8,4,4",options="header"] |=== -| Operator | Description | Examples | Results +| Operator | Min WeeChat | Description | Examples | Results -| `+=~+` | +| `+=~+` | | Is matching POSIX extended regex (optional flags are allowed, see function <<_string_regcomp,string_regcomp>>) | `+abc def =~ ab.*ef+` + `+abc def =~ y.*z+` | `+1+` + `+0+` -| `+!~+` | +| `+!~+` | | Is NOT matching POSIX extended regex (optional flags are allowed, see function <<_string_regcomp,string_regcomp>>) | `+abc def !~ ab.*ef+` + `+abc def !~ y.*z+` | `+0+` + `+1+` -| `+==*+` | - Is matching mask where "*" is allowed, case sensitive (see function <<_string_match,string_match>>) + - _(WeeChat ≥ 2.9)_ | +| `+==*+` | 2.9 | + Is matching mask where "*" is allowed, case sensitive (see function <<_string_match,string_match>>) | `+abc def ==* a*f+` + `+abc def ==* y*z+` | `+1+` + `+0+` -| `+!!*+` | - Is NOT wildcard mask where "*" is allowed, case sensitive (see function <<_string_match,string_match>>) + - _(WeeChat ≥ 2.9)_ | +| `+!!*+` | 2.9 | + Is NOT wildcard mask where "*" is allowed, case sensitive (see function <<_string_match,string_match>>) | `+abc def !!* a*f+` + `+abc def !!* y*z+` | `+0+` + `+1+` -| `+=*+` | - Is matching mask where "*" is allowed, case insensitive (see function <<_string_match,string_match>>) + - _(WeeChat ≥ 1.8)_ | +| `+=*+` | 1.8 | + Is matching mask where "*" is allowed, case insensitive (see function <<_string_match,string_match>>) | `+abc def =* A*F+` + `+abc def =* Y*Z+` | `+1+` + `+0+` -| `+!*+` | - Is NOT wildcard mask where "*" is allowed, case insensitive (see function <<_string_match,string_match>>) + - _(WeeChat ≥ 1.8)_ | +| `+!*+` | 1.8 | + Is NOT wildcard mask where "*" is allowed, case insensitive (see function <<_string_match,string_match>>) | `+abc def !* A*F+` + `+abc def !* Y*Z+` | `+0+` + `+1+` -| `+==-+` | - Is included, case sensitive + - _(WeeChat ≥ 2.9)_ | +| `+==-+` | 2.9 | + Is included, case sensitive | `+abc def ==- bc+` + `+abc def ==- xyz+` | `+1+` + `+0+` -| `+!!-+` | - Is NOT included, case sensitive + - _(WeeChat ≥ 2.9)_ | +| `+!!-+` | 2.9 | + Is NOT included, case sensitive | `+abc def !!- bc+` + `+abc def !!- xyz+` | `+0+` + `+1+` -| `+=-+` | - Is included, case insensitive + - _(WeeChat ≥ 2.9)_ | +| `+=-+` | 2.9 | + Is included, case insensitive | `+abc def =- BC+` + `+abc def =- XYZ+` | `+1+` + `+0+` -| `+!-+` | - Is NOT included, case insensitive + - _(WeeChat ≥ 2.9)_ | +| `+!-+` | 2.9 | + Is NOT included, case insensitive | `+abc def !- BC+` + `+abc def !- XYZ+` | `+0+` + `+1+` -| `+==+` | +| `+==+` | | Equal | `+test == test+` + `+test == string+` | `+1+` + `+0+` -| `+!=+` | +| `+!=+` | | Not equal | `+test != test+` + `+test != string+` | `+0+` + `+1+` -| `+<=+` | +| `+<=+` | | Less or equal | `+abc <= defghi+` + `+abc <= abc+` + @@ -2514,7 +2506,7 @@ from first used to last): `+0+` + `+0+` -| `+<+` | +| `+<+` | | Less | `+abc < defghi+` + `+abc < abc+` + @@ -2525,7 +2517,7 @@ from first used to last): `+0+` + `+0+` -| `+>=+` | +| `+>=+` | | Greater or equal | `+defghi >= abc+` + `+abc >= abc+` + @@ -2536,7 +2528,7 @@ from first used to last): `+0+` + `+1+` -| `+>+` | +| `+>+` | | Greater | `+defghi > abc+` + `+abc > abc+` + @@ -2567,28 +2559,26 @@ for example: List of variables expanded in expression (by order of priority, from first expanded to last): -[width="100%",cols="2,8,4,4",options="header"] +[width="100%",cols="2,1,8,4,4",options="header"] |=== -| Format | Description | Examples | Results +| Format | Min WeeChat | Description | Examples | Results -| `+${raw:xxx}+` + - _(WeeChat ≥ 3.1)_ | +| `+${raw:xxx}+` | 3.1 | Raw string (not evaluated). | `+${raw:${info:version}}+` | `+${info:version}+` -| `+${name}+` + - _(WeeChat ≥ 3.4)_ | +| `+${name}+` | 3.4 | User variable (defined with `+${define:name,value}+`). | `+${name}+` | `+value+` -| `+${name}+` | +| `+${name}+` | | Variable `name` from hashtable _extra_vars_. | `+${name}+` | `+value+` -| `+${weechat_xxx_dir}+` | +| `+${weechat_xxx_dir}+` | 3.2 | A WeeChat directory: `+${weechat_config_dir}+`, `+${weechat_data_dir}+`, `+${weechat_cache_dir}+` or `+${weechat_runtime_dir}+`. | `+${weechat_config_dir}+` + @@ -2600,37 +2590,32 @@ expanded to last): `+/home/user/.cache/weechat+` + `+/run/user/1000/weechat+` -| `+${eval:xxx}+` + - _(WeeChat ≥ 1.3)_ | +| `+${eval:xxx}+` | 1.3 | String to evaluate. | `+${eval:${date:${weechat.look.buffer_time_format}}}+` | `+19:02:45+` (with colors if there are color codes in the option weechat.look.buffer_time_format) -| `+${eval_cond:xxx}+` + - _(WeeChat ≥ 3.1)_ | +| `+${eval_cond:xxx}+` | 3.1 | String to evaluate as condition. | `+${eval_cond:${window.win_width} > 100}+` | `+1+` | `+${esc:xxx}+` + - `+${\xxx}+` + - _(WeeChat ≥ 1.0)_ | + `+${\xxx}+` | 1.0 | String with escaped chars. | `+${esc:prefix\tmessage}+` + `+${\ua9}+` | `+prefix<TAB>message+` + `+©+` -| `+${hide:x,string}+` + - _(WeeChat ≥ 1.1)_ | +| `+${hide:x,string}+` | 1.1 | String with hidden chars (all chars in `string` replaced by `x`). | `+${hide:*,password}+` | `+********+` | `+${cut:max,suffix,string}+` + - `+${cut:+max,suffix,string}+` + - _(WeeChat ≥ 1.8)_ | + `+${cut:+max,suffix,string}+` | 1.8 | String with `max` chars, and optional `suffix` if string is cut. + With the format `+max`, the suffix is counted in max length. | `+${cut:4,…,this is a test}+` + @@ -2641,8 +2626,7 @@ expanded to last): `+こん>>+` | `+${cutscr:max,suffix,string}+` + - `+${cutscr:+max,suffix,string}+` + - _(WeeChat ≥ 1.8)_ | + `+${cutscr:+max,suffix,string}+` | 1.8 | String with `max` chars displayed on screen, and optional `suffix` if string is cut. + With the format `+max`, the suffix is counted in max length. | `+${cutscr:4,…,this is a test}+` + @@ -2652,8 +2636,7 @@ expanded to last): `+thi…+` + `+こ>>+` -| `+${rev:xxx}+` + - _(WeeChat ≥ 2.2)_ | +| `+${rev:xxx}+` | 2.2 | Reversed string (color codes are reversed, so the string should not contain color codes). | `+${rev:Hello, world!}+` + @@ -2661,38 +2644,33 @@ expanded to last): `+!dlrow ,olleH+` + `+!dlrow30F ,olleH+` (no color, the color code is reversed) -| `+${revscr:xxx}+` + - _(WeeChat ≥ 2.7)_ | +| `+${revscr:xxx}+` | 2.7 | Reversed string for screen, color codes are not reversed. | `+${revscr:Hello, world!}+` + `+${revscr:Hello, ${color:red}world!}+` | `+!dlrow ,olleH+` + `+!dlrow ,olleH+` (`pass:[ ,olleH]` in red) -| `+${repeat:count,string}+` + - _(WeeChat ≥ 2.3)_ | +| `+${repeat:count,string}+` | 2.3 | Repeated string. | `+${repeat:5,-}+` | `+-----+` -| `+${length:xxx}+` + - _(WeeChat ≥ 2.7)_ | +| `+${length:xxx}+` | 2.7 | Length of string (number of UTF-8 chars), color codes are ignored. | `+${length:test}+` + `+${length:こんにちは世界}+` | `+4+` + `+7+` -| `+${lengthscr:xxx}+` + - _(WeeChat ≥ 2.7)_ | +| `+${lengthscr:xxx}+` | 2.7 | Length of string displayed on screen, color codes are ignored. | `+${lengthscr:test}+` + `+${lengthscr:こんにちは世界}+` | `+4+` + `+14+` -| `+${split:number,seps,flags,xxx}+` + - _(WeeChat ≥ 3.3)_ | +| `+${split:number,seps,flags,xxx}+` | 3.3 | Split string, and return, according to `number`: + - `count`: the number of items after split + - `random`: a random item + @@ -2725,8 +2703,7 @@ expanded to last): `+is+` + `+is a test+` -| `+${split_shell:number,xxx}+` + - _(WeeChat ≥ 3.3)_ | +| `+${split_shell:number,xxx}+` | 3.3 | Split shell arguments, and return, according to `number`: + - `count`: the number of arguments after split + - `random`: a random argument + @@ -2741,8 +2718,7 @@ expanded to last): `+2+` + `+arg2+` -| `+${re:xxx}+` + - _(WeeChat ≥ 1.1)_ | +| `+${re:xxx}+` | 1.1 | Regex data: + `0` = whole string matching, + `1` to `99` = group captured, + @@ -2762,8 +2738,7 @@ expanded to last): `+2+` + `+1+` -| `+${color:name}+` + - _(WeeChat ≥ 0.4.2)_ | +| `+${color:name}+` | 0.4.2 | WeeChat color code (the name of color has optional attributes), see function <<_color,color>> for supported formats. | `+${color:red}red text+` + @@ -2771,8 +2746,7 @@ expanded to last): `+red text+` (in red) + `+bold orange text+` (in bold orange) -| `+${modifier:name,data,string}+` + - _(WeeChat ≥ 2.7)_ | +| `+${modifier:name,data,string}+` | 2.7 | Result of a modifier, see function <<_hook_modifier_exec,hook_modifier_exec>>. | `+${modifier:eval_path_home,,~}+` + @@ -2781,8 +2755,7 @@ expanded to last): `+/home/user/.config/weechat/weechat.conf+` | `+${info:name}+` + - `+${info:name,arguments}+` + - _(WeeChat ≥ 0.4.3)_ | + `+${info:name,arguments}+` | 0.4.3 | Info from WeeChat or a plugin, see function <<_info_get,info_get>>. | `+${info:version}+` + @@ -2790,8 +2763,7 @@ expanded to last): `+1.0+` + `+lightblue+` -| `+${base_encode:base,xxx}+` + - _(WeeChat ≥ 2.9)_ | +| `+${base_encode:base,xxx}+` | 2.9 | String encoded in base 16, 32 or 64. | `+${base_encode:16,test string}+` + `+${base_encode:32,test string}+` + @@ -2800,8 +2772,7 @@ expanded to last): `+ORSXG5BAON2HE2LOM4======+` + `+dGVzdCBzdHJpbmc=+` -| `+${base_decode:base,xxx}+` + - _(WeeChat ≥ 2.9)_ | +| `+${base_decode:base,xxx}+` | 2.9 | String decoded from base 16, 32 or 64. | `+${base_decode:16,7465737420737472696E67}+` + `+${base_decode:32,ORSXG5BAON2HE2LOM4======}+` + @@ -2811,8 +2782,7 @@ expanded to last): `+test string+` | `+${date}+` + - `+${date:xxx}+` + - _(WeeChat ≥ 1.3)_ | + `+${date:xxx}+` | 1.3 | Current date/time, with custom format (see `man strftime`), default format is `%F %T`. | `+${date}+` + @@ -2820,24 +2790,21 @@ expanded to last): `+2015-06-30 19:02:45+` + `+19:02:45+` -| `+${env:NAME}+` + - _(WeeChat ≥ 1.2)_ | +| `+${env:NAME}+` | 1.2 | Value of the environment variable `NAME`. | `+${env:HOME}+` | `+/home/user+` | `+${if:condition}+` + `+${if:condition?true}+` - `+${if:condition?true:false}+` - _(WeeChat ≥ 1.8)_ | + `+${if:condition?true:false}+` | 1.8 | Ternary operator with a condition, a value if the condition is true (optional) and another value if the condition is false (optional). If values are not given, "1" or "0" are returned, according to the result of the condition. | `+${if:${info:term_width}>80?big:small}+` | `+big+` -| `+${calc:xxx}+` + - _(WeeChat ≥ 2.7)_ | +| `+${calc:xxx}+` | 2.7 | Result of expression, where parentheses and the following operators are supported: + `+++`: addition + @@ -2860,47 +2827,44 @@ expanded to last): `+0.2+` + `+65536+` -| `+${random:min,max}+` + - _(WeeChat ≥ 3.3)_ | +| `+${random:min,max}+` | 3.3 | Random integer number in the range from `min` to `max` (inclusive). | `+${random:0,10}+` | `+3+` -| `+${translate:xxx}+` + - _(WeeChat ≥ 3.2)_ | +| `+${translate:xxx}+` | 3.2 | Translated string (depends on the language used by WeeChat to display messages). | `+${translate:Plugin}+` | `+Extension+` (example in French) -| `+${define:name,value}+` + - _(WeeChat ≥ 3.4)_ | +| `+${define:name,value}+` | 3.4 | Define a variable `name` set to `value`, which can then be used in the same evaluated expression with `+${name}+`. | `+${define:len,${calc:5+3}}${len}x${len}+` | `+8x8+` -| `+${sec.data.name}+` | +| `+${sec.data.name}+` | | Value of the secured data `name`. | `+${sec.data.libera_pass}+` | `+my_password+` -| `+${file.section.option}+` | +| `+${file.section.option}+` | | Value of the option. | `+${weechat.look.buffer_time_format}+` | `+%H:%M:%S+` -| `+${name}+` | +| `+${name}+` | | Value of local variable `name` in buffer. | `+${nick}+` | `+FlashCode+` -| `+${pointer}+` | +| `+${pointer}+` | | Variable `pointer` from hashtable _pointers_. | `+${buffer}+` | `+0x1234abcd+` | `+${hdata.var1.var2...}+` + - `+${hdata[list].var1.var2...}+` | + `+${hdata[list].var1.var2...}+` | | Hdata value (pointers `window` and `buffer` are set by default with current window/buffer), `list` can be a list name (example: "gui_buffers"), a pointer (example: "0x1234abcd") or a pointer name (example: "my_pointer"). | |