From b1e2634f33b89761795493920cb09717913b9c44 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 1 Jul 2023 12:51:13 +0300 Subject: [PATCH] Fix long polling retries, unpair handling and other things --- libgm/binary/conversations.pb.go | 223 ++++++++++++++------------- libgm/binary/pairing.pb.go | 174 +++++++++++++++------ libgm/binary/raw/conversations.proto | 5 +- libgm/binary/raw/pairing.proto | 7 +- libgm/client.go | 8 +- libgm/event_handler.go | 11 +- libgm/events/ready.go | 9 +- libgm/opcode_handler.go | 11 +- libgm/pair.go | 1 + libgm/rpc.go | 32 ++-- 10 files changed, 296 insertions(+), 185 deletions(-) diff --git a/libgm/binary/conversations.pb.go b/libgm/binary/conversations.pb.go index 37c9e61..2195eae 100644 --- a/libgm/binary/conversations.pb.go +++ b/libgm/binary/conversations.pb.go @@ -97,21 +97,24 @@ type MsgStatusCode int32 const ( MsgStatusCode_UNKNOWN_STATUS MsgStatusCode = 0 - MsgStatusCode_SENDING MsgStatusCode = 5 MsgStatusCode_SENT MsgStatusCode = 1 + MsgStatusCode_SENDING MsgStatusCode = 5 + MsgStatusCode_READ MsgStatusCode = 11 ) // Enum value maps for MsgStatusCode. var ( MsgStatusCode_name = map[int32]string{ - 0: "UNKNOWN_STATUS", - 5: "SENDING", - 1: "SENT", + 0: "UNKNOWN_STATUS", + 1: "SENT", + 5: "SENDING", + 11: "READ", } MsgStatusCode_value = map[string]int32{ "UNKNOWN_STATUS": 0, - "SENDING": 5, "SENT": 1, + "SENDING": 5, + "READ": 11, } ) @@ -1149,9 +1152,9 @@ type MessageStatus struct { // // // RCS // READ|SEEN = 11; - Code int64 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` - ErrMsg string `protobuf:"bytes,4,opt,name=errMsg,proto3" json:"errMsg,omitempty"` - MsgStatus string `protobuf:"bytes,5,opt,name=msgStatus,proto3" json:"msgStatus,omitempty"` + Code MsgStatusCode `protobuf:"varint,2,opt,name=code,proto3,enum=conversations.MsgStatusCode" json:"code,omitempty"` + ErrMsg string `protobuf:"bytes,4,opt,name=errMsg,proto3" json:"errMsg,omitempty"` + MsgStatus string `protobuf:"bytes,5,opt,name=msgStatus,proto3" json:"msgStatus,omitempty"` } func (x *MessageStatus) Reset() { @@ -1186,11 +1189,11 @@ func (*MessageStatus) Descriptor() ([]byte, []int) { return file_conversations_proto_rawDescGZIP(), []int{15} } -func (x *MessageStatus) GetCode() int64 { +func (x *MessageStatus) GetCode() MsgStatusCode { if x != nil { return x.Code } - return 0 + return MsgStatusCode_UNKNOWN_STATUS } func (x *MessageStatus) GetErrMsg() string { @@ -1849,94 +1852,97 @@ var file_conversations_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x22, 0x0a, 0x08, 0x49, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x22, 0x59, 0x0a, 0x0d, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, - 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x73, 0x67, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x22, 0x52, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, - 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, - 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xd2, 0x03, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, - 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x61, 0x74, - 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x6c, 0x61, 0x74, 0x65, - 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x53, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x53, 0x12, 0x20, 0x0a, 0x0b, 0x69, - 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0b, 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x12, 0x2c, 0x0a, - 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, - 0x49, 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x12, 0x1c, 0x0a, - 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x3e, 0x0a, 0x0c, 0x70, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x70, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6f, - 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, - 0x18, 0x15, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, - 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xd1, 0x01, - 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x36, 0x0a, - 0x09, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x6d, 0x61, 0x6c, - 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x12, - 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, - 0x73, 0x4d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x12, - 0x0e, 0x0a, 0x02, 0x62, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x62, 0x73, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, - 0x65, 0x22, 0x5d, 0x0a, 0x09, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, - 0x22, 0x63, 0x0a, 0x0d, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, - 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x72, 0x6f, - 0x6d, 0x4d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, - 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, - 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, - 0x22, 0x21, 0x0a, 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x4d, - 0x75, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x4d, 0x75, - 0x74, 0x65, 0x64, 0x2a, 0xa0, 0x01, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, - 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x58, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4d, - 0x41, 0x47, 0x45, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x49, 0x44, 0x45, 0x4f, 0x10, 0x03, - 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x44, 0x49, 0x4f, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x41, - 0x54, 0x54, 0x41, 0x43, 0x48, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x4c, - 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x49, 0x43, - 0x48, 0x5f, 0x43, 0x41, 0x52, 0x44, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x43, 0x41, 0x52, - 0x44, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x4d, 0x53, 0x5f, 0x4e, 0x45, 0x45, 0x44, 0x53, - 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x10, 0x09, 0x12, 0x09, 0x0a, 0x05, 0x52, - 0x45, 0x50, 0x4c, 0x59, 0x10, 0x0a, 0x2a, 0x3a, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, - 0x57, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, - 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x45, 0x4e, 0x54, - 0x10, 0x01, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, - 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x08, 0x52, 0x06, 0x66, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x22, 0x77, 0x0a, 0x0d, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x30, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, + 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x22, 0x52, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xd2, 0x03, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, + 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x53, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x53, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x73, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, + 0x69, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x68, 0x61, 0x74, 0x12, 0x2c, 0x0a, 0x11, 0x73, + 0x65, 0x6c, 0x66, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x73, 0x65, 0x6c, 0x66, 0x50, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x3e, 0x0a, 0x0c, 0x70, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x70, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6f, 0x74, 0x68, + 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x15, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, + 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x16, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xd1, 0x01, 0x0a, 0x0b, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x73, + 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, + 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x61, 0x73, 0x68, 0x48, 0x65, 0x78, 0x12, 0x12, 0x0a, + 0x04, 0x69, 0x73, 0x4d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4d, + 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x12, 0x0e, 0x0a, + 0x02, 0x62, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x62, 0x73, 0x12, 0x20, 0x0a, + 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, + 0x5d, 0x0a, 0x09, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x44, 0x22, 0x63, + 0x0a, 0x0d, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x72, 0x6f, + 0x6d, 0x4d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x72, 0x6f, 0x6d, 0x4d, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x32, 0x22, 0x21, + 0x0a, 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x4d, 0x75, 0x74, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x4d, 0x75, 0x74, 0x65, + 0x64, 0x2a, 0xa0, 0x01, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, + 0x0a, 0x04, 0x54, 0x45, 0x58, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4d, 0x41, 0x47, + 0x45, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x49, 0x44, 0x45, 0x4f, 0x10, 0x03, 0x12, 0x09, + 0x0a, 0x05, 0x41, 0x55, 0x44, 0x49, 0x4f, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x54, 0x54, + 0x41, 0x43, 0x48, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, 0x43, + 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x49, 0x43, 0x48, 0x5f, + 0x43, 0x41, 0x52, 0x44, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x43, 0x41, 0x52, 0x44, 0x10, + 0x08, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x4d, 0x53, 0x5f, 0x4e, 0x45, 0x45, 0x44, 0x53, 0x5f, 0x44, + 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x10, 0x09, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x50, + 0x4c, 0x59, 0x10, 0x0a, 0x2a, 0x44, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x45, 0x4e, + 0x54, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x05, + 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x10, 0x0b, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, + 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1995,16 +2001,17 @@ var file_conversations_proto_depIdxs = []int32{ 15, // 11: conversations.MessageInfo.messageContent:type_name -> conversations.MessageContent 13, // 12: conversations.MessageInfo.imageContent:type_name -> conversations.ImageContent 14, // 13: conversations.ImageContent.pixels:type_name -> conversations.ImagePixels - 19, // 14: conversations.Conversations.conversations:type_name -> conversations.Conversation - 22, // 15: conversations.Conversation.latestMessage:type_name -> conversations.LatestMessage - 20, // 16: conversations.Conversation.participants:type_name -> conversations.Participant - 21, // 17: conversations.Participant.smallInfo:type_name -> conversations.SmallInfo - 24, // 18: conversations.Participant.muted:type_name -> conversations.Muted - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 1, // 14: conversations.MessageStatus.code:type_name -> conversations.MsgStatusCode + 19, // 15: conversations.Conversations.conversations:type_name -> conversations.Conversation + 22, // 16: conversations.Conversation.latestMessage:type_name -> conversations.LatestMessage + 20, // 17: conversations.Conversation.participants:type_name -> conversations.Participant + 21, // 18: conversations.Participant.smallInfo:type_name -> conversations.SmallInfo + 24, // 19: conversations.Participant.muted:type_name -> conversations.Muted + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_conversations_proto_init() } diff --git a/libgm/binary/pairing.pb.go b/libgm/binary/pairing.pb.go index 5b8f0e0..c3576a4 100644 --- a/libgm/binary/pairing.pb.go +++ b/libgm/binary/pairing.pb.go @@ -288,6 +288,53 @@ func (x *PairDeviceData) GetBrowser() *Device { return nil } +type UnpairDeviceData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Browser *Device `protobuf:"bytes,1,opt,name=browser,proto3" json:"browser,omitempty"` +} + +func (x *UnpairDeviceData) Reset() { + *x = UnpairDeviceData{} + if protoimpl.UnsafeEnabled { + mi := &file_pairing_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnpairDeviceData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnpairDeviceData) ProtoMessage() {} + +func (x *UnpairDeviceData) ProtoReflect() protoreflect.Message { + mi := &file_pairing_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnpairDeviceData.ProtoReflect.Descriptor instead. +func (*UnpairDeviceData) Descriptor() ([]byte, []int) { + return file_pairing_proto_rawDescGZIP(), []int{4} +} + +func (x *UnpairDeviceData) GetBrowser() *Device { + if x != nil { + return x.Browser + } + return nil +} + type WebAuthKey struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -300,7 +347,7 @@ type WebAuthKey struct { func (x *WebAuthKey) Reset() { *x = WebAuthKey{} if protoimpl.UnsafeEnabled { - mi := &file_pairing_proto_msgTypes[4] + mi := &file_pairing_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -313,7 +360,7 @@ func (x *WebAuthKey) String() string { func (*WebAuthKey) ProtoMessage() {} func (x *WebAuthKey) ProtoReflect() protoreflect.Message { - mi := &file_pairing_proto_msgTypes[4] + mi := &file_pairing_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -326,7 +373,7 @@ func (x *WebAuthKey) ProtoReflect() protoreflect.Message { // Deprecated: Use WebAuthKey.ProtoReflect.Descriptor instead. func (*WebAuthKey) Descriptor() ([]byte, []int) { - return file_pairing_proto_rawDescGZIP(), []int{4} + return file_pairing_proto_rawDescGZIP(), []int{5} } func (x *WebAuthKey) GetWebAuthKey() []byte { @@ -348,15 +395,16 @@ type Container struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PhoneRelay *PhoneRelayBody `protobuf:"bytes,1,opt,name=PhoneRelay,proto3" json:"PhoneRelay,omitempty"` - BrowserDetails *BrowserDetails `protobuf:"bytes,3,opt,name=browserDetails,proto3" json:"browserDetails,omitempty"` - PairDeviceData *PairDeviceData `protobuf:"bytes,4,opt,name=pairDeviceData,proto3" json:"pairDeviceData,omitempty"` + PhoneRelay *PhoneRelayBody `protobuf:"bytes,1,opt,name=PhoneRelay,proto3" json:"PhoneRelay,omitempty"` + BrowserDetails *BrowserDetails `protobuf:"bytes,3,opt,name=browserDetails,proto3" json:"browserDetails,omitempty"` + PairDeviceData *PairDeviceData `protobuf:"bytes,4,opt,name=pairDeviceData,proto3" json:"pairDeviceData,omitempty"` + UnpairDeviceData *UnpairDeviceData `protobuf:"bytes,5,opt,name=unpairDeviceData,proto3" json:"unpairDeviceData,omitempty"` } func (x *Container) Reset() { *x = Container{} if protoimpl.UnsafeEnabled { - mi := &file_pairing_proto_msgTypes[5] + mi := &file_pairing_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -369,7 +417,7 @@ func (x *Container) String() string { func (*Container) ProtoMessage() {} func (x *Container) ProtoReflect() protoreflect.Message { - mi := &file_pairing_proto_msgTypes[5] + mi := &file_pairing_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -382,7 +430,7 @@ func (x *Container) ProtoReflect() protoreflect.Message { // Deprecated: Use Container.ProtoReflect.Descriptor instead. func (*Container) Descriptor() ([]byte, []int) { - return file_pairing_proto_rawDescGZIP(), []int{5} + return file_pairing_proto_rawDescGZIP(), []int{6} } func (x *Container) GetPhoneRelay() *PhoneRelayBody { @@ -406,6 +454,13 @@ func (x *Container) GetPairDeviceData() *PairDeviceData { return nil } +func (x *Container) GetUnpairDeviceData() *UnpairDeviceData { + if x != nil { + return x.UnpairDeviceData + } + return nil +} + type UrlData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -419,7 +474,7 @@ type UrlData struct { func (x *UrlData) Reset() { *x = UrlData{} if protoimpl.UnsafeEnabled { - mi := &file_pairing_proto_msgTypes[6] + mi := &file_pairing_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -432,7 +487,7 @@ func (x *UrlData) String() string { func (*UrlData) ProtoMessage() {} func (x *UrlData) ProtoReflect() protoreflect.Message { - mi := &file_pairing_proto_msgTypes[6] + mi := &file_pairing_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -445,7 +500,7 @@ func (x *UrlData) ProtoReflect() protoreflect.Message { // Deprecated: Use UrlData.ProtoReflect.Descriptor instead. func (*UrlData) Descriptor() ([]byte, []int) { - return file_pairing_proto_rawDescGZIP(), []int{6} + return file_pairing_proto_rawDescGZIP(), []int{7} } func (x *UrlData) GetPairingKey() []byte { @@ -508,11 +563,15 @@ var file_pairing_proto_rawDesc = []byte{ 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, + 0x72, 0x22, 0x3e, 0x0a, 0x10, 0x55, 0x6e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x22, 0x48, 0x0a, 0x0a, 0x57, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x77, 0x65, 0x62, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x22, 0xc6, 0x01, 0x0a, 0x09, + 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x22, 0x8d, 0x02, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, @@ -525,15 +584,19 @@ var file_pairing_proto_rawDesc = []byte{ 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x44, 0x61, 0x74, 0x61, 0x22, 0x6b, 0x0a, 0x07, 0x55, 0x72, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, - 0x22, 0x0a, 0x0c, 0x41, 0x45, 0x53, 0x43, 0x54, 0x52, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x41, 0x45, 0x53, 0x43, 0x54, 0x52, 0x32, 0x35, 0x36, - 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x4b, 0x65, - 0x79, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, - 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x45, 0x0a, 0x10, 0x75, 0x6e, 0x70, 0x61, 0x69, 0x72, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x55, 0x6e, 0x70, 0x61, 0x69, 0x72, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x10, 0x75, 0x6e, 0x70, 0x61, 0x69, + 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x22, 0x6b, 0x0a, 0x07, 0x55, + 0x72, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, + 0x67, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x69, 0x72, + 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x45, 0x53, 0x43, 0x54, 0x52, + 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x41, 0x45, + 0x53, 0x43, 0x54, 0x52, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x48, + 0x41, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x53, + 0x48, 0x41, 0x32, 0x35, 0x36, 0x4b, 0x65, 0x79, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, + 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -548,32 +611,35 @@ func file_pairing_proto_rawDescGZIP() []byte { return file_pairing_proto_rawDescData } -var file_pairing_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_pairing_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_pairing_proto_goTypes = []interface{}{ - (*BrowserDetails)(nil), // 0: pairing.BrowserDetails - (*PhoneRelayBody)(nil), // 1: pairing.PhoneRelayBody - (*ECDSAKeys)(nil), // 2: pairing.ECDSAKeys - (*PairDeviceData)(nil), // 3: pairing.PairDeviceData - (*WebAuthKey)(nil), // 4: pairing.WebAuthKey - (*Container)(nil), // 5: pairing.Container - (*UrlData)(nil), // 6: pairing.UrlData - (*Date)(nil), // 7: messages.Date - (*Device)(nil), // 8: messages.Device + (*BrowserDetails)(nil), // 0: pairing.BrowserDetails + (*PhoneRelayBody)(nil), // 1: pairing.PhoneRelayBody + (*ECDSAKeys)(nil), // 2: pairing.ECDSAKeys + (*PairDeviceData)(nil), // 3: pairing.PairDeviceData + (*UnpairDeviceData)(nil), // 4: pairing.UnpairDeviceData + (*WebAuthKey)(nil), // 5: pairing.WebAuthKey + (*Container)(nil), // 6: pairing.Container + (*UrlData)(nil), // 7: pairing.UrlData + (*Date)(nil), // 8: messages.Date + (*Device)(nil), // 9: messages.Device } var file_pairing_proto_depIdxs = []int32{ - 7, // 0: pairing.PhoneRelayBody.date:type_name -> messages.Date - 8, // 1: pairing.PairDeviceData.mobile:type_name -> messages.Device - 2, // 2: pairing.PairDeviceData.ecdsaKeys:type_name -> pairing.ECDSAKeys - 4, // 3: pairing.PairDeviceData.webAuthKeyData:type_name -> pairing.WebAuthKey - 8, // 4: pairing.PairDeviceData.browser:type_name -> messages.Device - 1, // 5: pairing.Container.PhoneRelay:type_name -> pairing.PhoneRelayBody - 0, // 6: pairing.Container.browserDetails:type_name -> pairing.BrowserDetails - 3, // 7: pairing.Container.pairDeviceData:type_name -> pairing.PairDeviceData - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 8, // 0: pairing.PhoneRelayBody.date:type_name -> messages.Date + 9, // 1: pairing.PairDeviceData.mobile:type_name -> messages.Device + 2, // 2: pairing.PairDeviceData.ecdsaKeys:type_name -> pairing.ECDSAKeys + 5, // 3: pairing.PairDeviceData.webAuthKeyData:type_name -> pairing.WebAuthKey + 9, // 4: pairing.PairDeviceData.browser:type_name -> messages.Device + 9, // 5: pairing.UnpairDeviceData.browser:type_name -> messages.Device + 1, // 6: pairing.Container.PhoneRelay:type_name -> pairing.PhoneRelayBody + 0, // 7: pairing.Container.browserDetails:type_name -> pairing.BrowserDetails + 3, // 8: pairing.Container.pairDeviceData:type_name -> pairing.PairDeviceData + 4, // 9: pairing.Container.unpairDeviceData:type_name -> pairing.UnpairDeviceData + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_pairing_proto_init() } @@ -632,7 +698,7 @@ func file_pairing_proto_init() { } } file_pairing_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebAuthKey); i { + switch v := v.(*UnpairDeviceData); i { case 0: return &v.state case 1: @@ -644,7 +710,7 @@ func file_pairing_proto_init() { } } file_pairing_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Container); i { + switch v := v.(*WebAuthKey); i { case 0: return &v.state case 1: @@ -656,6 +722,18 @@ func file_pairing_proto_init() { } } file_pairing_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Container); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pairing_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UrlData); i { case 0: return &v.state @@ -674,7 +752,7 @@ func file_pairing_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pairing_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/libgm/binary/raw/conversations.proto b/libgm/binary/raw/conversations.proto index 320b35a..6d854f0 100644 --- a/libgm/binary/raw/conversations.proto +++ b/libgm/binary/raw/conversations.proto @@ -115,8 +115,9 @@ message IsFromMe { enum MsgStatusCode { UNKNOWN_STATUS = 0; - SENDING = 5; SENT = 1; + SENDING = 5; + READ = 11; } message MessageStatus { @@ -129,7 +130,7 @@ message MessageStatus { // RCS READ|SEEN = 11; */ - int64 code = 2; + MsgStatusCode code = 2; string errMsg = 4; string msgStatus = 5; } diff --git a/libgm/binary/raw/pairing.proto b/libgm/binary/raw/pairing.proto index da2ba0c..b4892eb 100644 --- a/libgm/binary/raw/pairing.proto +++ b/libgm/binary/raw/pairing.proto @@ -25,12 +25,16 @@ message ECDSAKeys { } message PairDeviceData { - messages.Device mobile = 1; + messages.Device mobile = 1; ECDSAKeys ecdsaKeys = 6; WebAuthKey webAuthKeyData = 2; messages.Device browser = 3; } +message UnpairDeviceData { + messages.Device browser = 1; +} + message WebAuthKey { bytes webAuthKey = 1; int64 validFor = 2; @@ -40,6 +44,7 @@ message Container { PhoneRelayBody PhoneRelay = 1; BrowserDetails browserDetails = 3; PairDeviceData pairDeviceData = 4; + UnpairDeviceData unpairDeviceData = 5; } message UrlData { diff --git a/libgm/client.go b/libgm/client.go index 944b350..710ae5f 100644 --- a/libgm/client.go +++ b/libgm/client.go @@ -95,8 +95,14 @@ func (c *Client) Connect(rpcKey []byte) error { } c.rpc.rpcSessionID = receiveMesageSessionID c.rpcKey = rpcKey - c.rpc.ListenReceiveMessages(rpcPayload) + go c.rpc.ListenReceiveMessages(rpcPayload) c.Logger.Debug().Any("rpcKey", rpcKey).Msg("Successfully connected to server") + if c.devicePair != nil { + sendInitialDataErr := c.rpc.sendInitialData() + if sendInitialDataErr != nil { + panic(sendInitialDataErr) + } + } return nil } diff --git a/libgm/event_handler.go b/libgm/event_handler.go index 6c0c52c..baf7a3b 100644 --- a/libgm/event_handler.go +++ b/libgm/event_handler.go @@ -1,16 +1,25 @@ package libgm import ( + "encoding/base64" + + "google.golang.org/protobuf/proto" + "go.mau.fi/mautrix-gmessages/libgm/binary" ) func (c *Client) handleEventOpCode(response *Response) { c.Logger.Debug().Any("res", response).Msg("got event response?") eventData := &binary.Event{} - decryptedErr := c.cryptor.DecryptAndDecodeData(response.Data.EncryptedData, eventData) + data, decryptedErr := c.cryptor.Decrypt(response.Data.EncryptedData) if decryptedErr != nil { panic(decryptedErr) } + c.Logger.Debug().Str("protobuf_data", base64.StdEncoding.EncodeToString(data)).Msg("decrypted data") + err := proto.Unmarshal(data, eventData) + if err != nil { + panic(err) + } switch evt := eventData.Event.(type) { case *binary.Event_MessageEvent: c.handleMessageEvent(response, evt) diff --git a/libgm/events/ready.go b/libgm/events/ready.go index 23dc1a3..22acf27 100644 --- a/libgm/events/ready.go +++ b/libgm/events/ready.go @@ -1,18 +1,15 @@ package events import ( - "go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/util" ) type ClientReady struct { - Session *util.SessionResponse - Conversations []*binary.Conversation + Session *util.SessionResponse } -func NewClientReady(session *util.SessionResponse, conversationList *binary.Conversations) *ClientReady { +func NewClientReady(session *util.SessionResponse) *ClientReady { return &ClientReady{ - Session: session, - Conversations: conversationList.Conversations, + Session: session, } } diff --git a/libgm/opcode_handler.go b/libgm/opcode_handler.go index 2fed1ae..396215b 100644 --- a/libgm/opcode_handler.go +++ b/libgm/opcode_handler.go @@ -18,8 +18,17 @@ func (c *Client) handleSeperateOpCode(msgData *binary.MessageData) { if err != nil { panic(err) } + if decodedData.UnpairDeviceData != nil { + c.Logger.Warn().Any("data", decodedData).Msg("Unpaired?") + return + } + // TODO unpairing c.Logger.Debug().Any("data", decodedData).Msg("Paired device decoded data") - c.pairer.pairCallback(decodedData) + if c.pairer != nil { + c.pairer.pairCallback(decodedData) + } else { + c.Logger.Warn().Msg("No pairer to receive callback") + } default: decodedData := &binary.EncodedResponse{} err = binary.DecodeProtoMessage(decodedBytes, decodedData) diff --git a/libgm/pair.go b/libgm/pair.go index 3d29bd4..6c3cfb0 100644 --- a/libgm/pair.go +++ b/libgm/pair.go @@ -153,4 +153,5 @@ func (p *Pairer) pairCallback(pairData *binary.Container) { p.client.devicePair = &DevicePair{Mobile: pairData.PairDeviceData.Mobile, Browser: pairData.PairDeviceData.Browser} p.client.pairer.GetWebEncryptionKey() p.client.triggerEvent(&events.PairSuccessful{Container: pairData}) + p.client.pairer = nil } diff --git a/libgm/rpc.go b/libgm/rpc.go index dfab147..775932d 100644 --- a/libgm/rpc.go +++ b/libgm/rpc.go @@ -22,18 +22,21 @@ type RPC struct { } func (r *RPC) ListenReceiveMessages(payload []byte) { - req, err := http.NewRequest("POST", util.RECEIVE_MESSAGES, bytes.NewReader(payload)) - if err != nil { - panic(fmt.Errorf("Error creating request: %v", err)) + for { + r.client.Logger.Debug().Msg("Starting new long-polling request") + req, err := http.NewRequest("POST", util.RECEIVE_MESSAGES, bytes.NewReader(payload)) + if err != nil { + panic(fmt.Errorf("Error creating request: %v", err)) + } + util.BuildRelayHeaders(req, "application/json+protobuf", "*/*") + resp, reqErr := r.http.Do(req) + //r.client.Logger.Info().Any("bodyLength", len(payload)).Any("url", util.RECEIVE_MESSAGES).Any("headers", resp.Request.Header).Msg("RPC Request Headers") + if reqErr != nil { + panic(fmt.Errorf("Error making request: %v", err)) + } + r.conn = resp.Body + r.startReadingData(resp.Body) } - util.BuildRelayHeaders(req, "application/json+protobuf", "*/*") - resp, reqErr := r.http.Do(req) - //r.client.Logger.Info().Any("bodyLength", len(payload)).Any("url", util.RECEIVE_MESSAGES).Any("headers", resp.Request.Header).Msg("RPC Request Headers") - if reqErr != nil { - panic(fmt.Errorf("Error making request: %v", err)) - } - r.conn = resp.Body - go r.startReadingData(resp.Body) } /* @@ -156,12 +159,7 @@ func (r *RPC) sendInitialData() error { return err } - conversationList, convErr := r.client.Conversations.List(25) - if convErr != nil { - return convErr - } - - evtData := events.NewClientReady(sessionResponse, conversationList) + evtData := events.NewClientReady(sessionResponse) r.client.triggerEvent(evtData) r.client.sessionHandler.startAckInterval() return nil