From 77e6174ff8e75484860d4c180b3712ae32696a01 Mon Sep 17 00:00:00 2001 From: Ping Chen Date: Fri, 5 Sep 2025 16:29:59 +0900 Subject: [PATCH] bridgev2/networkinterface: add interface to handle deleting chat from matrix --- bridgev2/networkinterface.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bridgev2/networkinterface.go b/bridgev2/networkinterface.go index 8293be51..42fbb1ed 100644 --- a/bridgev2/networkinterface.go +++ b/bridgev2/networkinterface.go @@ -984,6 +984,14 @@ type PushParsingNetwork interface { ParsePushNotification(ctx context.Context, data json.RawMessage) (networkid.UserLoginID, any, error) } +// DeleteChatHandlingNetworkAPI is an optional interface that network connectors +// can implement to delete a chat from the remote network. +type DeleteChatHandlingNetworkAPI interface { + NetworkAPI + // HandleMatrixDeleteChat is called when the user explicitly deletes a chat. + HandleMatrixDeleteChat(ctx context.Context, msg *MatrixDeleteChat) error +} + type RemoteEventType int func (ret RemoteEventType) String() string { @@ -1374,6 +1382,13 @@ type MatrixViewingChat struct { Portal *Portal } +type MatrixDeleteChat struct { + // The portal that the user deleted. + Portal *Portal + // Delete the chat for the other user in that chat. Not every bridge supports this. + DeleteForEveryone bool +} + type MatrixMarkedUnread = MatrixRoomMeta[*event.MarkedUnreadEventContent] type MatrixMute = MatrixRoomMeta[*event.BeeperMuteEventContent] type MatrixRoomTag = MatrixRoomMeta[*event.TagEventContent]