summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-03-11 18:31:30 +0100
committerSébastien Helleu <flashcode@flashtux.org>2018-03-11 18:31:30 +0100
commitc6d4deb8df82d6ab955ac1e93510a30ed177a727 (patch)
tree90c65c58c01ec2627de441415a019ec3426d32c0 /src/core
parent985a55cf45ccabfe8f0a6f601a4b031f06f47a37 (diff)
downloadweechat-c6d4deb8df82d6ab955ac1e93510a30ed177a727.zip
Revert "core: remove colors from prefix/message only when needed in hook_print_exec"
This reverts commit bfc579cb3354cb47a224c8fa55b6a2e5684c7ab9.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-hook.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index 530bf8794..8e83c0a8e 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -2484,8 +2484,16 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
if (!line->data->message || !line->data->message[0])
return;
- prefix_no_color = NULL;
- message_no_color = NULL;
+ prefix_no_color = (line->data->prefix) ?
+ gui_color_decode (line->data->prefix, NULL) : NULL;
+
+ message_no_color = gui_color_decode (line->data->message, NULL);
+ if (!message_no_color)
+ {
+ if (prefix_no_color)
+ free (prefix_no_color);
+ return;
+ }
hook_exec_start ();
@@ -2503,23 +2511,12 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
|| string_strcasestr (prefix_no_color, HOOK_PRINT(ptr_hook, message))
|| string_strcasestr (message_no_color, HOOK_PRINT(ptr_hook, message))))
{
- /* check if tags are matching */
+ /* check if tags match */
if (!HOOK_PRINT(ptr_hook, tags_array)
|| gui_line_match_tags (line->data,
HOOK_PRINT(ptr_hook, tags_count),
HOOK_PRINT(ptr_hook, tags_array)))
{
- /* strip colors if needed (and if not already done) */
- if (HOOK_PRINT(ptr_hook, strip_colors) && !message_no_color)
- {
- message_no_color = gui_color_decode (line->data->message,
- NULL);
- if (!message_no_color)
- goto end;
- prefix_no_color = (line->data->prefix) ?
- gui_color_decode (line->data->prefix, NULL) : NULL;
- }
-
/* run callback */
ptr_hook->running = 1;
(void) (HOOK_PRINT(ptr_hook, callback))
@@ -2537,7 +2534,6 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
ptr_hook = next_hook;
}
-end:
if (prefix_no_color)
free (prefix_no_color);
if (message_no_color)