319 Commits

Author SHA1 Message Date
Sébastien Helleu
e58c827c91 trigger: add tests on main trigger functions 2021-04-11 09:20:49 +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
611ea27edc tests: disable pylint error useless-object-inheritance 2021-03-19 09:14:59 +01: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
c54cadace5 tests: use macros UINT32_C and UINT64_C for integer constants of type uint32_t and uint64_t
This fixes the following compiler warnings: "integer constant is so large that
it is unsigned".
2021-03-17 21:56:43 +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
a34959a619 irc: add info "irc_is_message_ignored" 2021-02-03 18:30:32 +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
bb82dbc0ec tests: add missing braces around if/else in macro WEE_NICK_STRDUP_FOR_COLOR (issue #1565) 2020-10-04 08:53:08 +02:00
Sébastien Helleu
f8403c76db api: add optional list of colors in infos "nick_color" and "nick_color_name" (closes #1565) 2020-10-04 08:46:36 +02:00
Sébastien Helleu
657e659c42 core: add argument "num_colors" in function gui_nick_hash_color, add tests on nick functions (issue #1565)
Functions tested:

- gui_nick_hash_djb2_64
- gui_nick_hash_djb2_32
- gui_nick_hash_sum_64
- gui_nick_hash_sum_32
- gui_nick_get_forced_color
- gui_nick_strdup_for_color
- gui_nick_find_color
- gui_nick_find_color_name
2020-10-04 08:46:25 +02:00
Sébastien Helleu
1c5e5824e7 tests: run callback when resetting options in tests 2020-10-03 14:40:59 +02:00
Sébastien Helleu
579af1b265 tests: fix compilation with CppUTest ≥ 4.0
MemoryLeakWarningPlugin::turnOnNewDeleteOverloads is replaced by
MemoryLeakWarningPlugin::turnOnThreadSafeNewDeleteOverloads, which is available
in both CppUTest 3.x and 4.0.
2020-08-29 10:18:50 +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
268aa631c6 api: add function string_color_code_size (issue #1547) 2020-08-22 08:55:16 +02:00
Sébastien Helleu
d15db0ecbb core: set "notify_level" to 3 if there is a highlight in the line (closes #1529) 2020-08-15 14:02:40 +02:00
Sébastien Helleu
0cc5df6649 irc: send all channels in a single JOIN command when reconnecting to the server (closes #1551) 2020-08-05 20:05:36 +02:00
Sébastien Helleu
36c55f6973 tests: fix name of some unit tests 2020-08-05 07:28:30 +02:00
Sébastien Helleu
8cf56dfdf9 tests: add tests on GUI line functions
Functions tested:

- gui_line_lines_alloc
- gui_line_lines_free
- gui_line_tags_alloc
- gui_line_tags_free
- gui_line_is_displayed
- gui_line_has_tag_no_filter
- gui_line_search_tag_starting_with
- gui_line_get_nick_tag
2020-08-04 23:42:20 +02:00
Sébastien Helleu
5b151d1639 irc: check that the first nick char is not a prefix char or chantype in function irc_nick_is_nick 2020-06-21 10:22:37 +02:00
Sébastien Helleu
4a42cda3a5 irc: change default chantypes from "#&+!" to "#&"
The default chantypes was conflicting with
irc_server_prefix_chars_default ("@+").
2020-06-21 10:22:04 +02:00
Sébastien Helleu
9446610452 tests: add test of function irc_nick_is_nick with invalid UTF-8 string 2020-06-20 17:44:48 +02:00
Sébastien Helleu
12051a506d irc: add support of UTF8MAPPING, add support of optional server in info "irc_is_nick" (closes #1528) 2020-06-20 17:28:28 +02:00
Sébastien Helleu
bf964de939 tests: add tests on IRC function irc_channel_is_channel 2020-06-20 12:04:40 +02:00
Sébastien Helleu
e41eeaf203 tests: add tests on IRC command ACCOUNT with colon before the account name 2020-06-16 08:07:55 +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
88bef0b1b1 core: rename functions hook_completion_{get_string|list_add} to completion_{get_string|list_add}
Old functions are kept for compatibility reasons.
2020-05-08 10:51:30 +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
2b05b64cc1 tests: fix pylint errors 2020-05-03 20:22:21 +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
60b75f4677 tests: add tests on functions relay_auth_password_hash_algo_search and relay_auth_generate_nonce 2020-04-20 07:16:08 +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
bfe22fc66a tests: remove obsolete file test-relay-weechat-protocol.cpp 2020-04-19 10:56:11 +02:00
Sébastien Helleu
9fa3609c85 relay: add command "handshake" in weechat relay protocol and nonce to prevent replay attacks (closes #1474)
This introduces a new command called "handshake" in the weechat relay protocol.
It should be sent by the client before the "init" command, to negotiate the way
to authenticate with a password.

3 new options are added:

* relay.network.auth_password
* relay.network.hash_iterations
* relay.network.nonce_size
2020-04-14 21:38:12 +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