aboutsummaryrefslogtreecommitdiff
path: root/connector/mattermost/mattermost.go
diff options
context:
space:
mode:
Diffstat (limited to 'connector/mattermost/mattermost.go')
-rw-r--r--connector/mattermost/mattermost.go35
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,
}
}