diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-08 09:55:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-08 12:08:50 +0200 |
commit | 2aa1b950cd6e091c2e27fe351b5fe24d0573591a (patch) | |
tree | 3534fc7daea0fd5c0ecba4798828dc5a7241b2ad | |
parent | 0df1cde496b310bb5cab5d30e86fbfc2120847ab (diff) | |
download | weechat-2aa1b950cd6e091c2e27fe351b5fe24d0573591a.zip |
core: add function gui_buffer_set_day_change
-rw-r--r-- | src/gui/gui-buffer.c | 21 | ||||
-rw-r--r-- | tests/unit/gui/test-gui-buffer.cpp | 10 |
2 files changed, 27 insertions, 4 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 6e992a037..5cb028136 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1609,6 +1609,22 @@ gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer, int refresh) } /* + * Sets day_change for a buffer. + */ + +void +gui_buffer_set_day_change (struct t_gui_buffer *buffer, int day_change) +{ + day_change = (day_change) ? 1 : 0; + + if (!buffer || (buffer->day_change == day_change)) + return; + + buffer->day_change = day_change; + gui_buffer_ask_chat_refresh (buffer, 2); +} + +/* * Sets name for a buffer. */ @@ -2516,10 +2532,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) - { - buffer->day_change = (number) ? 1 : 0; - gui_buffer_ask_chat_refresh (buffer, 2); - } + gui_buffer_set_day_change (buffer, number); } else if (strcmp (property, "clear") == 0) { diff --git a/tests/unit/gui/test-gui-buffer.cpp b/tests/unit/gui/test-gui-buffer.cpp index b6f14cdcb..9d72f225f 100644 --- a/tests/unit/gui/test-gui-buffer.cpp +++ b/tests/unit/gui/test-gui-buffer.cpp @@ -973,6 +973,16 @@ TEST(GuiBuffer, AskChatRefresh) /* * Tests functions: + * gui_buffer_set_day_change + */ + +TEST(GuiBuffer, SetDayChange) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: * gui_buffer_set_name */ |