From 95c2cb1c5b6b53f95b8b6b3bdcddfd6233bf078a Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 11 Jan 2010 14:45:08 +0100 Subject: Allow callback for modifier "weechat_print" to return empty value, in order to remove a printed message --- src/gui/gui-chat.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 4bdba4478..6aec77ecc 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -495,13 +495,23 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date, "weechat_print", modifier_data, pos); - /* no changes in new message */ - if (new_msg && (strcmp (message, new_msg) == 0)) + free (modifier_data); + if (new_msg) { - free (new_msg); - new_msg = NULL; + if (!new_msg[0]) + { + /* modifier returned empty message, then we'll not + print anything */ + free (new_msg); + return; + } + if (strcmp (message, new_msg) == 0) + { + /* no changes in new message */ + free (new_msg); + new_msg = NULL; + } } - free (modifier_data); } } -- cgit v1.2.3