1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
* Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_GUI_FILTER_H
#define WEECHAT_GUI_FILTER_H 1
#include <regex.h>
#define GUI_FILTER_TAG_NO_FILTER "no_filter"
/* filter structures */
struct t_gui_line_data;
struct t_gui_filter
{
int enabled; /* 1 if filter enabled, otherwise 0 */
char *name; /* filter name */
char *buffer_name; /* name of buffer(s) */
int num_buffers; /* number of buffers in list */
char **buffers; /* list of buffer names */
char *tags; /* tags */
int tags_count; /* number of tags */
char ***tags_array; /* array of tags */
char *regex; /* regex */
regex_t *regex_prefix; /* regex for line prefix */
regex_t *regex_message; /* regex for line message */
struct t_gui_filter *prev_filter; /* link to previous filter */
struct t_gui_filter *next_filter; /* link to next filter */
};
/* filter variables */
extern struct t_gui_filter *gui_filters;
extern struct t_gui_filter *last_gui_filter;
extern int gui_filters_enabled;
/* filter functions */
extern int gui_filter_check_line (struct t_gui_line_data *line_data);
extern void gui_filter_buffer (struct t_gui_buffer *buffer,
struct t_gui_line_data *line_data);
extern void gui_filter_all_buffers ();
extern void gui_filter_global_enable ();
extern void gui_filter_global_disable ();
extern struct t_gui_filter *gui_filter_search_by_name (const char *name);
extern struct t_gui_filter *gui_filter_new (int enabled,
const char *name,
const char *buffer_name,
const char *tags,
const char *regex);
extern int gui_filter_rename (struct t_gui_filter *filter,
const char *new_name);
extern void gui_filter_free (struct t_gui_filter *filter);
extern void gui_filter_free_all ();
extern struct t_hdata *gui_filter_hdata_filter_cb (const void *pointer,
void *data,
const char *hdata_name);
extern int gui_filter_add_to_infolist (struct t_infolist *infolist,
struct t_gui_filter *filter);
extern void gui_filter_print_log ();
#endif /* WEECHAT_GUI_FILTER_H */
|