aboutsummaryrefslogtreecommitdiff
path: root/xC.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-10 17:37:19 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-10 17:38:33 +0200
commit632ac992ab4a032a3415b99a419c0c88c22157e5 (patch)
tree3ded5c5a26320d1f460d64946150d77b44479478 /xC.c
parentd29e2cbfe82197319ab66ace6837bd3c1763dbad (diff)
downloadxK-632ac992ab4a032a3415b99a419c0c88c22157e5.tar.gz
xK-632ac992ab4a032a3415b99a419c0c88c22157e5.tar.xz
xK-632ac992ab4a032a3415b99a419c0c88c22157e5.zip
xC/xP: only send buffer stats in the initial sync
The client and frontends track these separately, there is no need for hard synchronization.
Diffstat (limited to 'xC.c')
-rw-r--r--xC.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/xC.c b/xC.c
index 2644bce..13cd57d 100644
--- a/xC.c
+++ b/xC.c
@@ -3068,6 +3068,15 @@ 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);
+}
+
+static void
+relay_prepare_buffer_stats (struct app_context *ctx, struct buffer *buffer)
+{
+ struct relay_event_message *m = relay_prepare (ctx);
+ struct relay_event_data_buffer_stats *e = &m->data.buffer_stats;
+ e->event = RELAY_EVENT_BUFFER_STATS;
+ 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,
@@ -15223,6 +15232,8 @@ client_resync (struct client *c)
{
relay_prepare_buffer_update (c->ctx, buffer);
relay_send (c);
+ relay_prepare_buffer_stats (c->ctx, buffer);
+ relay_send (c);
LIST_FOR_EACH (struct buffer_line, line, buffer->lines)
{