2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Version 0.10.8: editing of service message added.

This commit is contained in:
John Preston
2016-09-23 21:26:53 +03:00
parent efbf67a8ff
commit 947963d5d1
5 changed files with 52 additions and 44 deletions

View File

@@ -1111,19 +1111,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());
}
}