diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-06-13 12:32:27 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-06-13 12:32:27 +0200 |
commit | c8b2a6a08485abfe6a8fb849b68ec574af8879e5 (patch) | |
tree | e7b5202773f259439d7f1cac1239ea464769768b /src/gui/gui-filter.c | |
parent | 756252b95cb1b1988891c7a7525378c8feaa5f8e (diff) | |
download | weechat-c8b2a6a08485abfe6a8fb849b68ec574af8879e5.zip |
core: add "hdata" (direct access to WeeChat/plugin data)
Diffstat (limited to 'src/gui/gui-filter.c')
-rw-r--r-- | src/gui/gui-filter.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index 032fd4f9a..104c4bc6c 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -26,11 +26,13 @@ #endif #include <stdlib.h> +#include <stddef.h> #include <string.h> #include <regex.h> #include "../core/weechat.h" #include "../core/wee-config.h" +#include "../core/wee-hdata.h" #include "../core/wee-hook.h" #include "../core/wee-infolist.h" #include "../core/wee-log.h" @@ -45,6 +47,8 @@ struct t_gui_filter *gui_filters = NULL; /* first filter */ struct t_gui_filter *last_gui_filter = NULL; /* last filter */ int gui_filters_enabled = 1; /* filters enabled? */ +struct t_hdata *gui_filter_hdata_filter = NULL; + /* * gui_filter_line_has_tag_no_filter: return 1 if line has tag "no_filter", @@ -474,6 +478,44 @@ gui_filter_free_all () } /* + * gui_filter_hdata_filter_cb: return hdata for filter + */ + +struct t_hdata * +gui_filter_hdata_filter_cb (void *data, const char *hdata_name) +{ + struct t_hdata *hdata; + + /* make C compiler happy */ + (void) data; + + if (gui_filter_hdata_filter) + return gui_filter_hdata_filter; + + hdata = hdata_new (hdata_name, "prev_filter", "next_filter"); + if (hdata) + { + gui_filter_hdata_filter = hdata; + HDATA_VAR(struct t_gui_filter, enabled, INTEGER); + HDATA_VAR(struct t_gui_filter, name, STRING); + HDATA_VAR(struct t_gui_filter, buffer_name, STRING); + HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER); + HDATA_VAR(struct t_gui_filter, buffers, POINTER); + HDATA_VAR(struct t_gui_filter, tags, STRING); + HDATA_VAR(struct t_gui_filter, tags_count, INTEGER); + HDATA_VAR(struct t_gui_filter, tags_array, POINTER); + HDATA_VAR(struct t_gui_filter, regex, STRING); + HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER); + HDATA_VAR(struct t_gui_filter, regex_message, POINTER); + HDATA_VAR(struct t_gui_filter, prev_filter, POINTER); + HDATA_VAR(struct t_gui_filter, next_filter, POINTER); + HDATA_LIST(gui_filters); + HDATA_LIST(last_gui_filter); + } + return gui_filter_hdata_filter; +} + +/* * gui_filter_add_to_infolist: add a filter in an infolist * return 1 if ok, 0 if error */ |