From 78c7d1deae23d7807c130028883cf350348dc4db Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 18 Feb 2020 16:14:31 +0100 Subject: [PATCH] (incomplete) handle title changes from mattermost to matrix --- connector/mattermost/mattermost.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/connector/mattermost/mattermost.go b/connector/mattermost/mattermost.go index 3520c2b..2dbc436 100644 --- a/connector/mattermost/mattermost.go +++ b/connector/mattermost/mattermost.go @@ -245,6 +245,7 @@ func (mm *Mattermost) handleLoop(msgCh chan *matterclient.Message, quitCh chan b case <-quitCh: break case msg := <-msgCh: + fmt.Printf("Mattermost: %#v\n", msg) if len(strings.Split(msg.Channel, "__")) == 2 { // Private message ids := strings.Split(msg.Channel, "__") @@ -278,6 +279,20 @@ func (mm *Mattermost) handleLoop(msgCh chan *matterclient.Message, quitCh chan b } user := UserID(fmt.Sprintf("%s@%s", msg.Username, mm.server)) + + if strings.Contains(msg.Text, "updated the channel header") { + splits := strings.SplitN(msg.Text, "to: ", 2) + if len(splits) == 2 { + if user == mm.User() { + user = UserID("") + } + mm.handler.RoomInfoUpdated(room, user, &RoomInfo{ + Topic: splits[1], + }) + continue + } + } + if user == mm.User() { continue }