From 1d50da4b1c43273ab2dc8c47829e03f5f6981f92 Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Tue, 1 Jun 2021 17:17:07 -0400 Subject: Add support for message deletion (nctalk) (#1492) * nctalk: add message deletion support Signed-off-by: Gary Kim * nctalk: seperate out deletion and sending logic Signed-off-by: Gary Kim * nctalk: update library to v0.2.0 Signed-off-by: Gary Kim * Rename functions to be clearer Signed-off-by: Gary Kim * Update to go-nc-talk v0.2.1 Signed-off-by: Gary Kim * Update to go-nc-talk v0.2.2 Signed-off-by: Gary Kim * Make deletions easier to debug Signed-off-by: Gary Kim --- vendor/gomod.garykim.dev/nc-talk/ocs/capabilities.go | 6 +++++- vendor/gomod.garykim.dev/nc-talk/ocs/message.go | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'vendor/gomod.garykim.dev/nc-talk/ocs') diff --git a/vendor/gomod.garykim.dev/nc-talk/ocs/capabilities.go b/vendor/gomod.garykim.dev/nc-talk/ocs/capabilities.go index 4dbaa735..8b2919fc 100644 --- a/vendor/gomod.garykim.dev/nc-talk/ocs/capabilities.go +++ b/vendor/gomod.garykim.dev/nc-talk/ocs/capabilities.go @@ -33,10 +33,14 @@ type SpreedCapabilities struct { Folder string `json:"folder"` } `json:"attachments"` Chat struct { - MaxLength int `json:"max-length"` + MaxLength int `json:"max-length"` + ReadPrivacy int `json:"read-privacy"` } `json:"chat"` Conversations struct { CanCreate bool `json:"can-create"` } `json:"conversations"` + Previews struct { + MaxGifSize int `json:"max-gif-size"` + } `json:"previews"` } `json:"config"` } diff --git a/vendor/gomod.garykim.dev/nc-talk/ocs/message.go b/vendor/gomod.garykim.dev/nc-talk/ocs/message.go index d4766006..1a8f95dc 100644 --- a/vendor/gomod.garykim.dev/nc-talk/ocs/message.go +++ b/vendor/gomod.garykim.dev/nc-talk/ocs/message.go @@ -35,6 +35,15 @@ const ( // MessageCommand is a Nextcloud Talk message that is a command MessageCommand MessageType = "command" + // MessageDelete is a Nextcloud Talk message indicating a message that was deleted + // + // If a message has been deleted, a message of MessageType MessageSystem is + // sent through the channel for which the parent message's MessageType is MessageDelete. + // So, in order to check if a new message is a message deletion request, a check + // like this can be used: + // msg.MessageType == ocs.MessageSystem && msg.Parent != nil && msg.Parent.MessageType == ocs.MessageDelete + MessageDelete MessageType = "comment_deleted" + // ActorUser is a Nextcloud Talk message sent by a user ActorUser ActorType = "users" @@ -55,6 +64,8 @@ type TalkRoomMessageData struct { SystemMessage string `json:"systemMessage"` Timestamp int `json:"timestamp"` MessageType MessageType `json:"messageType"` + Deleted bool `json:"deleted"` + Parent *TalkRoomMessageData `json:"parent"` MessageParameters map[string]RichObjectString `json:"-"` } -- cgit v1.2.3