-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_online.go
58 lines (44 loc) · 1.26 KB
/
server_online.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package tdproto
func NewServerOnline(contacts []OnlineContact, calls []OnlineCall) (r ServerOnline) {
r.Name = r.GetName()
r.Params.Contacts = contacts
r.Params.Calls = calls
return r
}
// Online team members and current active calls
type ServerOnline struct {
BaseEvent
Params serverOnlineParams `json:"params"`
}
func (p ServerOnline) GetName() string { return "server.online" }
// Params of the server.online event
type serverOnlineParams struct {
// Online team members
Contacts []OnlineContact `json:"contacts"`
// Active calls
Calls []OnlineCall `json:"calls,omitempty"`
}
// Contact online status
type OnlineContact struct {
// Contact id
Jid JID `json:"jid"`
// Is away from keyboard
Afk bool `json:"afk,omitempty"`
// Focus mode enabled
Focused bool `json:"focused,omitempty"`
// Is mobile client
Mobile bool `json:"mobile"` // TODO: omitempty. 17feb2020
}
// Active call status
type OnlineCall struct {
// Chat or contact id
Jid JID `json:"jid"`
// Call id
Uid string `json:"uid"`
// Call start
Start ISODateTimeString `json:"start,omitempty"`
// Number participants in call
OnlineCount int `json:"online_count,omitempty"`
// CallType is a type of call("audio" - audio room, "video" - video room)
CallType CallType `json:"call_type"`
}