Log conversation status when syncing

This commit is contained in:
Tulir Asokan 2023-07-24 16:46:54 +03:00
parent a463f06c48
commit 57dfe0fc72
7 changed files with 201 additions and 242 deletions

View file

@ -22,58 +22,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type ConversationStatus int32
const (
ConversationStatus_UNKNOWN_STATUS ConversationStatus = 0
ConversationStatus_UNARCHIVE ConversationStatus = 1
ConversationStatus_ARCHIVE ConversationStatus = 2
ConversationStatus_DELETE ConversationStatus = 3
)
// Enum value maps for ConversationStatus.
var (
ConversationStatus_name = map[int32]string{
0: "UNKNOWN_STATUS",
1: "UNARCHIVE",
2: "ARCHIVE",
3: "DELETE",
}
ConversationStatus_value = map[string]int32{
"UNKNOWN_STATUS": 0,
"UNARCHIVE": 1,
"ARCHIVE": 2,
"DELETE": 3,
}
)
func (x ConversationStatus) Enum() *ConversationStatus {
p := new(ConversationStatus)
*p = x
return p
}
func (x ConversationStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ConversationStatus) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[0].Descriptor()
}
func (ConversationStatus) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[0]
}
func (x ConversationStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ConversationStatus.Descriptor instead.
func (ConversationStatus) EnumDescriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{0}
}
type ConversationActionStatus int32 type ConversationActionStatus int32
const ( const (
@ -110,11 +58,11 @@ func (x ConversationActionStatus) String() string {
} }
func (ConversationActionStatus) Descriptor() protoreflect.EnumDescriptor { func (ConversationActionStatus) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[1].Descriptor() return file_client_proto_enumTypes[0].Descriptor()
} }
func (ConversationActionStatus) Type() protoreflect.EnumType { func (ConversationActionStatus) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[1] return &file_client_proto_enumTypes[0]
} }
func (x ConversationActionStatus) Number() protoreflect.EnumNumber { func (x ConversationActionStatus) Number() protoreflect.EnumNumber {
@ -123,7 +71,7 @@ func (x ConversationActionStatus) Number() protoreflect.EnumNumber {
// Deprecated: Use ConversationActionStatus.Descriptor instead. // Deprecated: Use ConversationActionStatus.Descriptor instead.
func (ConversationActionStatus) EnumDescriptor() ([]byte, []int) { func (ConversationActionStatus) EnumDescriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{1} return file_client_proto_rawDescGZIP(), []int{0}
} }
type ConversationMuteStatus int32 type ConversationMuteStatus int32
@ -156,11 +104,11 @@ func (x ConversationMuteStatus) String() string {
} }
func (ConversationMuteStatus) Descriptor() protoreflect.EnumDescriptor { func (ConversationMuteStatus) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[2].Descriptor() return file_client_proto_enumTypes[1].Descriptor()
} }
func (ConversationMuteStatus) Type() protoreflect.EnumType { func (ConversationMuteStatus) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[2] return &file_client_proto_enumTypes[1]
} }
func (x ConversationMuteStatus) Number() protoreflect.EnumNumber { func (x ConversationMuteStatus) Number() protoreflect.EnumNumber {
@ -169,7 +117,7 @@ func (x ConversationMuteStatus) Number() protoreflect.EnumNumber {
// Deprecated: Use ConversationMuteStatus.Descriptor instead. // Deprecated: Use ConversationMuteStatus.Descriptor instead.
func (ConversationMuteStatus) EnumDescriptor() ([]byte, []int) { func (ConversationMuteStatus) EnumDescriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{2} return file_client_proto_rawDescGZIP(), []int{1}
} }
type ListConversationsRequest_Folder int32 type ListConversationsRequest_Folder int32
@ -208,11 +156,11 @@ func (x ListConversationsRequest_Folder) String() string {
} }
func (ListConversationsRequest_Folder) Descriptor() protoreflect.EnumDescriptor { func (ListConversationsRequest_Folder) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[3].Descriptor() return file_client_proto_enumTypes[2].Descriptor()
} }
func (ListConversationsRequest_Folder) Type() protoreflect.EnumType { func (ListConversationsRequest_Folder) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[3] return &file_client_proto_enumTypes[2]
} }
func (x ListConversationsRequest_Folder) Number() protoreflect.EnumNumber { func (x ListConversationsRequest_Folder) Number() protoreflect.EnumNumber {
@ -257,11 +205,11 @@ func (x GetOrCreateConversationResponse_Status) String() string {
} }
func (GetOrCreateConversationResponse_Status) Descriptor() protoreflect.EnumDescriptor { func (GetOrCreateConversationResponse_Status) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[4].Descriptor() return file_client_proto_enumTypes[3].Descriptor()
} }
func (GetOrCreateConversationResponse_Status) Type() protoreflect.EnumType { func (GetOrCreateConversationResponse_Status) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[4] return &file_client_proto_enumTypes[3]
} }
func (x GetOrCreateConversationResponse_Status) Number() protoreflect.EnumNumber { func (x GetOrCreateConversationResponse_Status) Number() protoreflect.EnumNumber {
@ -309,11 +257,11 @@ func (x SendReactionRequest_Action) String() string {
} }
func (SendReactionRequest_Action) Descriptor() protoreflect.EnumDescriptor { func (SendReactionRequest_Action) Descriptor() protoreflect.EnumDescriptor {
return file_client_proto_enumTypes[5].Descriptor() return file_client_proto_enumTypes[4].Descriptor()
} }
func (SendReactionRequest_Action) Type() protoreflect.EnumType { func (SendReactionRequest_Action) Type() protoreflect.EnumType {
return &file_client_proto_enumTypes[5] return &file_client_proto_enumTypes[4]
} }
func (x SendReactionRequest_Action) Number() protoreflect.EnumNumber { func (x SendReactionRequest_Action) Number() protoreflect.EnumNumber {
@ -2038,7 +1986,7 @@ func (x *UpdateConversationData) GetStatus() ConversationStatus {
if x, ok := x.GetData().(*UpdateConversationData_Status); ok { if x, ok := x.GetData().(*UpdateConversationData_Status); ok {
return x.Status return x.Status
} }
return ConversationStatus_UNKNOWN_STATUS return ConversationStatus_UNKNOWN_CONVERSATION_STATUS
} }
func (x *UpdateConversationData) GetMute() ConversationMuteStatus { func (x *UpdateConversationData) GetMute() ConversationMuteStatus {
@ -2053,7 +2001,7 @@ type isUpdateConversationData_Data interface {
} }
type UpdateConversationData_Status struct { type UpdateConversationData_Status struct {
Status ConversationStatus `protobuf:"varint,12,opt,name=status,proto3,enum=client.ConversationStatus,oneof"` Status ConversationStatus `protobuf:"varint,12,opt,name=status,proto3,enum=conversations.ConversationStatus,oneof"`
} }
type UpdateConversationData_Mute struct { type UpdateConversationData_Mute struct {
@ -3187,121 +3135,121 @@ func file_client_proto_rawDescGZIP() []byte {
return file_client_proto_rawDescData return file_client_proto_rawDescData
} }
var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
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{}{
(ConversationStatus)(0), // 0: client.ConversationStatus (ConversationActionStatus)(0), // 0: client.ConversationActionStatus
(ConversationActionStatus)(0), // 1: client.ConversationActionStatus (ConversationMuteStatus)(0), // 1: client.ConversationMuteStatus
(ConversationMuteStatus)(0), // 2: client.ConversationMuteStatus (ListConversationsRequest_Folder)(0), // 2: client.ListConversationsRequest.Folder
(ListConversationsRequest_Folder)(0), // 3: client.ListConversationsRequest.Folder (GetOrCreateConversationResponse_Status)(0), // 3: client.GetOrCreateConversationResponse.Status
(GetOrCreateConversationResponse_Status)(0), // 4: client.GetOrCreateConversationResponse.Status (SendReactionRequest_Action)(0), // 4: client.SendReactionRequest.Action
(SendReactionRequest_Action)(0), // 5: client.SendReactionRequest.Action (*NotifyDittoActivityRequest)(nil), // 5: client.NotifyDittoActivityRequest
(*NotifyDittoActivityRequest)(nil), // 6: client.NotifyDittoActivityRequest (*NotifyDittoActivityResponse)(nil), // 6: client.NotifyDittoActivityResponse
(*NotifyDittoActivityResponse)(nil), // 7: client.NotifyDittoActivityResponse (*ReceiveMessagesRequest)(nil), // 7: client.ReceiveMessagesRequest
(*ReceiveMessagesRequest)(nil), // 8: client.ReceiveMessagesRequest (*MessageReadRequest)(nil), // 8: client.MessageReadRequest
(*MessageReadRequest)(nil), // 9: client.MessageReadRequest (*AckMessageRequest)(nil), // 9: client.AckMessageRequest
(*AckMessageRequest)(nil), // 10: client.AckMessageRequest (*DownloadAttachmentRequest)(nil), // 10: client.DownloadAttachmentRequest
(*DownloadAttachmentRequest)(nil), // 11: client.DownloadAttachmentRequest (*AttachmentInfo)(nil), // 11: client.AttachmentInfo
(*AttachmentInfo)(nil), // 12: client.AttachmentInfo (*StartMediaUploadRequest)(nil), // 12: client.StartMediaUploadRequest
(*StartMediaUploadRequest)(nil), // 13: client.StartMediaUploadRequest (*UploadMediaResponse)(nil), // 13: client.UploadMediaResponse
(*UploadMediaResponse)(nil), // 14: client.UploadMediaResponse (*UploadedMedia)(nil), // 14: client.UploadedMedia
(*UploadedMedia)(nil), // 15: client.UploadedMedia (*GetParticipantThumbnailRequest)(nil), // 15: client.GetParticipantThumbnailRequest
(*GetParticipantThumbnailRequest)(nil), // 16: client.GetParticipantThumbnailRequest (*GetParticipantThumbnailResponse)(nil), // 16: client.GetParticipantThumbnailResponse
(*GetParticipantThumbnailResponse)(nil), // 17: client.GetParticipantThumbnailResponse (*ParticipantThumbnail)(nil), // 17: client.ParticipantThumbnail
(*ParticipantThumbnail)(nil), // 18: client.ParticipantThumbnail (*GetContactsThumbnailRequest)(nil), // 18: client.GetContactsThumbnailRequest
(*GetContactsThumbnailRequest)(nil), // 19: client.GetContactsThumbnailRequest (*ThumbnailData)(nil), // 19: client.ThumbnailData
(*ThumbnailData)(nil), // 20: client.ThumbnailData (*Cursor)(nil), // 20: client.Cursor
(*Cursor)(nil), // 21: client.Cursor (*ListMessagesRequest)(nil), // 21: client.ListMessagesRequest
(*ListMessagesRequest)(nil), // 22: client.ListMessagesRequest (*ListMessagesResponse)(nil), // 22: client.ListMessagesResponse
(*ListMessagesResponse)(nil), // 23: client.ListMessagesResponse (*ListContactsRequest)(nil), // 23: client.ListContactsRequest
(*ListContactsRequest)(nil), // 24: client.ListContactsRequest (*ListTopContactsRequest)(nil), // 24: client.ListTopContactsRequest
(*ListTopContactsRequest)(nil), // 25: client.ListTopContactsRequest (*ListContactsResponse)(nil), // 25: client.ListContactsResponse
(*ListContactsResponse)(nil), // 26: client.ListContactsResponse (*ListTopContactsResponse)(nil), // 26: client.ListTopContactsResponse
(*ListTopContactsResponse)(nil), // 27: client.ListTopContactsResponse (*ListConversationsRequest)(nil), // 27: client.ListConversationsRequest
(*ListConversationsRequest)(nil), // 28: client.ListConversationsRequest (*ListConversationsResponse)(nil), // 28: client.ListConversationsResponse
(*ListConversationsResponse)(nil), // 29: client.ListConversationsResponse (*GetOrCreateConversationRequest)(nil), // 29: client.GetOrCreateConversationRequest
(*GetOrCreateConversationRequest)(nil), // 30: client.GetOrCreateConversationRequest (*GetOrCreateConversationResponse)(nil), // 30: client.GetOrCreateConversationResponse
(*GetOrCreateConversationResponse)(nil), // 31: client.GetOrCreateConversationResponse (*DeleteMessageRequest)(nil), // 31: client.DeleteMessageRequest
(*DeleteMessageRequest)(nil), // 32: client.DeleteMessageRequest (*DeleteMessageResponse)(nil), // 32: client.DeleteMessageResponse
(*DeleteMessageResponse)(nil), // 33: client.DeleteMessageResponse (*UpdateConversationRequest)(nil), // 33: client.UpdateConversationRequest
(*UpdateConversationRequest)(nil), // 34: client.UpdateConversationRequest (*ConversationAction5)(nil), // 34: client.ConversationAction5
(*ConversationAction5)(nil), // 35: client.ConversationAction5 (*UpdateConversationData)(nil), // 35: client.UpdateConversationData
(*UpdateConversationData)(nil), // 36: client.UpdateConversationData (*UpdateConversationResponse)(nil), // 36: client.UpdateConversationResponse
(*UpdateConversationResponse)(nil), // 37: client.UpdateConversationResponse (*ConversationTypeRequest)(nil), // 37: client.ConversationTypeRequest
(*ConversationTypeRequest)(nil), // 38: client.ConversationTypeRequest (*GetConversationTypeResponse)(nil), // 38: client.GetConversationTypeResponse
(*GetConversationTypeResponse)(nil), // 39: client.GetConversationTypeResponse (*GetConversationRequest)(nil), // 39: client.GetConversationRequest
(*GetConversationRequest)(nil), // 40: client.GetConversationRequest (*GetConversationResponse)(nil), // 40: client.GetConversationResponse
(*GetConversationResponse)(nil), // 41: client.GetConversationResponse (*OpenConversationRequest)(nil), // 41: client.OpenConversationRequest
(*OpenConversationRequest)(nil), // 42: client.OpenConversationRequest (*PrepareOpenConversationRequest)(nil), // 42: client.PrepareOpenConversationRequest
(*PrepareOpenConversationRequest)(nil), // 43: client.PrepareOpenConversationRequest (*IsBugleDefaultResponse)(nil), // 43: client.IsBugleDefaultResponse
(*IsBugleDefaultResponse)(nil), // 44: client.IsBugleDefaultResponse (*SendMessageRequest)(nil), // 44: client.SendMessageRequest
(*SendMessageRequest)(nil), // 45: client.SendMessageRequest (*ReplyPayload)(nil), // 45: client.ReplyPayload
(*ReplyPayload)(nil), // 46: client.ReplyPayload (*MessagePayload)(nil), // 46: client.MessagePayload
(*MessagePayload)(nil), // 47: client.MessagePayload (*MessagePayloadContent)(nil), // 47: client.MessagePayloadContent
(*MessagePayloadContent)(nil), // 48: client.MessagePayloadContent (*SendMessageResponse)(nil), // 48: client.SendMessageResponse
(*SendMessageResponse)(nil), // 49: client.SendMessageResponse (*SendReactionRequest)(nil), // 49: client.SendReactionRequest
(*SendReactionRequest)(nil), // 50: client.SendReactionRequest (*SendReactionResponse)(nil), // 50: client.SendReactionResponse
(*SendReactionResponse)(nil), // 51: client.SendReactionResponse (*ResendMessageRequest)(nil), // 51: client.ResendMessageRequest
(*ResendMessageRequest)(nil), // 52: client.ResendMessageRequest (*TypingUpdateRequest)(nil), // 52: client.TypingUpdateRequest
(*TypingUpdateRequest)(nil), // 53: client.TypingUpdateRequest (*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 53: client.ReceiveMessagesRequest.UnknownEmptyObject1
(*ReceiveMessagesRequest_UnknownEmptyObject1)(nil), // 54: client.ReceiveMessagesRequest.UnknownEmptyObject1 (*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 54: client.ReceiveMessagesRequest.UnknownEmptyObject2
(*ReceiveMessagesRequest_UnknownEmptyObject2)(nil), // 55: client.ReceiveMessagesRequest.UnknownEmptyObject2 (*AckMessageRequest_Message)(nil), // 55: client.AckMessageRequest.Message
(*AckMessageRequest_Message)(nil), // 56: client.AckMessageRequest.Message (*TypingUpdateRequest_Data)(nil), // 56: client.TypingUpdateRequest.Data
(*TypingUpdateRequest_Data)(nil), // 57: client.TypingUpdateRequest.Data (*AuthMessage)(nil), // 57: authentication.AuthMessage
(*AuthMessage)(nil), // 58: authentication.AuthMessage (*EmptyArr)(nil), // 58: util.EmptyArr
(*EmptyArr)(nil), // 59: util.EmptyArr (*Device)(nil), // 59: authentication.Device
(*Device)(nil), // 60: authentication.Device (*Dimensions)(nil), // 60: conversations.Dimensions
(*Dimensions)(nil), // 61: conversations.Dimensions (*Message)(nil), // 61: conversations.Message
(*Message)(nil), // 62: conversations.Message (*Contact)(nil), // 62: conversations.Contact
(*Contact)(nil), // 63: conversations.Contact (*Conversation)(nil), // 63: conversations.Conversation
(*Conversation)(nil), // 64: conversations.Conversation (*ContactNumber)(nil), // 64: conversations.ContactNumber
(*ContactNumber)(nil), // 65: conversations.ContactNumber (ConversationStatus)(0), // 65: conversations.ConversationStatus
(*MessageInfo)(nil), // 66: conversations.MessageInfo (*MessageInfo)(nil), // 66: conversations.MessageInfo
(*MessageContent)(nil), // 67: conversations.MessageContent (*MessageContent)(nil), // 67: conversations.MessageContent
(*ReactionData)(nil), // 68: conversations.ReactionData (*ReactionData)(nil), // 68: conversations.ReactionData
} }
var file_client_proto_depIdxs = []int32{ var file_client_proto_depIdxs = []int32{
58, // 0: client.ReceiveMessagesRequest.auth:type_name -> authentication.AuthMessage 57, // 0: client.ReceiveMessagesRequest.auth:type_name -> authentication.AuthMessage
55, // 1: client.ReceiveMessagesRequest.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject2 54, // 1: client.ReceiveMessagesRequest.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject2
58, // 2: client.AckMessageRequest.authData:type_name -> authentication.AuthMessage 57, // 2: client.AckMessageRequest.authData:type_name -> authentication.AuthMessage
59, // 3: client.AckMessageRequest.emptyArr:type_name -> util.EmptyArr 58, // 3: client.AckMessageRequest.emptyArr:type_name -> util.EmptyArr
56, // 4: client.AckMessageRequest.acks:type_name -> client.AckMessageRequest.Message 55, // 4: client.AckMessageRequest.acks:type_name -> client.AckMessageRequest.Message
12, // 5: client.DownloadAttachmentRequest.info:type_name -> client.AttachmentInfo 11, // 5: client.DownloadAttachmentRequest.info:type_name -> client.AttachmentInfo
58, // 6: client.DownloadAttachmentRequest.authData:type_name -> authentication.AuthMessage 57, // 6: client.DownloadAttachmentRequest.authData:type_name -> authentication.AuthMessage
58, // 7: client.StartMediaUploadRequest.authData:type_name -> authentication.AuthMessage 57, // 7: client.StartMediaUploadRequest.authData:type_name -> authentication.AuthMessage
60, // 8: client.StartMediaUploadRequest.mobile:type_name -> authentication.Device 59, // 8: client.StartMediaUploadRequest.mobile:type_name -> authentication.Device
15, // 9: client.UploadMediaResponse.media:type_name -> client.UploadedMedia 14, // 9: client.UploadMediaResponse.media:type_name -> client.UploadedMedia
18, // 10: client.GetParticipantThumbnailResponse.thumbnail:type_name -> client.ParticipantThumbnail 17, // 10: client.GetParticipantThumbnailResponse.thumbnail:type_name -> client.ParticipantThumbnail
20, // 11: client.ParticipantThumbnail.data:type_name -> client.ThumbnailData 19, // 11: client.ParticipantThumbnail.data:type_name -> client.ThumbnailData
61, // 12: client.ThumbnailData.dimensions:type_name -> conversations.Dimensions 60, // 12: client.ThumbnailData.dimensions:type_name -> conversations.Dimensions
21, // 13: client.ListMessagesRequest.cursor:type_name -> client.Cursor 20, // 13: client.ListMessagesRequest.cursor:type_name -> client.Cursor
62, // 14: client.ListMessagesResponse.messages:type_name -> conversations.Message 61, // 14: client.ListMessagesResponse.messages:type_name -> conversations.Message
21, // 15: client.ListMessagesResponse.cursor:type_name -> client.Cursor 20, // 15: client.ListMessagesResponse.cursor:type_name -> client.Cursor
63, // 16: client.ListContactsResponse.contacts:type_name -> conversations.Contact 62, // 16: client.ListContactsResponse.contacts:type_name -> conversations.Contact
63, // 17: client.ListTopContactsResponse.contacts:type_name -> conversations.Contact 62, // 17: client.ListTopContactsResponse.contacts:type_name -> conversations.Contact
3, // 18: client.ListConversationsRequest.folder:type_name -> client.ListConversationsRequest.Folder 2, // 18: client.ListConversationsRequest.folder:type_name -> client.ListConversationsRequest.Folder
21, // 19: client.ListConversationsRequest.cursor:type_name -> client.Cursor 20, // 19: client.ListConversationsRequest.cursor:type_name -> client.Cursor
64, // 20: client.ListConversationsResponse.conversations:type_name -> conversations.Conversation 63, // 20: client.ListConversationsResponse.conversations:type_name -> conversations.Conversation
21, // 21: client.ListConversationsResponse.cursor:type_name -> client.Cursor 20, // 21: client.ListConversationsResponse.cursor:type_name -> client.Cursor
65, // 22: client.GetOrCreateConversationRequest.numbers:type_name -> conversations.ContactNumber 64, // 22: client.GetOrCreateConversationRequest.numbers:type_name -> conversations.ContactNumber
64, // 23: client.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation 63, // 23: client.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation
4, // 24: client.GetOrCreateConversationResponse.status:type_name -> client.GetOrCreateConversationResponse.Status 3, // 24: client.GetOrCreateConversationResponse.status:type_name -> client.GetOrCreateConversationResponse.Status
36, // 25: client.UpdateConversationRequest.data:type_name -> client.UpdateConversationData 35, // 25: client.UpdateConversationRequest.data:type_name -> client.UpdateConversationData
1, // 26: client.UpdateConversationRequest.action:type_name -> client.ConversationActionStatus 0, // 26: client.UpdateConversationRequest.action:type_name -> client.ConversationActionStatus
35, // 27: client.UpdateConversationRequest.action5:type_name -> client.ConversationAction5 34, // 27: client.UpdateConversationRequest.action5:type_name -> client.ConversationAction5
0, // 28: client.UpdateConversationData.status:type_name -> client.ConversationStatus 65, // 28: client.UpdateConversationData.status:type_name -> conversations.ConversationStatus
2, // 29: client.UpdateConversationData.mute:type_name -> client.ConversationMuteStatus 1, // 29: client.UpdateConversationData.mute:type_name -> client.ConversationMuteStatus
64, // 30: client.GetConversationResponse.conversation:type_name -> conversations.Conversation 63, // 30: client.GetConversationResponse.conversation:type_name -> conversations.Conversation
47, // 31: client.SendMessageRequest.messagePayload:type_name -> client.MessagePayload 46, // 31: client.SendMessageRequest.messagePayload:type_name -> client.MessagePayload
46, // 32: client.SendMessageRequest.reply:type_name -> client.ReplyPayload 45, // 32: client.SendMessageRequest.reply:type_name -> client.ReplyPayload
48, // 33: client.MessagePayload.messagePayloadContent:type_name -> client.MessagePayloadContent 47, // 33: client.MessagePayload.messagePayloadContent:type_name -> client.MessagePayloadContent
66, // 34: client.MessagePayload.messageInfo:type_name -> conversations.MessageInfo 66, // 34: client.MessagePayload.messageInfo:type_name -> conversations.MessageInfo
67, // 35: client.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent 67, // 35: client.MessagePayloadContent.messageContent:type_name -> conversations.MessageContent
68, // 36: client.SendReactionRequest.reactionData:type_name -> conversations.ReactionData 68, // 36: client.SendReactionRequest.reactionData:type_name -> conversations.ReactionData
5, // 37: client.SendReactionRequest.action:type_name -> client.SendReactionRequest.Action 4, // 37: client.SendReactionRequest.action:type_name -> client.SendReactionRequest.Action
57, // 38: client.TypingUpdateRequest.data:type_name -> client.TypingUpdateRequest.Data 56, // 38: client.TypingUpdateRequest.data:type_name -> client.TypingUpdateRequest.Data
54, // 39: client.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject1 53, // 39: client.ReceiveMessagesRequest.UnknownEmptyObject2.unknown:type_name -> client.ReceiveMessagesRequest.UnknownEmptyObject1
60, // 40: client.AckMessageRequest.Message.device:type_name -> authentication.Device 59, // 40: client.AckMessageRequest.Message.device:type_name -> authentication.Device
41, // [41:41] is the sub-list for method output_type 41, // [41:41] is the sub-list for method output_type
41, // [41:41] is the sub-list for method input_type 41, // [41:41] is the sub-list for method input_type
41, // [41:41] is the sub-list for extension type_name 41, // [41:41] is the sub-list for extension type_name
@ -3956,7 +3904,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: 6, NumEnums: 5,
NumMessages: 52, NumMessages: 52,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,

Binary file not shown.

View file

@ -183,18 +183,11 @@ message ConversationAction5 {
message UpdateConversationData { message UpdateConversationData {
string conversationID = 1; string conversationID = 1;
oneof data { oneof data {
ConversationStatus status = 12; conversations.ConversationStatus status = 12;
ConversationMuteStatus mute = 7; ConversationMuteStatus mute = 7;
} }
} }
enum ConversationStatus {
UNKNOWN_STATUS = 0;
UNARCHIVE = 1;
ARCHIVE = 2;
DELETE = 3;
}
enum ConversationActionStatus { enum ConversationActionStatus {
UNKNOWN_ACTION_STATUS = 0; UNKNOWN_ACTION_STATUS = 0;
UNBLOCK = 2; UNBLOCK = 2;

View file

@ -476,61 +476,64 @@ func (MessageStatusType) EnumDescriptor() ([]byte, []int) {
return file_conversations_proto_rawDescGZIP(), []int{3} return file_conversations_proto_rawDescGZIP(), []int{3}
} }
type ConvUpdateTypes int32 type ConversationStatus int32
const ( const (
ConvUpdateTypes_UNKNOWN_CONVTYPE ConvUpdateTypes = 0 ConversationStatus_UNKNOWN_CONVERSATION_STATUS ConversationStatus = 0
ConvUpdateTypes_UNARCHIVED ConvUpdateTypes = 1 ConversationStatus_ACTIVE ConversationStatus = 1
ConvUpdateTypes_ARCHIVED ConvUpdateTypes = 2 ConversationStatus_ARCHIVED ConversationStatus = 2
ConvUpdateTypes_DELETED ConvUpdateTypes = 3 ConversationStatus_DELETED ConversationStatus = 3
ConvUpdateTypes_BLOCKED_AND_REPORTED ConvUpdateTypes = 5 ConversationStatus_KEEP_ARCHIVED ConversationStatus = 4
ConvUpdateTypes_BLOCKED ConvUpdateTypes = 6 ConversationStatus_SPAM_FOLDER ConversationStatus = 5
ConversationStatus_BLOCKED_FOLDER ConversationStatus = 6
) )
// Enum value maps for ConvUpdateTypes. // Enum value maps for ConversationStatus.
var ( var (
ConvUpdateTypes_name = map[int32]string{ ConversationStatus_name = map[int32]string{
0: "UNKNOWN_CONVTYPE", 0: "UNKNOWN_CONVERSATION_STATUS",
1: "UNARCHIVED", 1: "ACTIVE",
2: "ARCHIVED", 2: "ARCHIVED",
3: "DELETED", 3: "DELETED",
5: "BLOCKED_AND_REPORTED", 4: "KEEP_ARCHIVED",
6: "BLOCKED", 5: "SPAM_FOLDER",
6: "BLOCKED_FOLDER",
} }
ConvUpdateTypes_value = map[string]int32{ ConversationStatus_value = map[string]int32{
"UNKNOWN_CONVTYPE": 0, "UNKNOWN_CONVERSATION_STATUS": 0,
"UNARCHIVED": 1, "ACTIVE": 1,
"ARCHIVED": 2, "ARCHIVED": 2,
"DELETED": 3, "DELETED": 3,
"BLOCKED_AND_REPORTED": 5, "KEEP_ARCHIVED": 4,
"BLOCKED": 6, "SPAM_FOLDER": 5,
"BLOCKED_FOLDER": 6,
} }
) )
func (x ConvUpdateTypes) Enum() *ConvUpdateTypes { func (x ConversationStatus) Enum() *ConversationStatus {
p := new(ConvUpdateTypes) p := new(ConversationStatus)
*p = x *p = x
return p return p
} }
func (x ConvUpdateTypes) String() string { func (x ConversationStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
} }
func (ConvUpdateTypes) Descriptor() protoreflect.EnumDescriptor { func (ConversationStatus) Descriptor() protoreflect.EnumDescriptor {
return file_conversations_proto_enumTypes[4].Descriptor() return file_conversations_proto_enumTypes[4].Descriptor()
} }
func (ConvUpdateTypes) Type() protoreflect.EnumType { func (ConversationStatus) Type() protoreflect.EnumType {
return &file_conversations_proto_enumTypes[4] return &file_conversations_proto_enumTypes[4]
} }
func (x ConvUpdateTypes) Number() protoreflect.EnumNumber { func (x ConversationStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x) return protoreflect.EnumNumber(x)
} }
// Deprecated: Use ConvUpdateTypes.Descriptor instead. // Deprecated: Use ConversationStatus.Descriptor instead.
func (ConvUpdateTypes) EnumDescriptor() ([]byte, []int) { func (ConversationStatus) EnumDescriptor() ([]byte, []int) {
return file_conversations_proto_rawDescGZIP(), []int{4} return file_conversations_proto_rawDescGZIP(), []int{4}
} }
@ -1754,24 +1757,24 @@ type Conversation struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"` ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
LatestMessage *LatestMessage `protobuf:"bytes,4,opt,name=latestMessage,proto3" json:"latestMessage,omitempty"` LatestMessage *LatestMessage `protobuf:"bytes,4,opt,name=latestMessage,proto3" json:"latestMessage,omitempty"`
LastMessageTimestamp int64 `protobuf:"varint,5,opt,name=lastMessageTimestamp,proto3" json:"lastMessageTimestamp,omitempty"` LastMessageTimestamp int64 `protobuf:"varint,5,opt,name=lastMessageTimestamp,proto3" json:"lastMessageTimestamp,omitempty"`
Unread bool `protobuf:"varint,6,opt,name=unread,proto3" json:"unread,omitempty"` Unread bool `protobuf:"varint,6,opt,name=unread,proto3" json:"unread,omitempty"`
IsGroupChat bool `protobuf:"varint,10,opt,name=isGroupChat,proto3" json:"isGroupChat,omitempty"` // not certain IsGroupChat bool `protobuf:"varint,10,opt,name=isGroupChat,proto3" json:"isGroupChat,omitempty"` // not certain
DefaultOutgoingID string `protobuf:"bytes,11,opt,name=defaultOutgoingID,proto3" json:"defaultOutgoingID,omitempty"` DefaultOutgoingID string `protobuf:"bytes,11,opt,name=defaultOutgoingID,proto3" json:"defaultOutgoingID,omitempty"`
Status ConvUpdateTypes `protobuf:"varint,12,opt,name=status,proto3,enum=conversations.ConvUpdateTypes" json:"status,omitempty"` Status ConversationStatus `protobuf:"varint,12,opt,name=status,proto3,enum=conversations.ConversationStatus" json:"status,omitempty"`
ReadOnly bool `protobuf:"varint,13,opt,name=readOnly,proto3" json:"readOnly,omitempty"` ReadOnly bool `protobuf:"varint,13,opt,name=readOnly,proto3" json:"readOnly,omitempty"`
AvatarHexColor string `protobuf:"bytes,15,opt,name=avatarHexColor,proto3" json:"avatarHexColor,omitempty"` AvatarHexColor string `protobuf:"bytes,15,opt,name=avatarHexColor,proto3" json:"avatarHexColor,omitempty"`
LatestMessageID string `protobuf:"bytes,17,opt,name=latestMessageID,proto3" json:"latestMessageID,omitempty"` LatestMessageID string `protobuf:"bytes,17,opt,name=latestMessageID,proto3" json:"latestMessageID,omitempty"`
Participants []*Participant `protobuf:"bytes,20,rep,name=participants,proto3" json:"participants,omitempty"` Participants []*Participant `protobuf:"bytes,20,rep,name=participants,proto3" json:"participants,omitempty"`
OtherParticipants []string `protobuf:"bytes,21,rep,name=otherParticipants,proto3" json:"otherParticipants,omitempty"` // participant ids excluding me OtherParticipants []string `protobuf:"bytes,21,rep,name=otherParticipants,proto3" json:"otherParticipants,omitempty"` // participant ids excluding me
Type ConversationType `protobuf:"varint,22,opt,name=type,proto3,enum=conversations.ConversationType" json:"type,omitempty"` Type ConversationType `protobuf:"varint,22,opt,name=type,proto3,enum=conversations.ConversationType" json:"type,omitempty"`
SubType bool `protobuf:"varint,24,opt,name=subType,proto3" json:"subType,omitempty"` SubType bool `protobuf:"varint,24,opt,name=subType,proto3" json:"subType,omitempty"`
Pinned bool `protobuf:"varint,26,opt,name=pinned,proto3" json:"pinned,omitempty"` Pinned bool `protobuf:"varint,26,opt,name=pinned,proto3" json:"pinned,omitempty"`
UnknownTimestamp int64 `protobuf:"varint,28,opt,name=unknownTimestamp,proto3" json:"unknownTimestamp,omitempty"` // set to lastMessageTimestamp + 1000 when marking as unread? UnknownTimestamp int64 `protobuf:"varint,28,opt,name=unknownTimestamp,proto3" json:"unknownTimestamp,omitempty"` // set to lastMessageTimestamp + 1000 when marking as unread?
ThirdType bool `protobuf:"varint,29,opt,name=thirdType,proto3" json:"thirdType,omitempty"` ThirdType bool `protobuf:"varint,29,opt,name=thirdType,proto3" json:"thirdType,omitempty"`
} }
func (x *Conversation) Reset() { func (x *Conversation) Reset() {
@ -1855,11 +1858,11 @@ func (x *Conversation) GetDefaultOutgoingID() string {
return "" return ""
} }
func (x *Conversation) GetStatus() ConvUpdateTypes { func (x *Conversation) GetStatus() ConversationStatus {
if x != nil { if x != nil {
return x.Status return x.Status
} }
return ConvUpdateTypes_UNKNOWN_CONVTYPE return ConversationStatus_UNKNOWN_CONVERSATION_STATUS
} }
func (x *Conversation) GetReadOnly() bool { func (x *Conversation) GetReadOnly() bool {
@ -2327,7 +2330,7 @@ var file_conversations_proto_goTypes = []interface{}{
(IdentifierType)(0), // 1: conversations.IdentifierType (IdentifierType)(0), // 1: conversations.IdentifierType
(ConversationType)(0), // 2: conversations.ConversationType (ConversationType)(0), // 2: conversations.ConversationType
(MessageStatusType)(0), // 3: conversations.MessageStatusType (MessageStatusType)(0), // 3: conversations.MessageStatusType
(ConvUpdateTypes)(0), // 4: conversations.ConvUpdateTypes (ConversationStatus)(0), // 4: conversations.ConversationStatus
(MediaFormats)(0), // 5: conversations.MediaFormats (MediaFormats)(0), // 5: conversations.MediaFormats
(*Contact)(nil), // 6: conversations.Contact (*Contact)(nil), // 6: conversations.Contact
(*ContactNumber)(nil), // 7: conversations.ContactNumber (*ContactNumber)(nil), // 7: conversations.ContactNumber
@ -2368,7 +2371,7 @@ var file_conversations_proto_depIdxs = []int32{
17, // 13: conversations.MediaContent.dimensions:type_name -> conversations.Dimensions 17, // 13: conversations.MediaContent.dimensions:type_name -> conversations.Dimensions
3, // 14: conversations.MessageStatus.status:type_name -> conversations.MessageStatusType 3, // 14: conversations.MessageStatus.status:type_name -> conversations.MessageStatusType
24, // 15: conversations.Conversation.latestMessage:type_name -> conversations.LatestMessage 24, // 15: conversations.Conversation.latestMessage:type_name -> conversations.LatestMessage
4, // 16: conversations.Conversation.status:type_name -> conversations.ConvUpdateTypes 4, // 16: conversations.Conversation.status:type_name -> conversations.ConversationStatus
22, // 17: conversations.Conversation.participants:type_name -> conversations.Participant 22, // 17: conversations.Conversation.participants:type_name -> conversations.Participant
2, // 18: conversations.Conversation.type:type_name -> conversations.ConversationType 2, // 18: conversations.Conversation.type:type_name -> conversations.ConversationType
23, // 19: conversations.Participant.ID:type_name -> conversations.SmallInfo 23, // 19: conversations.Participant.ID:type_name -> conversations.SmallInfo

Binary file not shown.

View file

@ -132,7 +132,7 @@ message Conversation {
bool isGroupChat = 10; // not certain bool isGroupChat = 10; // not certain
string defaultOutgoingID = 11; string defaultOutgoingID = 11;
ConvUpdateTypes status = 12; ConversationStatus status = 12;
bool readOnly = 13; bool readOnly = 13;
string avatarHexColor = 15; string avatarHexColor = 15;
string latestMessageID = 17; string latestMessageID = 17;
@ -281,13 +281,14 @@ enum MessageStatusType {
MESSAGE_DELETED = 300; MESSAGE_DELETED = 300;
} }
enum ConvUpdateTypes { enum ConversationStatus {
UNKNOWN_CONVTYPE = 0; UNKNOWN_CONVERSATION_STATUS = 0;
UNARCHIVED = 1; ACTIVE = 1;
ARCHIVED = 2; ARCHIVED = 2;
DELETED = 3; DELETED = 3;
BLOCKED_AND_REPORTED = 5; KEEP_ARCHIVED = 4;
BLOCKED = 6; SPAM_FOLDER = 5;
BLOCKED_FOLDER = 6;
} }
enum MediaFormats { enum MediaFormats {

26
user.go
View file

@ -795,14 +795,23 @@ func (user *User) Logout(state status.BridgeState, unpair bool) (logoutOK bool)
func (user *User) syncConversation(v *gmproto.Conversation) { func (user *User) syncConversation(v *gmproto.Conversation) {
updateType := v.GetStatus() updateType := v.GetStatus()
portal := user.GetPortalByID(v.GetConversationID()) portal := user.GetPortalByID(v.GetConversationID())
log := portal.zlog.With().
Str("action", "sync conversation").
Str("conversation_status", updateType.String()).
Logger()
if portal.MXID != "" { if portal.MXID != "" {
switch updateType { switch updateType {
// TODO also delete if blocked? // TODO also delete if blocked?
case gmproto.ConvUpdateTypes_DELETED: case gmproto.ConversationStatus_DELETED:
user.zlog.Info().Str("conversation_id", portal.ID).Msg("Got delete event, cleaning up portal") log.Info().Msg("Got delete event, cleaning up portal")
portal.Delete() portal.Delete()
portal.Cleanup(false) portal.Cleanup(false)
default: default:
if v.Participants == nil {
log.Debug().Msg("Not syncing conversation with nil participants")
return
}
log.Debug().Msg("Syncing existing portal")
portal.UpdateMetadata(user, v) portal.UpdateMetadata(user, v)
didBackfill := portal.missedForwardBackfill(user, time.UnixMicro(v.LastMessageTimestamp), v.LatestMessageID, !v.GetUnread()) didBackfill := portal.missedForwardBackfill(user, time.UnixMicro(v.LastMessageTimestamp), v.LatestMessageID, !v.GetUnread())
user.syncChatDoublePuppetDetails(portal, v, false) user.syncChatDoublePuppetDetails(portal, v, false)
@ -811,13 +820,18 @@ func (user *User) syncConversation(v *gmproto.Conversation) {
//user.markSelfReadFull(portal, v.LatestMessageID) //user.markSelfReadFull(portal, v.LatestMessageID)
} }
} }
} else if updateType == gmproto.ConvUpdateTypes_UNARCHIVED || updateType == gmproto.ConvUpdateTypes_ARCHIVED { } else if updateType == gmproto.ConversationStatus_ACTIVE || updateType == gmproto.ConversationStatus_ARCHIVED {
if v.Participants == nil {
log.Debug().Msg("Not syncing conversation with nil participants")
return
}
log.Debug().Msg("Creating portal for conversation")
err := portal.CreateMatrixRoom(user, v) err := portal.CreateMatrixRoom(user, v)
if err != nil { if err != nil {
user.zlog.Err(err).Msg("Error creating Matrix room from conversation event") log.Err(err).Msg("Error creating Matrix room from conversation event")
} }
} else { } else {
user.zlog.Debug().Str("update_type", updateType.String()).Msg("Not creating portal for conversation") log.Debug().Msg("Not creating portal for conversation")
} }
} }
@ -922,7 +936,7 @@ func (user *User) syncChatDoublePuppetDetails(portal *Portal, conv *gmproto.Conv
if err != nil && !errors.Is(err, mautrix.MNotFound) { if err != nil && !errors.Is(err, mautrix.MNotFound) {
user.zlog.Warn().Err(err).Str("room_id", portal.MXID.String()).Msg("Failed to get existing room tags") user.zlog.Warn().Err(err).Str("room_id", portal.MXID.String()).Msg("Failed to get existing room tags")
} }
user.updateChatTag(portal, user.bridge.Config.Bridge.ArchiveTag, conv.Status == gmproto.ConvUpdateTypes_ARCHIVED, existingTags) user.updateChatTag(portal, user.bridge.Config.Bridge.ArchiveTag, conv.Status == gmproto.ConversationStatus_ARCHIVED || conv.Status == gmproto.ConversationStatus_KEEP_ARCHIVED, existingTags)
user.updateChatTag(portal, user.bridge.Config.Bridge.PinnedTag, conv.Pinned, existingTags) user.updateChatTag(portal, user.bridge.Config.Bridge.PinnedTag, conv.Pinned, existingTags)
} }
} }