Revert "core: remove colors from prefix/message only when needed in hook_print_exec"
This reverts commit bfc579cb3354cb47a224c8fa55b6a2e5684c7ab9.
This commit is contained in:
parent
985a55cf45
commit
c6d4deb8df
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user