mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 16:23:14 +02:00
relay/api: fix "body_type" returned when lines or nicks of a buffer are requested
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
* python: fix crash on quit with Python 3.12 (issue #2046, issue #2126)
|
||||
* core: fix crash when deleting a bar that has no items (issue #2138)
|
||||
* ruby: fix builtin functions not available (issue #2109)
|
||||
* relay/api: fix "body_type" returned when lines or nicks of a buffer are requested
|
||||
|
||||
[[v4.3.3]]
|
||||
== Version 4.3.3 (2024-06-22)
|
||||
|
||||
@@ -511,6 +511,8 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
|
||||
int nicks;
|
||||
enum t_relay_api_colors colors;
|
||||
|
||||
json = NULL;
|
||||
|
||||
ptr_buffer = NULL;
|
||||
if (client->http_req->num_path_items > 2)
|
||||
{
|
||||
@@ -536,6 +538,11 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
|
||||
{
|
||||
lines = relay_http_get_param_long (client->http_req, "lines", LONG_MAX);
|
||||
json = relay_api_msg_lines_to_json (ptr_buffer, lines, colors);
|
||||
if (json)
|
||||
{
|
||||
relay_api_msg_send_json (client, RELAY_HTTP_200_OK, NULL,
|
||||
"line", json);
|
||||
}
|
||||
}
|
||||
else if (strcmp (client->http_req->path_items[3], "nicks") == 0)
|
||||
{
|
||||
@@ -543,6 +550,11 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
|
||||
weechat_hdata_pointer (relay_hdata_buffer,
|
||||
ptr_buffer, "nicklist_root"),
|
||||
colors);
|
||||
if (json)
|
||||
{
|
||||
relay_api_msg_send_json (client, RELAY_HTTP_200_OK, NULL,
|
||||
"nick_group", json);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -580,13 +592,18 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
|
||||
ptr_buffer = weechat_hdata_move (relay_hdata_buffer, ptr_buffer, 1);
|
||||
}
|
||||
}
|
||||
if (json)
|
||||
{
|
||||
relay_api_msg_send_json (client, RELAY_HTTP_200_OK, NULL,
|
||||
"buffer", json);
|
||||
}
|
||||
}
|
||||
|
||||
if (!json)
|
||||
return RELAY_API_PROTOCOL_RC_MEMORY;
|
||||
|
||||
relay_api_msg_send_json (client, RELAY_HTTP_200_OK, NULL, "buffer", json);
|
||||
cJSON_Delete (json);
|
||||
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user