mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Add filter with third argument of infolist_get for some infolists (bars, bar items, buffers, filters, plugins, irc_server, alias, script list)
This commit is contained in:
+3
-1
@@ -2303,7 +2303,9 @@ gui_bar_add_to_infolist (struct t_infolist *infolist,
|
||||
ptr_item = infolist_new_item (infolist);
|
||||
if (!ptr_item)
|
||||
return 0;
|
||||
|
||||
|
||||
if (!infolist_new_var_string (ptr_item, "name", bar->name))
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "hidden", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_HIDDEN])))
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "priority", CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_PRIORITY])))
|
||||
|
||||
@@ -505,6 +505,8 @@ gui_filter_add_to_infolist (struct t_infolist *infolist,
|
||||
|
||||
if (!infolist_new_var_integer (ptr_item, "enabled", filter->enabled))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "name", filter->name))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "plugin_name", filter->plugin_name))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "buffer_name", filter->buffer_name))
|
||||
|
||||
@@ -63,14 +63,18 @@ alias_info_get_infolist_cb (void *data, const char *infolist_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all aliases */
|
||||
/* build list with all aliases matching arguments */
|
||||
for (ptr_alias = alias_list; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (!alias_add_to_infolist (ptr_infolist, ptr_alias))
|
||||
if (!arguments || !arguments[0]
|
||||
|| weechat_string_match (ptr_alias->name, arguments, 0))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!alias_add_to_infolist (ptr_infolist, ptr_alias))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
|
||||
@@ -210,14 +210,18 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all servers */
|
||||
/* build list with all servers matching arguments */
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (!irc_server_add_to_infolist (ptr_infolist, ptr_server))
|
||||
if (!arguments || !arguments[0]
|
||||
|| weechat_string_match (ptr_server->name, arguments, 0))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!irc_server_add_to_infolist (ptr_infolist, ptr_server))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
|
||||
+44
-19
@@ -317,6 +317,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
struct t_gui_window *ptr_window;
|
||||
struct t_gui_hotlist *ptr_hotlist;
|
||||
struct t_weechat_plugin *ptr_plugin;
|
||||
char buffer_full_name[1024];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -345,13 +346,17 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all bars */
|
||||
/* build list with all bars matching arguments */
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
if (!gui_bar_add_to_infolist (ptr_infolist, ptr_bar))
|
||||
if (!arguments || !arguments[0]
|
||||
|| string_match (ptr_bar->name, arguments, 0))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!gui_bar_add_to_infolist (ptr_infolist, ptr_bar))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
@@ -379,14 +384,18 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all bar items */
|
||||
/* build list with all bar items matching arguments */
|
||||
for (ptr_bar_item = gui_bar_items; ptr_bar_item;
|
||||
ptr_bar_item = ptr_bar_item->next_item)
|
||||
{
|
||||
if (!gui_bar_item_add_to_infolist (ptr_infolist, ptr_bar_item))
|
||||
if (!arguments || !arguments[0]
|
||||
|| string_match (ptr_bar_item->name, arguments, 0))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!gui_bar_item_add_to_infolist (ptr_infolist, ptr_bar_item))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
@@ -465,14 +474,22 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all buffers */
|
||||
/* build list with all buffers matching arguments */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (!gui_buffer_add_to_infolist (ptr_infolist, ptr_buffer))
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name),
|
||||
"%s.%s",
|
||||
plugin_get_name (ptr_buffer->plugin),
|
||||
ptr_buffer->name);
|
||||
if (!arguments || !arguments[0]
|
||||
|| string_match (buffer_full_name, arguments, 0))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!gui_buffer_add_to_infolist (ptr_infolist, ptr_buffer))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
@@ -514,10 +531,14 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
for (ptr_filter = gui_filters; ptr_filter;
|
||||
ptr_filter = ptr_filter->next_filter)
|
||||
{
|
||||
if (!gui_filter_add_to_infolist (ptr_infolist, ptr_filter))
|
||||
if (!arguments || !arguments[0]
|
||||
|| string_match (ptr_filter->name, arguments, 0))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!gui_filter_add_to_infolist (ptr_infolist, ptr_filter))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
@@ -604,14 +625,18 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all plugins */
|
||||
/* build list with all plugins matching arguments */
|
||||
for (ptr_plugin = weechat_plugins; ptr_plugin;
|
||||
ptr_plugin = ptr_plugin->next_plugin)
|
||||
{
|
||||
if (!plugin_add_to_infolist (ptr_infolist, ptr_plugin))
|
||||
if (!arguments || !arguments[0]
|
||||
|| string_match (ptr_plugin->name, arguments, 0))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!plugin_add_to_infolist (ptr_infolist, ptr_plugin))
|
||||
{
|
||||
infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
|
||||
@@ -1007,6 +1007,8 @@ plugin_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!infolist_new_var_pointer (ptr_item, "handle", plugin->handle))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "name", plugin->name))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "description", plugin->description))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "author", plugin->author))
|
||||
|
||||
@@ -473,7 +473,6 @@ weechat_lua_infolist_cb (void *data, const char *infolist_name,
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) arguments;
|
||||
|
||||
if (!infolist_name || !infolist_name[0])
|
||||
return NULL;
|
||||
@@ -481,7 +480,8 @@ weechat_lua_infolist_cb (void *data, const char *infolist_name,
|
||||
if (weechat_strcasecmp (infolist_name, "lua_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_lua_plugin,
|
||||
lua_scripts, pointer);
|
||||
lua_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -619,7 +619,6 @@ weechat_perl_infolist_cb (void *data, const char *infolist_name,
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) arguments;
|
||||
|
||||
if (!infolist_name || !infolist_name[0])
|
||||
return NULL;
|
||||
@@ -627,7 +626,8 @@ weechat_perl_infolist_cb (void *data, const char *infolist_name,
|
||||
if (weechat_strcasecmp (infolist_name, "perl_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_perl_plugin,
|
||||
perl_scripts, pointer);
|
||||
perl_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -704,7 +704,6 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) arguments;
|
||||
|
||||
if (!infolist_name || !infolist_name[0])
|
||||
return NULL;
|
||||
@@ -712,7 +711,8 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
|
||||
if (weechat_strcasecmp (infolist_name, "python_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_python_plugin,
|
||||
python_scripts, pointer);
|
||||
python_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -672,7 +672,6 @@ weechat_ruby_infolist_cb (void *data, const char *infolist_name,
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) arguments;
|
||||
|
||||
if (!infolist_name || !infolist_name[0])
|
||||
return NULL;
|
||||
@@ -680,7 +679,8 @@ weechat_ruby_infolist_cb (void *data, const char *infolist_name,
|
||||
if (weechat_strcasecmp (infolist_name, "ruby_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_ruby_plugin,
|
||||
ruby_scripts, pointer);
|
||||
ruby_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -1161,7 +1161,8 @@ script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_infolist *
|
||||
script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void *pointer)
|
||||
void *pointer,
|
||||
const char *arguments)
|
||||
{
|
||||
struct t_infolist *ptr_infolist;
|
||||
struct t_plugin_script *ptr_script;
|
||||
@@ -1185,15 +1186,19 @@ script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* build list with all scripts */
|
||||
/* build list with all scripts matching arguments */
|
||||
for (ptr_script = scripts; ptr_script;
|
||||
ptr_script = ptr_script->next_script)
|
||||
{
|
||||
if (!script_add_to_infolist (weechat_plugin,
|
||||
ptr_infolist, ptr_script))
|
||||
if (!arguments || !arguments[0]
|
||||
|| weechat_string_match (ptr_script->name, arguments, 0))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
if (!script_add_to_infolist (weechat_plugin,
|
||||
ptr_infolist, ptr_script))
|
||||
{
|
||||
weechat_infolist_free (ptr_infolist);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ptr_infolist;
|
||||
|
||||
@@ -137,7 +137,8 @@ extern int script_add_to_infolist (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script);
|
||||
extern struct t_infolist *script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
void *pointer);
|
||||
void *pointer,
|
||||
const char *arguments);
|
||||
extern void script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
|
||||
|
||||
@@ -414,7 +414,6 @@ weechat_tcl_infolist_cb (void *data, const char *infolist_name,
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) arguments;
|
||||
|
||||
if (!infolist_name || !infolist_name[0])
|
||||
return NULL;
|
||||
@@ -422,7 +421,8 @@ weechat_tcl_infolist_cb (void *data, const char *infolist_name,
|
||||
if (weechat_strcasecmp (infolist_name, "tcl_script") == 0)
|
||||
{
|
||||
return script_infolist_list_scripts (weechat_tcl_plugin,
|
||||
tcl_scripts, pointer);
|
||||
tcl_scripts, pointer,
|
||||
arguments);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user