diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-18 09:51:39 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-18 09:51:39 +0200 |
commit | 8949a65f526e54f67f8a6d4637850eee0dbc1a65 (patch) | |
tree | 523b4305b4cfa787aaa2e57c40b3820be8f81335 /src/plugins/relay | |
parent | 2423fdbf2d66d241c809f797f75afd65dff91568 (diff) | |
download | weechat-8949a65f526e54f67f8a6d4637850eee0dbc1a65.zip |
relay/remote: fix highlight on lines received from remote
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/api/remote/relay-remote-event.c | 32 |
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) |