summaryrefslogtreecommitdiff
path: root/src/plugins/relay
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-05 23:57:02 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-05 23:57:02 +0200
commit177b0a4299550dd79d326606b59fa35e13e13d89 (patch)
treecf107d834936af4df521b6ab7fa730a631608f77 /src/plugins/relay
parent75270d78419e94ad5a6a808e3c448af9f591762a (diff)
downloadweechat-177b0a4299550dd79d326606b59fa35e13e13d89.zip
relay/remote: synchronize input with remote relay
Diffstat (limited to 'src/plugins/relay')
-rw-r--r--src/plugins/relay/api/remote/relay-remote-event.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/relay/api/remote/relay-remote-event.c b/src/plugins/relay/api/remote/relay-remote-event.c
index d5318db47..d47c07613 100644
--- a/src/plugins/relay/api/remote/relay-remote-event.c
+++ b/src/plugins/relay/api/remote/relay-remote-event.c
@@ -616,6 +616,30 @@ RELAY_REMOTE_EVENT_CALLBACK(buffer_closed)
}
/*
+ * Callback for an input event.
+ */
+
+RELAY_REMOTE_EVENT_CALLBACK(input)
+{
+ cJSON *json_obj;
+ const char *input;
+ char str_pos[64];
+ int input_position;
+
+ if (!event->buffer || !event->json)
+ return WEECHAT_RC_OK;
+
+ JSON_GET_STR(event->json, input);
+ JSON_GET_NUM(event->json, input_position, 0);
+
+ weechat_buffer_set (event->buffer, "input", input);
+ snprintf (str_pos, sizeof (str_pos), "%d", input_position);
+ weechat_buffer_set (event->buffer, "input_pos", str_pos);
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* Callback for response to GET /api/version.
*/
@@ -694,6 +718,7 @@ relay_remote_event_recv (struct t_relay_remote *remote, const char *data)
{ "buffer_cleared", &relay_remote_event_cb_buffer_cleared },
{ "buffer_closed", &relay_remote_event_cb_buffer_closed },
{ "buffer_*", &relay_remote_event_cb_buffer },
+ { "input_*", &relay_remote_event_cb_input },
{ "nicklist_group_*", &relay_remote_event_cb_nick_group },
{ "nicklist_nick_*", &relay_remote_event_cb_nick },
{ NULL, NULL },