1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 16:23:14 +02:00

relay/api: add parameter "lines_free" in GET /api/buffers

This parameter is the number of lines to return for buffers with free content.

Its default value is `0` if "lines" is set to `0`, otherwise all buffer lines
are returned.
This commit is contained in:
Sébastien Helleu
2024-05-05 22:30:04 +02:00
parent 9ceea3697b
commit 211cd11c2a
4 changed files with 66 additions and 13 deletions
+4
View File
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <sys/time.h>
@@ -355,6 +356,7 @@ relay_api_msg_buffer_add_local_vars_cb (void *data,
cJSON *
relay_api_msg_buffer_to_json (struct t_gui_buffer *buffer,
long lines,
long lines_free,
int nicks,
enum t_relay_api_colors colors)
{
@@ -379,6 +381,8 @@ relay_api_msg_buffer_to_json (struct t_gui_buffer *buffer,
MSG_ADD_HDATA_STR("short_name", "short_name");
MSG_ADD_HDATA_VAR(Number, "number", integer, "number");
ptr_string = weechat_buffer_get_string (buffer, "type");
if (weechat_strcmp (ptr_string, "free") == 0)
lines = lines_free;
MSG_ADD_STR_PTR("type", ptr_string);
MSG_ADD_HDATA_STR_COLORS("title", "title");
MSG_ADD_HDATA_VAR(Bool, "nicklist", integer, "nicklist");