summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-08 13:23:50 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-08 13:23:50 +0200
commitdf52b57c33affe5ba23988bca4734d3032e98166 (patch)
tree1db8a769332d9a88a0fe87ff661760bcebb26f49 /src
parent7addd1bf0070c8b6c36f6e1d90245c44f742d7ee (diff)
downloadweechat-df52b57c33affe5ba23988bca4734d3032e98166.zip
core: add function gui_buffer_set_filter
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-buffer.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index e671278b8..800c7980f 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -1625,6 +1625,22 @@ gui_buffer_set_day_change (struct t_gui_buffer *buffer, int day_change)
}
/*
+ * Sets filter for a buffer.
+ */
+
+void
+gui_buffer_set_filter (struct t_gui_buffer *buffer, int filter)
+{
+ filter = (filter) ? 1 : 0;
+
+ if (!buffer || (buffer->filter == filter))
+ return;
+
+ buffer->filter = filter;
+ gui_filter_buffer (buffer, NULL);
+}
+
+/*
* Sets name for a buffer.
*/
@@ -2573,10 +2589,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
- {
- buffer->filter = (number) ? 1 : 0;
- gui_filter_buffer (buffer, NULL);
- }
+ gui_buffer_set_filter (buffer, number);
}
else if (strcmp (property, "number") == 0)
{