summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-05-18 09:51:39 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-05-18 09:51:39 +0200
commit8949a65f526e54f67f8a6d4637850eee0dbc1a65 (patch)
tree523b4305b4cfa787aaa2e57c40b3820be8f81335 /src/plugins
parent2423fdbf2d66d241c809f797f75afd65dff91568 (diff)
downloadweechat-8949a65f526e54f67f8a6d4637850eee0dbc1a65.zip
relay/remote: fix highlight on lines received from remote
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/relay/api/remote/relay-remote-event.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/plugins/relay/api/remote/relay-remote-event.c b/src/plugins/relay/api/remote/relay-remote-event.c
index 60de6f88c..01ec8f95f 100644
--- a/src/plugins/relay/api/remote/relay-remote-event.c
+++ b/src/plugins/relay/api/remote/relay-remote-event.c
@@ -134,9 +134,9 @@ relay_remote_event_get_buffer_id (struct t_gui_buffer *buffer)
RELAY_REMOTE_EVENT_CALLBACK(line)
{
cJSON *json_obj, *json_tags, *json_tag;
- const char *date, *prefix, *message;
+ const char *date, *prefix, *message, *ptr_tag;
char **tags;
- int y;
+ int y, highlight, tag_notify_highlight;
struct timeval tv_date;
if (!event->buffer || !event->json)
@@ -144,6 +144,7 @@ RELAY_REMOTE_EVENT_CALLBACK(line)
JSON_GET_NUM(event->json, y, -1);
JSON_GET_STR(event->json, date);
+ JSON_GET_BOOL(event->json, highlight);
JSON_GET_STR(event->json, prefix);
JSON_GET_STR(event->json, message);
@@ -153,6 +154,8 @@ RELAY_REMOTE_EVENT_CALLBACK(line)
tv_date.tv_usec = 0;
}
+ tag_notify_highlight = 0;
+
tags = weechat_string_dyn_alloc (256);
if (tags)
{
@@ -161,12 +164,29 @@ RELAY_REMOTE_EVENT_CALLBACK(line)
{
cJSON_ArrayForEach (json_tag, json_tags)
{
- if (*tags[0])
- weechat_string_dyn_concat (tags, ",", -1);
- weechat_string_dyn_concat (
- tags, cJSON_GetStringValue (json_tag), -1);
+ ptr_tag = cJSON_GetStringValue (json_tag);
+ if (ptr_tag)
+ {
+ if (*tags[0])
+ weechat_string_dyn_concat (tags, ",", -1);
+ if (highlight && (strncmp (ptr_tag, "notify_", 7) == 0))
+ {
+ weechat_string_dyn_concat (tags, "notify_highlight", -1);
+ tag_notify_highlight = 1;
+ }
+ else
+ {
+ weechat_string_dyn_concat (tags, ptr_tag, -1);
+ }
+ }
}
}
+ if (highlight && !tag_notify_highlight)
+ {
+ if (*tags[0])
+ weechat_string_dyn_concat (tags, ",", -1);
+ weechat_string_dyn_concat (tags, "notify_highlight", -1);
+ }
}
if (y >= 0)