-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from tada-team/9015-call-events
9015 fix: set omitempty
- Loading branch information
Showing
9 changed files
with
35 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,15 @@ | ||
package tdproto | ||
|
||
import "time" | ||
|
||
func NewServerCallState(chat HasJid, startCall, finishCall *time.Time, onliners []CallOnliner, audiorecord, buzz bool, uid string, timestamp int64) (r ServerCallState) { | ||
func NewServerCallState(callEvent CallEvent) (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 | ||
r.Params = callEvent | ||
return | ||
} | ||
|
||
// Call participant number or parameters changed | ||
// Call information | ||
type ServerCallState struct { | ||
BaseEvent | ||
Params serverCallStateParams `json:"params"` | ||
Params CallEvent `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"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters