summaryrefslogtreecommitdiffstats
path: root/matterclient
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-11-13 16:03:04 +0100
committerWim <wim@42.be>2016-11-13 16:03:04 +0100
commit4fb0544b0e25bf6409811fc3e574bf45efea369d (patch)
treefd3d0c76c8cd1cf18ad4d68076cea22000a4d5ef /matterclient
parent0b4ac6143514d2f3fbd8c55eec5d9e8bc6dd62bf (diff)
downloadmatterbridge-msglm-4fb0544b0e25bf6409811fc3e574bf45efea369d.tar.gz
matterbridge-msglm-4fb0544b0e25bf6409811fc3e574bf45efea369d.tar.bz2
matterbridge-msglm-4fb0544b0e25bf6409811fc3e574bf45efea369d.zip
Fix GetLastViewedAt
Diffstat (limited to 'matterclient')
-rw-r--r--matterclient/matterclient.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 90c8d1a4..cf51847a 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -275,7 +275,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
}
func (m *MMClient) UpdateUsers() error {
- mmusers, err := m.Client.GetProfiles(0, 1000, "")
+ mmusers, err := m.Client.GetProfiles(0, 5000, "")
if err != nil {
return errors.New(err.DetailedError)
}
@@ -542,14 +542,12 @@ func (m *MMClient) GetTeamFromChannel(channelId string) string {
func (m *MMClient) GetLastViewedAt(channelId string) int64 {
m.RLock()
defer m.RUnlock()
- /*
- for _, t := range m.OtherTeams {
- if _, ok := t.Channels.Members[channelId]; ok {
- return t.Channels.Members[channelId].LastViewedAt
- }
- }
- */
- return 0
+ res, err := m.Client.GetChannel(channelId, "")
+ if err != nil {
+ return model.GetMillis()
+ }
+ data := res.Data.(*model.ChannelData)
+ return data.Member.LastViewedAt
}
func (m *MMClient) GetUsers() map[string]*model.User {
@@ -623,7 +621,7 @@ func (m *MMClient) initUser() error {
//m.log.Debug("initUser(): loading all team data")
for _, v := range initData.Teams {
m.Client.SetTeamId(v.Id)
- mmusers, _ := m.Client.GetProfiles(0, 1000, "")
+ mmusers, _ := m.Client.GetProfiles(0, 5000, "")
t := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id}
mmchannels, _ := m.Client.GetChannels("")
t.Channels = mmchannels.Data.(*model.ChannelList)