From 4ba28c6ed3b952a06aba8ae96220c429d4d02365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Wed, 7 Sep 2022 19:42:18 +0200 Subject: xC/xP: mark highlights and buffer activity And more or less finalize out the protocol for this use case. --- xC.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'xC.c') diff --git a/xC.c b/xC.c index b7aa712..1a30f85 100644 --- a/xC.c +++ b/xC.c @@ -3068,6 +3068,11 @@ relay_prepare_buffer_update (struct app_context *ctx, struct buffer *buffer) struct relay_event_data_buffer_update *e = &m->data.buffer_update; e->event = RELAY_EVENT_BUFFER_UPDATE; e->buffer_name = str_from_cstr (buffer->name); + e->new_messages = MIN (UINT32_MAX, + buffer->new_messages_count - buffer->new_unimportant_count); + e->new_unimportant_messages = MIN (UINT32_MAX, + buffer->new_unimportant_count); + e->highlighted = buffer->highlighted; } static void @@ -5015,8 +5020,16 @@ buffer_merge (struct app_context *ctx, buffer->lines_count += n; // And since there is no log_*() call, send them to relays manually + buffer->highlighted |= merged->highlighted; LIST_FOR_EACH (struct buffer_line, line, start) { + if (buffer->new_messages_count) + { + buffer->new_messages_count++; + if (line->flags & BUFFER_LINE_UNIMPORTANT) + buffer->new_unimportant_count++; + } + relay_prepare_buffer_line (ctx, buffer, line, false); relay_broadcast (ctx); } -- cgit v1.2.3