From 328a3eac53e858049dac4d46e5473a4f9f85242c Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 1 Sep 2023 13:42:52 +0300 Subject: [PATCH] Handle send error statuses properly --- libgm/gmproto/client.pb.go | 291 +++++++++++++++++++++--------------- libgm/gmproto/client.pb.raw | Bin 6010 -> 6132 bytes libgm/gmproto/client.proto | 9 +- messagetracking.go | 10 +- portal.go | 5 +- 5 files changed, 187 insertions(+), 128 deletions(-) diff --git a/libgm/gmproto/client.pb.go b/libgm/gmproto/client.pb.go index e8f7cfa..e9520e2 100644 --- a/libgm/gmproto/client.pb.go +++ b/libgm/gmproto/client.pb.go @@ -221,6 +221,61 @@ func (GetOrCreateConversationResponse_Status) EnumDescriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{25, 0} } +type SendMessageResponse_Status int32 + +const ( + SendMessageResponse_UNKNOWN SendMessageResponse_Status = 0 + SendMessageResponse_SUCCESS SendMessageResponse_Status = 1 + SendMessageResponse_FAILURE_2 SendMessageResponse_Status = 2 + SendMessageResponse_FAILURE_3 SendMessageResponse_Status = 3 + SendMessageResponse_FAILURE_4 SendMessageResponse_Status = 4 +) + +// Enum value maps for SendMessageResponse_Status. +var ( + SendMessageResponse_Status_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SUCCESS", + 2: "FAILURE_2", + 3: "FAILURE_3", + 4: "FAILURE_4", + } + SendMessageResponse_Status_value = map[string]int32{ + "UNKNOWN": 0, + "SUCCESS": 1, + "FAILURE_2": 2, + "FAILURE_3": 3, + "FAILURE_4": 4, + } +) + +func (x SendMessageResponse_Status) Enum() *SendMessageResponse_Status { + p := new(SendMessageResponse_Status) + *p = x + return p +} + +func (x SendMessageResponse_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SendMessageResponse_Status) Descriptor() protoreflect.EnumDescriptor { + return file_client_proto_enumTypes[4].Descriptor() +} + +func (SendMessageResponse_Status) Type() protoreflect.EnumType { + return &file_client_proto_enumTypes[4] +} + +func (x SendMessageResponse_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SendMessageResponse_Status.Descriptor instead. +func (SendMessageResponse_Status) EnumDescriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{43, 0} +} + type SendReactionRequest_Action int32 const ( @@ -257,11 +312,11 @@ func (x SendReactionRequest_Action) String() string { } func (SendReactionRequest_Action) Descriptor() protoreflect.EnumDescriptor { - return file_client_proto_enumTypes[4].Descriptor() + return file_client_proto_enumTypes[5].Descriptor() } func (SendReactionRequest_Action) Type() protoreflect.EnumType { - return &file_client_proto_enumTypes[4] + return &file_client_proto_enumTypes[5] } func (x SendReactionRequest_Action) Number() protoreflect.EnumNumber { @@ -2685,7 +2740,7 @@ type SendMessageResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type int64 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"` + Status SendMessageResponse_Status `protobuf:"varint,3,opt,name=status,proto3,enum=client.SendMessageResponse_Status" json:"status,omitempty"` } func (x *SendMessageResponse) Reset() { @@ -2720,11 +2775,11 @@ func (*SendMessageResponse) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{43} } -func (x *SendMessageResponse) GetType() int64 { +func (x *SendMessageResponse) GetStatus() SendMessageResponse_Status { if x != nil { - return x.Type + return x.Status } - return 0 + return SendMessageResponse_UNKNOWN } type SendReactionRequest struct { @@ -3143,128 +3198,130 @@ func file_client_proto_rawDescGZIP() []byte { return file_client_proto_rawDescData } -var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 52) var file_client_proto_goTypes = []interface{}{ (ConversationActionStatus)(0), // 0: client.ConversationActionStatus (ConversationMuteStatus)(0), // 1: client.ConversationMuteStatus (ListConversationsRequest_Folder)(0), // 2: client.ListConversationsRequest.Folder (GetOrCreateConversationResponse_Status)(0), // 3: client.GetOrCreateConversationResponse.Status - (SendReactionRequest_Action)(0), // 4: client.SendReactionRequest.Action - (*NotifyDittoActivityRequest)(nil), // 5: client.NotifyDittoActivityRequest - (*NotifyDittoActivityResponse)(nil), // 6: client.NotifyDittoActivityResponse - (*ReceiveMessagesRequest)(nil), // 7: client.ReceiveMessagesRequest - (*MessageReadRequest)(nil), // 8: client.MessageReadRequest - (*AckMessageRequest)(nil), // 9: client.AckMessageRequest - (*DownloadAttachmentRequest)(nil), // 10: client.DownloadAttachmentRequest - (*AttachmentInfo)(nil), // 11: client.AttachmentInfo - (*StartMediaUploadRequest)(nil), // 12: client.StartMediaUploadRequest - (*UploadMediaResponse)(nil), // 13: client.UploadMediaResponse - (*UploadedMedia)(nil), // 14: client.UploadedMedia - (*GetParticipantThumbnailRequest)(nil), // 15: client.GetParticipantThumbnailRequest - (*GetParticipantThumbnailResponse)(nil), // 16: client.GetParticipantThumbnailResponse - (*ParticipantThumbnail)(nil), // 17: client.ParticipantThumbnail - (*GetContactsThumbnailRequest)(nil), // 18: client.GetContactsThumbnailRequest - (*ThumbnailData)(nil), // 19: client.ThumbnailData - (*Cursor)(nil), // 20: client.Cursor - (*ListMessagesRequest)(nil), // 21: client.ListMessagesRequest - (*ListMessagesResponse)(nil), // 22: client.ListMessagesResponse - (*ListContactsRequest)(nil), // 23: client.ListContactsRequest - (*ListTopContactsRequest)(nil), // 24: client.ListTopContactsRequest - (*ListContactsResponse)(nil), // 25: client.ListContactsResponse - (*ListTopContactsResponse)(nil), // 26: client.ListTopContactsResponse - (*ListConversationsRequest)(nil), // 27: client.ListConversationsRequest - (*ListConversationsResponse)(nil), // 28: client.ListConversationsResponse - (*GetOrCreateConversationRequest)(nil), // 29: client.GetOrCreateConversationRequest - (*GetOrCreateConversationResponse)(nil), // 30: client.GetOrCreateConversationResponse - (*DeleteMessageRequest)(nil), // 31: client.DeleteMessageRequest - (*DeleteMessageResponse)(nil), // 32: client.DeleteMessageResponse - (*UpdateConversationRequest)(nil), // 33: client.UpdateConversationRequest - (*ConversationAction5)(nil), // 34: client.ConversationAction5 - (*UpdateConversationData)(nil), // 35: client.UpdateConversationData - (*UpdateConversationResponse)(nil), // 36: client.UpdateConversationResponse - (*GetConversationTypeRequest)(nil), // 37: client.GetConversationTypeRequest - (*GetConversationTypeResponse)(nil), // 38: client.GetConversationTypeResponse - (*GetConversationRequest)(nil), // 39: client.GetConversationRequest - (*GetConversationResponse)(nil), // 40: client.GetConversationResponse - (*OpenConversationRequest)(nil), // 41: client.OpenConversationRequest - (*PrepareOpenConversationRequest)(nil), // 42: client.PrepareOpenConversationRequest - (*IsBugleDefaultResponse)(nil), // 43: client.IsBugleDefaultResponse - (*SendMessageRequest)(nil), // 44: client.SendMessageRequest - (*ReplyPayload)(nil), // 45: client.ReplyPayload - (*MessagePayload)(nil), // 46: client.MessagePayload - (*MessagePayloadContent)(nil), // 47: client.MessagePayloadContent - (*SendMessageResponse)(nil), // 48: client.SendMessageResponse - (*SendReactionRequest)(nil), // 49: client.SendReactionRequest - (*SendReactionResponse)(nil), // 50: client.SendReactionResponse - (*ResendMessageRequest)(nil), // 51: client.ResendMessageRequest - (*TypingUpdateRequest)(nil), // 52: client.TypingUpdateRequest - (*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 53: client.ReceiveMessagesRequest.UnknownEmptyObject1 - (*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 54: client.ReceiveMessagesRequest.UnknownEmptyObject2 - (*AckMessageRequest_Message)(nil), // 55: client.AckMessageRequest.Message - (*TypingUpdateRequest_Data)(nil), // 56: client.TypingUpdateRequest.Data - (*AuthMessage)(nil), // 57: authentication.AuthMessage - (*EmptyArr)(nil), // 58: util.EmptyArr - (*Device)(nil), // 59: authentication.Device - (*Dimensions)(nil), // 60: conversations.Dimensions - (*Message)(nil), // 61: conversations.Message - (*Contact)(nil), // 62: conversations.Contact - (*Conversation)(nil), // 63: conversations.Conversation - (*ContactNumber)(nil), // 64: conversations.ContactNumber - (ConversationStatus)(0), // 65: conversations.ConversationStatus - (*SIMPayload)(nil), // 66: settings.SIMPayload - (*MessageInfo)(nil), // 67: conversations.MessageInfo - (*MessageContent)(nil), // 68: conversations.MessageContent - (*ReactionData)(nil), // 69: conversations.ReactionData + (SendMessageResponse_Status)(0), // 4: client.SendMessageResponse.Status + (SendReactionRequest_Action)(0), // 5: client.SendReactionRequest.Action + (*NotifyDittoActivityRequest)(nil), // 6: client.NotifyDittoActivityRequest + (*NotifyDittoActivityResponse)(nil), // 7: client.NotifyDittoActivityResponse + (*ReceiveMessagesRequest)(nil), // 8: client.ReceiveMessagesRequest + (*MessageReadRequest)(nil), // 9: client.MessageReadRequest + (*AckMessageRequest)(nil), // 10: client.AckMessageRequest + (*DownloadAttachmentRequest)(nil), // 11: client.DownloadAttachmentRequest + (*AttachmentInfo)(nil), // 12: client.AttachmentInfo + (*StartMediaUploadRequest)(nil), // 13: client.StartMediaUploadRequest + (*UploadMediaResponse)(nil), // 14: client.UploadMediaResponse + (*UploadedMedia)(nil), // 15: client.UploadedMedia + (*GetParticipantThumbnailRequest)(nil), // 16: client.GetParticipantThumbnailRequest + (*GetParticipantThumbnailResponse)(nil), // 17: client.GetParticipantThumbnailResponse + (*ParticipantThumbnail)(nil), // 18: client.ParticipantThumbnail + (*GetContactsThumbnailRequest)(nil), // 19: client.GetContactsThumbnailRequest + (*ThumbnailData)(nil), // 20: client.ThumbnailData + (*Cursor)(nil), // 21: client.Cursor + (*ListMessagesRequest)(nil), // 22: client.ListMessagesRequest + (*ListMessagesResponse)(nil), // 23: client.ListMessagesResponse + (*ListContactsRequest)(nil), // 24: client.ListContactsRequest + (*ListTopContactsRequest)(nil), // 25: client.ListTopContactsRequest + (*ListContactsResponse)(nil), // 26: client.ListContactsResponse + (*ListTopContactsResponse)(nil), // 27: client.ListTopContactsResponse + (*ListConversationsRequest)(nil), // 28: client.ListConversationsRequest + (*ListConversationsResponse)(nil), // 29: client.ListConversationsResponse + (*GetOrCreateConversationRequest)(nil), // 30: client.GetOrCreateConversationRequest + (*GetOrCreateConversationResponse)(nil), // 31: client.GetOrCreateConversationResponse + (*DeleteMessageRequest)(nil), // 32: client.DeleteMessageRequest + (*DeleteMessageResponse)(nil), // 33: client.DeleteMessageResponse + (*UpdateConversationRequest)(nil), // 34: client.UpdateConversationRequest + (*ConversationAction5)(nil), // 35: client.ConversationAction5 + (*UpdateConversationData)(nil), // 36: client.UpdateConversationData + (*UpdateConversationResponse)(nil), // 37: client.UpdateConversationResponse + (*GetConversationTypeRequest)(nil), // 38: client.GetConversationTypeRequest + (*GetConversationTypeResponse)(nil), // 39: client.GetConversationTypeResponse + (*GetConversationRequest)(nil), // 40: client.GetConversationRequest + (*GetConversationResponse)(nil), // 41: client.GetConversationResponse + (*OpenConversationRequest)(nil), // 42: client.OpenConversationRequest + (*PrepareOpenConversationRequest)(nil), // 43: client.PrepareOpenConversationRequest + (*IsBugleDefaultResponse)(nil), // 44: client.IsBugleDefaultResponse + (*SendMessageRequest)(nil), // 45: client.SendMessageRequest + (*ReplyPayload)(nil), // 46: client.ReplyPayload + (*MessagePayload)(nil), // 47: client.MessagePayload + (*MessagePayloadContent)(nil), // 48: client.MessagePayloadContent + (*SendMessageResponse)(nil), // 49: client.SendMessageResponse + (*SendReactionRequest)(nil), // 50: client.SendReactionRequest + (*SendReactionResponse)(nil), // 51: client.SendReactionResponse + (*ResendMessageRequest)(nil), // 52: client.ResendMessageRequest + (*TypingUpdateRequest)(nil), // 53: client.TypingUpdateRequest + (*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 54: client.ReceiveMessagesRequest.UnknownEmptyObject1 + (*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 55: client.ReceiveMessagesRequest.UnknownEmptyObject2 + (*AckMessageRequest_Message)(nil), // 56: client.AckMessageRequest.Message + (*TypingUpdateRequest_Data)(nil), // 57: client.TypingUpdateRequest.Data + (*AuthMessage)(nil), // 58: authentication.AuthMessage + (*EmptyArr)(nil), // 59: util.EmptyArr + (*Device)(nil), // 60: authentication.Device + (*Dimensions)(nil), // 61: conversations.Dimensions + (*Message)(nil), // 62: conversations.Message + (*Contact)(nil), // 63: conversations.Contact + (*Conversation)(nil), // 64: conversations.Conversation + (*ContactNumber)(nil), // 65: conversations.ContactNumber + (ConversationStatus)(0), // 66: conversations.ConversationStatus + (*SIMPayload)(nil), // 67: settings.SIMPayload + (*MessageInfo)(nil), // 68: conversations.MessageInfo + (*MessageContent)(nil), // 69: conversations.MessageContent + (*ReactionData)(nil), // 70: conversations.ReactionData } var file_client_proto_depIdxs = []int32{ - 57, // 0: client.ReceiveMessagesRequest.auth:type_name -> authentication.AuthMessage - 54, // 1: client.ReceiveMessagesRequest.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject2 - 57, // 2: client.AckMessageRequest.authData:type_name -> authentication.AuthMessage - 58, // 3: client.AckMessageRequest.emptyArr:type_name -> util.EmptyArr - 55, // 4: client.AckMessageRequest.acks:type_name -> client.AckMessageRequest.Message - 11, // 5: client.DownloadAttachmentRequest.info:type_name -> client.AttachmentInfo - 57, // 6: client.DownloadAttachmentRequest.authData:type_name -> authentication.AuthMessage - 57, // 7: client.StartMediaUploadRequest.authData:type_name -> authentication.AuthMessage - 59, // 8: client.StartMediaUploadRequest.mobile:type_name -> authentication.Device - 14, // 9: client.UploadMediaResponse.media:type_name -> client.UploadedMedia - 17, // 10: client.GetParticipantThumbnailResponse.thumbnail:type_name -> client.ParticipantThumbnail - 19, // 11: client.ParticipantThumbnail.data:type_name -> client.ThumbnailData - 60, // 12: client.ThumbnailData.dimensions:type_name -> conversations.Dimensions - 20, // 13: client.ListMessagesRequest.cursor:type_name -> client.Cursor - 61, // 14: client.ListMessagesResponse.messages:type_name -> conversations.Message - 20, // 15: client.ListMessagesResponse.cursor:type_name -> client.Cursor - 62, // 16: client.ListContactsResponse.contacts:type_name -> conversations.Contact - 62, // 17: client.ListTopContactsResponse.contacts:type_name -> conversations.Contact + 58, // 0: client.ReceiveMessagesRequest.auth:type_name -> authentication.AuthMessage + 55, // 1: client.ReceiveMessagesRequest.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject2 + 58, // 2: client.AckMessageRequest.authData:type_name -> authentication.AuthMessage + 59, // 3: client.AckMessageRequest.emptyArr:type_name -> util.EmptyArr + 56, // 4: client.AckMessageRequest.acks:type_name -> client.AckMessageRequest.Message + 12, // 5: client.DownloadAttachmentRequest.info:type_name -> client.AttachmentInfo + 58, // 6: client.DownloadAttachmentRequest.authData:type_name -> authentication.AuthMessage + 58, // 7: client.StartMediaUploadRequest.authData:type_name -> authentication.AuthMessage + 60, // 8: client.StartMediaUploadRequest.mobile:type_name -> authentication.Device + 15, // 9: client.UploadMediaResponse.media:type_name -> client.UploadedMedia + 18, // 10: client.GetParticipantThumbnailResponse.thumbnail:type_name -> client.ParticipantThumbnail + 20, // 11: client.ParticipantThumbnail.data:type_name -> client.ThumbnailData + 61, // 12: client.ThumbnailData.dimensions:type_name -> conversations.Dimensions + 21, // 13: client.ListMessagesRequest.cursor:type_name -> client.Cursor + 62, // 14: client.ListMessagesResponse.messages:type_name -> conversations.Message + 21, // 15: client.ListMessagesResponse.cursor:type_name -> client.Cursor + 63, // 16: client.ListContactsResponse.contacts:type_name -> conversations.Contact + 63, // 17: client.ListTopContactsResponse.contacts:type_name -> conversations.Contact 2, // 18: client.ListConversationsRequest.folder:type_name -> client.ListConversationsRequest.Folder - 20, // 19: client.ListConversationsRequest.cursor:type_name -> client.Cursor - 63, // 20: client.ListConversationsResponse.conversations:type_name -> conversations.Conversation - 20, // 21: client.ListConversationsResponse.cursor:type_name -> client.Cursor - 64, // 22: client.GetOrCreateConversationRequest.numbers:type_name -> conversations.ContactNumber - 63, // 23: client.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation + 21, // 19: client.ListConversationsRequest.cursor:type_name -> client.Cursor + 64, // 20: client.ListConversationsResponse.conversations:type_name -> conversations.Conversation + 21, // 21: client.ListConversationsResponse.cursor:type_name -> client.Cursor + 65, // 22: client.GetOrCreateConversationRequest.numbers:type_name -> conversations.ContactNumber + 64, // 23: client.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation 3, // 24: client.GetOrCreateConversationResponse.status:type_name -> client.GetOrCreateConversationResponse.Status - 35, // 25: client.UpdateConversationRequest.data:type_name -> client.UpdateConversationData + 36, // 25: client.UpdateConversationRequest.data:type_name -> client.UpdateConversationData 0, // 26: client.UpdateConversationRequest.action:type_name -> client.ConversationActionStatus - 34, // 27: client.UpdateConversationRequest.action5:type_name -> client.ConversationAction5 - 65, // 28: client.UpdateConversationData.status:type_name -> conversations.ConversationStatus + 35, // 27: client.UpdateConversationRequest.action5:type_name -> client.ConversationAction5 + 66, // 28: client.UpdateConversationData.status:type_name -> conversations.ConversationStatus 1, // 29: client.UpdateConversationData.mute:type_name -> client.ConversationMuteStatus - 63, // 30: client.GetConversationResponse.conversation:type_name -> conversations.Conversation - 46, // 31: client.SendMessageRequest.messagePayload:type_name -> client.MessagePayload - 66, // 32: client.SendMessageRequest.SIMPayload:type_name -> settings.SIMPayload - 45, // 33: client.SendMessageRequest.reply:type_name -> client.ReplyPayload - 47, // 34: client.MessagePayload.messagePayloadContent:type_name -> client.MessagePayloadContent - 67, // 35: client.MessagePayload.messageInfo:type_name -> conversations.MessageInfo - 68, // 36: client.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent - 69, // 37: client.SendReactionRequest.reactionData:type_name -> conversations.ReactionData - 4, // 38: client.SendReactionRequest.action:type_name -> client.SendReactionRequest.Action - 56, // 39: client.TypingUpdateRequest.data:type_name -> client.TypingUpdateRequest.Data - 53, // 40: client.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject1 - 59, // 41: client.AckMessageRequest.Message.device:type_name -> authentication.Device - 42, // [42:42] is the sub-list for method output_type - 42, // [42:42] is the sub-list for method input_type - 42, // [42:42] is the sub-list for extension type_name - 42, // [42:42] is the sub-list for extension extendee - 0, // [0:42] is the sub-list for field type_name + 64, // 30: client.GetConversationResponse.conversation:type_name -> conversations.Conversation + 47, // 31: client.SendMessageRequest.messagePayload:type_name -> client.MessagePayload + 67, // 32: client.SendMessageRequest.SIMPayload:type_name -> settings.SIMPayload + 46, // 33: client.SendMessageRequest.reply:type_name -> client.ReplyPayload + 48, // 34: client.MessagePayload.messagePayloadContent:type_name -> client.MessagePayloadContent + 68, // 35: client.MessagePayload.messageInfo:type_name -> conversations.MessageInfo + 69, // 36: client.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent + 4, // 37: client.SendMessageResponse.status:type_name -> client.SendMessageResponse.Status + 70, // 38: client.SendReactionRequest.reactionData:type_name -> conversations.ReactionData + 5, // 39: client.SendReactionRequest.action:type_name -> client.SendReactionRequest.Action + 57, // 40: client.TypingUpdateRequest.data:type_name -> client.TypingUpdateRequest.Data + 54, // 41: client.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject1 + 60, // 42: client.AckMessageRequest.Message.device:type_name -> authentication.Device + 43, // [43:43] is the sub-list for method output_type + 43, // [43:43] is the sub-list for method input_type + 43, // [43:43] is the sub-list for extension type_name + 43, // [43:43] is the sub-list for extension extendee + 0, // [0:43] is the sub-list for field type_name } func init() { file_client_proto_init() } @@ -3915,7 +3972,7 @@ func file_client_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_client_proto_rawDesc, - NumEnums: 5, + NumEnums: 6, NumMessages: 52, NumExtensions: 0, NumServices: 0, diff --git a/libgm/gmproto/client.pb.raw b/libgm/gmproto/client.pb.raw index bcdb622bde4f95afe683ae53b3328fa250d698bf..7ece16c9ed61ec50b91463cb338d3e4d48fae097 100644 GIT binary patch delta 128 zcmeyR_eFoh4iTG0j9kLOsd*{Bsl~;K>8U}f#Rd6!#i>G8Tx`W9i6y1Q63hyW8hl1d zddWGNsd*)ONQx&5@=7rJPuAj9*5T#ibaV9d2@P_MHxghHLgE?=Fe7tK1Xwmd5}CmS E04&-hQUCw| delta 55 zcmeyO|4VPf4iPO)F5%$RycFNm;^M^g)S%Sjg8aPVR3RZQmXgYXR0(DUMh)g5Fne>1 H=nN(RC^ixY diff --git a/libgm/gmproto/client.proto b/libgm/gmproto/client.proto index 6e13b0d..6a5eb88 100644 --- a/libgm/gmproto/client.proto +++ b/libgm/gmproto/client.proto @@ -274,7 +274,14 @@ message MessagePayloadContent { } message SendMessageResponse { - int64 type = 3; + enum Status { + UNKNOWN = 0; + SUCCESS = 1; + FAILURE_2 = 2; + FAILURE_3 = 3; + FAILURE_4 = 4; + } + Status status = 3; } message SendReactionRequest { diff --git a/messagetracking.go b/messagetracking.go index e2b3e3a..55bef34 100644 --- a/messagetracking.go +++ b/messagetracking.go @@ -226,13 +226,10 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin } portal.sendStatusEvent(origEvtID, evt.ID, err, nil) } else { - logEvt := portal.zlog.Debug(). + portal.zlog.Debug(). Str("event_id", evt.ID.String()). - Str("event_type", evt.Type.Type) - if ms.responseType != 0 { - logEvt = logEvt.Int64("response_type", ms.responseType) - } - logEvt.Msg("Handled Matrix event") + Str("event_type", evt.Type.Type). + Msg("Handled Matrix event") portal.sendDeliveryReceipt(evt.ID) if msgType != "message" { portal.bridge.SendMessageSuccessCheckpoint(evt, status.MsgStepRemote, ms.getRetryNum()) @@ -275,7 +272,6 @@ type metricSender struct { completed bool retryNum int timings *messageTimings - responseType int64 } func (ms *metricSender) getRetryNum() int { diff --git a/portal.go b/portal.go index 5bb7c0a..3125747 100644 --- a/portal.go +++ b/portal.go @@ -1731,12 +1731,11 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event, timing Msg("Sending Matrix message to Google Messages") start = time.Now() resp, err := sender.Client.SendMessage(req) - if resp != nil { - ms.responseType = resp.Type - } timings.send = time.Since(start) if err != nil { go ms.sendMessageMetrics(evt, err, "Error sending", true) + } else if resp.Status != gmproto.SendMessageResponse_SUCCESS { + go ms.sendMessageMetrics(evt, fmt.Errorf("response status %d", resp.Status), "Error sending", true) } else { go ms.sendMessageMetrics(evt, nil, "", true) }