From ed018207226912ee57ecaae06c539aea37e7bb96 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 11 Sep 2017 22:45:15 +0200 Subject: Add support for deleting messages across bridges. Currently fully support mattermost,slack and discord. Message deleted on the bridge or received from other bridges will be deleted. Partially support for Gitter. Gitter bridge will delete messages received from other bridges. But if you delete a message on gitter, this deletion will not be sent to other bridges (this is a gitter API limitation, it doesn't propogate edits or deletes via the API) --- matterclient/matterclient.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'matterclient') diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index e348b760..732c9e30 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -299,7 +299,7 @@ func (m *MMClient) WsReceiver() { func (m *MMClient) parseMessage(rmsg *Message) { switch rmsg.Raw.Event { - case model.WEBSOCKET_EVENT_POSTED, model.WEBSOCKET_EVENT_POST_EDITED: + case model.WEBSOCKET_EVENT_POSTED, model.WEBSOCKET_EVENT_POST_EDITED, model.WEBSOCKET_EVENT_POST_DELETED: m.parseActionPost(rmsg) /* case model.ACTION_USER_REMOVED: @@ -476,6 +476,14 @@ func (m *MMClient) EditMessage(postId string, text string) (string, error) { return res.Id, nil } +func (m *MMClient) DeleteMessage(postId string) error { + _, resp := m.Client.DeletePost(postId) + if resp.Error != nil { + return resp.Error + } + return nil +} + func (m *MMClient) JoinChannel(channelId string) error { m.RLock() defer m.RUnlock() -- cgit v1.2.3