Handle send error statuses properly

This commit is contained in:
Tulir Asokan 2023-09-01 13:42:52 +03:00
parent 1618051a12
commit 328a3eac53
5 changed files with 187 additions and 128 deletions

View file

@ -221,6 +221,61 @@ func (GetOrCreateConversationResponse_Status) EnumDescriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{25, 0} 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 type SendReactionRequest_Action int32
const ( const (
@ -257,11 +312,11 @@ func (x SendReactionRequest_Action) String() string {
} }
func (SendReactionRequest_Action) Descriptor() protoreflect.EnumDescriptor { 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 { 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 { func (x SendReactionRequest_Action) Number() protoreflect.EnumNumber {
@ -2685,7 +2740,7 @@ type SendMessageResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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() { func (x *SendMessageResponse) Reset() {
@ -2720,11 +2775,11 @@ func (*SendMessageResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{43} return file_client_proto_rawDescGZIP(), []int{43}
} }
func (x *SendMessageResponse) GetType() int64 { func (x *SendMessageResponse) GetStatus() SendMessageResponse_Status {
if x != nil { if x != nil {
return x.Type return x.Status
} }
return 0 return SendMessageResponse_UNKNOWN
} }
type SendReactionRequest struct { type SendReactionRequest struct {
@ -3143,128 +3198,130 @@ func file_client_proto_rawDescGZIP() []byte {
return file_client_proto_rawDescData 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_msgTypes = make([]protoimpl.MessageInfo, 52)
var file_client_proto_goTypes = []interface{}{ var file_client_proto_goTypes = []interface{}{
(ConversationActionStatus)(0), // 0: client.ConversationActionStatus (ConversationActionStatus)(0), // 0: client.ConversationActionStatus
(ConversationMuteStatus)(0), // 1: client.ConversationMuteStatus (ConversationMuteStatus)(0), // 1: client.ConversationMuteStatus
(ListConversationsRequest_Folder)(0), // 2: client.ListConversationsRequest.Folder (ListConversationsRequest_Folder)(0), // 2: client.ListConversationsRequest.Folder
(GetOrCreateConversationResponse_Status)(0), // 3: client.GetOrCreateConversationResponse.Status (GetOrCreateConversationResponse_Status)(0), // 3: client.GetOrCreateConversationResponse.Status
(SendReactionRequest_Action)(0), // 4: client.SendReactionRequest.Action (SendMessageResponse_Status)(0), // 4: client.SendMessageResponse.Status
(*NotifyDittoActivityRequest)(nil), // 5: client.NotifyDittoActivityRequest (SendReactionRequest_Action)(0), // 5: client.SendReactionRequest.Action
(*NotifyDittoActivityResponse)(nil), // 6: client.NotifyDittoActivityResponse (*NotifyDittoActivityRequest)(nil), // 6: client.NotifyDittoActivityRequest
(*ReceiveMessagesRequest)(nil), // 7: client.ReceiveMessagesRequest (*NotifyDittoActivityResponse)(nil), // 7: client.NotifyDittoActivityResponse
(*MessageReadRequest)(nil), // 8: client.MessageReadRequest (*ReceiveMessagesRequest)(nil), // 8: client.ReceiveMessagesRequest
(*AckMessageRequest)(nil), // 9: client.AckMessageRequest (*MessageReadRequest)(nil), // 9: client.MessageReadRequest
(*DownloadAttachmentRequest)(nil), // 10: client.DownloadAttachmentRequest (*AckMessageRequest)(nil), // 10: client.AckMessageRequest
(*AttachmentInfo)(nil), // 11: client.AttachmentInfo (*DownloadAttachmentRequest)(nil), // 11: client.DownloadAttachmentRequest
(*StartMediaUploadRequest)(nil), // 12: client.StartMediaUploadRequest (*AttachmentInfo)(nil), // 12: client.AttachmentInfo
(*UploadMediaResponse)(nil), // 13: client.UploadMediaResponse (*StartMediaUploadRequest)(nil), // 13: client.StartMediaUploadRequest
(*UploadedMedia)(nil), // 14: client.UploadedMedia (*UploadMediaResponse)(nil), // 14: client.UploadMediaResponse
(*GetParticipantThumbnailRequest)(nil), // 15: client.GetParticipantThumbnailRequest (*UploadedMedia)(nil), // 15: client.UploadedMedia
(*GetParticipantThumbnailResponse)(nil), // 16: client.GetParticipantThumbnailResponse (*GetParticipantThumbnailRequest)(nil), // 16: client.GetParticipantThumbnailRequest
(*ParticipantThumbnail)(nil), // 17: client.ParticipantThumbnail (*GetParticipantThumbnailResponse)(nil), // 17: client.GetParticipantThumbnailResponse
(*GetContactsThumbnailRequest)(nil), // 18: client.GetContactsThumbnailRequest (*ParticipantThumbnail)(nil), // 18: client.ParticipantThumbnail
(*ThumbnailData)(nil), // 19: client.ThumbnailData (*GetContactsThumbnailRequest)(nil), // 19: client.GetContactsThumbnailRequest
(*Cursor)(nil), // 20: client.Cursor (*ThumbnailData)(nil), // 20: client.ThumbnailData
(*ListMessagesRequest)(nil), // 21: client.ListMessagesRequest (*Cursor)(nil), // 21: client.Cursor
(*ListMessagesResponse)(nil), // 22: client.ListMessagesResponse (*ListMessagesRequest)(nil), // 22: client.ListMessagesRequest
(*ListContactsRequest)(nil), // 23: client.ListContactsRequest (*ListMessagesResponse)(nil), // 23: client.ListMessagesResponse
(*ListTopContactsRequest)(nil), // 24: client.ListTopContactsRequest (*ListContactsRequest)(nil), // 24: client.ListContactsRequest
(*ListContactsResponse)(nil), // 25: client.ListContactsResponse (*ListTopContactsRequest)(nil), // 25: client.ListTopContactsRequest
(*ListTopContactsResponse)(nil), // 26: client.ListTopContactsResponse (*ListContactsResponse)(nil), // 26: client.ListContactsResponse
(*ListConversationsRequest)(nil), // 27: client.ListConversationsRequest (*ListTopContactsResponse)(nil), // 27: client.ListTopContactsResponse
(*ListConversationsResponse)(nil), // 28: client.ListConversationsResponse (*ListConversationsRequest)(nil), // 28: client.ListConversationsRequest
(*GetOrCreateConversationRequest)(nil), // 29: client.GetOrCreateConversationRequest (*ListConversationsResponse)(nil), // 29: client.ListConversationsResponse
(*GetOrCreateConversationResponse)(nil), // 30: client.GetOrCreateConversationResponse (*GetOrCreateConversationRequest)(nil), // 30: client.GetOrCreateConversationRequest
(*DeleteMessageRequest)(nil), // 31: client.DeleteMessageRequest (*GetOrCreateConversationResponse)(nil), // 31: client.GetOrCreateConversationResponse
(*DeleteMessageResponse)(nil), // 32: client.DeleteMessageResponse (*DeleteMessageRequest)(nil), // 32: client.DeleteMessageRequest
(*UpdateConversationRequest)(nil), // 33: client.UpdateConversationRequest (*DeleteMessageResponse)(nil), // 33: client.DeleteMessageResponse
(*ConversationAction5)(nil), // 34: client.ConversationAction5 (*UpdateConversationRequest)(nil), // 34: client.UpdateConversationRequest
(*UpdateConversationData)(nil), // 35: client.UpdateConversationData (*ConversationAction5)(nil), // 35: client.ConversationAction5
(*UpdateConversationResponse)(nil), // 36: client.UpdateConversationResponse (*UpdateConversationData)(nil), // 36: client.UpdateConversationData
(*GetConversationTypeRequest)(nil), // 37: client.GetConversationTypeRequest (*UpdateConversationResponse)(nil), // 37: client.UpdateConversationResponse
(*GetConversationTypeResponse)(nil), // 38: client.GetConversationTypeResponse (*GetConversationTypeRequest)(nil), // 38: client.GetConversationTypeRequest
(*GetConversationRequest)(nil), // 39: client.GetConversationRequest (*GetConversationTypeResponse)(nil), // 39: client.GetConversationTypeResponse
(*GetConversationResponse)(nil), // 40: client.GetConversationResponse (*GetConversationRequest)(nil), // 40: client.GetConversationRequest
(*OpenConversationRequest)(nil), // 41: client.OpenConversationRequest (*GetConversationResponse)(nil), // 41: client.GetConversationResponse
(*PrepareOpenConversationRequest)(nil), // 42: client.PrepareOpenConversationRequest (*OpenConversationRequest)(nil), // 42: client.OpenConversationRequest
(*IsBugleDefaultResponse)(nil), // 43: client.IsBugleDefaultResponse (*PrepareOpenConversationRequest)(nil), // 43: client.PrepareOpenConversationRequest
(*SendMessageRequest)(nil), // 44: client.SendMessageRequest (*IsBugleDefaultResponse)(nil), // 44: client.IsBugleDefaultResponse
(*ReplyPayload)(nil), // 45: client.ReplyPayload (*SendMessageRequest)(nil), // 45: client.SendMessageRequest
(*MessagePayload)(nil), // 46: client.MessagePayload (*ReplyPayload)(nil), // 46: client.ReplyPayload
(*MessagePayloadContent)(nil), // 47: client.MessagePayloadContent (*MessagePayload)(nil), // 47: client.MessagePayload
(*SendMessageResponse)(nil), // 48: client.SendMessageResponse (*MessagePayloadContent)(nil), // 48: client.MessagePayloadContent
(*SendReactionRequest)(nil), // 49: client.SendReactionRequest (*SendMessageResponse)(nil), // 49: client.SendMessageResponse
(*SendReactionResponse)(nil), // 50: client.SendReactionResponse (*SendReactionRequest)(nil), // 50: client.SendReactionRequest
(*ResendMessageRequest)(nil), // 51: client.ResendMessageRequest (*SendReactionResponse)(nil), // 51: client.SendReactionResponse
(*TypingUpdateRequest)(nil), // 52: client.TypingUpdateRequest (*ResendMessageRequest)(nil), // 52: client.ResendMessageRequest
(*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 53: client.ReceiveMessagesRequest.UnknownEmptyObject1 (*TypingUpdateRequest)(nil), // 53: client.TypingUpdateRequest
(*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 54: client.ReceiveMessagesRequest.UnknownEmptyObject2 (*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 54: client.ReceiveMessagesRequest.UnknownEmptyObject1
(*AckMessageRequest_Message)(nil), // 55: client.AckMessageRequest.Message (*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 55: client.ReceiveMessagesRequest.UnknownEmptyObject2
(*TypingUpdateRequest_Data)(nil), // 56: client.TypingUpdateRequest.Data (*AckMessageRequest_Message)(nil), // 56: client.AckMessageRequest.Message
(*AuthMessage)(nil), // 57: authentication.AuthMessage (*TypingUpdateRequest_Data)(nil), // 57: client.TypingUpdateRequest.Data
(*EmptyArr)(nil), // 58: util.EmptyArr (*AuthMessage)(nil), // 58: authentication.AuthMessage
(*Device)(nil), // 59: authentication.Device (*EmptyArr)(nil), // 59: util.EmptyArr
(*Dimensions)(nil), // 60: conversations.Dimensions (*Device)(nil), // 60: authentication.Device
(*Message)(nil), // 61: conversations.Message (*Dimensions)(nil), // 61: conversations.Dimensions
(*Contact)(nil), // 62: conversations.Contact (*Message)(nil), // 62: conversations.Message
(*Conversation)(nil), // 63: conversations.Conversation (*Contact)(nil), // 63: conversations.Contact
(*ContactNumber)(nil), // 64: conversations.ContactNumber (*Conversation)(nil), // 64: conversations.Conversation
(ConversationStatus)(0), // 65: conversations.ConversationStatus (*ContactNumber)(nil), // 65: conversations.ContactNumber
(*SIMPayload)(nil), // 66: settings.SIMPayload (ConversationStatus)(0), // 66: conversations.ConversationStatus
(*MessageInfo)(nil), // 67: conversations.MessageInfo (*SIMPayload)(nil), // 67: settings.SIMPayload
(*MessageContent)(nil), // 68: conversations.MessageContent (*MessageInfo)(nil), // 68: conversations.MessageInfo
(*ReactionData)(nil), // 69: conversations.ReactionData (*MessageContent)(nil), // 69: conversations.MessageContent
(*ReactionData)(nil), // 70: conversations.ReactionData
} }
var file_client_proto_depIdxs = []int32{ var file_client_proto_depIdxs = []int32{
57, // 0: client.ReceiveMessagesRequest.auth:type_name -> authentication.AuthMessage 58, // 0: client.ReceiveMessagesRequest.auth:type_name -> authentication.AuthMessage
54, // 1: client.ReceiveMessagesRequest.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject2 55, // 1: client.ReceiveMessagesRequest.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject2
57, // 2: client.AckMessageRequest.authData:type_name -> authentication.AuthMessage 58, // 2: client.AckMessageRequest.authData:type_name -> authentication.AuthMessage
58, // 3: client.AckMessageRequest.emptyArr:type_name -> util.EmptyArr 59, // 3: client.AckMessageRequest.emptyArr:type_name -> util.EmptyArr
55, // 4: client.AckMessageRequest.acks:type_name -> client.AckMessageRequest.Message 56, // 4: client.AckMessageRequest.acks:type_name -> client.AckMessageRequest.Message
11, // 5: client.DownloadAttachmentRequest.info:type_name -> client.AttachmentInfo 12, // 5: client.DownloadAttachmentRequest.info:type_name -> client.AttachmentInfo
57, // 6: client.DownloadAttachmentRequest.authData:type_name -> authentication.AuthMessage 58, // 6: client.DownloadAttachmentRequest.authData:type_name -> authentication.AuthMessage
57, // 7: client.StartMediaUploadRequest.authData:type_name -> authentication.AuthMessage 58, // 7: client.StartMediaUploadRequest.authData:type_name -> authentication.AuthMessage
59, // 8: client.StartMediaUploadRequest.mobile:type_name -> authentication.Device 60, // 8: client.StartMediaUploadRequest.mobile:type_name -> authentication.Device
14, // 9: client.UploadMediaResponse.media:type_name -> client.UploadedMedia 15, // 9: client.UploadMediaResponse.media:type_name -> client.UploadedMedia
17, // 10: client.GetParticipantThumbnailResponse.thumbnail:type_name -> client.ParticipantThumbnail 18, // 10: client.GetParticipantThumbnailResponse.thumbnail:type_name -> client.ParticipantThumbnail
19, // 11: client.ParticipantThumbnail.data:type_name -> client.ThumbnailData 20, // 11: client.ParticipantThumbnail.data:type_name -> client.ThumbnailData
60, // 12: client.ThumbnailData.dimensions:type_name -> conversations.Dimensions 61, // 12: client.ThumbnailData.dimensions:type_name -> conversations.Dimensions
20, // 13: client.ListMessagesRequest.cursor:type_name -> client.Cursor 21, // 13: client.ListMessagesRequest.cursor:type_name -> client.Cursor
61, // 14: client.ListMessagesResponse.messages:type_name -> conversations.Message 62, // 14: client.ListMessagesResponse.messages:type_name -> conversations.Message
20, // 15: client.ListMessagesResponse.cursor:type_name -> client.Cursor 21, // 15: client.ListMessagesResponse.cursor:type_name -> client.Cursor
62, // 16: client.ListContactsResponse.contacts:type_name -> conversations.Contact 63, // 16: client.ListContactsResponse.contacts:type_name -> conversations.Contact
62, // 17: client.ListTopContactsResponse.contacts:type_name -> conversations.Contact 63, // 17: client.ListTopContactsResponse.contacts:type_name -> conversations.Contact
2, // 18: client.ListConversationsRequest.folder:type_name -> client.ListConversationsRequest.Folder 2, // 18: client.ListConversationsRequest.folder:type_name -> client.ListConversationsRequest.Folder
20, // 19: client.ListConversationsRequest.cursor:type_name -> client.Cursor 21, // 19: client.ListConversationsRequest.cursor:type_name -> client.Cursor
63, // 20: client.ListConversationsResponse.conversations:type_name -> conversations.Conversation 64, // 20: client.ListConversationsResponse.conversations:type_name -> conversations.Conversation
20, // 21: client.ListConversationsResponse.cursor:type_name -> client.Cursor 21, // 21: client.ListConversationsResponse.cursor:type_name -> client.Cursor
64, // 22: client.GetOrCreateConversationRequest.numbers:type_name -> conversations.ContactNumber 65, // 22: client.GetOrCreateConversationRequest.numbers:type_name -> conversations.ContactNumber
63, // 23: client.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation 64, // 23: client.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation
3, // 24: client.GetOrCreateConversationResponse.status:type_name -> client.GetOrCreateConversationResponse.Status 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 0, // 26: client.UpdateConversationRequest.action:type_name -> client.ConversationActionStatus
34, // 27: client.UpdateConversationRequest.action5:type_name -> client.ConversationAction5 35, // 27: client.UpdateConversationRequest.action5:type_name -> client.ConversationAction5
65, // 28: client.UpdateConversationData.status:type_name -> conversations.ConversationStatus 66, // 28: client.UpdateConversationData.status:type_name -> conversations.ConversationStatus
1, // 29: client.UpdateConversationData.mute:type_name -> client.ConversationMuteStatus 1, // 29: client.UpdateConversationData.mute:type_name -> client.ConversationMuteStatus
63, // 30: client.GetConversationResponse.conversation:type_name -> conversations.Conversation 64, // 30: client.GetConversationResponse.conversation:type_name -> conversations.Conversation
46, // 31: client.SendMessageRequest.messagePayload:type_name -> client.MessagePayload 47, // 31: client.SendMessageRequest.messagePayload:type_name -> client.MessagePayload
66, // 32: client.SendMessageRequest.SIMPayload:type_name -> settings.SIMPayload 67, // 32: client.SendMessageRequest.SIMPayload:type_name -> settings.SIMPayload
45, // 33: client.SendMessageRequest.reply:type_name -> client.ReplyPayload 46, // 33: client.SendMessageRequest.reply:type_name -> client.ReplyPayload
47, // 34: client.MessagePayload.messagePayloadContent:type_name -> client.MessagePayloadContent 48, // 34: client.MessagePayload.messagePayloadContent:type_name -> client.MessagePayloadContent
67, // 35: client.MessagePayload.messageInfo:type_name -> conversations.MessageInfo 68, // 35: client.MessagePayload.messageInfo:type_name -> conversations.MessageInfo
68, // 36: client.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent 69, // 36: client.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent
69, // 37: client.SendReactionRequest.reactionData:type_name -> conversations.ReactionData 4, // 37: client.SendMessageResponse.status:type_name -> client.SendMessageResponse.Status
4, // 38: client.SendReactionRequest.action:type_name -> client.SendReactionRequest.Action 70, // 38: client.SendReactionRequest.reactionData:type_name -> conversations.ReactionData
56, // 39: client.TypingUpdateRequest.data:type_name -> client.TypingUpdateRequest.Data 5, // 39: client.SendReactionRequest.action:type_name -> client.SendReactionRequest.Action
53, // 40: client.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject1 57, // 40: client.TypingUpdateRequest.data:type_name -> client.TypingUpdateRequest.Data
59, // 41: client.AckMessageRequest.Message.device:type_name -> authentication.Device 54, // 41: client.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject1
42, // [42:42] is the sub-list for method output_type 60, // 42: client.AckMessageRequest.Message.device:type_name -> authentication.Device
42, // [42:42] is the sub-list for method input_type 43, // [43:43] is the sub-list for method output_type
42, // [42:42] is the sub-list for extension type_name 43, // [43:43] is the sub-list for method input_type
42, // [42:42] is the sub-list for extension extendee 43, // [43:43] is the sub-list for extension type_name
0, // [0:42] is the sub-list for field 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() } func init() { file_client_proto_init() }
@ -3915,7 +3972,7 @@ func file_client_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_client_proto_rawDesc, RawDescriptor: file_client_proto_rawDesc,
NumEnums: 5, NumEnums: 6,
NumMessages: 52, NumMessages: 52,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,

Binary file not shown.

View file

@ -274,7 +274,14 @@ message MessagePayloadContent {
} }
message SendMessageResponse { 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 { message SendReactionRequest {

View file

@ -226,13 +226,10 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin
} }
portal.sendStatusEvent(origEvtID, evt.ID, err, nil) portal.sendStatusEvent(origEvtID, evt.ID, err, nil)
} else { } else {
logEvt := portal.zlog.Debug(). portal.zlog.Debug().
Str("event_id", evt.ID.String()). Str("event_id", evt.ID.String()).
Str("event_type", evt.Type.Type) Str("event_type", evt.Type.Type).
if ms.responseType != 0 { Msg("Handled Matrix event")
logEvt = logEvt.Int64("response_type", ms.responseType)
}
logEvt.Msg("Handled Matrix event")
portal.sendDeliveryReceipt(evt.ID) portal.sendDeliveryReceipt(evt.ID)
if msgType != "message" { if msgType != "message" {
portal.bridge.SendMessageSuccessCheckpoint(evt, status.MsgStepRemote, ms.getRetryNum()) portal.bridge.SendMessageSuccessCheckpoint(evt, status.MsgStepRemote, ms.getRetryNum())
@ -275,7 +272,6 @@ type metricSender struct {
completed bool completed bool
retryNum int retryNum int
timings *messageTimings timings *messageTimings
responseType int64
} }
func (ms *metricSender) getRetryNum() int { func (ms *metricSender) getRetryNum() int {

View file

@ -1731,12 +1731,11 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event, timing
Msg("Sending Matrix message to Google Messages") Msg("Sending Matrix message to Google Messages")
start = time.Now() start = time.Now()
resp, err := sender.Client.SendMessage(req) resp, err := sender.Client.SendMessage(req)
if resp != nil {
ms.responseType = resp.Type
}
timings.send = time.Since(start) timings.send = time.Since(start)
if err != nil { if err != nil {
go ms.sendMessageMetrics(evt, err, "Error sending", true) 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 { } else {
go ms.sendMessageMetrics(evt, nil, "", true) go ms.sendMessageMetrics(evt, nil, "", true)
} }