summaryrefslogtreecommitdiff
path: root/xC.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-07 19:42:18 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-08 01:28:51 +0200
commit4ba28c6ed3b952a06aba8ae96220c429d4d02365 (patch)
tree30b9ef26d0652451e0c28aa65343950594239c15 /xC.c
parent45aa0e8dfba2a51d26b6a4fe4990a1686ab4af65 (diff)
downloadxK-4ba28c6ed3b952a06aba8ae96220c429d4d02365.tar.gz
xK-4ba28c6ed3b952a06aba8ae96220c429d4d02365.tar.xz
xK-4ba28c6ed3b952a06aba8ae96220c429d4d02365.zip
xC/xP: mark highlights and buffer activity
And more or less finalize out the protocol for this use case.
Diffstat (limited to 'xC.c')
-rw-r--r--xC.c13
1 files changed, 13 insertions, 0 deletions
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);
}