5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 17:30:26 +00:00

Use mattermost v4 api (drops support for mattermost < 3.8)

This commit is contained in:
Wim 2017-08-16 23:41:35 +02:00
parent b963f83c6a
commit 85ff1995fd
2 changed files with 128 additions and 154 deletions

View File

@ -36,7 +36,7 @@ Has a REST API.
# Requirements # Requirements
Accounts to one of the supported bridges Accounts to one of the supported bridges
* [Mattermost](https://github.com/mattermost/platform/) 3.5.x - 3.10.x, 4.0.x * [Mattermost](https://github.com/mattermost/platform/) 3.8.x - 3.10.x, 4.0.x - 4.1.x
* [IRC](http://www.mirc.com/servers.html) * [IRC](http://www.mirc.com/servers.html)
* [XMPP](https://jabber.org) * [XMPP](https://jabber.org)
* [Gitter](https://gitter.im) * [Gitter](https://gitter.im)

View File

@ -45,8 +45,8 @@ type Message struct {
type Team struct { type Team struct {
Team *model.Team Team *model.Team
Id string Id string
Channels *model.ChannelList Channels []*model.Channel
MoreChannels *model.ChannelList MoreChannels []*model.Channel
Users map[string]*model.User Users map[string]*model.User
} }
@ -55,7 +55,7 @@ type MMClient struct {
*Credentials *Credentials
Team *Team Team *Team
OtherTeams []*Team OtherTeams []*Team
Client *model.Client Client *model.Client4
User *model.User User *model.User
Users map[string]*model.User Users map[string]*model.User
MessageChan chan *Message MessageChan chan *Message
@ -109,21 +109,21 @@ func (m *MMClient) Login() error {
uriScheme = "http://" uriScheme = "http://"
} }
// login to mattermost // login to mattermost
m.Client = model.NewClient(uriScheme + m.Credentials.Server) m.Client = model.NewAPIv4Client(uriScheme + m.Credentials.Server)
m.Client.HttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: m.SkipTLSVerify}, Proxy: http.ProxyFromEnvironment} m.Client.HttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: m.SkipTLSVerify}, Proxy: http.ProxyFromEnvironment}
m.Client.HttpClient.Timeout = time.Second * 10 m.Client.HttpClient.Timeout = time.Second * 10
for { for {
d := b.Duration() d := b.Duration()
// bogus call to get the serverversion // bogus call to get the serverversion
_, err := m.Client.GetClientProperties() _, resp := m.Client.Logout()
if err != nil { if resp.Error != nil {
return fmt.Errorf("%#v", err.Error()) return fmt.Errorf("%#v", resp.Error.Error())
} }
if firstConnection && !supportedVersion(m.Client.ServerVersion) { if firstConnection && !supportedVersion(resp.ServerVersion) {
return fmt.Errorf("unsupported mattermost version: %s", m.Client.ServerVersion) return fmt.Errorf("unsupported mattermost version: %s", resp.ServerVersion)
} }
m.ServerVersion = m.Client.ServerVersion m.ServerVersion = resp.ServerVersion
if m.ServerVersion == "" { if m.ServerVersion == "" {
m.log.Debugf("Server not up yet, reconnecting in %s", d) m.log.Debugf("Server not up yet, reconnecting in %s", d)
time.Sleep(d) time.Sleep(d)
@ -134,7 +134,8 @@ func (m *MMClient) Login() error {
} }
b.Reset() b.Reset()
var myinfo *model.Result var resp *model.Response
//var myinfo *model.Result
var appErr *model.AppError var appErr *model.AppError
var logmsg = "trying login" var logmsg = "trying login"
for { for {
@ -146,18 +147,20 @@ func (m *MMClient) Login() error {
return errors.New("incorrect MMAUTHTOKEN. valid input is MMAUTHTOKEN=yourtoken") return errors.New("incorrect MMAUTHTOKEN. valid input is MMAUTHTOKEN=yourtoken")
} }
m.Client.HttpClient.Jar = m.createCookieJar(token[1]) m.Client.HttpClient.Jar = m.createCookieJar(token[1])
m.Client.MockSession(token[1]) m.Client.AuthToken = token[1]
myinfo, appErr = m.Client.GetMe("") m.Client.AuthType = model.HEADER_BEARER
if appErr != nil { m.User, resp = m.Client.GetMe("")
return errors.New(appErr.DetailedError) if resp.Error != nil {
return errors.New(resp.Error.DetailedError)
} }
if myinfo.Data.(*model.User) == nil { if m.User == nil {
m.log.Errorf("LOGIN TOKEN: %s is invalid", m.Credentials.Pass) m.log.Errorf("LOGIN TOKEN: %s is invalid", m.Credentials.Pass)
return errors.New("invalid " + model.SESSION_COOKIE_TOKEN) return errors.New("invalid " + model.SESSION_COOKIE_TOKEN)
} }
} else { } else {
_, appErr = m.Client.Login(m.Credentials.Login, m.Credentials.Pass) m.User, resp = m.Client.Login(m.Credentials.Login, m.Credentials.Pass)
} }
appErr = resp.Error
if appErr != nil { if appErr != nil {
d := b.Duration() d := b.Duration()
m.log.Debug(appErr.DetailedError) m.log.Debug(appErr.DetailedError)
@ -185,8 +188,6 @@ func (m *MMClient) Login() error {
if m.Team == nil { if m.Team == nil {
return errors.New("team not found") return errors.New("team not found")
} }
// set our team id as default route
m.Client.SetTeamId(m.Team.Id)
m.wsConnect() m.wsConnect()
@ -207,7 +208,7 @@ func (m *MMClient) wsConnect() {
} }
// setup websocket connection // setup websocket connection
wsurl := wsScheme + m.Credentials.Server + model.API_URL_SUFFIX_V3 + "/users/websocket" wsurl := wsScheme + m.Credentials.Server + model.API_URL_SUFFIX_V4 + "/websocket"
header := http.Header{} header := http.Header{}
header.Set(model.HEADER_AUTH, "BEARER "+m.Client.AuthToken) header.Set(model.HEADER_AUTH, "BEARER "+m.Client.AuthToken)
@ -241,9 +242,9 @@ func (m *MMClient) Logout() error {
m.log.Debug("Not invalidating session in logout, credential is a token") m.log.Debug("Not invalidating session in logout, credential is a token")
return nil return nil
} }
_, err := m.Client.Logout() _, resp := m.Client.Logout()
if err != nil { if resp.Error != nil {
return err return resp.Error
} }
return nil return nil
} }
@ -349,33 +350,34 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
} }
func (m *MMClient) UpdateUsers() error { func (m *MMClient) UpdateUsers() error {
mmusers, err := m.Client.GetProfiles(0, 50000, "") mmusers, resp := m.Client.GetUsers(0, 50000, "")
if err != nil { if resp.Error != nil {
return errors.New(err.DetailedError) return errors.New(resp.Error.DetailedError)
} }
m.Lock() m.Lock()
m.Users = mmusers.Data.(map[string]*model.User) for _, user := range mmusers {
m.Users[user.Id] = user
}
m.Unlock() m.Unlock()
return nil return nil
} }
func (m *MMClient) UpdateChannels() error { func (m *MMClient) UpdateChannels() error {
mmchannels, err := m.Client.GetChannels("") mmchannels, resp := m.Client.GetChannelsForTeamForUser(m.Team.Id, m.User.Id, "")
if err != nil { if resp.Error != nil {
return errors.New(err.DetailedError) return errors.New(resp.Error.DetailedError)
}
var mmchannels2 *model.Result
if m.mmVersion() >= 3.08 {
mmchannels2, err = m.Client.GetMoreChannelsPage(0, 5000)
} else {
mmchannels2, err = m.Client.GetMoreChannels("")
}
if err != nil {
return errors.New(err.DetailedError)
} }
m.Lock() m.Lock()
m.Team.Channels = mmchannels.Data.(*model.ChannelList) m.Team.Channels = mmchannels
m.Team.MoreChannels = mmchannels2.Data.(*model.ChannelList) m.Unlock()
mmchannels, resp = m.Client.GetPublicChannelsForTeam(m.Team.Id, 0, 5000, "")
if resp.Error != nil {
return errors.New(resp.Error.DetailedError)
}
m.Lock()
m.Team.MoreChannels = mmchannels
m.Unlock() m.Unlock()
return nil return nil
} }
@ -388,14 +390,14 @@ func (m *MMClient) GetChannelName(channelId string) string {
continue continue
} }
if t.Channels != nil { if t.Channels != nil {
for _, channel := range *t.Channels { for _, channel := range t.Channels {
if channel.Id == channelId { if channel.Id == channelId {
return channel.Name return channel.Name
} }
} }
} }
if t.MoreChannels != nil { if t.MoreChannels != nil {
for _, channel := range *t.MoreChannels { for _, channel := range t.MoreChannels {
if channel.Id == channelId { if channel.Id == channelId {
return channel.Name return channel.Name
} }
@ -413,7 +415,7 @@ func (m *MMClient) GetChannelId(name string, teamId string) string {
} }
for _, t := range m.OtherTeams { for _, t := range m.OtherTeams {
if t.Id == teamId { if t.Id == teamId {
for _, channel := range append(*t.Channels, *t.MoreChannels...) { for _, channel := range append(t.Channels, t.MoreChannels...) {
if channel.Name == name { if channel.Name == name {
return channel.Id return channel.Id
} }
@ -427,7 +429,7 @@ func (m *MMClient) GetChannelTeamId(id string) string {
m.RLock() m.RLock()
defer m.RUnlock() defer m.RUnlock()
for _, t := range append(m.OtherTeams, m.Team) { for _, t := range append(m.OtherTeams, m.Team) {
for _, channel := range append(*t.Channels, *t.MoreChannels...) { for _, channel := range append(t.Channels, t.MoreChannels...) {
if channel.Id == id { if channel.Id == id {
return channel.TeamId return channel.TeamId
} }
@ -440,7 +442,7 @@ func (m *MMClient) GetChannelHeader(channelId string) string {
m.RLock() m.RLock()
defer m.RUnlock() defer m.RUnlock()
for _, t := range m.OtherTeams { for _, t := range m.OtherTeams {
for _, channel := range append(*t.Channels, *t.MoreChannels...) { for _, channel := range append(t.Channels, t.MoreChannels...) {
if channel.Id == channelId { if channel.Id == channelId {
return channel.Header return channel.Header
} }
@ -458,46 +460,46 @@ func (m *MMClient) PostMessage(channelId string, text string) {
func (m *MMClient) JoinChannel(channelId string) error { func (m *MMClient) JoinChannel(channelId string) error {
m.RLock() m.RLock()
defer m.RUnlock() defer m.RUnlock()
for _, c := range *m.Team.Channels { for _, c := range m.Team.Channels {
if c.Id == channelId { if c.Id == channelId {
m.log.Debug("Not joining ", channelId, " already joined.") m.log.Debug("Not joining ", channelId, " already joined.")
return nil return nil
} }
} }
m.log.Debug("Joining ", channelId) m.log.Debug("Joining ", channelId)
_, err := m.Client.JoinChannel(channelId) _, resp := m.Client.AddChannelMember(channelId, m.User.Id)
if err != nil { if resp.Error != nil {
return errors.New("failed to join") return errors.New("failed to join")
} }
return nil return nil
} }
func (m *MMClient) GetPostsSince(channelId string, time int64) *model.PostList { func (m *MMClient) GetPostsSince(channelId string, time int64) *model.PostList {
res, err := m.Client.GetPostsSince(channelId, time) res, resp := m.Client.GetPostsSince(channelId, time)
if err != nil { if resp.Error != nil {
return nil return nil
} }
return res.Data.(*model.PostList) return res
} }
func (m *MMClient) SearchPosts(query string) *model.PostList { func (m *MMClient) SearchPosts(query string) *model.PostList {
res, err := m.Client.SearchPosts(query, false) res, resp := m.Client.SearchPosts(m.Team.Id, query, false)
if err != nil { if resp.Error != nil {
return nil return nil
} }
return res.Data.(*model.PostList) return res
} }
func (m *MMClient) GetPosts(channelId string, limit int) *model.PostList { func (m *MMClient) GetPosts(channelId string, limit int) *model.PostList {
res, err := m.Client.GetPosts(channelId, 0, limit, "") res, resp := m.Client.GetPostsForChannel(channelId, 0, limit, "")
if err != nil { if resp.Error != nil {
return nil return nil
} }
return res.Data.(*model.PostList) return res
} }
func (m *MMClient) GetPublicLink(filename string) string { func (m *MMClient) GetPublicLink(filename string) string {
res, err := m.Client.GetPublicLink(filename) res, err := m.Client.GetFileLink(filename)
if err != nil { if err != nil {
return "" return ""
} }
@ -507,7 +509,7 @@ func (m *MMClient) GetPublicLink(filename string) string {
func (m *MMClient) GetPublicLinks(filenames []string) []string { func (m *MMClient) GetPublicLinks(filenames []string) []string {
var output []string var output []string
for _, f := range filenames { for _, f := range filenames {
res, err := m.Client.GetPublicLink(f) res, err := m.Client.GetFileLink(f)
if err != nil { if err != nil {
continue continue
} }
@ -524,7 +526,7 @@ func (m *MMClient) GetFileLinks(filenames []string) []string {
var output []string var output []string
for _, f := range filenames { for _, f := range filenames {
res, err := m.Client.GetPublicLink(f) res, err := m.Client.GetFileLink(f)
if err != nil { if err != nil {
// public links is probably disabled, create the link ourselves // public links is probably disabled, create the link ourselves
output = append(output, uriScheme+m.Credentials.Server+model.API_URL_SUFFIX_V3+"/files/"+f+"/get") output = append(output, uriScheme+m.Credentials.Server+model.API_URL_SUFFIX_V3+"/files/"+f+"/get")
@ -536,42 +538,33 @@ func (m *MMClient) GetFileLinks(filenames []string) []string {
} }
func (m *MMClient) UpdateChannelHeader(channelId string, header string) { func (m *MMClient) UpdateChannelHeader(channelId string, header string) {
data := make(map[string]string) channel := &model.Channel{Id: channelId, Header: header}
data["channel_id"] = channelId
data["channel_header"] = header
m.log.Debugf("updating channelheader %#v, %#v", channelId, header) m.log.Debugf("updating channelheader %#v, %#v", channelId, header)
_, err := m.Client.UpdateChannelHeader(data) _, resp := m.Client.UpdateChannel(channel)
if err != nil { if resp.Error != nil {
log.Error(err) log.Error(resp.Error)
} }
} }
func (m *MMClient) UpdateLastViewed(channelId string) { func (m *MMClient) UpdateLastViewed(channelId string) {
m.log.Debugf("posting lastview %#v", channelId) m.log.Debugf("posting lastview %#v", channelId)
if m.mmVersion() >= 3.08 { view := &model.ChannelView{ChannelId: channelId}
view := model.ChannelView{ChannelId: channelId} res, _ := m.Client.ViewChannel(m.User.Id, view)
res, _ := m.Client.ViewChannel(view) if !res {
if !res { m.log.Errorf("ChannelView update for %s failed", channelId)
m.log.Errorf("ChannelView update for %s failed", channelId)
}
return
}
_, err := m.Client.UpdateLastViewedAt(channelId, true)
if err != nil {
m.log.Error(err)
} }
} }
func (m *MMClient) UsernamesInChannel(channelId string) []string { func (m *MMClient) UsernamesInChannel(channelId string) []string {
res, err := m.Client.GetProfilesInChannel(channelId, 0, 50000, "") res, resp := m.Client.GetChannelMembers(channelId, 0, 50000, "")
if err != nil { if resp.Error != nil {
m.log.Errorf("UsernamesInChannel(%s) failed: %s", channelId, err) m.log.Errorf("UsernamesInChannel(%s) failed: %s", channelId, resp.Error)
return []string{} return []string{}
} }
members := res.Data.(map[string]*model.User) allusers := m.GetUsers()
result := []string{} result := []string{}
for _, member := range members { for _, member := range *res {
result = append(result, member.Nickname) result = append(result, allusers[member.UserId].Nickname)
} }
return result return result
} }
@ -595,7 +588,7 @@ func (m *MMClient) createCookieJar(token string) *cookiejar.Jar {
func (m *MMClient) SendDirectMessage(toUserId string, msg string) { func (m *MMClient) SendDirectMessage(toUserId string, msg string) {
m.log.Debugf("SendDirectMessage to %s, msg %s", toUserId, msg) m.log.Debugf("SendDirectMessage to %s, msg %s", toUserId, msg)
// create DM channel (only happens on first message) // create DM channel (only happens on first message)
_, err := m.Client.CreateDirectChannel(toUserId) _, err := m.Client.CreateDirectChannel(m.User.Id, toUserId)
if err != nil { if err != nil {
m.log.Debugf("SendDirectMessage to %#v failed: %s", toUserId, err) m.log.Debugf("SendDirectMessage to %#v failed: %s", toUserId, err)
return return
@ -603,14 +596,7 @@ func (m *MMClient) SendDirectMessage(toUserId string, msg string) {
channelName := model.GetDMNameFromIds(toUserId, m.User.Id) channelName := model.GetDMNameFromIds(toUserId, m.User.Id)
// update our channels // update our channels
mmchannels, err := m.Client.GetChannels("") m.UpdateChannels()
if err != nil {
m.log.Debug("SendDirectMessage: Couldn't update channels")
return
}
m.Lock()
m.Team.Channels = mmchannels.Data.(*model.ChannelList)
m.Unlock()
// build & send the message // build & send the message
msg = strings.Replace(msg, "\r", "", -1) msg = strings.Replace(msg, "\r", "", -1)
@ -636,10 +622,10 @@ func (m *MMClient) GetChannels() []*model.Channel {
defer m.RUnlock() defer m.RUnlock()
var channels []*model.Channel var channels []*model.Channel
// our primary team channels first // our primary team channels first
channels = append(channels, *m.Team.Channels...) channels = append(channels, m.Team.Channels...)
for _, t := range m.OtherTeams { for _, t := range m.OtherTeams {
if t.Id != m.Team.Id { if t.Id != m.Team.Id {
channels = append(channels, *t.Channels...) channels = append(channels, t.Channels...)
} }
} }
return channels return channels
@ -651,7 +637,7 @@ func (m *MMClient) GetMoreChannels() []*model.Channel {
defer m.RUnlock() defer m.RUnlock()
var channels []*model.Channel var channels []*model.Channel
for _, t := range m.OtherTeams { for _, t := range m.OtherTeams {
channels = append(channels, *t.MoreChannels...) channels = append(channels, t.MoreChannels...)
} }
return channels return channels
} }
@ -662,9 +648,9 @@ func (m *MMClient) GetTeamFromChannel(channelId string) string {
defer m.RUnlock() defer m.RUnlock()
var channels []*model.Channel var channels []*model.Channel
for _, t := range m.OtherTeams { for _, t := range m.OtherTeams {
channels = append(channels, *t.Channels...) channels = append(channels, t.Channels...)
if t.MoreChannels != nil { if t.MoreChannels != nil {
channels = append(channels, *t.MoreChannels...) channels = append(channels, t.MoreChannels...)
} }
for _, c := range channels { for _, c := range channels {
if c.Id == channelId { if c.Id == channelId {
@ -678,12 +664,11 @@ func (m *MMClient) GetTeamFromChannel(channelId string) string {
func (m *MMClient) GetLastViewedAt(channelId string) int64 { func (m *MMClient) GetLastViewedAt(channelId string) int64 {
m.RLock() m.RLock()
defer m.RUnlock() defer m.RUnlock()
res, err := m.Client.GetChannel(channelId, "") res, resp := m.Client.GetChannelMember(channelId, m.User.Id, "")
if err != nil { if resp.Error != nil {
return model.GetMillis() return model.GetMillis()
} }
data := res.Data.(*model.ChannelData) return res.LastViewedAt
return data.Member.LastViewedAt
} }
func (m *MMClient) GetUsers() map[string]*model.User { func (m *MMClient) GetUsers() map[string]*model.User {
@ -701,12 +686,11 @@ func (m *MMClient) GetUser(userId string) *model.User {
defer m.Unlock() defer m.Unlock()
_, ok := m.Users[userId] _, ok := m.Users[userId]
if !ok { if !ok {
res, err := m.Client.GetProfilesByIds([]string{userId}) res, resp := m.Client.GetUser(userId, "")
if err != nil { if resp.Error != nil {
return nil return nil
} }
u := res.Data.(map[string]*model.User)[userId] m.Users[userId] = res
m.Users[userId] = u
} }
return m.Users[userId] return m.Users[userId]
} }
@ -720,36 +704,36 @@ func (m *MMClient) GetUserName(userId string) string {
} }
func (m *MMClient) GetStatus(userId string) string { func (m *MMClient) GetStatus(userId string) string {
res, err := m.Client.GetStatusesByIds([]string{userId}) res, resp := m.Client.GetUserStatus(userId, "")
if err != nil { if resp.Error != nil {
return "" return ""
} }
status := res.Data.(map[string]string) if res.Status == model.STATUS_AWAY {
if status[userId] == model.STATUS_AWAY {
return "away" return "away"
} }
if status[userId] == model.STATUS_ONLINE { if res.Status == model.STATUS_ONLINE {
return "online" return "online"
} }
return "offline" return "offline"
} }
func (m *MMClient) GetStatuses() map[string]string { func (m *MMClient) GetStatuses() map[string]string {
var ok bool var ids []string
statuses := make(map[string]string) statuses := make(map[string]string)
res, err := m.Client.GetStatuses() for id := range m.Users {
if err != nil { ids = append(ids, id)
}
res, resp := m.Client.GetUsersStatusesByIds(ids)
if resp.Error != nil {
return statuses return statuses
} }
if statuses, ok = res.Data.(map[string]string); ok { for _, status := range res {
for userId, status := range statuses { statuses[status.UserId] = "offline"
statuses[userId] = "offline" if status.Status == model.STATUS_AWAY {
if status == model.STATUS_AWAY { statuses[status.UserId] = "away"
statuses[userId] = "away" }
} if status.Status == model.STATUS_ONLINE {
if status == model.STATUS_ONLINE { statuses[status.UserId] = "online"
statuses[userId] = "online"
}
} }
} }
return statuses return statuses
@ -800,40 +784,33 @@ func (m *MMClient) StatusLoop() {
func (m *MMClient) initUser() error { func (m *MMClient) initUser() error {
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
initLoad, err := m.Client.GetInitialLoad()
if err != nil {
return err
}
initData := initLoad.Data.(*model.InitialLoad)
m.User = initData.User
// we only load all team data on initial login. // we only load all team data on initial login.
// all other updates are for channels from our (primary) team only. // all other updates are for channels from our (primary) team only.
//m.log.Debug("initUser(): loading all team data") //m.log.Debug("initUser(): loading all team data")
for _, v := range initData.Teams { teams, resp := m.Client.GetTeamsForUser(m.User.Id, "")
m.Client.SetTeamId(v.Id) if resp.Error != nil {
mmusers, err := m.Client.GetProfiles(0, 50000, "") return resp.Error
if err != nil { }
return errors.New(err.DetailedError) for _, team := range teams {
mmusers, resp := m.Client.GetUsersInTeam(team.Id, 0, 50000, "")
if resp.Error != nil {
return errors.New(resp.Error.DetailedError)
} }
t := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id} usermap := make(map[string]*model.User)
mmchannels, err := m.Client.GetChannels("") for _, user := range mmusers {
if err != nil { usermap[user.Id] = user
return errors.New(err.DetailedError)
} }
t.Channels = mmchannels.Data.(*model.ChannelList) t := &Team{Team: team, Users: usermap, Id: team.Id}
if m.mmVersion() >= 3.08 {
mmchannels, err = m.Client.GetMoreChannelsPage(0, 5000) mmchannels, resp := m.Client.GetPublicChannelsForTeam(team.Id, 0, 5000, "")
} else { if resp.Error != nil {
mmchannels, err = m.Client.GetMoreChannels("") return errors.New(resp.Error.DetailedError)
} }
if err != nil { t.Channels = mmchannels
return errors.New(err.DetailedError)
}
t.MoreChannels = mmchannels.Data.(*model.ChannelList)
m.OtherTeams = append(m.OtherTeams, t) m.OtherTeams = append(m.OtherTeams, t)
if v.Name == m.Credentials.Team { if team.Name == m.Credentials.Team {
m.Team = t m.Team = t
m.log.Debugf("initUser(): found our team %s (id: %s)", v.Name, v.Id) m.log.Debugf("initUser(): found our team %s (id: %s)", team.Name, team.Id)
} }
// add all users // add all users
for k, v := range t.Users { for k, v := range t.Users {
@ -863,10 +840,7 @@ func (m *MMClient) mmVersion() float64 {
} }
func supportedVersion(version string) bool { func supportedVersion(version string) bool {
if strings.HasPrefix(version, "3.5.0") || if strings.HasPrefix(version, "3.8.0") ||
strings.HasPrefix(version, "3.6.0") ||
strings.HasPrefix(version, "3.7.0") ||
strings.HasPrefix(version, "3.8.0") ||
strings.HasPrefix(version, "3.9.0") || strings.HasPrefix(version, "3.9.0") ||
strings.HasPrefix(version, "3.10.0") || strings.HasPrefix(version, "3.10.0") ||
strings.HasPrefix(version, "4.0") || strings.HasPrefix(version, "4.0") ||