From 500e54578b26c502ab4a6d1e455d60c15844a965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 2 Jun 2017 20:19:00 +0200 Subject: [PATCH] fset: add filtering by type ("t:xxx") --- src/plugins/fset/fset-command.c | 2 ++ src/plugins/fset/fset-option.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index 5eefb034a..c2c66090b 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -493,6 +493,8 @@ fset_command_init () "formats are:\n" " * show all options (no filter)\n" " f:xxx show only configuration file \"xxx\"\n" + " t:xxx show only type \"xxx\" (beginning of type " + "name is allowed, both English and translated types are allowed)\n" " d show only changed options\n" " d:xxx show only changed options with \"xxx\" in name\n" " d=xxx show only changed options with \"xxx\" in value\n" diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 2ffd290b5..e53061b3a 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -215,6 +215,8 @@ int fset_option_match_filters (const char *config_name, const char *section_name, struct t_fset_option *fset_option) { + int length; + if (!weechat_config_boolean (fset_config_look_show_plugin_description) && (strcmp (config_name, "plugins") == 0) && (strcmp (section_name, "desc") == 0)) @@ -230,6 +232,21 @@ fset_option_match_filters (const char *config_name, const char *section_name, /* filter by config name */ return (weechat_strcasecmp (config_name, fset_option_filter + 2) == 0) ? 1 : 0; } + if (strncmp (fset_option_filter, "t:", 2) == 0) + { + /* filter by type */ + length = strlen (fset_option_filter + 2); + return ((length > 0) + && ((weechat_strncasecmp ( + fset_option_type_string[fset_option->type], + fset_option_filter + 2, + length) == 0) + || (weechat_strncasecmp ( + _(fset_option_type_string[fset_option->type]), + fset_option_filter + 2, + length) == 0))) ? 1 : 0; + } + else if (strncmp (fset_option_filter, "d==", 3) == 0) { /* filter by modified values, exact value */