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

Function ParseInvite

Telegram/SourceFiles/api/api_chat_invite.cpp:74–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72};
73
74[[nodiscard]] ChatInvite ParseInvite(
75 not_null<Main::Session*> session,
76 const MTPDchatInvite &data) {
77 auto participants = std::vector<InviteParticipant>();
78 if (const auto list = data.vparticipants()) {
79 participants.reserve(list->v.size());
80 for (const auto &participant : list->v) {
81 if (const auto user = session->data().processUser(participant)) {
82 participants.push_back(InviteParticipant{ user });
83 }
84 }
85 }
86 const auto photo = session->data().processPhoto(data.vphoto());
87 return {
88 .title = qs(data.vtitle()),
89 .about = data.vabout().value_or_empty(),
90 .photo = (photo->isNull() ? nullptr : photo.get()),
91 .participantsCount = data.vparticipants_count().v,
92 .participants = std::move(participants),
93 .isPublic = data.is_public(),
94 .isChannel = data.is_channel(),
95 .isMegagroup = data.is_megagroup(),
96 .isBroadcast = data.is_broadcast(),
97 .isRequestNeeded = data.is_request_needed(),
98 .isFake = data.is_fake(),
99 .isScam = data.is_scam(),
100 .isVerified = data.is_verified(),
101 };
102}
103
104[[nodiscard]] Info::Profile::BadgeType BadgeForInvite(
105 const ChatInvite &invite) {

Callers 1

ConfirmInviteBoxFunction · 0.85

Calls 7

qsFunction · 0.85
processUserMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
processPhotoMethod · 0.45
isNullMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected