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

Function SetTopPinnedMessageId

Telegram/SourceFiles/data/data_peer.cpp:2180–2206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2178namespace Data {
2179
2180void SetTopPinnedMessageId(
2181 not_null<PeerData*> peer,
2182 MsgId messageId) {
2183 if (const auto channel = peer->asChannel()) {
2184 if (messageId <= channel->availableMinId()) {
2185 return;
2186 }
2187 }
2188 auto &session = peer->session();
2189 const auto hiddenId = session.settings().hiddenPinnedMessageId(peer->id);
2190 if (hiddenId != 0 && hiddenId != messageId) {
2191 session.settings().setHiddenPinnedMessageId(
2192 peer->id,
2193 MsgId(0), // topicRootId
2194 PeerId(0), // monoforumPeerId
2195 0);
2196 session.saveSettingsDelayed();
2197 }
2198 session.storage().add(Storage::SharedMediaAddExisting(
2199 peer->id,
2200 MsgId(0), // topicRootId
2201 PeerId(0), // monoforumPeerId
2202 Storage::SharedMediaType::Pinned,
2203 messageId,
2204 { messageId, ServerMaxMsgId }));
2205 peer->owner().history(peer)->setHasPinnedMessages(true);
2206}
2207
2208FullMsgId ResolveTopPinnedId(
2209 not_null<PeerData*> peer,

Callers 3

ApplyChannelUpdateFunction · 0.85
ApplyUserUpdateFunction · 0.85
ApplyChatUpdateFunction · 0.85

Calls 14

PeerIdClass · 0.85
asChannelMethod · 0.80
availableMinIdMethod · 0.80
hiddenPinnedMessageIdMethod · 0.80
settingsMethod · 0.80
setHasPinnedMessagesMethod · 0.80
MsgIdClass · 0.70
sessionMethod · 0.45
saveSettingsDelayedMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected