diff options
author | Wim <wim@42.be> | 2016-05-15 23:02:30 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2016-05-15 23:02:30 +0200 |
commit | 59e6abcc11ed3a3548ffb02d1e455485672d8308 (patch) | |
tree | a5086741b8595d7eb33a0f41e7c109d064be33ef /vendor/github.com/42wim/matterbridge-plus/matterclient | |
parent | 38e3bbe5c96eb84f3e223c44f801ee7e3308b2c1 (diff) | |
download | matterbridge-msglm-59e6abcc11ed3a3548ffb02d1e455485672d8308.tar.gz matterbridge-msglm-59e6abcc11ed3a3548ffb02d1e455485672d8308.tar.bz2 matterbridge-msglm-59e6abcc11ed3a3548ffb02d1e455485672d8308.zip |
Sync with mattermost 3.0
Diffstat (limited to 'vendor/github.com/42wim/matterbridge-plus/matterclient')
-rw-r--r-- | vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go b/vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go index 11891d07..13faf383 100644 --- a/vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go +++ b/vendor/github.com/42wim/matterbridge-plus/matterclient/matterclient.go @@ -78,7 +78,7 @@ func (m *MMClient) Login() error { var logmsg = "trying login" for { m.log.Debugf(logmsg+" %s %s %s", m.Credentials.Team, m.Credentials.Login, m.Credentials.Server) - myinfo, appErr = m.Client.LoginByEmail(m.Credentials.Team, m.Credentials.Login, m.Credentials.Pass) + myinfo, appErr = m.Client.Login(m.Credentials.Login, m.Credentials.Pass) if appErr != nil { d := b.Duration() m.log.Debug(appErr.DetailedError) @@ -99,11 +99,23 @@ func (m *MMClient) Login() error { // reset timer b.Reset() m.User = myinfo.Data.(*model.User) - myinfo, _ = m.Client.GetMyTeam("") - m.Team = myinfo.Data.(*model.Team) + + teamdata, _ := m.Client.GetAllTeamListings() + teams := teamdata.Data.(map[string]*model.Team) + for k, v := range teams { + if v.Name == m.Credentials.Team { + m.Client.SetTeamId(k) + m.Team = v + m.log.Debug("GetallTeamListings: found id ", k) + break + } + } + if m.Team == nil { + return errors.New("team not found") + } // setup websocket connection - wsurl := wsScheme + m.Credentials.Server + "/api/v1/websocket" + wsurl := wsScheme + m.Credentials.Server + "/api/v3/users/websocket" header := http.Header{} header.Set(model.HEADER_AUTH, "BEARER "+m.Client.AuthToken) @@ -186,7 +198,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) { } func (m *MMClient) UpdateUsers() error { - mmusers, _ := m.Client.GetProfiles(m.User.TeamId, "") + mmusers, _ := m.Client.GetProfiles(m.Client.GetTeamId(), "") m.Users = mmusers.Data.(map[string]*model.User) return nil } @@ -267,7 +279,7 @@ func (m *MMClient) GetPostsSince(channelId string, time int64) *model.PostList { } func (m *MMClient) SearchPosts(query string) *model.PostList { - res, err := m.Client.SearchPosts(query) + res, err := m.Client.SearchPosts(query, false) if err != nil { return nil } |