diff --git a/libgm/event_handler.go b/libgm/event_handler.go index 9f2f179..3d39e8d 100644 --- a/libgm/event_handler.go +++ b/libgm/event_handler.go @@ -190,19 +190,23 @@ func (c *Client) handleUpdatesEvent(msg *IncomingRPCMessage) { c.triggerEvent(evt.SettingsEvent) case *gmproto.UpdateEvents_ConversationEvent: - if c.deduplicateUpdate(evt.ConversationEvent.GetData().GetConversationID(), msg) { - return + for _, part := range evt.ConversationEvent.GetData() { + if c.deduplicateUpdate(part.GetConversationID(), msg) { + return + } + c.triggerEvent(part) } - c.triggerEvent(evt.ConversationEvent.GetData()) case *gmproto.UpdateEvents_MessageEvent: - if c.deduplicateUpdate(evt.MessageEvent.GetData().GetMessageID(), msg) { - return + for _, part := range evt.MessageEvent.GetData() { + if c.deduplicateUpdate(part.GetMessageID(), msg) { + return + } + c.triggerEvent(&WrappedMessage{ + Message: part, + Data: msg.DecryptedData, + }) } - c.triggerEvent(&WrappedMessage{ - Message: evt.MessageEvent.GetData(), - Data: msg.DecryptedData, - }) case *gmproto.UpdateEvents_TypingEvent: c.logContent(msg, "", nil) diff --git a/libgm/gmproto/events.pb.go b/libgm/gmproto/events.pb.go index 7ca3a78..98c6458 100644 --- a/libgm/gmproto/events.pb.go +++ b/libgm/gmproto/events.pb.go @@ -290,7 +290,7 @@ type ConversationEvent struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *Conversation `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Data []*Conversation `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"` } func (x *ConversationEvent) Reset() { @@ -325,7 +325,7 @@ func (*ConversationEvent) Descriptor() ([]byte, []int) { return file_events_proto_rawDescGZIP(), []int{1} } -func (x *ConversationEvent) GetData() *Conversation { +func (x *ConversationEvent) GetData() []*Conversation { if x != nil { return x.Data } @@ -384,7 +384,7 @@ type MessageEvent struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *Message `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Data []*Message `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"` } func (x *MessageEvent) Reset() { @@ -419,7 +419,7 @@ func (*MessageEvent) Descriptor() ([]byte, []int) { return file_events_proto_rawDescGZIP(), []int{3} } -func (x *MessageEvent) GetData() *Message { +func (x *MessageEvent) GetData() []*Message { if x != nil { return x.Data } diff --git a/libgm/gmproto/events.pb.raw b/libgm/gmproto/events.pb.raw index d4b837c..6db9caa 100644 Binary files a/libgm/gmproto/events.pb.raw and b/libgm/gmproto/events.pb.raw differ diff --git a/libgm/gmproto/events.proto b/libgm/gmproto/events.proto index 911d363..73a6905 100644 --- a/libgm/gmproto/events.proto +++ b/libgm/gmproto/events.proto @@ -35,7 +35,7 @@ message UpdateEvents { } message ConversationEvent { - conversations.Conversation data = 2; + repeated conversations.Conversation data = 2; } message TypingEvent { @@ -43,7 +43,7 @@ message TypingEvent { } message MessageEvent { - conversations.Message data = 2; + repeated conversations.Message data = 2; } message UserAlertEvent {