2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Improve reply options edit design.

This commit is contained in:
John Preston
2023-10-25 11:00:22 +04:00
parent b463c76eca
commit 1409d38ac3
26 changed files with 219 additions and 86 deletions

View File

@@ -126,6 +126,40 @@ AllowedReactions Parse(const MTPChatReactions &value) {
});
}
PeerData *PeerFromInputMTP(
not_null<Session*> owner,
const MTPInputPeer &input) {
return input.match([&](const MTPDinputPeerUser &data) {
const auto user = owner->user(data.vuser_id().v);
user->setAccessHash(data.vaccess_hash().v);
return (PeerData*)user;
}, [&](const MTPDinputPeerChat &data) {
return (PeerData*)owner->chat(data.vchat_id().v);
}, [&](const MTPDinputPeerChannel &data) {
const auto channel = owner->channel(data.vchannel_id().v);
channel->setAccessHash(data.vaccess_hash().v);
return (PeerData*)channel;
}, [&](const MTPDinputPeerSelf &data) {
return (PeerData*)owner->session().user();
}, [&](const auto &data) {
return (PeerData*)nullptr;
});
}
UserData *UserFromInputMTP(
not_null<Session*> owner,
const MTPInputUser &input) {
return input.match([&](const MTPDinputUser &data) {
const auto user = owner->user(data.vuser_id().v);
user->setAccessHash(data.vaccess_hash().v);
return user.get();
}, [&](const MTPDinputUserSelf &data) {
return owner->session().user().get();
}, [](const auto &data) {
return (UserData*)nullptr;
});
}
} // namespace Data
PeerClickHandler::PeerClickHandler(not_null<PeerData*> peer)