diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-23 20:24:50 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-23 20:24:50 +0100 |
commit | ec9bc9b7520a8e8c3c372943126df985329dcd18 (patch) | |
tree | 000683f506359d0463e37010996aab8422620e78 /connector/mattermost | |
parent | 0f6be9663e6e8b954d24596c455a704d42499a52 (diff) | |
download | easybridge-ec9bc9b7520a8e8c3c372943126df985329dcd18.tar.gz easybridge-ec9bc9b7520a8e8c3c372943126df985329dcd18.zip |
go fmt
Diffstat (limited to 'connector/mattermost')
-rw-r--r-- | connector/mattermost/mattermost.go | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/connector/mattermost/mattermost.go b/connector/mattermost/mattermost.go index 13deb6e..010e102 100644 --- a/connector/mattermost/mattermost.go +++ b/connector/mattermost/mattermost.go @@ -1,16 +1,16 @@ package mattermost import ( - "net/http" + "encoding/json" "fmt" + "io/ioutil" + "net/http" _ "os" "strings" "time" - "io/ioutil" - "encoding/json" - "github.com/mattermost/mattermost-server/model" "github.com/42wim/matterbridge/matterclient" + "github.com/mattermost/mattermost-server/model" log "github.com/sirupsen/logrus" . "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector" @@ -22,19 +22,18 @@ import ( type Mattermost struct { handler Handler - server string + server string username string - teams map[string]bool + teams map[string]bool - conn *matterclient.MMClient + conn *matterclient.MMClient handlerStopChan chan bool - usermap map[string]string // map username to mm user id - sentjoinedmap map[string]bool // map username/room name to bool - userdisplaynamemap map[UserID]string // map username to last displayname + usermap map[string]string // map username to mm user id + sentjoinedmap map[string]bool // map username/room name to bool + userdisplaynamemap map[UserID]string // map username to last displayname } - func (mm *Mattermost) SetHandler(h Handler) { mm.handler = h } @@ -318,7 +317,7 @@ func (mm *Mattermost) handleConnected() { // Update room info room_info := &RoomInfo{ - Name: ch.DisplayName, + Name: ch.DisplayName, Topic: ch.Header, } for _, t := range mm.conn.OtherTeams { @@ -446,8 +445,8 @@ func (mm *Mattermost) ensureJoined(user *model.User, roomId RoomID) { if _, ok := mm.sentjoinedmap[cache_key]; !ok { mm.handler.Event(&Event{ Author: userId, - Room: roomId, - Type: EVENT_JOIN, + Room: roomId, + Type: EVENT_JOIN, }) mm.sentjoinedmap[cache_key] = true } @@ -484,10 +483,10 @@ func (mm *Mattermost) handlePost(channel_name string, post *model.Post, only_mes // Build message event msg_ev := &Event{ - Id: post.Id, + Id: post.Id, Author: userId, - Text: post.Message, - Type: EVENT_MESSAGE, + Text: post.Message, + Type: EVENT_MESSAGE, } if post.Type == "me" { msg_ev.Type = EVENT_ACTION @@ -511,7 +510,7 @@ func (mm *Mattermost) handlePost(channel_name string, post *model.Post, only_mes } if file.Width > 0 { media_object.ObjectImageSize = &ImageSize{ - Width: file.Width, + Width: file.Width, Height: file.Height, } } |