summaryrefslogtreecommitdiff
path: root/src/plugins/relay
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-01 11:20:59 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-01 13:37:45 +0200
commitc47e4fa8830e15094d796ae22fdc9343836e3cff (patch)
treee093b7abf7229f8245f87546921f99d259c4c17e /src/plugins/relay
parent6c1f21f10c4f740c88c56228a725b5f47ce4ca52 (diff)
downloadweechat-c47e4fa8830e15094d796ae22fdc9343836e3cff.zip
relay/remote: display lines on buffers with free content (issue #2066)
Diffstat (limited to 'src/plugins/relay')
-rw-r--r--src/plugins/relay/api/remote/relay-remote-event.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/plugins/relay/api/remote/relay-remote-event.c b/src/plugins/relay/api/remote/relay-remote-event.c
index 20537ef0f..c2b3717a9 100644
--- a/src/plugins/relay/api/remote/relay-remote-event.c
+++ b/src/plugins/relay/api/remote/relay-remote-event.c
@@ -136,11 +136,13 @@ RELAY_REMOTE_EVENT_CALLBACK(line)
cJSON *json_obj, *json_tags, *json_tag;
const char *date, *prefix, *message;
char **tags;
+ int y;
struct timeval tv_date;
if (!event->buffer)
return WEECHAT_RC_ERROR;
+ JSON_GET_NUM(event->json, y, -1);
JSON_GET_STR(event->json, date);
JSON_GET_STR(event->json, prefix);
JSON_GET_STR(event->json, message);
@@ -167,15 +169,33 @@ RELAY_REMOTE_EVENT_CALLBACK(line)
}
}
- weechat_printf_datetime_tags (
- event->buffer,
- tv_date.tv_sec,
- tv_date.tv_usec,
- (tags) ? *tags : NULL,
- "%s%s%s",
- (prefix && prefix[0]) ? prefix : "",
- (prefix && prefix[0]) ? "\t" : "",
- message);
+ if (y >= 0)
+ {
+ /* buffer with free content */
+ weechat_printf_y_datetime_tags (
+ event->buffer,
+ y,
+ tv_date.tv_sec,
+ tv_date.tv_usec,
+ (tags) ? *tags : NULL,
+ "%s%s%s",
+ (prefix && prefix[0]) ? prefix : "",
+ (prefix && prefix[0]) ? "\t" : "",
+ message);
+ }
+ else
+ {
+ /* buffer with formatted content */
+ weechat_printf_datetime_tags (
+ event->buffer,
+ tv_date.tv_sec,
+ tv_date.tv_usec,
+ (tags) ? *tags : NULL,
+ "%s%s%s",
+ (prefix && prefix[0]) ? prefix : "",
+ (prefix && prefix[0]) ? "\t" : "",
+ message);
+ }
weechat_string_dyn_free (tags, 1);