mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-18 17:12:37 +01:00
Add 3.10.0 support (mattermost)
This commit is contained in:
parent
3bc219167a
commit
4ec9b6dd4e
@ -327,7 +327,7 @@ func (m *MMClient) UpdateChannels() error {
|
|||||||
return errors.New(err.DetailedError)
|
return errors.New(err.DetailedError)
|
||||||
}
|
}
|
||||||
var mmchannels2 *model.Result
|
var mmchannels2 *model.Result
|
||||||
if m.mmVersion() >= 3.8 {
|
if m.mmVersion() >= 3.08 {
|
||||||
mmchannels2, err = m.Client.GetMoreChannelsPage(0, 5000)
|
mmchannels2, err = m.Client.GetMoreChannelsPage(0, 5000)
|
||||||
} else {
|
} else {
|
||||||
mmchannels2, err = m.Client.GetMoreChannels("")
|
mmchannels2, err = m.Client.GetMoreChannels("")
|
||||||
@ -479,7 +479,7 @@ func (m *MMClient) UpdateChannelHeader(channelId string, header string) {
|
|||||||
|
|
||||||
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.8 {
|
if m.mmVersion() >= 3.08 {
|
||||||
view := model.ChannelView{ChannelId: channelId}
|
view := model.ChannelView{ChannelId: channelId}
|
||||||
res, _ := m.Client.ViewChannel(view)
|
res, _ := m.Client.ViewChannel(view)
|
||||||
if res == false {
|
if res == false {
|
||||||
@ -728,9 +728,11 @@ func (m *MMClient) initUser() error {
|
|||||||
return errors.New(err.DetailedError)
|
return errors.New(err.DetailedError)
|
||||||
}
|
}
|
||||||
t.Channels = mmchannels.Data.(*model.ChannelList)
|
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)
|
mmchannels, err = m.Client.GetMoreChannelsPage(0, 5000)
|
||||||
} else {
|
} else {
|
||||||
|
m.log.Debug("nee hier", m.mmVersion())
|
||||||
mmchannels, err = m.Client.GetMoreChannels("")
|
mmchannels, err = m.Client.GetMoreChannels("")
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -762,7 +764,10 @@ func (m *MMClient) sendWSRequest(action string, data map[string]interface{}) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *MMClient) mmVersion() float64 {
|
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
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,7 +776,8 @@ func supportedVersion(version string) bool {
|
|||||||
strings.HasPrefix(version, "3.6.0") ||
|
strings.HasPrefix(version, "3.6.0") ||
|
||||||
strings.HasPrefix(version, "3.7.0") ||
|
strings.HasPrefix(version, "3.7.0") ||
|
||||||
strings.HasPrefix(version, "3.8.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 true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user