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

Function peerSize

Telegram/SourceFiles/storage/serialize_peer.cpp:113–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113uint32 peerSize(not_null<PeerData*> peer) {
114 uint32 result = sizeof(quint64) // id
115 + sizeof(quint64) // version tag
116 + sizeof(qint32) // version
117 + sizeof(quint64) // userpic photo id
118 + imageLocationSize(peer->userpicLocation())
119 + sizeof(qint32); // userpic has video
120 if (const auto user = peer->asUser()) {
121 const auto botInlinePlaceholder = user->isBot()
122 ? user->botInfo->inlinePlaceholder
123 : QString();
124 result += stringSize(user->firstName)
125 + stringSize(user->lastName)
126 + stringSize(user->phone())
127 + stringSize(user->username())
128 + sizeof(quint64) // access
129 + sizeof(qint32) // flags
130 + stringSize(botInlinePlaceholder)
131 + sizeof(quint32) // lastseen
132 + sizeof(qint32) // contact
133 + sizeof(qint32) // botInfoVersion
134 + sizeof(qint32); // supportsGuestChat
135 } else if (const auto chat = peer->asChat()) {
136 result += stringSize(chat->name())
137 + sizeof(qint32) // count
138 + sizeof(qint32) // date
139 + sizeof(qint32) // version
140 + sizeof(qint32) // creator id 1
141 + sizeof(qint32) // creator id 2
142 + sizeof(quint32) // flags
143 + stringSize(chat->inviteLink());
144 } else if (const auto channel = peer->asChannel()) {
145 result += stringSize(channel->name())
146 + sizeof(quint64) // access
147 + sizeof(qint32) // date
148 + sizeof(qint32) // version
149 + sizeof(qint32) // old forbidden
150 + sizeof(quint32) // flags
151 + stringSize(channel->inviteLink());
152 }
153 return result;
154}
155
156void writePeer(QDataStream &stream, not_null<PeerData*> peer) {
157 stream

Callers 4

serializeMethod · 0.85
serializeMethod · 0.85
writeMapMethod · 0.85

Calls 11

imageLocationSizeFunction · 0.85
stringSizeFunction · 0.85
userpicLocationMethod · 0.80
asUserMethod · 0.80
asChatMethod · 0.80
asChannelMethod · 0.80
QStringClass · 0.50
isBotMethod · 0.45
usernameMethod · 0.45
nameMethod · 0.45
inviteLinkMethod · 0.45

Tested by

no test coverage detected