Send unpair request when logging out

This commit is contained in:
Tulir Asokan 2023-07-16 02:11:25 +03:00
parent 00b7dd1268
commit abb2c8a21f
8 changed files with 670 additions and 464 deletions

View file

@ -39,6 +39,7 @@ func (br *GMBridge) RegisterCommands() {
proc.AddHandlers(
cmdLogin,
cmdDeleteSession,
cmdLogout,
cmdReconnect,
cmdDisconnect,
cmdPing,
@ -134,6 +135,28 @@ func (user *User) uploadQR(ce *WrappedCommandEvent, code string) (id.ContentURI,
return resp.ContentURI, true
}
var cmdLogout = &commands.FullHandler{
Func: wrapCommand(fnLogout),
Name: "logout",
Help: commands.HelpMeta{
Section: commands.HelpSectionAuth,
Description: "Unpair the bridge and delete session information.",
},
}
func fnLogout(ce *WrappedCommandEvent) {
if ce.User.Session == nil && ce.User.Client == nil {
ce.Reply("You're not logged in")
return
}
logoutOK := ce.User.Logout(status.BridgeState{StateEvent: status.StateLoggedOut}, true)
if logoutOK {
ce.Reply("Successfully logged out")
} else {
ce.Reply("Session information removed, but unpairing may not have succeeded")
}
}
var cmdDeleteSession = &commands.FullHandler{
Func: wrapCommand(fnDeleteSession),
Name: "delete-session",
@ -148,7 +171,7 @@ func fnDeleteSession(ce *WrappedCommandEvent) {
ce.Reply("Nothing to purge: no session information stored and no active connection.")
return
}
ce.User.Logout(status.BridgeState{StateEvent: status.StateLoggedOut})
ce.User.Logout(status.BridgeState{StateEvent: status.StateLoggedOut}, false)
ce.Reply("Session information purged")
}

File diff suppressed because it is too large Load diff

View file

@ -55,6 +55,11 @@ message InternalRequestData {
bool bool3 = 9;
}
message RevokeRelayPairing {
AuthMessage authMessage = 1;
Device browser = 2;
}
message SendMessage {
Device mobile = 1;
SendMessageData messageData = 2;

View file

@ -26,6 +26,10 @@ message RegisterRefreshResponse {
RefreshAuthData tokenData = 2;
}
message RevokeRelayPairingResponse {
// field 1 is an object with an unknown int64 in field 2
}
message RefreshAuthData {
bytes tachyonAuthToken = 1;
string validFor = 2;

View file

@ -232,6 +232,44 @@ func (x *RegisterRefreshResponse) GetTokenData() *RefreshAuthData {
return nil
}
type RevokeRelayPairingResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *RevokeRelayPairingResponse) Reset() {
*x = RevokeRelayPairingResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RevokeRelayPairingResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RevokeRelayPairingResponse) ProtoMessage() {}
func (x *RevokeRelayPairingResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_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 RevokeRelayPairingResponse.ProtoReflect.Descriptor instead.
func (*RevokeRelayPairingResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{4}
}
type RefreshAuthData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -244,7 +282,7 @@ type RefreshAuthData struct {
func (x *RefreshAuthData) Reset() {
*x = RefreshAuthData{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[4]
mi := &file_responses_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -257,7 +295,7 @@ func (x *RefreshAuthData) String() string {
func (*RefreshAuthData) ProtoMessage() {}
func (x *RefreshAuthData) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[4]
mi := &file_responses_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -270,7 +308,7 @@ func (x *RefreshAuthData) ProtoReflect() protoreflect.Message {
// Deprecated: Use RefreshAuthData.ProtoReflect.Descriptor instead.
func (*RefreshAuthData) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{4}
return file_responses_proto_rawDescGZIP(), []int{5}
}
func (x *RefreshAuthData) GetTachyonAuthToken() []byte {
@ -301,7 +339,7 @@ type FetchMessagesResponse struct {
func (x *FetchMessagesResponse) Reset() {
*x = FetchMessagesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[5]
mi := &file_responses_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -314,7 +352,7 @@ func (x *FetchMessagesResponse) String() string {
func (*FetchMessagesResponse) ProtoMessage() {}
func (x *FetchMessagesResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[5]
mi := &file_responses_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -327,7 +365,7 @@ func (x *FetchMessagesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use FetchMessagesResponse.ProtoReflect.Descriptor instead.
func (*FetchMessagesResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{5}
return file_responses_proto_rawDescGZIP(), []int{6}
}
func (x *FetchMessagesResponse) GetMessages() []*Message {
@ -369,7 +407,7 @@ type DeleteMessageResponse struct {
func (x *DeleteMessageResponse) Reset() {
*x = DeleteMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[6]
mi := &file_responses_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -382,7 +420,7 @@ func (x *DeleteMessageResponse) String() string {
func (*DeleteMessageResponse) ProtoMessage() {}
func (x *DeleteMessageResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[6]
mi := &file_responses_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -395,7 +433,7 @@ func (x *DeleteMessageResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteMessageResponse.ProtoReflect.Descriptor instead.
func (*DeleteMessageResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{6}
return file_responses_proto_rawDescGZIP(), []int{7}
}
func (x *DeleteMessageResponse) GetSuccess() bool {
@ -416,7 +454,7 @@ type UpdateConversationResponse struct {
func (x *UpdateConversationResponse) Reset() {
*x = UpdateConversationResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[7]
mi := &file_responses_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -429,7 +467,7 @@ func (x *UpdateConversationResponse) String() string {
func (*UpdateConversationResponse) ProtoMessage() {}
func (x *UpdateConversationResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[7]
mi := &file_responses_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -442,7 +480,7 @@ func (x *UpdateConversationResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateConversationResponse.ProtoReflect.Descriptor instead.
func (*UpdateConversationResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{7}
return file_responses_proto_rawDescGZIP(), []int{8}
}
func (x *UpdateConversationResponse) GetSuccess() bool {
@ -466,7 +504,7 @@ type GetConversationTypeResponse struct {
func (x *GetConversationTypeResponse) Reset() {
*x = GetConversationTypeResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[8]
mi := &file_responses_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -479,7 +517,7 @@ func (x *GetConversationTypeResponse) String() string {
func (*GetConversationTypeResponse) ProtoMessage() {}
func (x *GetConversationTypeResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[8]
mi := &file_responses_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -492,7 +530,7 @@ func (x *GetConversationTypeResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetConversationTypeResponse.ProtoReflect.Descriptor instead.
func (*GetConversationTypeResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{8}
return file_responses_proto_rawDescGZIP(), []int{9}
}
func (x *GetConversationTypeResponse) GetConversationID() string {
@ -532,7 +570,7 @@ type NotifyDittoActivityResponse struct {
func (x *NotifyDittoActivityResponse) Reset() {
*x = NotifyDittoActivityResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[9]
mi := &file_responses_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -545,7 +583,7 @@ func (x *NotifyDittoActivityResponse) String() string {
func (*NotifyDittoActivityResponse) ProtoMessage() {}
func (x *NotifyDittoActivityResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[9]
mi := &file_responses_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -558,7 +596,7 @@ func (x *NotifyDittoActivityResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use NotifyDittoActivityResponse.ProtoReflect.Descriptor instead.
func (*NotifyDittoActivityResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{9}
return file_responses_proto_rawDescGZIP(), []int{10}
}
type IsBugleDefaultResponse struct {
@ -572,7 +610,7 @@ type IsBugleDefaultResponse struct {
func (x *IsBugleDefaultResponse) Reset() {
*x = IsBugleDefaultResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[10]
mi := &file_responses_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -585,7 +623,7 @@ func (x *IsBugleDefaultResponse) String() string {
func (*IsBugleDefaultResponse) ProtoMessage() {}
func (x *IsBugleDefaultResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[10]
mi := &file_responses_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -598,7 +636,7 @@ func (x *IsBugleDefaultResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use IsBugleDefaultResponse.ProtoReflect.Descriptor instead.
func (*IsBugleDefaultResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{10}
return file_responses_proto_rawDescGZIP(), []int{11}
}
func (x *IsBugleDefaultResponse) GetSuccess() bool {
@ -619,7 +657,7 @@ type GetUpdatesResponse struct {
func (x *GetUpdatesResponse) Reset() {
*x = GetUpdatesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[11]
mi := &file_responses_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -632,7 +670,7 @@ func (x *GetUpdatesResponse) String() string {
func (*GetUpdatesResponse) ProtoMessage() {}
func (x *GetUpdatesResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[11]
mi := &file_responses_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -645,7 +683,7 @@ func (x *GetUpdatesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetUpdatesResponse.ProtoReflect.Descriptor instead.
func (*GetUpdatesResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{11}
return file_responses_proto_rawDescGZIP(), []int{12}
}
func (x *GetUpdatesResponse) GetData() *UserAlertEvent {
@ -666,7 +704,7 @@ type SendMessageResponse struct {
func (x *SendMessageResponse) Reset() {
*x = SendMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[12]
mi := &file_responses_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -679,7 +717,7 @@ func (x *SendMessageResponse) String() string {
func (*SendMessageResponse) ProtoMessage() {}
func (x *SendMessageResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[12]
mi := &file_responses_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -692,7 +730,7 @@ func (x *SendMessageResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SendMessageResponse.ProtoReflect.Descriptor instead.
func (*SendMessageResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{12}
return file_responses_proto_rawDescGZIP(), []int{13}
}
func (x *SendMessageResponse) GetType() int64 {
@ -715,7 +753,7 @@ type RefreshPhoneRelayResponse struct {
func (x *RefreshPhoneRelayResponse) Reset() {
*x = RefreshPhoneRelayResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[13]
mi := &file_responses_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -728,7 +766,7 @@ func (x *RefreshPhoneRelayResponse) String() string {
func (*RefreshPhoneRelayResponse) ProtoMessage() {}
func (x *RefreshPhoneRelayResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[13]
mi := &file_responses_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -741,7 +779,7 @@ func (x *RefreshPhoneRelayResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use RefreshPhoneRelayResponse.ProtoReflect.Descriptor instead.
func (*RefreshPhoneRelayResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{13}
return file_responses_proto_rawDescGZIP(), []int{14}
}
func (x *RefreshPhoneRelayResponse) GetCoordinates() *CoordinateMessage {
@ -777,7 +815,7 @@ type WebEncryptionKeyResponse struct {
func (x *WebEncryptionKeyResponse) Reset() {
*x = WebEncryptionKeyResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[14]
mi := &file_responses_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -790,7 +828,7 @@ func (x *WebEncryptionKeyResponse) String() string {
func (*WebEncryptionKeyResponse) ProtoMessage() {}
func (x *WebEncryptionKeyResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[14]
mi := &file_responses_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -803,7 +841,7 @@ func (x *WebEncryptionKeyResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use WebEncryptionKeyResponse.ProtoReflect.Descriptor instead.
func (*WebEncryptionKeyResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{14}
return file_responses_proto_rawDescGZIP(), []int{15}
}
func (x *WebEncryptionKeyResponse) GetCoordinates() *CoordinateMessage {
@ -836,7 +874,7 @@ type RegisterPhoneRelayResponse struct {
func (x *RegisterPhoneRelayResponse) Reset() {
*x = RegisterPhoneRelayResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[15]
mi := &file_responses_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -849,7 +887,7 @@ func (x *RegisterPhoneRelayResponse) String() string {
func (*RegisterPhoneRelayResponse) ProtoMessage() {}
func (x *RegisterPhoneRelayResponse) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[15]
mi := &file_responses_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -862,7 +900,7 @@ func (x *RegisterPhoneRelayResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use RegisterPhoneRelayResponse.ProtoReflect.Descriptor instead.
func (*RegisterPhoneRelayResponse) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{15}
return file_responses_proto_rawDescGZIP(), []int{16}
}
func (x *RegisterPhoneRelayResponse) GetCoordinates() *CoordinateMessage {
@ -918,7 +956,7 @@ type CoordinateMessage struct {
func (x *CoordinateMessage) Reset() {
*x = CoordinateMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[16]
mi := &file_responses_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -931,7 +969,7 @@ func (x *CoordinateMessage) String() string {
func (*CoordinateMessage) ProtoMessage() {}
func (x *CoordinateMessage) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[16]
mi := &file_responses_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -944,7 +982,7 @@ func (x *CoordinateMessage) ProtoReflect() protoreflect.Message {
// Deprecated: Use CoordinateMessage.ProtoReflect.Descriptor instead.
func (*CoordinateMessage) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{16}
return file_responses_proto_rawDescGZIP(), []int{17}
}
func (x *CoordinateMessage) GetCoord1() int64 {
@ -966,7 +1004,7 @@ type AuthKeyData struct {
func (x *AuthKeyData) Reset() {
*x = AuthKeyData{}
if protoimpl.UnsafeEnabled {
mi := &file_responses_proto_msgTypes[17]
mi := &file_responses_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -979,7 +1017,7 @@ func (x *AuthKeyData) String() string {
func (*AuthKeyData) ProtoMessage() {}
func (x *AuthKeyData) ProtoReflect() protoreflect.Message {
mi := &file_responses_proto_msgTypes[17]
mi := &file_responses_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -992,7 +1030,7 @@ func (x *AuthKeyData) ProtoReflect() protoreflect.Message {
// Deprecated: Use AuthKeyData.ProtoReflect.Descriptor instead.
func (*AuthKeyData) Descriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{17}
return file_responses_proto_rawDescGZIP(), []int{18}
}
func (x *AuthKeyData) GetTachyonAuthToken() []byte {
@ -1040,96 +1078,98 @@ var file_responses_proto_rawDesc = []byte{
0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x44, 0x61, 0x74, 0x61,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x73, 0x2e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x41, 0x75, 0x74, 0x68, 0x44, 0x61,
0x74, 0x61, 0x52, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x59, 0x0a,
0x0f, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x41, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61,
0x12, 0x2a, 0x0a, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54,
0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x61, 0x63, 0x68,
0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x22, 0xbe, 0x01, 0x0a, 0x15, 0x46, 0x65, 0x74,
0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x79,
0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x42,
0x79, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x75,
0x72, 0x73, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e,
0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x75, 0x72, 0x73, 0x6f,
0x72, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x31, 0x0a, 0x15, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20,
0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x36, 0x0a, 0x1a,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63,
0x63, 0x65, 0x73, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76,
0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04,
0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52,
0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72,
0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32,
0x22, 0x1d, 0x0a, 0x1b, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x44, 0x69, 0x74, 0x74, 0x6f, 0x41,
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x32, 0x0a, 0x16, 0x49, 0x73, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c,
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63,
0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x22, 0x40, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52,
0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x29, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x22, 0x91, 0x01, 0x0a, 0x19, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x68, 0x6f, 0x6e,
0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e,
0x74, 0x61, 0x52, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x1c, 0x0a,
0x1a, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x50, 0x61, 0x69, 0x72,
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0f, 0x52,
0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x41, 0x75, 0x74, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a,
0x0a, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f,
0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x22, 0xbe, 0x01, 0x0a, 0x15, 0x46, 0x65, 0x74, 0x63, 0x68,
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x32, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x79, 0x74, 0x65,
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x6f, 0x6d, 0x65, 0x42, 0x79, 0x74,
0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73,
0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65,
0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52,
0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x31, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76,
0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14,
0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62,
0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x18,
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x22, 0x1d,
0x0a, 0x1b, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x44, 0x69, 0x74, 0x74, 0x6f, 0x41, 0x63, 0x74,
0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a,
0x16, 0x49, 0x73, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
0x73, 0x22, 0x40, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18,
0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x64,
0x61, 0x74, 0x61, 0x22, 0x29, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x91,
0x01, 0x0a, 0x19, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52,
0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b,
0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x43, 0x6f,
0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07,
0x70, 0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70,
0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46,
0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46,
0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x18, 0x57, 0x65, 0x62, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e,
0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e,
0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x18,
0x0a, 0x07, 0x70, 0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x07, 0x70, 0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x46, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x46, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x18, 0x57, 0x65, 0x62, 0x45, 0x6e, 0x63, 0x72, 0x79,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x3e, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x73, 0x2e, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x22, 0x9e, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50,
0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65,
0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x18, 0x02, 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, 0x12, 0x1e, 0x0a,
0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a,
0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x0b, 0x61, 0x75, 0x74,
0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4b,
0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44,
0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49,
0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x49, 0x44, 0x22, 0x2b, 0x0a, 0x11, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74,
0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6f, 0x72,
0x64, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31,
0x22, 0x55, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12,
0x2a, 0x0a, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79,
0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 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, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e,
0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x22, 0x9e, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, 0x6f,
0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x3e, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73,
0x2e, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12,
0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x18, 0x02, 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, 0x12, 0x1e, 0x0a, 0x0a, 0x70,
0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76,
0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76,
0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x4b,
0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79,
0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74,
0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x44, 0x18,
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49,
0x44, 0x22, 0x2b, 0x0a, 0x11, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31, 0x22, 0x55,
0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a,
0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e,
0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 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, 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 (
@ -1144,45 +1184,46 @@ func file_responses_proto_rawDescGZIP() []byte {
return file_responses_proto_rawDescData
}
var file_responses_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_responses_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_responses_proto_goTypes = []interface{}{
(*ParticipantThumbnail)(nil), // 0: responses.ParticipantThumbnail
(*Thumbnail)(nil), // 1: responses.Thumbnail
(*ThumbnailData)(nil), // 2: responses.ThumbnailData
(*RegisterRefreshResponse)(nil), // 3: responses.RegisterRefreshResponse
(*RefreshAuthData)(nil), // 4: responses.RefreshAuthData
(*FetchMessagesResponse)(nil), // 5: responses.FetchMessagesResponse
(*DeleteMessageResponse)(nil), // 6: responses.DeleteMessageResponse
(*UpdateConversationResponse)(nil), // 7: responses.UpdateConversationResponse
(*GetConversationTypeResponse)(nil), // 8: responses.GetConversationTypeResponse
(*NotifyDittoActivityResponse)(nil), // 9: responses.NotifyDittoActivityResponse
(*IsBugleDefaultResponse)(nil), // 10: responses.IsBugleDefaultResponse
(*GetUpdatesResponse)(nil), // 11: responses.GetUpdatesResponse
(*SendMessageResponse)(nil), // 12: responses.SendMessageResponse
(*RefreshPhoneRelayResponse)(nil), // 13: responses.RefreshPhoneRelayResponse
(*WebEncryptionKeyResponse)(nil), // 14: responses.WebEncryptionKeyResponse
(*RegisterPhoneRelayResponse)(nil), // 15: responses.RegisterPhoneRelayResponse
(*CoordinateMessage)(nil), // 16: responses.CoordinateMessage
(*AuthKeyData)(nil), // 17: responses.AuthKeyData
(*Pixels)(nil), // 18: conversations.Pixels
(*Message)(nil), // 19: conversations.Message
(*Cursor)(nil), // 20: conversations.Cursor
(*UserAlertEvent)(nil), // 21: events.UserAlertEvent
(*Device)(nil), // 22: messages.Device
(*RevokeRelayPairingResponse)(nil), // 4: responses.RevokeRelayPairingResponse
(*RefreshAuthData)(nil), // 5: responses.RefreshAuthData
(*FetchMessagesResponse)(nil), // 6: responses.FetchMessagesResponse
(*DeleteMessageResponse)(nil), // 7: responses.DeleteMessageResponse
(*UpdateConversationResponse)(nil), // 8: responses.UpdateConversationResponse
(*GetConversationTypeResponse)(nil), // 9: responses.GetConversationTypeResponse
(*NotifyDittoActivityResponse)(nil), // 10: responses.NotifyDittoActivityResponse
(*IsBugleDefaultResponse)(nil), // 11: responses.IsBugleDefaultResponse
(*GetUpdatesResponse)(nil), // 12: responses.GetUpdatesResponse
(*SendMessageResponse)(nil), // 13: responses.SendMessageResponse
(*RefreshPhoneRelayResponse)(nil), // 14: responses.RefreshPhoneRelayResponse
(*WebEncryptionKeyResponse)(nil), // 15: responses.WebEncryptionKeyResponse
(*RegisterPhoneRelayResponse)(nil), // 16: responses.RegisterPhoneRelayResponse
(*CoordinateMessage)(nil), // 17: responses.CoordinateMessage
(*AuthKeyData)(nil), // 18: responses.AuthKeyData
(*Pixels)(nil), // 19: conversations.Pixels
(*Message)(nil), // 20: conversations.Message
(*Cursor)(nil), // 21: conversations.Cursor
(*UserAlertEvent)(nil), // 22: events.UserAlertEvent
(*Device)(nil), // 23: messages.Device
}
var file_responses_proto_depIdxs = []int32{
1, // 0: responses.ParticipantThumbnail.thumbnail:type_name -> responses.Thumbnail
2, // 1: responses.Thumbnail.data:type_name -> responses.ThumbnailData
18, // 2: responses.ThumbnailData.pixels:type_name -> conversations.Pixels
4, // 3: responses.RegisterRefreshResponse.tokenData:type_name -> responses.RefreshAuthData
19, // 4: responses.FetchMessagesResponse.messages:type_name -> conversations.Message
20, // 5: responses.FetchMessagesResponse.cursor:type_name -> conversations.Cursor
21, // 6: responses.GetUpdatesResponse.data:type_name -> events.UserAlertEvent
16, // 7: responses.RefreshPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage
16, // 8: responses.WebEncryptionKeyResponse.coordinates:type_name -> responses.CoordinateMessage
16, // 9: responses.RegisterPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage
22, // 10: responses.RegisterPhoneRelayResponse.browser:type_name -> messages.Device
17, // 11: responses.RegisterPhoneRelayResponse.authKeyData:type_name -> responses.AuthKeyData
19, // 2: responses.ThumbnailData.pixels:type_name -> conversations.Pixels
5, // 3: responses.RegisterRefreshResponse.tokenData:type_name -> responses.RefreshAuthData
20, // 4: responses.FetchMessagesResponse.messages:type_name -> conversations.Message
21, // 5: responses.FetchMessagesResponse.cursor:type_name -> conversations.Cursor
22, // 6: responses.GetUpdatesResponse.data:type_name -> events.UserAlertEvent
17, // 7: responses.RefreshPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage
17, // 8: responses.WebEncryptionKeyResponse.coordinates:type_name -> responses.CoordinateMessage
17, // 9: responses.RegisterPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage
23, // 10: responses.RegisterPhoneRelayResponse.browser:type_name -> messages.Device
18, // 11: responses.RegisterPhoneRelayResponse.authKeyData:type_name -> responses.AuthKeyData
12, // [12:12] is the sub-list for method output_type
12, // [12:12] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
@ -1248,7 +1289,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RefreshAuthData); i {
switch v := v.(*RevokeRelayPairingResponse); i {
case 0:
return &v.state
case 1:
@ -1260,7 +1301,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FetchMessagesResponse); i {
switch v := v.(*RefreshAuthData); i {
case 0:
return &v.state
case 1:
@ -1272,7 +1313,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteMessageResponse); i {
switch v := v.(*FetchMessagesResponse); i {
case 0:
return &v.state
case 1:
@ -1284,7 +1325,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateConversationResponse); i {
switch v := v.(*DeleteMessageResponse); i {
case 0:
return &v.state
case 1:
@ -1296,7 +1337,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetConversationTypeResponse); i {
switch v := v.(*UpdateConversationResponse); i {
case 0:
return &v.state
case 1:
@ -1308,7 +1349,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NotifyDittoActivityResponse); i {
switch v := v.(*GetConversationTypeResponse); i {
case 0:
return &v.state
case 1:
@ -1320,7 +1361,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsBugleDefaultResponse); i {
switch v := v.(*NotifyDittoActivityResponse); i {
case 0:
return &v.state
case 1:
@ -1332,7 +1373,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUpdatesResponse); i {
switch v := v.(*IsBugleDefaultResponse); i {
case 0:
return &v.state
case 1:
@ -1344,7 +1385,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SendMessageResponse); i {
switch v := v.(*GetUpdatesResponse); i {
case 0:
return &v.state
case 1:
@ -1356,7 +1397,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RefreshPhoneRelayResponse); i {
switch v := v.(*SendMessageResponse); i {
case 0:
return &v.state
case 1:
@ -1368,7 +1409,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WebEncryptionKeyResponse); i {
switch v := v.(*RefreshPhoneRelayResponse); i {
case 0:
return &v.state
case 1:
@ -1380,7 +1421,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RegisterPhoneRelayResponse); i {
switch v := v.(*WebEncryptionKeyResponse); i {
case 0:
return &v.state
case 1:
@ -1392,7 +1433,7 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CoordinateMessage); i {
switch v := v.(*RegisterPhoneRelayResponse); i {
case 0:
return &v.state
case 1:
@ -1404,6 +1445,18 @@ func file_responses_proto_init() {
}
}
file_responses_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CoordinateMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_responses_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuthKeyData); i {
case 0:
return &v.state
@ -1422,7 +1475,7 @@ func file_responses_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_responses_proto_rawDesc,
NumEnums: 0,
NumMessages: 18,
NumMessages: 19,
NumExtensions: 0,
NumServices: 0,
},

View file

@ -4,6 +4,7 @@ import (
"io"
"time"
"github.com/google/uuid"
"google.golang.org/protobuf/proto"
"go.mau.fi/mautrix-gmessages/libgm/binary"
@ -150,3 +151,35 @@ func (c *Client) GetWebEncryptionKey() (*binary.WebEncryptionKeyResponse, error)
}
return parsedResponse, nil
}
func (c *Client) Unpair() (*binary.RevokeRelayPairingResponse, error) {
if c.authData.TachyonAuthToken == nil || c.authData.DevicePair == nil || c.authData.DevicePair.Browser == nil {
return nil, nil
}
payload, err := proto.Marshal(&binary.RevokeRelayPairing{
AuthMessage: &binary.AuthMessage{
RequestID: uuid.NewString(),
TachyonAuthToken: c.authData.TachyonAuthToken,
ConfigVersion: payload.ConfigMessage,
},
Browser: c.authData.DevicePair.Browser,
})
if err != nil {
return nil, err
}
revokeResp, err := c.MakeRelayRequest(util.REVOKE_RELAY_PAIRING, payload)
if err != nil {
return nil, err
}
responseBody, err := io.ReadAll(revokeResp.Body)
defer revokeResp.Body.Close()
if err != nil {
return nil, err
}
parsedResponse := &binary.RevokeRelayPairingResponse{}
err = proto.Unmarshal(responseBody, parsedResponse)
if err != nil {
return nil, err
}
return parsedResponse, nil
}

View file

@ -13,6 +13,7 @@ var PAIRING = INSTANT_MESSAGING + "/$rpc/google.internal.communications.instantm
var REGISTER_PHONE_RELAY = PAIRING + "/RegisterPhoneRelay"
var REFRESH_PHONE_RELAY = PAIRING + "/RefreshPhoneRelay"
var GET_WEB_ENCRYPTION_KEY = PAIRING + "/GetWebEncryptionKey"
var REVOKE_RELAY_PAIRING = PAIRING + "/RevokeRelayPairing"
var MESSAGING = INSTANT_MESSAGING + "/$rpc/google.internal.communications.instantmessaging.v1.Messaging"
var RECEIVE_MESSAGES = MESSAGING + "/ReceiveMessages"

22
user.go
View file

@ -246,6 +246,7 @@ func (br *GMBridge) NewUser(dbUser *database.User) *User {
zlog: br.ZLog.With().Str("user_id", dbUser.MXID.String()).Logger(),
}
user.log = maulogadapt.ZeroAsMau(&user.zlog)
user.longPollingError = errors.New("not connected")
user.PermissionLevel = user.bridge.Config.Bridge.Permissions.Get(user.MXID)
user.Whitelisted = user.PermissionLevel >= bridgeconfig.PermissionLevelUser
@ -462,6 +463,7 @@ func (user *User) DeleteConnection() {
user.connLock.Lock()
defer user.connLock.Unlock()
user.unlockedDeleteConnection()
user.longPollingError = errors.New("not connected")
}
func (user *User) HasSession() bool {
@ -523,7 +525,7 @@ func (user *User) HandleEvent(event interface{}) {
StateEvent: status.StateBadCredentials,
Error: GMFatalError,
Info: map[string]any{"go_error": v.Error.Error()},
})
}, false)
case *events.ListenTemporaryError:
user.longPollingError = v.Error
user.BridgeState.Send(status.BridgeState{
@ -600,10 +602,10 @@ func (user *User) FillBridgeState(state status.BridgeState) status.BridgeState {
if state.Info == nil {
state.Info = make(map[string]any)
}
state.Info["battery_low"] = user.batteryLow
state.Info["mobile_data"] = user.mobileData
state.Info["browser_active"] = user.browserInactiveType == ""
if state.StateEvent == status.StateConnected {
state.Info["battery_low"] = user.batteryLow
state.Info["mobile_data"] = user.mobileData
state.Info["browser_active"] = user.browserInactiveType == ""
if user.longPollingError != nil {
state.StateEvent = status.StateTransientDisconnect
state.Error = GMListenError
@ -617,11 +619,19 @@ func (user *User) FillBridgeState(state status.BridgeState) status.BridgeState {
return state
}
func (user *User) Logout(state status.BridgeState) {
func (user *User) Logout(state status.BridgeState, unpair bool) (logoutOK bool) {
if user.Client != nil && unpair {
_, err := user.Client.Unpair()
if err != nil {
user.zlog.Debug().Err(err).Msg("Error sending unpair request")
} else {
logoutOK = true
}
}
user.removeFromPhoneMap(state)
// TODO invalidate token
user.DeleteConnection()
user.DeleteSession()
return
}
func (user *User) syncConversation(v *binary.Conversation) {