mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 06:46:38 +02:00
relay/api: add field "last_read_line_id" in GET /api/buffers
This commit is contained in:
@@ -350,9 +350,13 @@ relay_api_msg_buffer_to_json (struct t_gui_buffer *buffer,
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
struct t_gui_buffer *pointer;
|
||||
struct t_gui_lines *ptr_lines;
|
||||
struct t_gui_line *ptr_line;
|
||||
struct t_gui_line_data *ptr_line_data;
|
||||
cJSON *json, *json_local_vars, *json_lines, *json_nicklist_root;
|
||||
const char *ptr_string;
|
||||
char *string;
|
||||
int last_read_line_id;
|
||||
|
||||
hdata = relay_hdata_buffer;
|
||||
pointer = buffer;
|
||||
@@ -405,6 +409,24 @@ relay_api_msg_buffer_to_json (struct t_gui_buffer *buffer,
|
||||
if (json_lines)
|
||||
cJSON_AddItemToObject (json, "lines", json_lines);
|
||||
}
|
||||
last_read_line_id = -1;
|
||||
ptr_lines = weechat_hdata_pointer (relay_hdata_buffer, buffer, "own_lines");
|
||||
if (ptr_lines)
|
||||
{
|
||||
ptr_line = weechat_hdata_pointer (relay_hdata_lines, ptr_lines, "last_read_line");
|
||||
if (ptr_line)
|
||||
{
|
||||
ptr_line_data = weechat_hdata_pointer (relay_hdata_line, ptr_line, "data");
|
||||
if (ptr_line_data)
|
||||
{
|
||||
last_read_line_id = weechat_hdata_integer (relay_hdata_line_data,
|
||||
ptr_line_data, "id");
|
||||
}
|
||||
}
|
||||
}
|
||||
cJSON_AddItemToObject (
|
||||
json, "last_read_line_id",
|
||||
cJSON_CreateNumber (last_read_line_id));
|
||||
|
||||
/* nicks */
|
||||
if (nicks)
|
||||
|
||||
@@ -26,8 +26,8 @@ struct t_relay_client;
|
||||
enum t_relay_status;
|
||||
|
||||
#define RELAY_API_VERSION_MAJOR 0
|
||||
#define RELAY_API_VERSION_MINOR 4
|
||||
#define RELAY_API_VERSION_PATCH 1
|
||||
#define RELAY_API_VERSION_MINOR 5
|
||||
#define RELAY_API_VERSION_PATCH 0
|
||||
#define RELAY_API_VERSION_NUMBER \
|
||||
((RELAY_API_VERSION_MAJOR << 16) \
|
||||
+ (RELAY_API_VERSION_MINOR << 8) \
|
||||
|
||||
@@ -17,7 +17,7 @@ info:
|
||||
license:
|
||||
name: CC BY-NC-SA 4.0
|
||||
url: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
version: 0.4.1
|
||||
version: 0.5.0
|
||||
|
||||
externalDocs:
|
||||
url: https://weechat.org/doc/
|
||||
@@ -1043,6 +1043,11 @@ components:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Line'
|
||||
last_read_line_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: identifier of the last line read in the buffer (-1 if read marker is not displayed)
|
||||
example: -1
|
||||
nicklist_root:
|
||||
$ref: '#/components/schemas/NickGroup'
|
||||
required:
|
||||
|
||||
Reference in New Issue
Block a user