xC/xP: mark highlights and buffer activity

And more or less finalize out the protocol for this use case.
This commit is contained in:
2022-09-07 19:42:18 +02:00
parent 45aa0e8dfb
commit 4ba28c6ed3
5 changed files with 114 additions and 19 deletions

13
xC.c
View File

@@ -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);
}