diff options
Diffstat (limited to 'matterclient')
-rw-r--r-- | matterclient/matterclient.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index a1efa957..75e67c5c 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -534,6 +534,30 @@ func (m *MMClient) GetUser(userId string) *model.User { return m.Users[userId] } +func (m *MMClient) GetStatuses() error { + _, err := m.Client.GetStatuses([]string{m.User.Id}) + if err != nil { + return errors.New(err.DetailedError) + } + return nil +} + +func (m *MMClient) StatusLoop() { + for { + if m.WsQuit { + return + } + if m.WsConnected { + err := m.GetStatuses() + if err != nil { + m.Logout() + m.Login() + } + } + time.Sleep(time.Second * 30) + } +} + // initialize user and teams func (m *MMClient) initUser() error { m.Lock() |