mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 16:53:14 +02:00
core: add "full_name" in buffer structure
This commit is contained in:
+20
-25
@@ -825,10 +825,9 @@ COMMAND_CALLBACK(buffer)
|
||||
if (gui_buffer_property_in_list (gui_buffer_properties_get_integer,
|
||||
argv[2]))
|
||||
{
|
||||
gui_chat_printf (NULL, "%s%s.%s%s: (int) %s = %d",
|
||||
gui_chat_printf (NULL, "%s%s%s: (int) %s = %d",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name,
|
||||
buffer->full_name,
|
||||
GUI_COLOR(GUI_COLOR_CHAT),
|
||||
argv[2],
|
||||
gui_buffer_get_integer (buffer, argv[2]));
|
||||
@@ -836,10 +835,9 @@ COMMAND_CALLBACK(buffer)
|
||||
if (gui_buffer_property_in_list (gui_buffer_properties_get_string,
|
||||
argv[2]))
|
||||
{
|
||||
gui_chat_printf (NULL, "%s%s.%s%s: (str) %s = %s",
|
||||
gui_chat_printf (NULL, "%s%s%s: (str) %s = %s",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name,
|
||||
buffer->full_name,
|
||||
GUI_COLOR(GUI_COLOR_CHAT),
|
||||
argv[2],
|
||||
gui_buffer_get_string (buffer, argv[2]));
|
||||
@@ -847,10 +845,9 @@ COMMAND_CALLBACK(buffer)
|
||||
if (gui_buffer_property_in_list (gui_buffer_properties_get_pointer,
|
||||
argv[2]))
|
||||
{
|
||||
gui_chat_printf (NULL, "%s%s.%s%s: (ptr) %s = 0x%lx",
|
||||
gui_chat_printf (NULL, "%s%s%s: (ptr) %s = 0x%lx",
|
||||
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name,
|
||||
buffer->full_name,
|
||||
GUI_COLOR(GUI_COLOR_CHAT),
|
||||
argv[2],
|
||||
gui_buffer_get_pointer (buffer, argv[2]));
|
||||
@@ -3998,21 +3995,21 @@ command_repeat_timer_cb (void *data, int remaining_calls)
|
||||
if (!repeat_args)
|
||||
return WEECHAT_RC_ERROR;
|
||||
|
||||
if (repeat_args[0] && repeat_args[1] && repeat_args[2])
|
||||
if (repeat_args[0] && repeat_args[1])
|
||||
{
|
||||
/* search buffer, fallback to core buffer if not found */
|
||||
ptr_buffer = gui_buffer_search_by_name (repeat_args[0], repeat_args[1]);
|
||||
ptr_buffer = gui_buffer_search_by_full_name (repeat_args[0]);
|
||||
if (!ptr_buffer)
|
||||
ptr_buffer = gui_buffer_search_main ();
|
||||
|
||||
/* execute command */
|
||||
if (ptr_buffer)
|
||||
input_exec_command (ptr_buffer, 1, NULL, repeat_args[2]);
|
||||
input_exec_command (ptr_buffer, 1, NULL, repeat_args[1]);
|
||||
}
|
||||
|
||||
if (remaining_calls == 0)
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (repeat_args[i])
|
||||
free (repeat_args[i]);
|
||||
@@ -4086,7 +4083,7 @@ COMMAND_CALLBACK(repeat)
|
||||
}
|
||||
else
|
||||
{
|
||||
repeat_args = malloc (3 * sizeof (*repeat_args));
|
||||
repeat_args = malloc (2 * sizeof (*repeat_args));
|
||||
if (!repeat_args)
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
@@ -4094,9 +4091,8 @@ COMMAND_CALLBACK(repeat)
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
repeat_args[0] = strdup (gui_buffer_get_plugin_name (buffer));
|
||||
repeat_args[1] = strdup (buffer->name);
|
||||
repeat_args[2] = command;
|
||||
repeat_args[0] = strdup (buffer->full_name);
|
||||
repeat_args[1] = command;
|
||||
hook_timer (NULL, interval, 0, count - 1,
|
||||
&command_repeat_timer_cb, repeat_args);
|
||||
}
|
||||
@@ -4859,19 +4855,19 @@ command_wait_timer_cb (void *data, int remaining_calls)
|
||||
if (!timer_args)
|
||||
return WEECHAT_RC_ERROR;
|
||||
|
||||
if (timer_args[0] && timer_args[1] && timer_args[2])
|
||||
if (timer_args[0] && timer_args[1])
|
||||
{
|
||||
/* search buffer, fallback to core buffer if not found */
|
||||
ptr_buffer = gui_buffer_search_by_name (timer_args[0], timer_args[1]);
|
||||
ptr_buffer = gui_buffer_search_by_full_name (timer_args[0]);
|
||||
if (!ptr_buffer)
|
||||
ptr_buffer = gui_buffer_search_main ();
|
||||
|
||||
/* execute command */
|
||||
if (ptr_buffer)
|
||||
input_data (ptr_buffer, timer_args[2]);
|
||||
input_data (ptr_buffer, timer_args[1]);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (timer_args[i])
|
||||
free (timer_args[i]);
|
||||
@@ -4932,7 +4928,7 @@ COMMAND_CALLBACK(wait)
|
||||
delay = number * factor;
|
||||
|
||||
/* build arguments for timer callback */
|
||||
timer_args = malloc (3 * sizeof (*timer_args));
|
||||
timer_args = malloc (2 * sizeof (*timer_args));
|
||||
if (!timer_args)
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
@@ -4940,9 +4936,8 @@ COMMAND_CALLBACK(wait)
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
timer_args[0] = strdup (gui_buffer_get_plugin_name (buffer));
|
||||
timer_args[1] = strdup (buffer->name);
|
||||
timer_args[2] = strdup (argv_eol[2]);
|
||||
timer_args[0] = strdup (buffer->full_name);
|
||||
timer_args[1] = strdup (argv_eol[2]);
|
||||
|
||||
/* schedule command, execute it after "delay" milliseconds */
|
||||
hook_timer (NULL, delay, 0, 1,
|
||||
|
||||
@@ -174,7 +174,6 @@ completion_list_add_buffers_plugins_names_cb (void *data,
|
||||
struct t_gui_completion *completion)
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
char name[512];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -184,10 +183,7 @@ completion_list_add_buffers_plugins_names_cb (void *data,
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
snprintf (name, sizeof (name), "%s.%s",
|
||||
gui_buffer_get_plugin_name (ptr_buffer),
|
||||
ptr_buffer->name);
|
||||
gui_completion_list_add (completion, name,
|
||||
gui_completion_list_add (completion, ptr_buffer->full_name,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
|
||||
|
||||
+9
-21
@@ -1373,9 +1373,7 @@ config_weechat_notify_delete_option_cb (void *data,
|
||||
int
|
||||
config_weechat_notify_set (struct t_gui_buffer *buffer, const char *notify)
|
||||
{
|
||||
const char *plugin_name;
|
||||
char *option_name;
|
||||
int i, value, length;
|
||||
int i, value;
|
||||
|
||||
if (!buffer || !notify)
|
||||
return 0;
|
||||
@@ -1392,24 +1390,14 @@ config_weechat_notify_set (struct t_gui_buffer *buffer, const char *notify)
|
||||
if ((value < 0) && (strcmp (notify, "reset") != 0))
|
||||
return 0;
|
||||
|
||||
plugin_name = gui_buffer_get_plugin_name (buffer);
|
||||
length = strlen (plugin_name) + 1 + strlen (buffer->name) + 1;
|
||||
option_name = malloc (length);
|
||||
if (option_name)
|
||||
{
|
||||
snprintf (option_name, length, "%s.%s", plugin_name, buffer->name);
|
||||
|
||||
/* create/update option */
|
||||
config_weechat_notify_create_option_cb (NULL,
|
||||
weechat_config_file,
|
||||
weechat_config_section_notify,
|
||||
option_name,
|
||||
(value < 0) ?
|
||||
NULL : gui_buffer_notify_string[value]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* create/update option */
|
||||
config_weechat_notify_create_option_cb (NULL,
|
||||
weechat_config_file,
|
||||
weechat_config_section_notify,
|
||||
buffer->full_name,
|
||||
(value < 0) ?
|
||||
NULL : gui_buffer_notify_string[value]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -437,6 +437,7 @@ upgrade_weechat_read_cb (void *data,
|
||||
upgrade_set_current_buffer = upgrade_current_buffer;
|
||||
upgrade_current_buffer->plugin_name_for_upgrade =
|
||||
strdup (infolist_string (infolist, "plugin_name"));
|
||||
gui_buffer_build_full_name (upgrade_current_buffer);
|
||||
upgrade_current_buffer->short_name =
|
||||
(infolist_string (infolist, "short_name")) ?
|
||||
strdup (infolist_string (infolist, "short_name")) : NULL;
|
||||
|
||||
+53
-31
@@ -86,8 +86,8 @@ char *gui_buffer_properties_get_integer[] =
|
||||
NULL
|
||||
};
|
||||
char *gui_buffer_properties_get_string[] =
|
||||
{ "plugin", "name", "short_name", "title", "input", "text_search_input",
|
||||
"highlight_words", "highlight_regex", "highlight_tags",
|
||||
{ "plugin", "name", "full_name", "short_name", "title", "input",
|
||||
"text_search_input", "highlight_words", "highlight_regex", "highlight_tags",
|
||||
"hotlist_max_level_nicks",
|
||||
NULL
|
||||
};
|
||||
@@ -135,6 +135,28 @@ gui_buffer_get_short_name (struct t_gui_buffer *buffer)
|
||||
return (buffer->short_name) ? buffer->short_name : buffer->name;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_build_full_name: build "full_name" of buffer (for example after
|
||||
* changing name or plugin_name_for_upgrade)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_build_full_name (struct t_gui_buffer *buffer)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (buffer->full_name)
|
||||
free (buffer->full_name);
|
||||
length = strlen (gui_buffer_get_plugin_name (buffer)) + 1 +
|
||||
strlen (buffer->name) + 1;
|
||||
buffer->full_name = malloc (length);
|
||||
if (buffer->full_name)
|
||||
{
|
||||
snprintf (buffer->full_name, length, "%s.%s",
|
||||
gui_buffer_get_plugin_name (buffer), buffer->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_local_var_add: add a new local variable to a buffer
|
||||
*/
|
||||
@@ -200,17 +222,15 @@ gui_buffer_local_var_remove_all (struct t_gui_buffer *buffer)
|
||||
int
|
||||
gui_buffer_notify_get (struct t_gui_buffer *buffer)
|
||||
{
|
||||
const char *plugin_name;
|
||||
char *option_name, *ptr_end;
|
||||
int length;
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
plugin_name = gui_buffer_get_plugin_name (buffer);
|
||||
length = strlen (plugin_name) + 1 + strlen (buffer->name) + 1;
|
||||
length = strlen (buffer->full_name) + 1;
|
||||
option_name = malloc (length);
|
||||
if (option_name)
|
||||
{
|
||||
snprintf (option_name, length, "%s.%s", plugin_name, buffer->name);
|
||||
snprintf (option_name, length, "%s", buffer->full_name);
|
||||
|
||||
ptr_end = option_name + strlen (option_name);
|
||||
while (ptr_end >= option_name)
|
||||
@@ -261,10 +281,9 @@ gui_buffer_notify_set (struct t_gui_buffer *buffer)
|
||||
{
|
||||
buffer->notify = new_notify;
|
||||
gui_chat_printf (NULL,
|
||||
_("Notify changed for \"%s%s.%s%s\": \"%s%s%s\" to \"%s%s%s\""),
|
||||
_("Notify changed for \"%s%s%s\": \"%s%s%s\" to \"%s%s%s\""),
|
||||
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name,
|
||||
buffer->full_name,
|
||||
GUI_COLOR(GUI_COLOR_CHAT),
|
||||
GUI_COLOR(GUI_COLOR_CHAT_VALUE),
|
||||
gui_buffer_notify_string[old_notify],
|
||||
@@ -445,6 +464,8 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
|
||||
&(new_buffer->layout_number),
|
||||
&(new_buffer->layout_number_merge_order));
|
||||
new_buffer->name = strdup (name);
|
||||
new_buffer->full_name = NULL;
|
||||
gui_buffer_build_full_name (new_buffer);
|
||||
new_buffer->short_name = NULL;
|
||||
new_buffer->type = GUI_BUFFER_TYPE_FORMATTED;
|
||||
new_buffer->notify = CONFIG_INTEGER(config_look_buffer_notify_default);
|
||||
@@ -681,13 +702,13 @@ gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer,
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_full_name_match_list: return 1 if full name of buffer matches
|
||||
* list of buffers
|
||||
* gui_buffer_match_list_split: return 1 if full name of buffer matches
|
||||
* (split) list of buffers
|
||||
*/
|
||||
|
||||
int
|
||||
gui_buffer_full_name_match_list (const char *full_name,
|
||||
int num_buffers, char **buffers)
|
||||
gui_buffer_match_list_split (struct t_gui_buffer *buffer,
|
||||
int num_buffers, char **buffers)
|
||||
{
|
||||
int i, match;
|
||||
char *ptr_name;
|
||||
@@ -699,7 +720,7 @@ gui_buffer_full_name_match_list (const char *full_name,
|
||||
ptr_name = buffers[i];
|
||||
if (ptr_name[0] == '!')
|
||||
ptr_name++;
|
||||
if (string_match (full_name, ptr_name, 0))
|
||||
if (string_match (buffer->full_name, ptr_name, 0))
|
||||
{
|
||||
if (buffers[i][0] == '!')
|
||||
return 0;
|
||||
@@ -727,7 +748,7 @@ gui_buffer_full_name_match_list (const char *full_name,
|
||||
int
|
||||
gui_buffer_match_list (struct t_gui_buffer *buffer, const char *string)
|
||||
{
|
||||
char **buffers, buffer_full_name[512];
|
||||
char **buffers;
|
||||
int num_buffers, match;
|
||||
|
||||
if (!string || !string[0])
|
||||
@@ -738,11 +759,7 @@ gui_buffer_match_list (struct t_gui_buffer *buffer, const char *string)
|
||||
buffers = string_split (string, ",", 0, 0, &num_buffers);
|
||||
if (buffers)
|
||||
{
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name);
|
||||
match = gui_buffer_full_name_match_list (buffer_full_name,
|
||||
num_buffers, buffers);
|
||||
match = gui_buffer_match_list_split (buffer, num_buffers, buffers);
|
||||
string_free_split (buffers);
|
||||
}
|
||||
|
||||
@@ -769,6 +786,8 @@ gui_buffer_set_plugin_for_upgrade (char *name, struct t_weechat_plugin *plugin)
|
||||
ptr_buffer->plugin_name_for_upgrade = NULL;
|
||||
|
||||
ptr_buffer->plugin = plugin;
|
||||
|
||||
gui_buffer_build_full_name (ptr_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -879,6 +898,8 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
|
||||
return gui_buffer_get_plugin_name (buffer);
|
||||
else if (string_strcasecmp (property, "name") == 0)
|
||||
return buffer->name;
|
||||
else if (string_strcasecmp (property, "full_name") == 0)
|
||||
return buffer->full_name;
|
||||
else if (string_strcasecmp (property, "short_name") == 0)
|
||||
return gui_buffer_get_short_name (buffer);
|
||||
else if (string_strcasecmp (property, "title") == 0)
|
||||
@@ -948,6 +969,7 @@ gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name)
|
||||
if (buffer->name)
|
||||
free (buffer->name);
|
||||
buffer->name = strdup (name);
|
||||
gui_buffer_build_full_name (buffer);
|
||||
|
||||
gui_buffer_local_var_add (buffer, "name", name);
|
||||
|
||||
@@ -1797,23 +1819,19 @@ struct t_gui_buffer *
|
||||
gui_buffer_search_by_full_name (const char *full_name)
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
char *name, *pos;
|
||||
|
||||
ptr_buffer = NULL;
|
||||
|
||||
name = strdup (full_name);
|
||||
if (name)
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
pos = strchr (name, '.');
|
||||
if (pos)
|
||||
if (ptr_buffer->full_name
|
||||
&& (strcmp (ptr_buffer->full_name, full_name) == 0))
|
||||
{
|
||||
pos[0] = '\0';
|
||||
ptr_buffer = gui_buffer_search_by_name (name, pos + 1);
|
||||
return ptr_buffer;
|
||||
}
|
||||
free (name);
|
||||
}
|
||||
|
||||
return ptr_buffer;
|
||||
/* buffer not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3071,6 +3089,7 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
|
||||
HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, layout_number_merge_order, INTEGER, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, name, STRING, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, full_name, STRING, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, short_name, STRING, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, type, INTEGER, NULL);
|
||||
HDATA_VAR(struct t_gui_buffer, notify, INTEGER, NULL);
|
||||
@@ -3220,6 +3239,8 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "name", buffer->name))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "full_name", buffer->full_name))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "short_name", gui_buffer_get_short_name (buffer)))
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "type", buffer->type))
|
||||
@@ -3412,6 +3433,7 @@ gui_buffer_print_log ()
|
||||
log_printf (" layout_number . . . . . : %d", ptr_buffer->layout_number);
|
||||
log_printf (" layout_number_merge_order: %d", ptr_buffer->layout_number_merge_order);
|
||||
log_printf (" name. . . . . . . . . . : '%s'", ptr_buffer->name);
|
||||
log_printf (" full_name . . . . . . . : '%s'", ptr_buffer->full_name);
|
||||
log_printf (" short_name. . . . . . . : '%s'", ptr_buffer->short_name);
|
||||
log_printf (" type. . . . . . . . . . : %d", ptr_buffer->type);
|
||||
log_printf (" notify. . . . . . . . . : %d", ptr_buffer->notify);
|
||||
|
||||
@@ -77,6 +77,7 @@ struct t_gui_buffer
|
||||
int layout_number; /* number of buffer saved in layout */
|
||||
int layout_number_merge_order; /* order in merge for layout */
|
||||
char *name; /* buffer name */
|
||||
char *full_name; /* plugin name + '.' + buffer name */
|
||||
char *short_name; /* short buffer name */
|
||||
enum t_gui_buffer_type type; /* buffer type (formatted, free, ..) */
|
||||
int notify; /* 0 = never */
|
||||
@@ -205,6 +206,7 @@ extern char *gui_buffer_properties_set[];
|
||||
|
||||
extern const char *gui_buffer_get_plugin_name (struct t_gui_buffer *buffer);
|
||||
extern const char *gui_buffer_get_short_name (struct t_gui_buffer *buffer);
|
||||
extern void gui_buffer_build_full_name (struct t_gui_buffer *buffer);
|
||||
extern void gui_buffer_notify_set_all ();
|
||||
extern void gui_buffer_input_buffer_init (struct t_gui_buffer *buffer);
|
||||
extern struct t_gui_buffer *gui_buffer_new (struct t_weechat_plugin *plugin,
|
||||
@@ -219,8 +221,8 @@ extern struct t_gui_buffer *gui_buffer_new (struct t_weechat_plugin *plugin,
|
||||
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_full_name_match_list (const char *full_name,
|
||||
int num_buffers, char **buffers);
|
||||
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,
|
||||
|
||||
+5
-10
@@ -75,7 +75,7 @@ gui_filter_line_has_tag_no_filter (struct t_gui_line *line)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_filter_check_line (struct t_gui_line *line, const char *buffer_full_name)
|
||||
gui_filter_check_line (struct t_gui_line *line)
|
||||
{
|
||||
struct t_gui_filter *ptr_filter;
|
||||
int rc;
|
||||
@@ -93,9 +93,9 @@ gui_filter_check_line (struct t_gui_line *line, const char *buffer_full_name)
|
||||
if (ptr_filter->enabled)
|
||||
{
|
||||
/* check buffer */
|
||||
if (gui_buffer_full_name_match_list (buffer_full_name,
|
||||
ptr_filter->num_buffers,
|
||||
ptr_filter->buffers))
|
||||
if (gui_buffer_match_list_split (line->data->buffer,
|
||||
ptr_filter->num_buffers,
|
||||
ptr_filter->buffers))
|
||||
{
|
||||
if ((strcmp (ptr_filter->tags, "*") == 0)
|
||||
|| (gui_line_match_tags (line,
|
||||
@@ -134,20 +134,15 @@ gui_filter_buffer (struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_gui_line *ptr_line;
|
||||
int line_displayed, lines_hidden;
|
||||
char buffer_full_name[512];
|
||||
|
||||
lines_hidden = 0;
|
||||
|
||||
buffer->lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min);
|
||||
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name);
|
||||
|
||||
for (ptr_line = buffer->lines->first_line; ptr_line;
|
||||
ptr_line = ptr_line->next_line)
|
||||
{
|
||||
line_displayed = gui_filter_check_line (ptr_line, buffer_full_name);
|
||||
line_displayed = gui_filter_check_line (ptr_line);
|
||||
|
||||
if (line_displayed
|
||||
&& (ptr_line->data->prefix_length > buffer->lines->prefix_max_length))
|
||||
|
||||
@@ -53,8 +53,7 @@ extern int gui_filters_enabled;
|
||||
|
||||
/* filter functions */
|
||||
|
||||
extern int gui_filter_check_line (struct t_gui_line *line,
|
||||
const char *buffer_full_name);
|
||||
extern int gui_filter_check_line (struct t_gui_line *line);
|
||||
extern void gui_filter_all_buffers ();
|
||||
extern void gui_filter_global_enable ();
|
||||
extern void gui_filter_global_disable ();
|
||||
|
||||
@@ -180,6 +180,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
|
||||
FOCUS_INT("_buffer_number", ((focus_info->window)->buffer)->number);
|
||||
FOCUS_STR("_buffer_plugin", plugin_get_name (((focus_info->window)->buffer)->plugin));
|
||||
FOCUS_STR("_buffer_name", ((focus_info->window)->buffer)->name);
|
||||
FOCUS_STR("_buffer_full_name", ((focus_info->window)->buffer)->full_name);
|
||||
hashtable_map (focus_info->window->buffer->local_variables,
|
||||
&gui_focus_buffer_localvar_map_cb, hashtable);
|
||||
}
|
||||
@@ -190,6 +191,7 @@ gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
|
||||
FOCUS_STR("_buffer_number", "-1");
|
||||
FOCUS_STR("_buffer_plugin", "");
|
||||
FOCUS_STR("_buffer_name", "");
|
||||
FOCUS_STR("_buffer_full_name", "");
|
||||
}
|
||||
|
||||
/* chat area */
|
||||
|
||||
+4
-10
@@ -897,8 +897,7 @@ gui_key_focus_matching (struct t_gui_key *key,
|
||||
struct t_hashtable **hashtable_focus)
|
||||
{
|
||||
int match[2], area;
|
||||
char buffer_full_name[512];
|
||||
const char *chat, *buffer_plugin, *buffer_name, *bar_name, *bar_item_name;
|
||||
const char *chat, *buffer_full_name, *bar_name, *bar_item_name;
|
||||
|
||||
for (area = 0; area < 2; area++)
|
||||
{
|
||||
@@ -910,16 +909,11 @@ gui_key_focus_matching (struct t_gui_key *key,
|
||||
break;
|
||||
case GUI_KEY_FOCUS_CHAT:
|
||||
chat = hashtable_get (hashtable_focus[area], "_chat");
|
||||
buffer_plugin = hashtable_get (hashtable_focus[area],
|
||||
"_buffer_plugin");
|
||||
buffer_name = hashtable_get (hashtable_focus[area],
|
||||
"_buffer_name");
|
||||
buffer_full_name = hashtable_get (hashtable_focus[area],
|
||||
"_buffer_full_name");
|
||||
if (chat && (strcmp (chat, "1") == 0)
|
||||
&& buffer_plugin && buffer_plugin[0]
|
||||
&& buffer_name && buffer_name[0])
|
||||
&& buffer_full_name && buffer_full_name[0])
|
||||
{
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name),
|
||||
"%s.%s", buffer_plugin, buffer_name);
|
||||
if (string_match (buffer_full_name, key->area_name[area], 0))
|
||||
match[area] = 1;
|
||||
}
|
||||
|
||||
+3
-12
@@ -793,7 +793,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
|
||||
struct t_gui_line *new_line;
|
||||
struct t_gui_line_data *new_line_data;
|
||||
struct t_gui_window *ptr_win;
|
||||
char *message_for_signal, buffer_full_name[512];
|
||||
char *message_for_signal;
|
||||
const char *nick;
|
||||
int notify_level, *max_notify_level, lines_removed;
|
||||
time_t current_time;
|
||||
@@ -880,11 +880,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
|
||||
gui_line_add_to_list (buffer->own_lines, new_line);
|
||||
|
||||
/* check if line is filtered or not */
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name);
|
||||
new_line->data->displayed = gui_filter_check_line (new_line,
|
||||
buffer_full_name);
|
||||
new_line->data->displayed = gui_filter_check_line (new_line);
|
||||
if (new_line->data->displayed)
|
||||
{
|
||||
if (new_line->data->highlight)
|
||||
@@ -967,7 +963,6 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
|
||||
{
|
||||
struct t_gui_line *ptr_line, *new_line;
|
||||
struct t_gui_line_data *new_line_data;
|
||||
char buffer_full_name[512];
|
||||
|
||||
/* search if line exists for "y" */
|
||||
for (ptr_line = buffer->own_lines->first_line; ptr_line;
|
||||
@@ -1044,11 +1039,7 @@ gui_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
|
||||
ptr_line->data->message = (message) ? strdup (message) : strdup ("");
|
||||
|
||||
/* check if line is filtered or not */
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name), "%s.%s",
|
||||
gui_buffer_get_plugin_name (buffer),
|
||||
buffer->name);
|
||||
ptr_line->data->displayed = gui_filter_check_line (ptr_line,
|
||||
buffer_full_name);
|
||||
ptr_line->data->displayed = gui_filter_check_line (ptr_line);
|
||||
if (!ptr_line->data->displayed)
|
||||
{
|
||||
if (!buffer->own_lines->lines_hidden)
|
||||
|
||||
@@ -400,7 +400,6 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
struct t_gui_hotlist *ptr_hotlist;
|
||||
struct t_gui_key *ptr_key;
|
||||
struct t_weechat_plugin *ptr_plugin;
|
||||
char buffer_full_name[1024];
|
||||
int context, number;
|
||||
char *error;
|
||||
|
||||
@@ -563,12 +562,8 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
snprintf (buffer_full_name, sizeof (buffer_full_name),
|
||||
"%s.%s",
|
||||
gui_buffer_get_plugin_name (ptr_buffer),
|
||||
ptr_buffer->name);
|
||||
if (!arguments || !arguments[0]
|
||||
|| string_match (buffer_full_name, arguments, 0))
|
||||
|| string_match (ptr_buffer->full_name, arguments, 0))
|
||||
{
|
||||
if (!gui_buffer_add_to_infolist (ptr_infolist, ptr_buffer))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user