diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-18 16:14:31 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-18 16:14:31 +0100 |
commit | 78c7d1deae23d7807c130028883cf350348dc4db (patch) | |
tree | d39f9ec63bb4ed2e9e8dde01abfe11aaa74a16c5 | |
parent | 62ca33fd0a9d58529e0fb7a71229e3ead98152d0 (diff) | |
download | easybridge-78c7d1deae23d7807c130028883cf350348dc4db.tar.gz easybridge-78c7d1deae23d7807c130028883cf350348dc4db.zip |
(incomplete) handle title changes from mattermost to matrix
-rw-r--r-- | connector/mattermost/mattermost.go | 15 |
1 files changed, 15 insertions, 0 deletions
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 } |