Sébastien Helleu
60b9e36ae2
core: fix function string_match with joker in the string if multiple words matched in input string
...
Before fix:
string_match("script.color.text_description", "*script*color*", 0) => 0
After fix:
string_match("script.color.text_description", "*script*color*", 0) => 1
2021-06-22 21:54:16 +02:00
Sébastien Helleu
0ceccb9798
tests: fix tests on signal_search_number
2021-06-16 12:34:30 +02:00
Sébastien Helleu
5cffb7179f
api: add function crypto_hmac (issue #1628 )
2021-06-01 20:39:04 +02:00
Sébastien Helleu
6ac6cf7293
tests: add test of base64 encode/decode with NUL char in string
2021-06-01 20:39:04 +02:00
Sébastien Helleu
a071ee5012
tests: remove dependency on French locale in eval tests
2021-05-16 20:17:07 +02:00
Sébastien Helleu
cf7ac76de9
tests: add missing include of locale.h in eval tests
2021-05-16 19:09:18 +02:00
Sébastien Helleu
215f12d859
tests: remove commented includes
2021-05-16 19:08:35 +02:00
Sébastien Helleu
89e43eaf40
core: set server name when connecting to server with TLS (SNI extension) only if it's not an IPV4/IPv6 ( closes #1635 )
2021-05-16 14:52:11 +02:00
Sébastien Helleu
e03642e9df
tests: add tests on translation in evaluated expressions
2021-05-16 14:09:07 +02:00
Sébastien Helleu
0f9640a5f3
core: split WeeChat home in 4 directories, use XDG directories by default (issue #1285 )
...
The 4 directories (which can be the same):
- config: configuration files, certificates
- data: log/upgrade files, local plugins, scripts, xfer files
- cache: script repository, scripts downloaded (temporary location)
- runtime: FIFO pipe, relay UNIX sockets
2021-05-11 21:06:34 +02:00
Sébastien Helleu
4c5fcb743b
core: move home directory functions from weechat.c to wee-dir.c (issue #1285 )
2021-05-11 21:06:32 +02:00
Sébastien Helleu
269576eea2
core: move directory/file functions from wee-util.c to wee-dir.c (issue #1285 )
2021-05-11 21:06:29 +02:00
Sébastien Helleu
3bf585ba04
core: evaluate left/right part of comparison after split on the comparison operator in ${if:xxx} ( closes #1627 )
...
To force evaluation of the expression before doing the comparison (less safe),
the "${eval_cond:xxx}" can be used.
With the old behavior we had:
>> ${if:a==b}
== [0]
>> ${if:${raw:a==b}}
== [0]
>> ${if:${eval_cond:${raw:a==b}}}
== [0]
And with the new behavior, we have:
>> ${if:a==b}
== [0]
>> ${if:${raw:a==b}}
== [1]
>> ${if:${eval_cond:${raw:a==b}}}
== [0]
2021-04-04 14:44:18 +02:00
Sébastien Helleu
8ee7d46605
api: add support of pointer names in function string_eval_expression (direct and in hdata)
...
These two formats are now supported, if "pointer_name" is present in the
"pointers" hashtable:
* "${pointer_name}": value of pointer (example: "0x1234abcd")
* ${buffer[pointer_name].full_name}: use of a pointer name instead of pointer
value or list name
2021-03-17 21:57:16 +01:00
Sébastien Helleu
0dc7fbcb0c
core: add options to customize commands on system signals, quit by default on SIGHUP when not running headless ( closes #1595 )
...
New options to customize behavior on signals received, with the default
behavior:
- weechat.signal.sighup: quit in normal mode, reload config in headless
- weechat.signal.sigquit: quit
- weechat.signal.sigterm: quit
- weechat.signal.sigusr1: no command executed by default
- weechat.signal.sigusr2: no command executed by default
The signals SIGUSR1 and SIGUSR2 are introduced by this commit, so it's now
possible to run commands when they are received.
The SIGHUP signal makes now WeeChat quit, it was the behavior before version
2.9 of WeeChat (see commit de1e61f7cd50cbd1a99777fe6611642a51abf5f6).
2021-03-16 18:47:31 +01:00
Sébastien Helleu
a93e598c35
core: add raw string in evaluation of expressions with "raw:xxx" ( closes #1611 )
2021-02-05 20:07:16 +01:00
Sébastien Helleu
efc7a588d6
core: update copyright dates
2021-01-02 21:34:16 +01:00
Sébastien Helleu
d413ccdf4f
core: add indentation and colors in /eval debug output
2021-01-01 17:08:59 +01:00
Sébastien Helleu
2ad3da03a2
core: display more verbose debug with two "-d" in command /eval
...
Now a single -d in command /eval shows less debug messages than previous
versions.
To get the same debug messages than previous versions, two -d must be used.
2020-12-31 20:37:43 +01:00
Sébastien Helleu
ee9aa28a8c
core: do not remove quotes in arguments of command /eval ( closes #1601 )
...
Now, /eval -n -c "a" == "a" returns True instead of False.
When quotes were removed, the condition evaluated was: a" == "a (which is
False).
2020-12-25 00:21:03 +01:00
Sébastien Helleu
b626df72fb
core: add evaluation of conditions in evaluation of expressions with "eval_cond:" ( closes #1582 )
2020-11-14 09:28:46 +01:00
Sébastien Helleu
1c5e5824e7
tests: run callback when resetting options in tests
2020-10-03 14:40:59 +02:00
Sébastien Helleu
cfd221014c
api: add argument "bytes" in function string_dyn_concat
2020-08-23 23:27:57 +02:00
Sébastien Helleu
36c55f6973
tests: fix name of some unit tests
2020-08-05 07:28:30 +02:00
Sébastien Helleu
8818fbb233
tests: fix memory leak in test of function string_hex_dump
2020-05-31 14:51:41 +02:00
Sébastien Helleu
aaa49d3188
tests: add tests on function string_input_for_buffer with custom command chars
2020-05-21 10:06:51 +02:00
Sébastien Helleu
f4913d0a6b
tests: add tests on function string_is_command_char with custom command chars
2020-05-21 10:06:42 +02:00
Sébastien Helleu
99b13aa671
tests: add test on function string_base64_decode with truncated base64 string
2020-05-21 09:56:35 +02:00
Sébastien Helleu
a997893cfe
tests: add test on function string_base16_decode with a char >= 0xA0
2020-05-21 09:55:40 +02:00
Sébastien Helleu
66d4590dab
core: add base 16/32/64 encoding/decoding in evaluation of expressions
2020-05-21 09:36:35 +02:00
Sébastien Helleu
1994d5641d
core: move functions string_base_encode and string_base_decode from plugin-api.c to wee-string.c
2020-05-21 00:02:24 +02:00
Sébastien Helleu
0ac936a5cf
core: return -1 in case of error in functions string_base16_decode and string_base64_decode
2020-05-21 00:01:35 +02:00
Sébastien Helleu
62ccee9505
tests: run tests on plugins only if the plugins are enabled and compiled
2020-05-17 15:29:06 +02:00
Sébastien Helleu
3505324096
api: use buffer pointer in argument "modifier_data" sent to weechat_print modifier callback ( closes #42 )
2020-05-09 10:08:18 +02:00
Sébastien Helleu
b1c3a29ac7
core: add include comparison operators in evaluation of expressions
...
New comparison operators:
- "==*": is matching mask, case sensitive (wildcard "*" is allowed)
- "!!*": is NOT matching mask, case sensitive (wildcard "*" is allowed)
- "==-": is included, case sensitive
- "!!-": is NOT included, case sensitive
- "=-": is included, case insensitive
- "!-": is NOT included, case insensitive
2020-05-05 20:43:45 +02:00
Sébastien Helleu
100440c8a1
core: restore signal "signal_sighup", and if eaten do not reload configuration
2020-04-21 22:34:42 +02:00
Sébastien Helleu
d38701f99f
tests: reduce number of iterations in PBKDF2 tests from 100000 to 1000
...
This speeds up tests by about 30%.
2020-04-19 10:56:25 +02:00
Sébastien Helleu
7fbd4c1079
tests: add missing include of locale.h
...
This fixes build of tests on FreeBSD.
2020-04-11 00:01:31 +02:00
Sébastien Helleu
9afe63b77a
tests: fix name of tests
2020-04-10 23:43:27 +02:00
Sébastien Helleu
007fd03bc8
tests: add tests on calc functions
...
Functions tested:
- calc_operator_precedence
- calc_pop_value
- calc_list_free_cb
- calc_operation
- calc_operation_stacks
2020-04-08 21:38:51 +02:00
Sébastien Helleu
a693125c81
tests: add missing include of stdio.h (issue #1469 )
2020-04-07 22:20:11 +02:00
Sébastien Helleu
d78ac827e9
core: fix memory leak in calculation of expression on FreeBSD ( closes #1469 )
...
The memory leak was caused by a bug in function setlocale on FreeBSD:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243195
The fix is the following:
* Remove the calls to setlocale when formatting the result.
* The function snprintf is still called, and then is now locale dependent,
for example in French the decimal separator is a comma instead of a dot.
* A new function calc_sanitize_decimal_number is introduced to "sanitize" a
decimal number: keep only the decimal separator (replace it by a dot) and
remove any other separator found.
Unit tests are added on these functions:
* calc_sanitize_decimal_number
* calc_format_result
2020-04-07 21:37:48 +02:00
Sébastien Helleu
dcd10657b1
tests: add tests on functions weecrypto_totp_generate and weecrypto_totp_validate
2020-03-05 22:21:48 +01:00
Sébastien Helleu
dabf32f213
tests: add tests on functions weecrypto_hash and weecrypto_hash_pbkdf2 with NULL hash
2020-03-04 08:24:46 +01:00
Sébastien Helleu
4afaacd34e
tests: add tests on function weecrypto_get_hash_algo
2020-03-03 21:29:44 +01:00
Sébastien Helleu
2d7829b2d5
core: require libgcrypt >= 1.7.0 for SHA3 algorithms
2020-03-02 21:49:30 +01:00
Sébastien Helleu
3157d1f06e
api: add function crypto_hash_pbkdf2
2020-03-01 23:14:55 +01:00
Sébastien Helleu
9a6a27ef58
core: move crypto functions to wee-crypto.c, rename API function string_hash to crypto_hash
2020-03-01 21:24:27 +01:00
Sébastien Helleu
c4ef3d6c2e
core: merge functions string_hash_binary and string_hash into a single function string_hash
2020-03-01 16:41:28 +01:00
Sébastien Helleu
1ae2591458
core: add function secure_hash_pbkdf2
2020-03-01 14:26:24 +01:00