package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type Config struct {
Flags bin .Fields
DefaultP2PContacts bool
PreloadFeaturedStickers bool
RevokePmInbox bool
BlockedMode bool
ForceTryIpv6 bool
Date int
Expires int
TestMode bool
ThisDC int
DCOptions []DCOption
DCTxtDomainName string
ChatSizeMax int
MegagroupSizeMax int
ForwardedCountMax int
OnlineUpdatePeriodMs int
OfflineBlurTimeoutMs int
OfflineIdleTimeoutMs int
OnlineCloudTimeoutMs int
NotifyCloudDelayMs int
NotifyDefaultDelayMs int
PushChatPeriodMs int
PushChatLimit int
EditTimeLimit int
RevokeTimeLimit int
RevokePmTimeLimit int
RatingEDecay int
StickersRecentLimit int
ChannelsReadMediaPeriod int
TmpSessions int
CallReceiveTimeoutMs int
CallRingTimeoutMs int
CallConnectTimeoutMs int
CallPacketTimeoutMs int
MeURLPrefix string
AutoupdateURLPrefix string
GifSearchUsername string
VenueSearchUsername string
ImgSearchUsername string
StaticMapsProvider string
CaptionLengthMax int
MessageLengthMax int
WebfileDCID int
SuggestedLangCode string
LangPackVersion int
BaseLangPackVersion int
ReactionsDefault ReactionClass
AutologinToken string
}
const ConfigTypeID = 0xcc1a241e
var (
_ bin .Encoder = &Config {}
_ bin .Decoder = &Config {}
_ bin .BareEncoder = &Config {}
_ bin .BareDecoder = &Config {}
)
func (c *Config ) Zero () bool {
if c == nil {
return true
}
if !(c .Flags .Zero ()) {
return false
}
if !(c .DefaultP2PContacts == false ) {
return false
}
if !(c .PreloadFeaturedStickers == false ) {
return false
}
if !(c .RevokePmInbox == false ) {
return false
}
if !(c .BlockedMode == false ) {
return false
}
if !(c .ForceTryIpv6 == false ) {
return false
}
if !(c .Date == 0 ) {
return false
}
if !(c .Expires == 0 ) {
return false
}
if !(c .TestMode == false ) {
return false
}
if !(c .ThisDC == 0 ) {
return false
}
if !(c .DCOptions == nil ) {
return false
}
if !(c .DCTxtDomainName == "" ) {
return false
}
if !(c .ChatSizeMax == 0 ) {
return false
}
if !(c .MegagroupSizeMax == 0 ) {
return false
}
if !(c .ForwardedCountMax == 0 ) {
return false
}
if !(c .OnlineUpdatePeriodMs == 0 ) {
return false
}
if !(c .OfflineBlurTimeoutMs == 0 ) {
return false
}
if !(c .OfflineIdleTimeoutMs == 0 ) {
return false
}
if !(c .OnlineCloudTimeoutMs == 0 ) {
return false
}
if !(c .NotifyCloudDelayMs == 0 ) {
return false
}
if !(c .NotifyDefaultDelayMs == 0 ) {
return false
}
if !(c .PushChatPeriodMs == 0 ) {
return false
}
if !(c .PushChatLimit == 0 ) {
return false
}
if !(c .EditTimeLimit == 0 ) {
return false
}
if !(c .RevokeTimeLimit == 0 ) {
return false
}
if !(c .RevokePmTimeLimit == 0 ) {
return false
}
if !(c .RatingEDecay == 0 ) {
return false
}
if !(c .StickersRecentLimit == 0 ) {
return false
}
if !(c .ChannelsReadMediaPeriod == 0 ) {
return false
}
if !(c .TmpSessions == 0 ) {
return false
}
if !(c .CallReceiveTimeoutMs == 0 ) {
return false
}
if !(c .CallRingTimeoutMs == 0 ) {
return false
}
if !(c .CallConnectTimeoutMs == 0 ) {
return false
}
if !(c .CallPacketTimeoutMs == 0 ) {
return false
}
if !(c .MeURLPrefix == "" ) {
return false
}
if !(c .AutoupdateURLPrefix == "" ) {
return false
}
if !(c .GifSearchUsername == "" ) {
return false
}
if !(c .VenueSearchUsername == "" ) {
return false
}
if !(c .ImgSearchUsername == "" ) {
return false
}
if !(c .StaticMapsProvider == "" ) {
return false
}
if !(c .CaptionLengthMax == 0 ) {
return false
}
if !(c .MessageLengthMax == 0 ) {
return false
}
if !(c .WebfileDCID == 0 ) {
return false
}
if !(c .SuggestedLangCode == "" ) {
return false
}
if !(c .LangPackVersion == 0 ) {
return false
}
if !(c .BaseLangPackVersion == 0 ) {
return false
}
if !(c .ReactionsDefault == nil ) {
return false
}
if !(c .AutologinToken == "" ) {
return false
}
return true
}
func (c *Config ) String () string {
if c == nil {
return "Config(nil)"
}
type Alias Config
return fmt .Sprintf ("Config%+v" , Alias (*c ))
}
func (c *Config ) FillFrom (from interface {
GetDefaultP2PContacts () (value bool )
GetPreloadFeaturedStickers () (value bool )
GetRevokePmInbox () (value bool )
GetBlockedMode () (value bool )
GetForceTryIpv6 () (value bool )
GetDate () (value int )
GetExpires () (value int )
GetTestMode () (value bool )
GetThisDC () (value int )
GetDCOptions () (value []DCOption )
GetDCTxtDomainName () (value string )
GetChatSizeMax () (value int )
GetMegagroupSizeMax () (value int )
GetForwardedCountMax () (value int )
GetOnlineUpdatePeriodMs () (value int )
GetOfflineBlurTimeoutMs () (value int )
GetOfflineIdleTimeoutMs () (value int )
GetOnlineCloudTimeoutMs () (value int )
GetNotifyCloudDelayMs () (value int )
GetNotifyDefaultDelayMs () (value int )
GetPushChatPeriodMs () (value int )
GetPushChatLimit () (value int )
GetEditTimeLimit () (value int )
GetRevokeTimeLimit () (value int )
GetRevokePmTimeLimit () (value int )
GetRatingEDecay () (value int )
GetStickersRecentLimit () (value int )
GetChannelsReadMediaPeriod () (value int )
GetTmpSessions () (value int , ok bool )
GetCallReceiveTimeoutMs () (value int )
GetCallRingTimeoutMs () (value int )
GetCallConnectTimeoutMs () (value int )
GetCallPacketTimeoutMs () (value int )
GetMeURLPrefix () (value string )
GetAutoupdateURLPrefix () (value string , ok bool )
GetGifSearchUsername () (value string , ok bool )
GetVenueSearchUsername () (value string , ok bool )
GetImgSearchUsername () (value string , ok bool )
GetStaticMapsProvider () (value string , ok bool )
GetCaptionLengthMax () (value int )
GetMessageLengthMax () (value int )
GetWebfileDCID () (value int )
GetSuggestedLangCode () (value string , ok bool )
GetLangPackVersion () (value int , ok bool )
GetBaseLangPackVersion () (value int , ok bool )
GetReactionsDefault () (value ReactionClass , ok bool )
GetAutologinToken () (value string , ok bool )
}) {
c .DefaultP2PContacts = from .GetDefaultP2PContacts ()
c .PreloadFeaturedStickers = from .GetPreloadFeaturedStickers ()
c .RevokePmInbox = from .GetRevokePmInbox ()
c .BlockedMode = from .GetBlockedMode ()
c .ForceTryIpv6 = from .GetForceTryIpv6 ()
c .Date = from .GetDate ()
c .Expires = from .GetExpires ()
c .TestMode = from .GetTestMode ()
c .ThisDC = from .GetThisDC ()
c .DCOptions = from .GetDCOptions ()
c .DCTxtDomainName = from .GetDCTxtDomainName ()
c .ChatSizeMax = from .GetChatSizeMax ()
c .MegagroupSizeMax = from .GetMegagroupSizeMax ()
c .ForwardedCountMax = from .GetForwardedCountMax ()
c .OnlineUpdatePeriodMs = from .GetOnlineUpdatePeriodMs ()
c .OfflineBlurTimeoutMs = from .GetOfflineBlurTimeoutMs ()
c .OfflineIdleTimeoutMs = from .GetOfflineIdleTimeoutMs ()
c .OnlineCloudTimeoutMs = from .GetOnlineCloudTimeoutMs ()
c .NotifyCloudDelayMs = from .GetNotifyCloudDelayMs ()
c .NotifyDefaultDelayMs = from .GetNotifyDefaultDelayMs ()
c .PushChatPeriodMs = from .GetPushChatPeriodMs ()
c .PushChatLimit = from .GetPushChatLimit ()
c .EditTimeLimit = from .GetEditTimeLimit ()
c .RevokeTimeLimit = from .GetRevokeTimeLimit ()
c .RevokePmTimeLimit = from .GetRevokePmTimeLimit ()
c .RatingEDecay = from .GetRatingEDecay ()
c .StickersRecentLimit = from .GetStickersRecentLimit ()
c .ChannelsReadMediaPeriod = from .GetChannelsReadMediaPeriod ()
if val , ok := from .GetTmpSessions (); ok {
c .TmpSessions = val
}
c .CallReceiveTimeoutMs = from .GetCallReceiveTimeoutMs ()
c .CallRingTimeoutMs = from .GetCallRingTimeoutMs ()
c .CallConnectTimeoutMs = from .GetCallConnectTimeoutMs ()
c .CallPacketTimeoutMs = from .GetCallPacketTimeoutMs ()
c .MeURLPrefix = from .GetMeURLPrefix ()
if val , ok := from .GetAutoupdateURLPrefix (); ok {
c .AutoupdateURLPrefix = val
}
if val , ok := from .GetGifSearchUsername (); ok {
c .GifSearchUsername = val
}
if val , ok := from .GetVenueSearchUsername (); ok {
c .VenueSearchUsername = val
}
if val , ok := from .GetImgSearchUsername (); ok {
c .ImgSearchUsername = val
}
if val , ok := from .GetStaticMapsProvider (); ok {
c .StaticMapsProvider = val
}
c .CaptionLengthMax = from .GetCaptionLengthMax ()
c .MessageLengthMax = from .GetMessageLengthMax ()
c .WebfileDCID = from .GetWebfileDCID ()
if val , ok := from .GetSuggestedLangCode (); ok {
c .SuggestedLangCode = val
}
if val , ok := from .GetLangPackVersion (); ok {
c .LangPackVersion = val
}
if val , ok := from .GetBaseLangPackVersion (); ok {
c .BaseLangPackVersion = val
}
if val , ok := from .GetReactionsDefault (); ok {
c .ReactionsDefault = val
}
if val , ok := from .GetAutologinToken (); ok {
c .AutologinToken = val
}
}
func (*Config ) TypeID () uint32 {
return ConfigTypeID
}
func (*Config ) TypeName () string {
return "config"
}
func (c *Config ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "config" ,
ID : ConfigTypeID ,
}
if c == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DefaultP2PContacts" ,
SchemaName : "default_p2p_contacts" ,
Null : !c .Flags .Has (3 ),
},
{
Name : "PreloadFeaturedStickers" ,
SchemaName : "preload_featured_stickers" ,
Null : !c .Flags .Has (4 ),
},
{
Name : "RevokePmInbox" ,
SchemaName : "revoke_pm_inbox" ,
Null : !c .Flags .Has (6 ),
},
{
Name : "BlockedMode" ,
SchemaName : "blocked_mode" ,
Null : !c .Flags .Has (8 ),
},
{
Name : "ForceTryIpv6" ,
SchemaName : "force_try_ipv6" ,
Null : !c .Flags .Has (14 ),
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "Expires" ,
SchemaName : "expires" ,
},
{
Name : "TestMode" ,
SchemaName : "test_mode" ,
},
{
Name : "ThisDC" ,
SchemaName : "this_dc" ,
},
{
Name : "DCOptions" ,
SchemaName : "dc_options" ,
},
{
Name : "DCTxtDomainName" ,
SchemaName : "dc_txt_domain_name" ,
},
{
Name : "ChatSizeMax" ,
SchemaName : "chat_size_max" ,
},
{
Name : "MegagroupSizeMax" ,
SchemaName : "megagroup_size_max" ,
},
{
Name : "ForwardedCountMax" ,
SchemaName : "forwarded_count_max" ,
},
{
Name : "OnlineUpdatePeriodMs" ,
SchemaName : "online_update_period_ms" ,
},
{
Name : "OfflineBlurTimeoutMs" ,
SchemaName : "offline_blur_timeout_ms" ,
},
{
Name : "OfflineIdleTimeoutMs" ,
SchemaName : "offline_idle_timeout_ms" ,
},
{
Name : "OnlineCloudTimeoutMs" ,
SchemaName : "online_cloud_timeout_ms" ,
},
{
Name : "NotifyCloudDelayMs" ,
SchemaName : "notify_cloud_delay_ms" ,
},
{
Name : "NotifyDefaultDelayMs" ,
SchemaName : "notify_default_delay_ms" ,
},
{
Name : "PushChatPeriodMs" ,
SchemaName : "push_chat_period_ms" ,
},
{
Name : "PushChatLimit" ,
SchemaName : "push_chat_limit" ,
},
{
Name : "EditTimeLimit" ,
SchemaName : "edit_time_limit" ,
},
{
Name : "RevokeTimeLimit" ,
SchemaName : "revoke_time_limit" ,
},
{
Name : "RevokePmTimeLimit" ,
SchemaName : "revoke_pm_time_limit" ,
},
{
Name : "RatingEDecay" ,
SchemaName : "rating_e_decay" ,
},
{
Name : "StickersRecentLimit" ,
SchemaName : "stickers_recent_limit" ,
},
{
Name : "ChannelsReadMediaPeriod" ,
SchemaName : "channels_read_media_period" ,
},
{
Name : "TmpSessions" ,
SchemaName : "tmp_sessions" ,
Null : !c .Flags .Has (0 ),
},
{
Name : "CallReceiveTimeoutMs" ,
SchemaName : "call_receive_timeout_ms" ,
},
{
Name : "CallRingTimeoutMs" ,
SchemaName : "call_ring_timeout_ms" ,
},
{
Name : "CallConnectTimeoutMs" ,
SchemaName : "call_connect_timeout_ms" ,
},
{
Name : "CallPacketTimeoutMs" ,
SchemaName : "call_packet_timeout_ms" ,
},
{
Name : "MeURLPrefix" ,
SchemaName : "me_url_prefix" ,
},
{
Name : "AutoupdateURLPrefix" ,
SchemaName : "autoupdate_url_prefix" ,
Null : !c .Flags .Has (7 ),
},
{
Name : "GifSearchUsername" ,
SchemaName : "gif_search_username" ,
Null : !c .Flags .Has (9 ),
},
{
Name : "VenueSearchUsername" ,
SchemaName : "venue_search_username" ,
Null : !c .Flags .Has (10 ),
},
{
Name : "ImgSearchUsername" ,
SchemaName : "img_search_username" ,
Null : !c .Flags .Has (11 ),
},
{
Name : "StaticMapsProvider" ,
SchemaName : "static_maps_provider" ,
Null : !c .Flags .Has (12 ),
},
{
Name : "CaptionLengthMax" ,
SchemaName : "caption_length_max" ,
},
{
Name : "MessageLengthMax" ,
SchemaName : "message_length_max" ,
},
{
Name : "WebfileDCID" ,
SchemaName : "webfile_dc_id" ,
},
{
Name : "SuggestedLangCode" ,
SchemaName : "suggested_lang_code" ,
Null : !c .Flags .Has (2 ),
},
{
Name : "LangPackVersion" ,
SchemaName : "lang_pack_version" ,
Null : !c .Flags .Has (2 ),
},
{
Name : "BaseLangPackVersion" ,
SchemaName : "base_lang_pack_version" ,
Null : !c .Flags .Has (2 ),
},
{
Name : "ReactionsDefault" ,
SchemaName : "reactions_default" ,
Null : !c .Flags .Has (15 ),
},
{
Name : "AutologinToken" ,
SchemaName : "autologin_token" ,
Null : !c .Flags .Has (16 ),
},
}
return typ
}
func (c *Config ) SetFlags () {
if !(c .DefaultP2PContacts == false ) {
c .Flags .Set (3 )
}
if !(c .PreloadFeaturedStickers == false ) {
c .Flags .Set (4 )
}
if !(c .RevokePmInbox == false ) {
c .Flags .Set (6 )
}
if !(c .BlockedMode == false ) {
c .Flags .Set (8 )
}
if !(c .ForceTryIpv6 == false ) {
c .Flags .Set (14 )
}
if !(c .TmpSessions == 0 ) {
c .Flags .Set (0 )
}
if !(c .AutoupdateURLPrefix == "" ) {
c .Flags .Set (7 )
}
if !(c .GifSearchUsername == "" ) {
c .Flags .Set (9 )
}
if !(c .VenueSearchUsername == "" ) {
c .Flags .Set (10 )
}
if !(c .ImgSearchUsername == "" ) {
c .Flags .Set (11 )
}
if !(c .StaticMapsProvider == "" ) {
c .Flags .Set (12 )
}
if !(c .SuggestedLangCode == "" ) {
c .Flags .Set (2 )
}
if !(c .LangPackVersion == 0 ) {
c .Flags .Set (2 )
}
if !(c .BaseLangPackVersion == 0 ) {
c .Flags .Set (2 )
}
if !(c .ReactionsDefault == nil ) {
c .Flags .Set (15 )
}
if !(c .AutologinToken == "" ) {
c .Flags .Set (16 )
}
}
func (c *Config ) Encode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode config#cc1a241e as nil" )
}
b .PutID (ConfigTypeID )
return c .EncodeBare (b )
}
func (c *Config ) EncodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't encode config#cc1a241e as nil" )
}
c .SetFlags ()
if err := c .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode config#cc1a241e: field flags: %w" , err )
}
b .PutInt (c .Date )
b .PutInt (c .Expires )
b .PutBool (c .TestMode )
b .PutInt (c .ThisDC )
b .PutVectorHeader (len (c .DCOptions ))
for idx , v := range c .DCOptions {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode config#cc1a241e: field dc_options element with index %d: %w" , idx , err )
}
}
b .PutString (c .DCTxtDomainName )
b .PutInt (c .ChatSizeMax )
b .PutInt (c .MegagroupSizeMax )
b .PutInt (c .ForwardedCountMax )
b .PutInt (c .OnlineUpdatePeriodMs )
b .PutInt (c .OfflineBlurTimeoutMs )
b .PutInt (c .OfflineIdleTimeoutMs )
b .PutInt (c .OnlineCloudTimeoutMs )
b .PutInt (c .NotifyCloudDelayMs )
b .PutInt (c .NotifyDefaultDelayMs )
b .PutInt (c .PushChatPeriodMs )
b .PutInt (c .PushChatLimit )
b .PutInt (c .EditTimeLimit )
b .PutInt (c .RevokeTimeLimit )
b .PutInt (c .RevokePmTimeLimit )
b .PutInt (c .RatingEDecay )
b .PutInt (c .StickersRecentLimit )
b .PutInt (c .ChannelsReadMediaPeriod )
if c .Flags .Has (0 ) {
b .PutInt (c .TmpSessions )
}
b .PutInt (c .CallReceiveTimeoutMs )
b .PutInt (c .CallRingTimeoutMs )
b .PutInt (c .CallConnectTimeoutMs )
b .PutInt (c .CallPacketTimeoutMs )
b .PutString (c .MeURLPrefix )
if c .Flags .Has (7 ) {
b .PutString (c .AutoupdateURLPrefix )
}
if c .Flags .Has (9 ) {
b .PutString (c .GifSearchUsername )
}
if c .Flags .Has (10 ) {
b .PutString (c .VenueSearchUsername )
}
if c .Flags .Has (11 ) {
b .PutString (c .ImgSearchUsername )
}
if c .Flags .Has (12 ) {
b .PutString (c .StaticMapsProvider )
}
b .PutInt (c .CaptionLengthMax )
b .PutInt (c .MessageLengthMax )
b .PutInt (c .WebfileDCID )
if c .Flags .Has (2 ) {
b .PutString (c .SuggestedLangCode )
}
if c .Flags .Has (2 ) {
b .PutInt (c .LangPackVersion )
}
if c .Flags .Has (2 ) {
b .PutInt (c .BaseLangPackVersion )
}
if c .Flags .Has (15 ) {
if c .ReactionsDefault == nil {
return fmt .Errorf ("unable to encode config#cc1a241e: field reactions_default is nil" )
}
if err := c .ReactionsDefault .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode config#cc1a241e: field reactions_default: %w" , err )
}
}
if c .Flags .Has (16 ) {
b .PutString (c .AutologinToken )
}
return nil
}
func (c *Config ) Decode (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode config#cc1a241e to nil" )
}
if err := b .ConsumeID (ConfigTypeID ); err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: %w" , err )
}
return c .DecodeBare (b )
}
func (c *Config ) DecodeBare (b *bin .Buffer ) error {
if c == nil {
return fmt .Errorf ("can't decode config#cc1a241e to nil" )
}
{
if err := c .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field flags: %w" , err )
}
}
c .DefaultP2PContacts = c .Flags .Has (3 )
c .PreloadFeaturedStickers = c .Flags .Has (4 )
c .RevokePmInbox = c .Flags .Has (6 )
c .BlockedMode = c .Flags .Has (8 )
c .ForceTryIpv6 = c .Flags .Has (14 )
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field date: %w" , err )
}
c .Date = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field expires: %w" , err )
}
c .Expires = value
}
{
value , err := b .Bool ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field test_mode: %w" , err )
}
c .TestMode = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field this_dc: %w" , err )
}
c .ThisDC = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field dc_options: %w" , err )
}
if headerLen > 0 {
c .DCOptions = make ([]DCOption , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value DCOption
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field dc_options: %w" , err )
}
c .DCOptions = append (c .DCOptions , value )
}
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field dc_txt_domain_name: %w" , err )
}
c .DCTxtDomainName = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field chat_size_max: %w" , err )
}
c .ChatSizeMax = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field megagroup_size_max: %w" , err )
}
c .MegagroupSizeMax = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field forwarded_count_max: %w" , err )
}
c .ForwardedCountMax = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field online_update_period_ms: %w" , err )
}
c .OnlineUpdatePeriodMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field offline_blur_timeout_ms: %w" , err )
}
c .OfflineBlurTimeoutMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field offline_idle_timeout_ms: %w" , err )
}
c .OfflineIdleTimeoutMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field online_cloud_timeout_ms: %w" , err )
}
c .OnlineCloudTimeoutMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field notify_cloud_delay_ms: %w" , err )
}
c .NotifyCloudDelayMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field notify_default_delay_ms: %w" , err )
}
c .NotifyDefaultDelayMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field push_chat_period_ms: %w" , err )
}
c .PushChatPeriodMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field push_chat_limit: %w" , err )
}
c .PushChatLimit = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field edit_time_limit: %w" , err )
}
c .EditTimeLimit = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field revoke_time_limit: %w" , err )
}
c .RevokeTimeLimit = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field revoke_pm_time_limit: %w" , err )
}
c .RevokePmTimeLimit = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field rating_e_decay: %w" , err )
}
c .RatingEDecay = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field stickers_recent_limit: %w" , err )
}
c .StickersRecentLimit = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field channels_read_media_period: %w" , err )
}
c .ChannelsReadMediaPeriod = value
}
if c .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field tmp_sessions: %w" , err )
}
c .TmpSessions = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field call_receive_timeout_ms: %w" , err )
}
c .CallReceiveTimeoutMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field call_ring_timeout_ms: %w" , err )
}
c .CallRingTimeoutMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field call_connect_timeout_ms: %w" , err )
}
c .CallConnectTimeoutMs = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field call_packet_timeout_ms: %w" , err )
}
c .CallPacketTimeoutMs = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field me_url_prefix: %w" , err )
}
c .MeURLPrefix = value
}
if c .Flags .Has (7 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field autoupdate_url_prefix: %w" , err )
}
c .AutoupdateURLPrefix = value
}
if c .Flags .Has (9 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field gif_search_username: %w" , err )
}
c .GifSearchUsername = value
}
if c .Flags .Has (10 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field venue_search_username: %w" , err )
}
c .VenueSearchUsername = value
}
if c .Flags .Has (11 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field img_search_username: %w" , err )
}
c .ImgSearchUsername = value
}
if c .Flags .Has (12 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field static_maps_provider: %w" , err )
}
c .StaticMapsProvider = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field caption_length_max: %w" , err )
}
c .CaptionLengthMax = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field message_length_max: %w" , err )
}
c .MessageLengthMax = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field webfile_dc_id: %w" , err )
}
c .WebfileDCID = value
}
if c .Flags .Has (2 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field suggested_lang_code: %w" , err )
}
c .SuggestedLangCode = value
}
if c .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field lang_pack_version: %w" , err )
}
c .LangPackVersion = value
}
if c .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field base_lang_pack_version: %w" , err )
}
c .BaseLangPackVersion = value
}
if c .Flags .Has (15 ) {
value , err := DecodeReaction (b )
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field reactions_default: %w" , err )
}
c .ReactionsDefault = value
}
if c .Flags .Has (16 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode config#cc1a241e: field autologin_token: %w" , err )
}
c .AutologinToken = value
}
return nil
}
func (c *Config ) SetDefaultP2PContacts (value bool ) {
if value {
c .Flags .Set (3 )
c .DefaultP2PContacts = true
} else {
c .Flags .Unset (3 )
c .DefaultP2PContacts = false
}
}
func (c *Config ) GetDefaultP2PContacts () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (3 )
}
func (c *Config ) SetPreloadFeaturedStickers (value bool ) {
if value {
c .Flags .Set (4 )
c .PreloadFeaturedStickers = true
} else {
c .Flags .Unset (4 )
c .PreloadFeaturedStickers = false
}
}
func (c *Config ) GetPreloadFeaturedStickers () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (4 )
}
func (c *Config ) SetRevokePmInbox (value bool ) {
if value {
c .Flags .Set (6 )
c .RevokePmInbox = true
} else {
c .Flags .Unset (6 )
c .RevokePmInbox = false
}
}
func (c *Config ) GetRevokePmInbox () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (6 )
}
func (c *Config ) SetBlockedMode (value bool ) {
if value {
c .Flags .Set (8 )
c .BlockedMode = true
} else {
c .Flags .Unset (8 )
c .BlockedMode = false
}
}
func (c *Config ) GetBlockedMode () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (8 )
}
func (c *Config ) SetForceTryIpv6 (value bool ) {
if value {
c .Flags .Set (14 )
c .ForceTryIpv6 = true
} else {
c .Flags .Unset (14 )
c .ForceTryIpv6 = false
}
}
func (c *Config ) GetForceTryIpv6 () (value bool ) {
if c == nil {
return
}
return c .Flags .Has (14 )
}
func (c *Config ) GetDate () (value int ) {
if c == nil {
return
}
return c .Date
}
func (c *Config ) GetExpires () (value int ) {
if c == nil {
return
}
return c .Expires
}
func (c *Config ) GetTestMode () (value bool ) {
if c == nil {
return
}
return c .TestMode
}
func (c *Config ) GetThisDC () (value int ) {
if c == nil {
return
}
return c .ThisDC
}
func (c *Config ) GetDCOptions () (value []DCOption ) {
if c == nil {
return
}
return c .DCOptions
}
func (c *Config ) GetDCTxtDomainName () (value string ) {
if c == nil {
return
}
return c .DCTxtDomainName
}
func (c *Config ) GetChatSizeMax () (value int ) {
if c == nil {
return
}
return c .ChatSizeMax
}
func (c *Config ) GetMegagroupSizeMax () (value int ) {
if c == nil {
return
}
return c .MegagroupSizeMax
}
func (c *Config ) GetForwardedCountMax () (value int ) {
if c == nil {
return
}
return c .ForwardedCountMax
}
func (c *Config ) GetOnlineUpdatePeriodMs () (value int ) {
if c == nil {
return
}
return c .OnlineUpdatePeriodMs
}
func (c *Config ) GetOfflineBlurTimeoutMs () (value int ) {
if c == nil {
return
}
return c .OfflineBlurTimeoutMs
}
func (c *Config ) GetOfflineIdleTimeoutMs () (value int ) {
if c == nil {
return
}
return c .OfflineIdleTimeoutMs
}
func (c *Config ) GetOnlineCloudTimeoutMs () (value int ) {
if c == nil {
return
}
return c .OnlineCloudTimeoutMs
}
func (c *Config ) GetNotifyCloudDelayMs () (value int ) {
if c == nil {
return
}
return c .NotifyCloudDelayMs
}
func (c *Config ) GetNotifyDefaultDelayMs () (value int ) {
if c == nil {
return
}
return c .NotifyDefaultDelayMs
}
func (c *Config ) GetPushChatPeriodMs () (value int ) {
if c == nil {
return
}
return c .PushChatPeriodMs
}
func (c *Config ) GetPushChatLimit () (value int ) {
if c == nil {
return
}
return c .PushChatLimit
}
func (c *Config ) GetEditTimeLimit () (value int ) {
if c == nil {
return
}
return c .EditTimeLimit
}
func (c *Config ) GetRevokeTimeLimit () (value int ) {
if c == nil {
return
}
return c .RevokeTimeLimit
}
func (c *Config ) GetRevokePmTimeLimit () (value int ) {
if c == nil {
return
}
return c .RevokePmTimeLimit
}
func (c *Config ) GetRatingEDecay () (value int ) {
if c == nil {
return
}
return c .RatingEDecay
}
func (c *Config ) GetStickersRecentLimit () (value int ) {
if c == nil {
return
}
return c .StickersRecentLimit
}
func (c *Config ) GetChannelsReadMediaPeriod () (value int ) {
if c == nil {
return
}
return c .ChannelsReadMediaPeriod
}
func (c *Config ) SetTmpSessions (value int ) {
c .Flags .Set (0 )
c .TmpSessions = value
}
func (c *Config ) GetTmpSessions () (value int , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (0 ) {
return value , false
}
return c .TmpSessions , true
}
func (c *Config ) GetCallReceiveTimeoutMs () (value int ) {
if c == nil {
return
}
return c .CallReceiveTimeoutMs
}
func (c *Config ) GetCallRingTimeoutMs () (value int ) {
if c == nil {
return
}
return c .CallRingTimeoutMs
}
func (c *Config ) GetCallConnectTimeoutMs () (value int ) {
if c == nil {
return
}
return c .CallConnectTimeoutMs
}
func (c *Config ) GetCallPacketTimeoutMs () (value int ) {
if c == nil {
return
}
return c .CallPacketTimeoutMs
}
func (c *Config ) GetMeURLPrefix () (value string ) {
if c == nil {
return
}
return c .MeURLPrefix
}
func (c *Config ) SetAutoupdateURLPrefix (value string ) {
c .Flags .Set (7 )
c .AutoupdateURLPrefix = value
}
func (c *Config ) GetAutoupdateURLPrefix () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (7 ) {
return value , false
}
return c .AutoupdateURLPrefix , true
}
func (c *Config ) SetGifSearchUsername (value string ) {
c .Flags .Set (9 )
c .GifSearchUsername = value
}
func (c *Config ) GetGifSearchUsername () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (9 ) {
return value , false
}
return c .GifSearchUsername , true
}
func (c *Config ) SetVenueSearchUsername (value string ) {
c .Flags .Set (10 )
c .VenueSearchUsername = value
}
func (c *Config ) GetVenueSearchUsername () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (10 ) {
return value , false
}
return c .VenueSearchUsername , true
}
func (c *Config ) SetImgSearchUsername (value string ) {
c .Flags .Set (11 )
c .ImgSearchUsername = value
}
func (c *Config ) GetImgSearchUsername () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (11 ) {
return value , false
}
return c .ImgSearchUsername , true
}
func (c *Config ) SetStaticMapsProvider (value string ) {
c .Flags .Set (12 )
c .StaticMapsProvider = value
}
func (c *Config ) GetStaticMapsProvider () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (12 ) {
return value , false
}
return c .StaticMapsProvider , true
}
func (c *Config ) GetCaptionLengthMax () (value int ) {
if c == nil {
return
}
return c .CaptionLengthMax
}
func (c *Config ) GetMessageLengthMax () (value int ) {
if c == nil {
return
}
return c .MessageLengthMax
}
func (c *Config ) GetWebfileDCID () (value int ) {
if c == nil {
return
}
return c .WebfileDCID
}
func (c *Config ) SetSuggestedLangCode (value string ) {
c .Flags .Set (2 )
c .SuggestedLangCode = value
}
func (c *Config ) GetSuggestedLangCode () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (2 ) {
return value , false
}
return c .SuggestedLangCode , true
}
func (c *Config ) SetLangPackVersion (value int ) {
c .Flags .Set (2 )
c .LangPackVersion = value
}
func (c *Config ) GetLangPackVersion () (value int , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (2 ) {
return value , false
}
return c .LangPackVersion , true
}
func (c *Config ) SetBaseLangPackVersion (value int ) {
c .Flags .Set (2 )
c .BaseLangPackVersion = value
}
func (c *Config ) GetBaseLangPackVersion () (value int , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (2 ) {
return value , false
}
return c .BaseLangPackVersion , true
}
func (c *Config ) SetReactionsDefault (value ReactionClass ) {
c .Flags .Set (15 )
c .ReactionsDefault = value
}
func (c *Config ) GetReactionsDefault () (value ReactionClass , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (15 ) {
return value , false
}
return c .ReactionsDefault , true
}
func (c *Config ) SetAutologinToken (value string ) {
c .Flags .Set (16 )
c .AutologinToken = value
}
func (c *Config ) GetAutologinToken () (value string , ok bool ) {
if c == nil {
return
}
if !c .Flags .Has (16 ) {
return value , false
}
return c .AutologinToken , true
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .