mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 09:13:14 +02:00
relay/api: fix "body_type" returned when lines or nicks of a buffer are requested
The "body_type" returned is now this one, instead of "buffer": - `GET /api/buffers/xxx/lines`: "line" - `GET /api/buffers/xxx/nicks`: "nick_group"
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
- ruby: fix builtin functions not available ([#2109](https://github.com/weechat/weechat/issues/2109))
|
||||
- php: fix return value of function hdata_longlong
|
||||
- tcl: fix return value of function hdata_longlong ([#2119](https://github.com/weechat/weechat/issues/2119))
|
||||
- relay/api: fix "body_type" returned when lines or nicks of a buffer are requested
|
||||
- relay: fix read of one buffer line in API protocol
|
||||
- relay: fix websocket permessage-deflate extension when the client doesn't send the max window bits parameters ([#1549](https://github.com/weechat/weechat/issues/1549))
|
||||
- relay: fix allocation and reinit of field "client_context_takeover" in websocket deflate structure ([#1549](https://github.com/weechat/weechat/issues/1549))
|
||||
|
||||
@@ -535,6 +535,8 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
|
||||
char *error;
|
||||
enum t_relay_api_colors colors;
|
||||
|
||||
json = NULL;
|
||||
|
||||
ptr_buffer = NULL;
|
||||
if (client->http_req->num_path_items > 2)
|
||||
{
|
||||
@@ -580,6 +582,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)
|
||||
{
|
||||
@@ -587,6 +594,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
|
||||
{
|
||||
@@ -624,13 +636,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