event: add beeper chat delete event

This commit is contained in:
Tulir Asokan 2025-09-22 16:05:28 +03:00
commit b3c883bc7f
5 changed files with 19 additions and 6 deletions

View file

@ -86,6 +86,10 @@ type BeeperRoomKeyAckEventContent struct {
FirstMessageIndex int `json:"first_message_index"`
}
type BeeperChatDeleteEventContent struct {
DeleteForEveryone bool `json:"delete_for_everyone,omitempty"`
}
type IntOrString int
func (ios *IntOrString) UnmarshalJSON(data []byte) error {

View file

@ -55,6 +55,11 @@ export interface RoomFeatures {
allowed_reactions?: string[]
/** Whether custom emoji reactions are allowed. */
custom_emoji_reactions?: boolean
/** Whether deleting the chat for yourself is supported. */
delete_chat?: boolean
/** Whether deleting the chat for all participants is supported. */
delete_chat_for_everyone?: boolean
}
declare type integer = number

View file

@ -51,11 +51,12 @@ type RoomFeatures struct {
AllowedReactions []string `json:"allowed_reactions,omitempty"`
CustomEmojiReactions bool `json:"custom_emoji_reactions,omitempty"`
ReadReceipts bool `json:"read_receipts,omitempty"`
TypingNotifications bool `json:"typing_notifications,omitempty"`
Archive bool `json:"archive,omitempty"`
MarkAsUnread bool `json:"mark_as_unread,omitempty"`
DeleteChat bool `json:"delete_chat,omitempty"`
ReadReceipts bool `json:"read_receipts,omitempty"`
TypingNotifications bool `json:"typing_notifications,omitempty"`
Archive bool `json:"archive,omitempty"`
MarkAsUnread bool `json:"mark_as_unread,omitempty"`
DeleteChat bool `json:"delete_chat,omitempty"`
DeleteChatForEveryone bool `json:"delete_chat_for_everyone,omitempty"`
}
func (rf *RoomFeatures) GetID() string {
@ -262,6 +263,7 @@ func (rf *RoomFeatures) Hash() []byte {
hashBool(hasher, "archive", rf.Archive)
hashBool(hasher, "mark_as_unread", rf.MarkAsUnread)
hashBool(hasher, "delete_chat", rf.DeleteChat)
hashBool(hasher, "delete_chat_for_everyone", rf.DeleteChatForEveryone)
return hasher.Sum(nil)
}

View file

@ -63,6 +63,7 @@ var TypeMap = map[Type]reflect.Type{
BeeperMessageStatus: reflect.TypeOf(BeeperMessageStatusEventContent{}),
BeeperTranscription: reflect.TypeOf(BeeperTranscriptionEventContent{}),
BeeperDeleteChat: reflect.TypeOf(BeeperChatDeleteEventContent{}),
AccountDataRoomTags: reflect.TypeOf(TagEventContent{}),
AccountDataDirectChats: reflect.TypeOf(DirectChatsEventContent{}),

View file

@ -128,7 +128,7 @@ func (et *Type) GuessClass() TypeClass {
InRoomVerificationKey.Type, InRoomVerificationMAC.Type, InRoomVerificationCancel.Type,
CallInvite.Type, CallCandidates.Type, CallAnswer.Type, CallReject.Type, CallSelectAnswer.Type,
CallNegotiate.Type, CallHangup.Type, BeeperMessageStatus.Type, EventUnstablePollStart.Type, EventUnstablePollResponse.Type,
EventUnstablePollEnd.Type, BeeperTranscription.Type:
EventUnstablePollEnd.Type, BeeperTranscription.Type, BeeperDeleteChat.Type:
return MessageEventType
case ToDeviceRoomKey.Type, ToDeviceRoomKeyRequest.Type, ToDeviceForwardedRoomKey.Type, ToDeviceRoomKeyWithheld.Type,
ToDeviceBeeperRoomKeyAck.Type:
@ -236,6 +236,7 @@ var (
BeeperMessageStatus = Type{"com.beeper.message_send_status", MessageEventType}
BeeperTranscription = Type{"com.beeper.transcription", MessageEventType}
BeeperDeleteChat = Type{"com.beeper.delete_chat", MessageEventType}
EventUnstablePollStart = Type{Type: "org.matrix.msc3381.poll.start", Class: MessageEventType}
EventUnstablePollResponse = Type{Type: "org.matrix.msc3381.poll.response", Class: MessageEventType}