summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-01-11 14:45:08 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-01-11 14:45:08 +0100
commit95c2cb1c5b6b53f95b8b6b3bdcddfd6233bf078a (patch)
treeb8f08e9c095c40695d8f347569d84ce8c315e1c0
parent1b829eed7701b438df68b39f5b142e40194305a5 (diff)
downloadweechat-95c2cb1c5b6b53f95b8b6b3bdcddfd6233bf078a.zip
Allow callback for modifier "weechat_print" to return empty value, in order to remove a printed message
-rw-r--r--src/gui/gui-chat.c20
1 files 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);
}
}