From cba13ad91ad3fa3de6ad4dda21f9651f2c56dc5e Mon Sep 17 00:00:00 2001 From: ycc Date: Sat, 2 Mar 2024 18:05:13 +0100 Subject: [PATCH] adding usermessage answer_to_usermessage in status --- client/peer.go | 5 ++-- messages.pb.go | 64 +++++++++++++++++++++++++++-------------------- pb/messages.proto | 16 ++++++------ 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/client/peer.go b/client/peer.go index b310952..2cae9e6 100644 --- a/client/peer.go +++ b/client/peer.go @@ -103,7 +103,8 @@ func (p *Peer) BuildSimpleUserMessage(message []byte) (*meowlib.UserMessage, err msg.Data = message msg.Type = "1" msg.Status = &meowlib.ConversationStatus{} - msg.Status.LocalUuid = uuid.New().String() + msg.Status.Uuid = uuid.New().String() + return &msg, nil } @@ -144,7 +145,7 @@ func (p *Peer) BuildSingleFileMessage(filename string, message []byte) ([]meowli msg.Type = "2" if chunk == 0 { msg.Status = &meowlib.ConversationStatus{} - msg.Status.LocalUuid = uuid.New().String() + msg.Status.Uuid = uuid.New().String() } msgs = append(msgs, msg) chunk++ diff --git a/messages.pb.go b/messages.pb.go index df6c772..953cefe 100644 --- a/messages.pb.go +++ b/messages.pb.go @@ -1034,13 +1034,14 @@ type ConversationStatus struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - LocalUuid string `protobuf:"bytes,1,opt,name=localUuid,proto3" json:"localUuid,omitempty"` - LocalSequence uint64 `protobuf:"varint,2,opt,name=localSequence,proto3" json:"localSequence,omitempty"` - Sent uint64 `protobuf:"varint,3,opt,name=sent,proto3" json:"sent,omitempty"` - Received uint64 `protobuf:"varint,4,opt,name=received,proto3" json:"received,omitempty"` - Processed uint64 `protobuf:"varint,5,opt,name=processed,proto3" json:"processed,omitempty"` - MyNextIdentity *ContactCard `protobuf:"bytes,6,opt,name=myNextIdentity,proto3" json:"myNextIdentity,omitempty"` - PeerNextIdentityAck int32 `protobuf:"varint,7,opt,name=peerNextIdentityAck,proto3" json:"peerNextIdentityAck,omitempty"` // version of the new peer accepted id + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + AnswerToUuid string `protobuf:"bytes,2,opt,name=answer_to_uuid,json=answerToUuid,proto3" json:"answer_to_uuid,omitempty"` // message is an answer to another one, specify uuid here + LocalSequence uint64 `protobuf:"varint,3,opt,name=localSequence,proto3" json:"localSequence,omitempty"` + Sent uint64 `protobuf:"varint,4,opt,name=sent,proto3" json:"sent,omitempty"` + Received uint64 `protobuf:"varint,5,opt,name=received,proto3" json:"received,omitempty"` + Processed uint64 `protobuf:"varint,6,opt,name=processed,proto3" json:"processed,omitempty"` + MyNextIdentity *ContactCard `protobuf:"bytes,7,opt,name=my_next_identity,json=myNextIdentity,proto3" json:"my_next_identity,omitempty"` + PeerNextIdentityAck int32 `protobuf:"varint,8,opt,name=peer_next_identityAck,json=peerNextIdentityAck,proto3" json:"peer_next_identityAck,omitempty"` // version of the new peer accepted id } func (x *ConversationStatus) Reset() { @@ -1075,9 +1076,16 @@ func (*ConversationStatus) Descriptor() ([]byte, []int) { return file_messages_proto_rawDescGZIP(), []int{12} } -func (x *ConversationStatus) GetLocalUuid() string { +func (x *ConversationStatus) GetUuid() string { if x != nil { - return x.LocalUuid + return x.Uuid + } + return "" +} + +func (x *ConversationStatus) GetAnswerToUuid() string { + if x != nil { + return x.AnswerToUuid } return "" } @@ -1737,23 +1745,25 @@ var file_messages_proto_rawDesc = []byte{ 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x96, 0x02, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x76, 0x65, - 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, - 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x55, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x55, 0x75, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6c, - 0x6f, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x04, 0x73, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x12, - 0x3c, 0x0a, 0x0e, 0x6d, 0x79, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, - 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x43, 0x61, 0x72, 0x64, 0x52, 0x0e, 0x6d, - 0x79, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x30, 0x0a, - 0x13, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x41, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x70, 0x65, 0x65, 0x72, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xb6, 0x02, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, + 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, + 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x5f, 0x74, 0x6f, 0x5f, 0x75, + 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x73, 0x77, 0x65, + 0x72, 0x54, 0x6f, 0x55, 0x75, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x65, 0x6e, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x12, 0x3e, 0x0a, 0x10, 0x6d, + 0x79, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x65, 0x6f, 0x77, 0x6c, 0x69, 0x62, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x43, 0x61, 0x72, 0x64, 0x52, 0x0e, 0x6d, 0x79, 0x4e, + 0x65, 0x78, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x32, 0x0a, 0x15, 0x70, + 0x65, 0x65, 0x72, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x41, 0x63, 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x70, 0x65, 0x65, 0x72, 0x4e, 0x65, 0x78, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x41, 0x63, 0x6b, 0x22, 0x4b, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x07, @@ -1881,7 +1891,7 @@ var file_messages_proto_depIdxs = []int32{ 7, // 11: meowlib.Matriochka.prev:type_name -> meowlib.MatriochkaServer 7, // 12: meowlib.Matriochka.next:type_name -> meowlib.MatriochkaServer 9, // 13: meowlib.ContactCard.pull_servers:type_name -> meowlib.ServerCard - 10, // 14: meowlib.ConversationStatus.myNextIdentity:type_name -> meowlib.ContactCard + 10, // 14: meowlib.ConversationStatus.my_next_identity:type_name -> meowlib.ContactCard 10, // 15: meowlib.Group.members:type_name -> meowlib.ContactCard 12, // 16: meowlib.UserMessage.Status:type_name -> meowlib.ConversationStatus 10, // 17: meowlib.UserMessage.contact:type_name -> meowlib.ContactCard diff --git a/pb/messages.proto b/pb/messages.proto index 0d9b7ff..cc87113 100644 --- a/pb/messages.proto +++ b/pb/messages.proto @@ -138,13 +138,14 @@ message PackedUserMessage { } message ConversationStatus { - string localUuid = 1; - uint64 localSequence = 2 ; - uint64 sent = 3 ; - uint64 received = 4; - uint64 processed = 5; - ContactCard myNextIdentity = 6; - int32 peerNextIdentityAck = 7; // version of the new peer accepted id + string uuid = 1; + string answer_to_uuid=2; // message is an answer to another one, specify uuid here + uint64 localSequence = 3 ; + uint64 sent = 4 ; + uint64 received = 5; + uint64 processed = 6; + ContactCard my_next_identity = 7; + int32 peer_next_identityAck = 8; // version of the new peer accepted id } message Group{ @@ -166,6 +167,7 @@ message UserMessage { Location currentLocation = 10; bytes appdata = 11; Invitation invitation = 12; + } message File {