diff options
author | Wim <wim@42.be> | 2017-06-15 01:30:05 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-06-15 01:30:05 +0200 |
commit | 4ec9b6dd4ec1e2cca8bcadd2036fa13ee75611cd (patch) | |
tree | 83d0fa2847452a8b85f26617f5b464aff8550b8f /matterclient/matterclient.go | |
parent | 3bc219167adab683d0ae6f2e960ba7fd0aed70e9 (diff) | |
download | matterbridge-msglm-4ec9b6dd4ec1e2cca8bcadd2036fa13ee75611cd.tar.gz matterbridge-msglm-4ec9b6dd4ec1e2cca8bcadd2036fa13ee75611cd.tar.bz2 matterbridge-msglm-4ec9b6dd4ec1e2cca8bcadd2036fa13ee75611cd.zip |
Add 3.10.0 support (mattermost)
Diffstat (limited to 'matterclient/matterclient.go')
-rw-r--r-- | matterclient/matterclient.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 43446bcb..1466c076 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -327,7 +327,7 @@ func (m *MMClient) UpdateChannels() error { return errors.New(err.DetailedError) } var mmchannels2 *model.Result - if m.mmVersion() >= 3.8 { + if m.mmVersion() >= 3.08 { mmchannels2, err = m.Client.GetMoreChannelsPage(0, 5000) } else { mmchannels2, err = m.Client.GetMoreChannels("") @@ -479,7 +479,7 @@ func (m *MMClient) UpdateChannelHeader(channelId string, header string) { func (m *MMClient) UpdateLastViewed(channelId string) { m.log.Debugf("posting lastview %#v", channelId) - if m.mmVersion() >= 3.8 { + if m.mmVersion() >= 3.08 { view := model.ChannelView{ChannelId: channelId} res, _ := m.Client.ViewChannel(view) if res == false { @@ -728,9 +728,11 @@ func (m *MMClient) initUser() error { return errors.New(err.DetailedError) } t.Channels = mmchannels.Data.(*model.ChannelList) - if m.mmVersion() >= 3.8 { + if m.mmVersion() >= 3.08 { + m.log.Debug("hier") mmchannels, err = m.Client.GetMoreChannelsPage(0, 5000) } else { + m.log.Debug("nee hier", m.mmVersion()) mmchannels, err = m.Client.GetMoreChannels("") } if err != nil { @@ -762,7 +764,10 @@ func (m *MMClient) sendWSRequest(action string, data map[string]interface{}) err } func (m *MMClient) mmVersion() float64 { - v, _ := strconv.ParseFloat(m.ServerVersion[0:3], 64) + v, _ := strconv.ParseFloat(string(m.ServerVersion[0:2])+"0"+string(m.ServerVersion[2]), 64) + if string(m.ServerVersion[4]) == "." { + v, _ = strconv.ParseFloat(m.ServerVersion[0:4], 64) + } return v } @@ -771,7 +776,8 @@ func supportedVersion(version string) bool { 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") { return true } return false |