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

Merge branch 'master' into player

This commit is contained in:
John Preston
2016-09-23 22:22:40 +03:00
21 changed files with 170 additions and 84 deletions

View File

@@ -1110,19 +1110,22 @@ namespace {
return false;
}
void updateEditedMessage(const MTPDmessage &m) {
PeerId peerId = peerFromMTP(m.vto_id);
template <typename TMTPDclass>
void updateEditedMessage(const TMTPDclass &m) {
auto peerId = peerFromMTP(m.vto_id);
if (m.has_from_id() && peerToUser(peerId) == MTP::authedId()) {
peerId = peerFromUser(m.vfrom_id);
}
if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) {
if (auto existing = App::histItemById(peerToChannel(peerId), m.vid.v)) {
existing->applyEdition(m);
}
}
void updateEditedMessageToEmpty(PeerId peerId, MsgId msgId) {
if (auto existing = App::histItemById(peerToChannel(peerId), msgId)) {
existing->applyEditionToEmpty();
void updateEditedMessage(const MTPMessage &m) {
if (m.type() == mtpc_message) { // apply message edit
App::updateEditedMessage(m.c_message());
} else if (m.type() == mtpc_messageService) {
App::updateEditedMessage(m.c_messageService());
}
}