mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 14:26:39 +02:00
core: remove function gui_buffer_match_list_split, use function string_match_list
This commit is contained in:
@@ -113,9 +113,9 @@ hook_line_exec (struct t_gui_line *line)
|
||||
if (!ptr_hook->deleted && !ptr_hook->running
|
||||
&& ((HOOK_LINE(ptr_hook, buffer_type) == -1)
|
||||
|| ((int)(line->data->buffer->type) == (HOOK_LINE(ptr_hook, buffer_type))))
|
||||
&& gui_buffer_match_list_split (line->data->buffer,
|
||||
HOOK_LINE(ptr_hook, num_buffers),
|
||||
HOOK_LINE(ptr_hook, buffers))
|
||||
&& string_match_list (line->data->buffer->full_name,
|
||||
(const char **)HOOK_LINE(ptr_hook, buffers),
|
||||
0)
|
||||
&& (!HOOK_LINE(ptr_hook, tags_array)
|
||||
|| gui_line_match_tags (line->data,
|
||||
HOOK_LINE(ptr_hook, tags_count),
|
||||
|
||||
+4
-40
@@ -994,43 +994,6 @@ gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer,
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if full name of buffer matches (split) list of buffers.
|
||||
*
|
||||
* Returns:
|
||||
* 1: full name matches list of buffers
|
||||
* 0: full name does not match list of buffers
|
||||
*/
|
||||
|
||||
int
|
||||
gui_buffer_match_list_split (struct t_gui_buffer *buffer,
|
||||
int num_buffers, char **buffers)
|
||||
{
|
||||
int i, match;
|
||||
char *ptr_name;
|
||||
|
||||
if (!buffer)
|
||||
return 0;
|
||||
|
||||
match = 0;
|
||||
|
||||
for (i = 0; i < num_buffers; i++)
|
||||
{
|
||||
ptr_name = buffers[i];
|
||||
if (ptr_name[0] == '!')
|
||||
ptr_name++;
|
||||
if (string_match (buffer->full_name, ptr_name, 0))
|
||||
{
|
||||
if (buffers[i][0] == '!')
|
||||
return 0;
|
||||
else
|
||||
match = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if full name of buffer marches list of buffers.
|
||||
*
|
||||
@@ -1049,17 +1012,18 @@ int
|
||||
gui_buffer_match_list (struct t_gui_buffer *buffer, const char *string)
|
||||
{
|
||||
char **buffers;
|
||||
int num_buffers, match;
|
||||
int match;
|
||||
|
||||
if (!buffer || !string || !string[0])
|
||||
return 0;
|
||||
|
||||
match = 0;
|
||||
|
||||
buffers = string_split (string, ",", 0, 0, &num_buffers);
|
||||
buffers = string_split (string, ",", 0, 0, NULL);
|
||||
if (buffers)
|
||||
{
|
||||
match = gui_buffer_match_list_split (buffer, num_buffers, buffers);
|
||||
match = string_match_list (buffer->full_name,
|
||||
(const char **)buffers, 0);
|
||||
string_free_split (buffers);
|
||||
}
|
||||
|
||||
|
||||
@@ -270,8 +270,6 @@ extern void gui_buffer_user_set_callbacks ();
|
||||
extern int gui_buffer_valid (struct t_gui_buffer *buffer);
|
||||
extern char *gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer,
|
||||
const char *string);
|
||||
extern int gui_buffer_match_list_split (struct t_gui_buffer *buffer,
|
||||
int num_buffers, char **buffers);
|
||||
extern int gui_buffer_match_list (struct t_gui_buffer *buffer,
|
||||
const char *string);
|
||||
extern void gui_buffer_set_plugin_for_upgrade (char *name,
|
||||
|
||||
@@ -75,9 +75,9 @@ gui_filter_check_line (struct t_gui_line_data *line_data)
|
||||
if (ptr_filter->enabled)
|
||||
{
|
||||
/* check buffer */
|
||||
if (gui_buffer_match_list_split (line_data->buffer,
|
||||
ptr_filter->num_buffers,
|
||||
ptr_filter->buffers))
|
||||
if (string_match_list (line_data->buffer->full_name,
|
||||
(const char **)ptr_filter->buffers,
|
||||
0))
|
||||
{
|
||||
if ((strcmp (ptr_filter->tags, "*") == 0)
|
||||
|| (gui_line_match_tags (line_data,
|
||||
@@ -200,9 +200,8 @@ gui_filter_all_buffers (struct t_gui_filter *filter)
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (!filter
|
||||
|| gui_buffer_match_list_split (ptr_buffer,
|
||||
filter->num_buffers,
|
||||
filter->buffers))
|
||||
|| string_match_list (ptr_buffer->full_name,
|
||||
(const char **)filter->buffers, 0))
|
||||
{
|
||||
gui_filter_buffer (ptr_buffer, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user