-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_call_state.go
59 lines (44 loc) · 1.3 KB
/
server_call_state.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
59
package tdproto
import "time"
func NewServerCallState(chat HasJid, startCall, finishCall *time.Time, onliners []CallOnliner, audiorecord, buzz bool, uid string, timestamp int64) (r ServerCallState) {
r.Name = r.GetName()
r.Params.Jid = chat.JID()
r.Params.Onliners = onliners
r.Params.Buzz = buzz
r.Params.Uid = uid
r.Params.Audiorecord = audiorecord
r.Params.Timestamp = timestamp
if startCall != nil {
r.Params.Start = NullableIsoDatetime(startCall)
} else {
r.Params.Buzz = true
}
if finishCall != nil {
r.Params.Finish = NullableIsoDatetime(startCall)
}
return r
}
// Call participant number or parameters changed
type ServerCallState struct {
BaseEvent
Params serverCallStateParams `json:"params"`
}
func (p ServerCallState) GetName() string { return "server.call.state" }
type serverCallStateParams struct {
// Chat or contact id
Jid JID `json:"jid"`
// Call id
Uid string `json:"uid"`
// Call participants
Onliners []CallOnliner `json:"onliners,omitempty"`
// Call start, if any
Start *ISODateTimeString `json:"start"`
// Call finish, if any
Finish *ISODateTimeString `json:"finish"`
// Call record enabled
Audiorecord bool `json:"audiorecord"`
// Call buzzing
Buzz bool `json:"buzz,omitempty"`
// Event start. FIXME: why not gentime?
Timestamp int64 `json:"timestamp"`
}