(incomplete) handle title changes from mattermost to matrix

This commit is contained in:
Alex 2020-02-18 16:14:31 +01:00
parent 62ca33fd0a
commit 78c7d1deae
1 changed files with 15 additions and 0 deletions

View File

@ -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
}