MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / setBarSettings

Method setBarSettings

Telegram/SourceFiles/data/data_peer.cpp:892–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890}
891
892void PeerData::setBarSettings(const MTPPeerSettings &data) {
893 data.match([&](const MTPDpeerSettings &data) {
894 const auto wasPaysPerMessage = paysPerMessage();
895 if (!data.vbusiness_bot_id()
896 && !data.vrequest_chat_title()
897 && !data.vcharge_paid_message_stars()
898 && !data.vphone_country()
899 && !data.vregistration_month()
900 && !data.vname_change_date()
901 && !data.vphoto_change_date()) {
902 _barDetails = nullptr;
903 } else if (!_barDetails) {
904 _barDetails = std::make_unique<PeerBarDetails>();
905 }
906 if (_barDetails) {
907 _barDetails->phoneCountryCode
908 = qs(data.vphone_country().value_or_empty());
909 _barDetails->registrationDate = ParseRegistrationDate(
910 data.vregistration_month().value_or_empty());
911 _barDetails->nameChangeDate
912 = data.vname_change_date().value_or_empty();
913 _barDetails->photoChangeDate
914 = data.vphoto_change_date().value_or_empty();
915 _barDetails->requestChatTitle
916 = qs(data.vrequest_chat_title().value_or_empty());
917 _barDetails->requestChatDate
918 = data.vrequest_chat_date().value_or_empty();
919 _barDetails->businessBot = data.vbusiness_bot_id()
920 ? _owner->user(data.vbusiness_bot_id()->v).get()
921 : nullptr;
922 _barDetails->businessBotManageUrl
923 = qs(data.vbusiness_bot_manage_url().value_or_empty());
924 _barDetails->paysPerMessage
925 = data.vcharge_paid_message_stars().value_or_empty();
926 }
927 using Flag = PeerBarSetting;
928 setBarSettings((data.is_add_contact() ? Flag::AddContact : Flag())
929 | (data.is_autoarchived() ? Flag::AutoArchived : Flag())
930 | (data.is_block_contact() ? Flag::BlockContact : Flag())
931 //| (data.is_invite_members() ? Flag::InviteMembers : Flag())
932 | (data.is_need_contacts_exception()
933 ? Flag::NeedContactsException
934 : Flag())
935 //| (data.is_report_geo() ? Flag::ReportGeo : Flag())
936 | (data.is_report_spam() ? Flag::ReportSpam : Flag())
937 | (data.is_share_contact() ? Flag::ShareContact : Flag())
938 | (data.vrequest_chat_title() ? Flag::RequestChat : Flag())
939 | (data.vbusiness_bot_id() ? Flag::HasBusinessBot : Flag())
940 | (data.is_request_chat_broadcast()
941 ? Flag::RequestChatIsBroadcast
942 : Flag())
943 | (data.is_business_bot_paused()
944 ? Flag::BusinessBotPaused
945 : Flag())
946 | (data.is_business_bot_can_reply()
947 ? Flag::BusinessBotCanReply
948 : Flag()));
949 if (wasPaysPerMessage != paysPerMessage()) {

Callers 9

requestPeerSettingsMethod · 0.80
SendRequestFunction · 0.80
ApplyUserUpdateFunction · 0.80
togglePausedMethod · 0.80
feedUpdateMethod · 0.80
setupShareHandlerMethod · 0.80
setupUnarchiveHandlerMethod · 0.80
setupCloseHandlerMethod · 0.80

Calls 11

qsFunction · 0.85
ParseRegistrationDateFunction · 0.85
peerUpdatedMethod · 0.80
FlagEnum · 0.70
getMethod · 0.45
userMethod · 0.45
changesMethod · 0.45
setMethod · 0.45
historyLoadedMethod · 0.45
sessionMethod · 0.45

Tested by

no test coverage detected