diff options
author | Wim <wim@42.be> | 2017-01-17 22:47:59 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-01-17 22:47:59 +0100 |
commit | 6df6c5d615181e91006ac3ceb72a2e09f29d1bb9 (patch) | |
tree | f558baa30943e298e135e4ea5302acabf189e853 | |
parent | 93114b76828357644afb22f7359c0ba185719478 (diff) | |
download | matterbridge-msglm-6df6c5d615181e91006ac3ceb72a2e09f29d1bb9.tar.gz matterbridge-msglm-6df6c5d615181e91006ac3ceb72a2e09f29d1bb9.tar.bz2 matterbridge-msglm-6df6c5d615181e91006ac3ceb72a2e09f29d1bb9.zip |
Add GetStatuses()
-rw-r--r-- | matterclient/matterclient.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index b860ec80..93fb7cad 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -582,6 +582,27 @@ func (m *MMClient) GetStatus(userId string) string { return "offline" } +func (m *MMClient) GetStatuses() map[string]string { + var ok bool + statuses := make(map[string]string) + res, err := m.Client.GetStatuses() + if err != nil { + return statuses + } + if statuses, ok = res.Data.(map[string]string); ok { + for userId, status := range statuses { + statuses[userId] = "offline" + if status == model.STATUS_AWAY { + statuses[userId] = "away" + } + if status == model.STATUS_ONLINE { + statuses[userId] = "online" + } + } + } + return statuses +} + func (m *MMClient) GetTeamId() string { return m.Team.Id } |