summaryrefslogtreecommitdiff
path: root/src/gui/gui-line.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui-line.c')
-rw-r--r--src/gui/gui-line.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index 3aa4b695c..f2cc03583 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -30,6 +30,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
+#include "../core/wee-hashtable.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@@ -378,6 +379,24 @@ gui_line_match_tags (struct t_gui_line *line, int tags_count,
}
/*
+ * gui_line_get_nick_tag: get nick in tags: return "xxx" if tag "nick_xxx"
+ * is found
+ */
+
+const char *
+gui_line_get_nick_tag (struct t_gui_line *line)
+{
+ int i;
+
+ for (i = 0; i < line->data->tags_count; i++)
+ {
+ if (strncmp (line->data->tags_array[i], "nick_", 5) == 0)
+ return line->data->tags_array[i] + 5;
+ }
+ return NULL;
+}
+
+/*
* gui_line_has_highlight: return 1 if given message contains highlight (with
* a string in global highlight or buffer highlight)
*/
@@ -387,6 +406,7 @@ gui_line_has_highlight (struct t_gui_line *line)
{
int rc, i;
char *msg_no_color, *highlight_words;
+ const char *nick;
/*
* highlights are disabled on this buffer? (special value "-" means that
@@ -414,6 +434,17 @@ gui_line_has_highlight (struct t_gui_line *line)
line->data->buffer->highlight_tags_array))
return 0;
}
+
+ /*
+ * if a nick is defined in tags ("nick_xxx"), then check if highlight is
+ * disabled for this nick (using hashtable buffer->no_highlight_nicks)
+ */
+ nick = gui_line_get_nick_tag (line);
+ if (nick)
+ {
+ if (hashtable_has_key (line->data->buffer->no_highlight_nicks, nick))
+ return 0;
+ }
/* remove color codes from line message */
msg_no_color = gui_color_decode (line->data->message, NULL);