diff options
-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 } |