Added oneof chat_entity option to membership_update_message

This commit is contained in:
Samuel Hawksby-Robinson 2020-07-25 17:02:54 +01:00 committed by Andrea Maria Piana
parent 3e857203ac
commit b6d24e950c
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
2 changed files with 83 additions and 31 deletions

View File

@ -140,7 +140,11 @@ type MembershipUpdateMessage struct {
// protobuf encoded MembershipUpdateEvent
Events [][]byte `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"`
// An optional chat message
Message *ChatMessage `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
//
// Types that are valid to be assigned to ChatEntity:
// *MembershipUpdateMessage_Message
// *MembershipUpdateMessage_EmojiReaction
ChatEntity isMembershipUpdateMessage_ChatEntity `protobuf_oneof:"chat_entity"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -185,43 +189,86 @@ func (m *MembershipUpdateMessage) GetEvents() [][]byte {
return nil
}
func (m *MembershipUpdateMessage) GetMessage() *ChatMessage {
type isMembershipUpdateMessage_ChatEntity interface {
isMembershipUpdateMessage_ChatEntity()
}
type MembershipUpdateMessage_Message struct {
Message *ChatMessage `protobuf:"bytes,3,opt,name=message,proto3,oneof"`
}
type MembershipUpdateMessage_EmojiReaction struct {
EmojiReaction *EmojiReaction `protobuf:"bytes,4,opt,name=emoji_reaction,json=emojiReaction,proto3,oneof"`
}
func (*MembershipUpdateMessage_Message) isMembershipUpdateMessage_ChatEntity() {}
func (*MembershipUpdateMessage_EmojiReaction) isMembershipUpdateMessage_ChatEntity() {}
func (m *MembershipUpdateMessage) GetChatEntity() isMembershipUpdateMessage_ChatEntity {
if m != nil {
return m.Message
return m.ChatEntity
}
return nil
}
func (m *MembershipUpdateMessage) GetMessage() *ChatMessage {
if x, ok := m.GetChatEntity().(*MembershipUpdateMessage_Message); ok {
return x.Message
}
return nil
}
func (m *MembershipUpdateMessage) GetEmojiReaction() *EmojiReaction {
if x, ok := m.GetChatEntity().(*MembershipUpdateMessage_EmojiReaction); ok {
return x.EmojiReaction
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*MembershipUpdateMessage) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*MembershipUpdateMessage_Message)(nil),
(*MembershipUpdateMessage_EmojiReaction)(nil),
}
}
func init() {
proto.RegisterEnum("protobuf.MembershipUpdateEvent_EventType", MembershipUpdateEvent_EventType_name, MembershipUpdateEvent_EventType_value)
proto.RegisterType((*MembershipUpdateEvent)(nil), "protobuf.MembershipUpdateEvent")
proto.RegisterType((*MembershipUpdateMessage)(nil), "protobuf.MembershipUpdateMessage")
}
func init() { proto.RegisterFile("membership_update_message.proto", fileDescriptor_8d37dd0dc857a6be) }
func init() {
proto.RegisterFile("membership_update_message.proto", fileDescriptor_8d37dd0dc857a6be)
}
var fileDescriptor_8d37dd0dc857a6be = []byte{
// 340 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x50, 0x41, 0x4f, 0xf2, 0x40,
0x10, 0xfd, 0x0a, 0xa5, 0xfd, 0x3a, 0x20, 0xa9, 0x13, 0x91, 0xc6, 0x8b, 0x0d, 0xa7, 0x7a, 0xa9,
0x09, 0x9e, 0x3d, 0xd4, 0xee, 0x46, 0xd0, 0xec, 0x92, 0xac, 0xa0, 0xc7, 0xa6, 0xc0, 0x2a, 0x44,
0x0b, 0x0d, 0x14, 0x13, 0xe2, 0x4f, 0xf1, 0x8f, 0xf8, 0xf3, 0x4c, 0x97, 0x16, 0xa2, 0xf1, 0xb2,
0xbb, 0xef, 0xcd, 0xbc, 0x37, 0x3b, 0x0f, 0xce, 0x13, 0x99, 0x8c, 0xe5, 0x6a, 0x3d, 0x9b, 0xa7,
0xd1, 0x26, 0x9d, 0xc6, 0x99, 0x8c, 0x12, 0xb9, 0x5e, 0xc7, 0x2f, 0xd2, 0x4f, 0x57, 0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, 0xdb, 0x60, 0xaa, 0xac, 0xe7, 0x53, 0x95, 0x9e,
0x25, 0x8c, 0x1c, 0xf6, 0xa7, 0x78, 0x0a, 0x86, 0xcc, 0x17, 0xda, 0xa5, 0xd7, 0x10, 0x05, 0xc2,
0xcb, 0x3c, 0x56, 0xa5, 0x55, 0xf9, 0xd5, 0xbb, 0xad, 0x43, 0x56, 0xe1, 0x2c, 0xce, 0x0a, 0x63,
0x51, 0x76, 0x8d, 0x0d, 0x55, 0xbe, 0xfa, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xb8, 0xe8, 0x9e,
0xff, 0x01, 0x00, 0x00,
// 393 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0x4d, 0xaf, 0x93, 0x50,
0x10, 0x2d, 0x2d, 0x0f, 0x64, 0x78, 0x6d, 0x70, 0xf2, 0x9e, 0x25, 0x6f, 0x23, 0xe9, 0x0a, 0x37,
0x24, 0xd6, 0xb5, 0x89, 0x3c, 0xee, 0x8d, 0x54, 0x03, 0x4d, 0xae, 0xad, 0x2e, 0x09, 0xa5, 0x57,
0x8b, 0xca, 0x47, 0xda, 0x5b, 0x93, 0xfe, 0x16, 0xff, 0x88, 0xbf, 0xc2, 0xdf, 0x64, 0xb8, 0x40,
0x6b, 0x8d, 0x1b, 0xe0, 0x9c, 0x99, 0x73, 0x98, 0x39, 0x03, 0xcf, 0x0b, 0x5e, 0x6c, 0xf8, 0xfe,
0xb0, 0xcb, 0xeb, 0xe4, 0x58, 0x6f, 0x53, 0xc1, 0x93, 0x82, 0x1f, 0x0e, 0xe9, 0x17, 0xee, 0xd5,
0xfb, 0x4a, 0x54, 0xf8, 0x44, 0xbe, 0x36, 0xc7, 0xcf, 0x0f, 0x98, 0xed, 0x52, 0x71, 0x5d, 0x7d,
0xb8, 0xe3, 0x45, 0xf5, 0x35, 0x4f, 0xf6, 0x3c, 0xcd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90, 0x6f, 0x65, 0x7c, 0x06, 0xd3, 0x1a, 0xb8, 0xd8, 0xe2, 0x33, 0xd0, 0x78, 0xb3, 0x51, 0x1b,
0xdf, 0x2d, 0xeb, 0x10, 0xbe, 0x6c, 0x72, 0x95, 0x5a, 0x19, 0xa0, 0x39, 0xbf, 0xbf, 0x84, 0x15,
0xec, 0x52, 0xd1, 0x19, 0x87, 0x03, 0xd6, 0xf7, 0xe1, 0x1b, 0x98, 0x5c, 0x9f, 0x54, 0xc6, 0x6c,
0xce, 0xa7, 0x17, 0x25, 0x6d, 0xea, 0xac, 0x2b, 0x87, 0x03, 0x36, 0xe6, 0x7f, 0x13, 0x8f, 0x63,
0x30, 0xe5, 0x94, 0xbc, 0x14, 0xb9, 0x38, 0x6d, 0x34, 0xa9, 0x7b, 0xf5, 0x27, 0x00, 0x00, 0xff,
0xff, 0x77, 0x9d, 0x8d, 0xe2, 0x69, 0x02, 0x00, 0x00,
}

View File

@ -3,6 +3,7 @@ syntax = "proto3";
package protobuf;
import "chat_message.proto";
import "emoji_reaction.proto";
message MembershipUpdateEvent {
// Lamport timestamp of the event
@ -35,6 +36,10 @@ message MembershipUpdateMessage {
// A list of events for this group chat, first x bytes are the signature, then is a
// protobuf encoded MembershipUpdateEvent
repeated bytes events = 2;
// An optional chat message
oneof chat_entity {
ChatMessage message = 3;
EmojiReaction emoji_reaction = 4;
}
}