summaryrefslogtreecommitdiff
path: root/src/plugins/relay
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-01 10:10:36 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-01 10:10:36 +0200
commit6c1f21f10c4f740c88c56228a725b5f47ce4ca52 (patch)
tree4577edcd969052975056d460e5115c2d3511cee2 /src/plugins/relay
parentee3fb67a0c57d174e9220b61a51b86aee78c8f3f (diff)
downloadweechat-6c1f21f10c4f740c88c56228a725b5f47ce4ca52.zip
relay: add option relay.api.remote_get_lines (issue #2066)
Diffstat (limited to 'src/plugins/relay')
-rw-r--r--src/plugins/relay/api/remote/relay-remote-network.c4
-rw-r--r--src/plugins/relay/relay-config.c25
-rw-r--r--src/plugins/relay/relay-config.h2
3 files changed, 30 insertions, 1 deletions
diff --git a/src/plugins/relay/api/remote/relay-remote-network.c b/src/plugins/relay/api/remote/relay-remote-network.c
index 49433ee2e..12b05cd90 100644
--- a/src/plugins/relay/api/remote/relay-remote-network.c
+++ b/src/plugins/relay/api/remote/relay-remote-network.c
@@ -34,6 +34,7 @@
#include "../../../weechat-plugin.h"
#include "../../relay.h"
#include "../../relay-auth.h"
+#include "../../relay-config.h"
#include "../../relay-http.h"
#include "../../relay-raw.h"
#include "../../relay-remote.h"
@@ -384,7 +385,8 @@ relay_remote_network_recv_text (struct t_relay_remote *remote,
request, strlen (request));
snprintf (request, sizeof (request),
"{\"request\": \"GET /api/buffers?"
- "lines=-100&nicks=true&colors=weechat\"}");
+ "lines=-%d&nicks=true&colors=weechat\"}",
+ weechat_config_integer (relay_config_api_remote_get_lines));
relay_remote_network_send (remote, RELAY_MSG_STANDARD,
request, strlen (request));
}
diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c
index dfd00ef57..f41af69e5 100644
--- a/src/plugins/relay/relay-config.c
+++ b/src/plugins/relay/relay-config.c
@@ -49,6 +49,7 @@ struct t_config_section *relay_config_section_look = NULL;
struct t_config_section *relay_config_section_color = NULL;
struct t_config_section *relay_config_section_network = NULL;
struct t_config_section *relay_config_section_irc = NULL;
+struct t_config_section *relay_config_section_api = NULL;
struct t_config_section *relay_config_section_port = NULL;
struct t_config_section *relay_config_section_path = NULL;
struct t_config_section *relay_config_section_remote = NULL;
@@ -100,6 +101,10 @@ struct t_config_option *relay_config_irc_backlog_since_last_message = NULL;
struct t_config_option *relay_config_irc_backlog_tags = NULL;
struct t_config_option *relay_config_irc_backlog_time_format = NULL;
+/* relay config, api section */
+
+struct t_config_option *relay_config_api_remote_get_lines = NULL;
+
/* other */
int relay_config_auto_open_buffer[RELAY_NUM_PROTOCOLS];
@@ -1795,6 +1800,26 @@ relay_config_init ()
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
+ /* section api */
+ relay_config_section_api = weechat_config_new_section (
+ relay_config_file, "api",
+ 0, 0,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ if (relay_config_section_api)
+ {
+ relay_config_api_remote_get_lines = weechat_config_new_option (
+ relay_config_file, relay_config_section_api,
+ "remote_get_lines", "integer",
+ N_("number of lines to retrieve on each buffer when connecting "
+ "to a remote relay"),
+ NULL, 0, INT_MAX, "1000", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+
/* section port */
relay_config_section_port = weechat_config_new_section (
relay_config_file, "port",
diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h
index afc8afc96..f29956d8b 100644
--- a/src/plugins/relay/relay-config.h
+++ b/src/plugins/relay/relay-config.h
@@ -68,6 +68,8 @@ extern struct t_config_option *relay_config_irc_backlog_since_last_message;
extern struct t_config_option *relay_config_irc_backlog_tags;
extern struct t_config_option *relay_config_irc_backlog_time_format;
+extern struct t_config_option *relay_config_api_remote_get_lines;
+
extern int relay_config_auto_open_buffer[];
extern int relay_config_display_clients[];
extern regex_t *relay_config_regex_allowed_ips;