summaryrefslogtreecommitdiff
path: root/src/plugins/relay/api/relay-api-msg.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-05 22:30:04 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-05 22:30:04 +0200
commit211cd11c2a310e336ecd8760d8f33fd04dc99590 (patch)
tree3e5be77b6ef0647339dcab2e292470229e3f3487 /src/plugins/relay/api/relay-api-msg.c
parent9ceea3697bf5f194d4a86e46dd9b04012dc0592c (diff)
downloadweechat-211cd11c2a310e336ecd8760d8f33fd04dc99590.zip
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.
Diffstat (limited to 'src/plugins/relay/api/relay-api-msg.c')
-rw-r--r--src/plugins/relay/api/relay-api-msg.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/relay/api/relay-api-msg.c b/src/plugins/relay/api/relay-api-msg.c
index d02868301..71b990b02 100644
--- a/src/plugins/relay/api/relay-api-msg.c
+++ b/src/plugins/relay/api/relay-api-msg.c
@@ -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");