diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-09-03 09:39:08 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-09-03 09:39:08 +0200 |
commit | 209df25bdbd153ae6ff74efbce1657b85d45c6ac (patch) | |
tree | 94741cdbfd281f378d70441fe1eceb093d3b2873 /src/gui | |
parent | 94c9b21450e070c9f7e0f3afa0ee5b17639c31e5 (diff) | |
download | weechat-209df25bdbd153ae6ff74efbce1657b85d45c6ac.zip |
Add "no_filter" tag, to prevent some lines to be filtered (like output of /filter command)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-filter.c | 27 | ||||
-rw-r--r-- | src/gui/gui-filter.h | 2 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index 53070f068..6919ffc56 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -43,6 +43,27 @@ int gui_filters_enabled = 1; /* filters enabled? */ /* + * gui_filter_line_has_tag_no_filter: return 1 if line has tag "no_filter", + * which means that line should never + * been filtered (always displayed) + */ + +int +gui_filter_line_has_tag_no_filter (struct t_gui_line *line) +{ + int i; + + for (i = 0; i < line->tags_count; i++) + { + if (strcmp (line->tags_array[i], GUI_FILTER_TAG_NO_FILTER) == 0) + return 1; + } + + /* tag not found, line may be filtered */ + return 0; +} + +/* * gui_filter_check_line: return 1 if a line should be displayed, or * 0 if line is hidden (tag or regex found) */ @@ -52,13 +73,13 @@ gui_filter_check_line (struct t_gui_buffer *buffer, struct t_gui_line *line) { struct t_gui_filter *ptr_filter; - /* make C compiler happy */ - (void) buffer; - /* line is always displayed if filters are disabled */ if (!gui_filters_enabled) return 1; + if (gui_filter_line_has_tag_no_filter (line)) + return 1; + for (ptr_filter = gui_filters; ptr_filter; ptr_filter = ptr_filter->next_filter) { diff --git a/src/gui/gui-filter.h b/src/gui/gui-filter.h index 93c3184fb..9daa65b4a 100644 --- a/src/gui/gui-filter.h +++ b/src/gui/gui-filter.h @@ -22,6 +22,8 @@ #include <regex.h> +#define GUI_FILTER_TAG_NO_FILTER "no_filter" + /* filter structures */ struct t_gui_line; |