xC/xP: only send buffer stats in the initial sync

The client and frontends track these separately,
there is no need for hard synchronization.
This commit is contained in:
2022-09-10 17:37:19 +02:00
parent d29e2cbfe8
commit 632ac992ab
3 changed files with 35 additions and 13 deletions

View File

@@ -19,7 +19,7 @@ struct CommandMessage {
case HELLO:
u32 version;
// If the version check succeeds, the client will receive
// an initial stream of BUFFER_UPDATE, BUFFER_LINE,
// an initial stream of BUFFER_UPDATE, BUFFER_STATS, BUFFER_LINE,
// and finally a BUFFER_ACTIVATE message.
case ACTIVE:
void;
@@ -50,6 +50,7 @@ struct EventMessage {
union EventData switch (enum Event {
PING,
BUFFER_UPDATE,
BUFFER_STATS,
BUFFER_RENAME,
BUFFER_REMOVE,
BUFFER_ACTIVATE,
@@ -62,12 +63,13 @@ struct EventMessage {
void;
case BUFFER_UPDATE:
string buffer_name;
case BUFFER_STATS:
string buffer_name;
// These are cumulative, even for lines flushed out from buffers.
// Updates to these values aren't broadcasted, thus handle:
// - BUFFER_LINE by bumping/setting them as appropriate,
// - BUFFER_ACTIVATE by clearing them for the previous buffer
// (this way, they can be used to mark unread messages).
// Any updates received after the initial sync should be ignored.
u32 new_messages;
u32 new_unimportant_messages;
bool highlighted;