mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-21 05:54:10 +08:00
* Route Calls pushes through a VoIP token if present
Add VoIP device id support so calls notifications can be delivered as iOS
PushKit pushes, while standard pushes continue using the regular device
token.
* New SessionPropVoIPDeviceId + IsValidVoIPDeviceID validator
* PushNotifyAppleReactNativeVoIP platform constant
* voip_device_id accepted on PUT /users/sessions/device and on login
* DoLogin refactored to accept LoginOptions struct; all four call sites
(api4/user, channels/web/{saml,magic_link,oauth}) converted
* sendPushNotificationToAllSessions: when SubType=calls, prefer
Session.Props[voip_device_id]; fall back to standard DeviceId
Tests cover the validator, the device-props endpoint (accept/reject), and
the SubType=calls routing matrix.
* Skip session per Calls plugin "answered_elsewhere" convention
When the Calls plugin fans out a cancel-ring push to a user's other
VoIP devices after they answer a call from one of them, it can't tell
core which session to skip because the public plugin API doesn't expose
a skip-session-id parameter. It encodes the auth-session-id on SenderId
together with Category="answered_elsewhere". Core honors the convention
and clears SenderId on the per-session copy before forwarding so the
session id never reaches the proxy or device. Category is preserved on
the wire so the mobile client can pick CXCallEndedReason.answeredElsewhere.
The matching side lives in mattermost-plugin-calls' push_notifications.go;
both sides cross-reference the constant.
* delay voip token audit until session props are set
* capture voip audit failed case
* Promote VoIP token to a column; dispatch by Transport; harden revocation
* ai feedback review
* feedback review
* feedback review
* fix tests
* update openAPI
* update serialized session model
---------
Co-authored-by: Jesse Hallam <jesse@mattermost.com>
938 lines
22 KiB
Go
938 lines
22 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
|
|
|
import (
|
|
"github.com/tinylib/msgp/msgp"
|
|
)
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *LoginOptions) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "DeviceId":
|
|
z.DeviceId, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "DeviceId")
|
|
return
|
|
}
|
|
case "VoIPDeviceId":
|
|
z.VoIPDeviceId, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "VoIPDeviceId")
|
|
return
|
|
}
|
|
case "IsMobile":
|
|
z.IsMobile, err = dc.ReadBool()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsMobile")
|
|
return
|
|
}
|
|
case "IsOAuthUser":
|
|
z.IsOAuthUser, err = dc.ReadBool()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsOAuthUser")
|
|
return
|
|
}
|
|
case "IsSaml":
|
|
z.IsSaml, err = dc.ReadBool()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsSaml")
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *LoginOptions) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 5
|
|
// write "DeviceId"
|
|
err = en.Append(0x85, 0xa8, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.DeviceId)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "DeviceId")
|
|
return
|
|
}
|
|
// write "VoIPDeviceId"
|
|
err = en.Append(0xac, 0x56, 0x6f, 0x49, 0x50, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.VoIPDeviceId)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "VoIPDeviceId")
|
|
return
|
|
}
|
|
// write "IsMobile"
|
|
err = en.Append(0xa8, 0x49, 0x73, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteBool(z.IsMobile)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsMobile")
|
|
return
|
|
}
|
|
// write "IsOAuthUser"
|
|
err = en.Append(0xab, 0x49, 0x73, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x55, 0x73, 0x65, 0x72)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteBool(z.IsOAuthUser)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsOAuthUser")
|
|
return
|
|
}
|
|
// write "IsSaml"
|
|
err = en.Append(0xa6, 0x49, 0x73, 0x53, 0x61, 0x6d, 0x6c)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteBool(z.IsSaml)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsSaml")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *LoginOptions) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 5
|
|
// string "DeviceId"
|
|
o = append(o, 0x85, 0xa8, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64)
|
|
o = msgp.AppendString(o, z.DeviceId)
|
|
// string "VoIPDeviceId"
|
|
o = append(o, 0xac, 0x56, 0x6f, 0x49, 0x50, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64)
|
|
o = msgp.AppendString(o, z.VoIPDeviceId)
|
|
// string "IsMobile"
|
|
o = append(o, 0xa8, 0x49, 0x73, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65)
|
|
o = msgp.AppendBool(o, z.IsMobile)
|
|
// string "IsOAuthUser"
|
|
o = append(o, 0xab, 0x49, 0x73, 0x4f, 0x41, 0x75, 0x74, 0x68, 0x55, 0x73, 0x65, 0x72)
|
|
o = msgp.AppendBool(o, z.IsOAuthUser)
|
|
// string "IsSaml"
|
|
o = append(o, 0xa6, 0x49, 0x73, 0x53, 0x61, 0x6d, 0x6c)
|
|
o = msgp.AppendBool(o, z.IsSaml)
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *LoginOptions) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "DeviceId":
|
|
z.DeviceId, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "DeviceId")
|
|
return
|
|
}
|
|
case "VoIPDeviceId":
|
|
z.VoIPDeviceId, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "VoIPDeviceId")
|
|
return
|
|
}
|
|
case "IsMobile":
|
|
z.IsMobile, bts, err = msgp.ReadBoolBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsMobile")
|
|
return
|
|
}
|
|
case "IsOAuthUser":
|
|
z.IsOAuthUser, bts, err = msgp.ReadBoolBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsOAuthUser")
|
|
return
|
|
}
|
|
case "IsSaml":
|
|
z.IsSaml, bts, err = msgp.ReadBoolBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsSaml")
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *LoginOptions) Msgsize() (s int) {
|
|
s = 1 + 9 + msgp.StringPrefixSize + len(z.DeviceId) + 13 + msgp.StringPrefixSize + len(z.VoIPDeviceId) + 9 + msgp.BoolSize + 12 + msgp.BoolSize + 7 + msgp.BoolSize
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *MobileSessionMetadata) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "Version":
|
|
z.Version, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Version")
|
|
return
|
|
}
|
|
case "Platform":
|
|
z.Platform, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Platform")
|
|
return
|
|
}
|
|
case "Count":
|
|
z.Count, err = dc.ReadFloat64()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Count")
|
|
return
|
|
}
|
|
case "NotificationDisabled":
|
|
z.NotificationDisabled, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "NotificationDisabled")
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *MobileSessionMetadata) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 4
|
|
// write "Version"
|
|
err = en.Append(0x84, 0xa7, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.Version)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Version")
|
|
return
|
|
}
|
|
// write "Platform"
|
|
err = en.Append(0xa8, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.Platform)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Platform")
|
|
return
|
|
}
|
|
// write "Count"
|
|
err = en.Append(0xa5, 0x43, 0x6f, 0x75, 0x6e, 0x74)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteFloat64(z.Count)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Count")
|
|
return
|
|
}
|
|
// write "NotificationDisabled"
|
|
err = en.Append(0xb4, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.NotificationDisabled)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "NotificationDisabled")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *MobileSessionMetadata) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 4
|
|
// string "Version"
|
|
o = append(o, 0x84, 0xa7, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e)
|
|
o = msgp.AppendString(o, z.Version)
|
|
// string "Platform"
|
|
o = append(o, 0xa8, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d)
|
|
o = msgp.AppendString(o, z.Platform)
|
|
// string "Count"
|
|
o = append(o, 0xa5, 0x43, 0x6f, 0x75, 0x6e, 0x74)
|
|
o = msgp.AppendFloat64(o, z.Count)
|
|
// string "NotificationDisabled"
|
|
o = append(o, 0xb4, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64)
|
|
o = msgp.AppendString(o, z.NotificationDisabled)
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *MobileSessionMetadata) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "Version":
|
|
z.Version, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Version")
|
|
return
|
|
}
|
|
case "Platform":
|
|
z.Platform, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Platform")
|
|
return
|
|
}
|
|
case "Count":
|
|
z.Count, bts, err = msgp.ReadFloat64Bytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Count")
|
|
return
|
|
}
|
|
case "NotificationDisabled":
|
|
z.NotificationDisabled, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "NotificationDisabled")
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *MobileSessionMetadata) Msgsize() (s int) {
|
|
s = 1 + 8 + msgp.StringPrefixSize + len(z.Version) + 9 + msgp.StringPrefixSize + len(z.Platform) + 6 + msgp.Float64Size + 21 + msgp.StringPrefixSize + len(z.NotificationDisabled)
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *Session) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var zb0001 uint32
|
|
zb0001, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
if zb0001 != 14 {
|
|
err = msgp.ArrayError{Wanted: 14, Got: zb0001}
|
|
return
|
|
}
|
|
z.Id, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Id")
|
|
return
|
|
}
|
|
z.Token, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Token")
|
|
return
|
|
}
|
|
z.CreateAt, err = dc.ReadInt64()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "CreateAt")
|
|
return
|
|
}
|
|
z.ExpiresAt, err = dc.ReadInt64()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "ExpiresAt")
|
|
return
|
|
}
|
|
z.LastActivityAt, err = dc.ReadInt64()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "LastActivityAt")
|
|
return
|
|
}
|
|
z.UserId, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "UserId")
|
|
return
|
|
}
|
|
z.DeviceId, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "DeviceId")
|
|
return
|
|
}
|
|
z.VoIPDeviceId, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "VoIPDeviceId")
|
|
return
|
|
}
|
|
z.Roles, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Roles")
|
|
return
|
|
}
|
|
z.IsOAuth, err = dc.ReadBool()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsOAuth")
|
|
return
|
|
}
|
|
z.ExpiredNotify, err = dc.ReadBool()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "ExpiredNotify")
|
|
return
|
|
}
|
|
var zb0002 uint32
|
|
zb0002, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props")
|
|
return
|
|
}
|
|
if z.Props == nil {
|
|
z.Props = make(StringMap, zb0002)
|
|
} else if len(z.Props) > 0 {
|
|
for key := range z.Props {
|
|
delete(z.Props, key)
|
|
}
|
|
}
|
|
for zb0002 > 0 {
|
|
zb0002--
|
|
var za0001 string
|
|
var za0002 string
|
|
za0001, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props")
|
|
return
|
|
}
|
|
za0002, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props", za0001)
|
|
return
|
|
}
|
|
z.Props[za0001] = za0002
|
|
}
|
|
var zb0003 uint32
|
|
zb0003, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers")
|
|
return
|
|
}
|
|
if cap(z.TeamMembers) >= int(zb0003) {
|
|
z.TeamMembers = (z.TeamMembers)[:zb0003]
|
|
} else {
|
|
z.TeamMembers = make([]*TeamMember, zb0003)
|
|
}
|
|
for za0003 := range z.TeamMembers {
|
|
if dc.IsNil() {
|
|
err = dc.ReadNil()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers", za0003)
|
|
return
|
|
}
|
|
z.TeamMembers[za0003] = nil
|
|
} else {
|
|
if z.TeamMembers[za0003] == nil {
|
|
z.TeamMembers[za0003] = new(TeamMember)
|
|
}
|
|
err = z.TeamMembers[za0003].DecodeMsg(dc)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers", za0003)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
z.Local, err = dc.ReadBool()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Local")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *Session) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// array header, size 14
|
|
err = en.Append(0x9e)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.Id)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Id")
|
|
return
|
|
}
|
|
err = en.WriteString(z.Token)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Token")
|
|
return
|
|
}
|
|
err = en.WriteInt64(z.CreateAt)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "CreateAt")
|
|
return
|
|
}
|
|
err = en.WriteInt64(z.ExpiresAt)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "ExpiresAt")
|
|
return
|
|
}
|
|
err = en.WriteInt64(z.LastActivityAt)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "LastActivityAt")
|
|
return
|
|
}
|
|
err = en.WriteString(z.UserId)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "UserId")
|
|
return
|
|
}
|
|
err = en.WriteString(z.DeviceId)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "DeviceId")
|
|
return
|
|
}
|
|
err = en.WriteString(z.VoIPDeviceId)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "VoIPDeviceId")
|
|
return
|
|
}
|
|
err = en.WriteString(z.Roles)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Roles")
|
|
return
|
|
}
|
|
err = en.WriteBool(z.IsOAuth)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsOAuth")
|
|
return
|
|
}
|
|
err = en.WriteBool(z.ExpiredNotify)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "ExpiredNotify")
|
|
return
|
|
}
|
|
err = en.WriteMapHeader(uint32(len(z.Props)))
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props")
|
|
return
|
|
}
|
|
for za0001, za0002 := range z.Props {
|
|
err = en.WriteString(za0001)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props")
|
|
return
|
|
}
|
|
err = en.WriteString(za0002)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props", za0001)
|
|
return
|
|
}
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.TeamMembers)))
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers")
|
|
return
|
|
}
|
|
for za0003 := range z.TeamMembers {
|
|
if z.TeamMembers[za0003] == nil {
|
|
err = en.WriteNil()
|
|
if err != nil {
|
|
return
|
|
}
|
|
} else {
|
|
err = z.TeamMembers[za0003].EncodeMsg(en)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers", za0003)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
err = en.WriteBool(z.Local)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Local")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *Session) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// array header, size 14
|
|
o = append(o, 0x9e)
|
|
o = msgp.AppendString(o, z.Id)
|
|
o = msgp.AppendString(o, z.Token)
|
|
o = msgp.AppendInt64(o, z.CreateAt)
|
|
o = msgp.AppendInt64(o, z.ExpiresAt)
|
|
o = msgp.AppendInt64(o, z.LastActivityAt)
|
|
o = msgp.AppendString(o, z.UserId)
|
|
o = msgp.AppendString(o, z.DeviceId)
|
|
o = msgp.AppendString(o, z.VoIPDeviceId)
|
|
o = msgp.AppendString(o, z.Roles)
|
|
o = msgp.AppendBool(o, z.IsOAuth)
|
|
o = msgp.AppendBool(o, z.ExpiredNotify)
|
|
o = msgp.AppendMapHeader(o, uint32(len(z.Props)))
|
|
for za0001, za0002 := range z.Props {
|
|
o = msgp.AppendString(o, za0001)
|
|
o = msgp.AppendString(o, za0002)
|
|
}
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.TeamMembers)))
|
|
for za0003 := range z.TeamMembers {
|
|
if z.TeamMembers[za0003] == nil {
|
|
o = msgp.AppendNil(o)
|
|
} else {
|
|
o, err = z.TeamMembers[za0003].MarshalMsg(o)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers", za0003)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = msgp.AppendBool(o, z.Local)
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *Session) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var zb0001 uint32
|
|
zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
if zb0001 != 14 {
|
|
err = msgp.ArrayError{Wanted: 14, Got: zb0001}
|
|
return
|
|
}
|
|
z.Id, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Id")
|
|
return
|
|
}
|
|
z.Token, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Token")
|
|
return
|
|
}
|
|
z.CreateAt, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "CreateAt")
|
|
return
|
|
}
|
|
z.ExpiresAt, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "ExpiresAt")
|
|
return
|
|
}
|
|
z.LastActivityAt, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "LastActivityAt")
|
|
return
|
|
}
|
|
z.UserId, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "UserId")
|
|
return
|
|
}
|
|
z.DeviceId, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "DeviceId")
|
|
return
|
|
}
|
|
z.VoIPDeviceId, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "VoIPDeviceId")
|
|
return
|
|
}
|
|
z.Roles, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Roles")
|
|
return
|
|
}
|
|
z.IsOAuth, bts, err = msgp.ReadBoolBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "IsOAuth")
|
|
return
|
|
}
|
|
z.ExpiredNotify, bts, err = msgp.ReadBoolBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "ExpiredNotify")
|
|
return
|
|
}
|
|
var zb0002 uint32
|
|
zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props")
|
|
return
|
|
}
|
|
if z.Props == nil {
|
|
z.Props = make(StringMap, zb0002)
|
|
} else if len(z.Props) > 0 {
|
|
for key := range z.Props {
|
|
delete(z.Props, key)
|
|
}
|
|
}
|
|
for zb0002 > 0 {
|
|
var za0001 string
|
|
var za0002 string
|
|
zb0002--
|
|
za0001, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props")
|
|
return
|
|
}
|
|
za0002, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Props", za0001)
|
|
return
|
|
}
|
|
z.Props[za0001] = za0002
|
|
}
|
|
var zb0003 uint32
|
|
zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers")
|
|
return
|
|
}
|
|
if cap(z.TeamMembers) >= int(zb0003) {
|
|
z.TeamMembers = (z.TeamMembers)[:zb0003]
|
|
} else {
|
|
z.TeamMembers = make([]*TeamMember, zb0003)
|
|
}
|
|
for za0003 := range z.TeamMembers {
|
|
if msgp.IsNil(bts) {
|
|
bts, err = msgp.ReadNilBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
z.TeamMembers[za0003] = nil
|
|
} else {
|
|
if z.TeamMembers[za0003] == nil {
|
|
z.TeamMembers[za0003] = new(TeamMember)
|
|
}
|
|
bts, err = z.TeamMembers[za0003].UnmarshalMsg(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "TeamMembers", za0003)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
z.Local, bts, err = msgp.ReadBoolBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Local")
|
|
return
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *Session) Msgsize() (s int) {
|
|
s = 1 + msgp.StringPrefixSize + len(z.Id) + msgp.StringPrefixSize + len(z.Token) + msgp.Int64Size + msgp.Int64Size + msgp.Int64Size + msgp.StringPrefixSize + len(z.UserId) + msgp.StringPrefixSize + len(z.DeviceId) + msgp.StringPrefixSize + len(z.VoIPDeviceId) + msgp.StringPrefixSize + len(z.Roles) + msgp.BoolSize + msgp.BoolSize + msgp.MapHeaderSize
|
|
if z.Props != nil {
|
|
for za0001, za0002 := range z.Props {
|
|
_ = za0002
|
|
s += msgp.StringPrefixSize + len(za0001) + msgp.StringPrefixSize + len(za0002)
|
|
}
|
|
}
|
|
s += msgp.ArrayHeaderSize
|
|
for za0003 := range z.TeamMembers {
|
|
if z.TeamMembers[za0003] == nil {
|
|
s += msgp.NilSize
|
|
} else {
|
|
s += z.TeamMembers[za0003].Msgsize()
|
|
}
|
|
}
|
|
s += msgp.BoolSize
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *StringMap) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var zb0003 uint32
|
|
zb0003, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
if (*z) == nil {
|
|
(*z) = make(StringMap, zb0003)
|
|
} else if len((*z)) > 0 {
|
|
for key := range *z {
|
|
delete((*z), key)
|
|
}
|
|
}
|
|
for zb0003 > 0 {
|
|
zb0003--
|
|
var zb0001 string
|
|
var zb0002 string
|
|
zb0001, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
zb0002, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, zb0001)
|
|
return
|
|
}
|
|
(*z)[zb0001] = zb0002
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z StringMap) EncodeMsg(en *msgp.Writer) (err error) {
|
|
err = en.WriteMapHeader(uint32(len(z)))
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0004, zb0005 := range z {
|
|
err = en.WriteString(zb0004)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
err = en.WriteString(zb0005)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, zb0004)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z StringMap) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
o = msgp.AppendMapHeader(o, uint32(len(z)))
|
|
for zb0004, zb0005 := range z {
|
|
o = msgp.AppendString(o, zb0004)
|
|
o = msgp.AppendString(o, zb0005)
|
|
}
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *StringMap) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var zb0003 uint32
|
|
zb0003, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
if (*z) == nil {
|
|
(*z) = make(StringMap, zb0003)
|
|
} else if len((*z)) > 0 {
|
|
for key := range *z {
|
|
delete((*z), key)
|
|
}
|
|
}
|
|
for zb0003 > 0 {
|
|
var zb0001 string
|
|
var zb0002 string
|
|
zb0003--
|
|
zb0001, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
zb0002, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, zb0001)
|
|
return
|
|
}
|
|
(*z)[zb0001] = zb0002
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z StringMap) Msgsize() (s int) {
|
|
s = msgp.MapHeaderSize
|
|
if z != nil {
|
|
for zb0004, zb0005 := range z {
|
|
_ = zb0005
|
|
s += msgp.StringPrefixSize + len(zb0004) + msgp.StringPrefixSize + len(zb0005)
|
|
}
|
|
}
|
|
return
|
|
}
|