From 4bcd1e3c595c141036a7827fd174b745f2ca6094 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 15 May 2018 21:11:29 +0300 Subject: [PATCH] Allow editing last sent saved message by up key. Also update libtgvoip. Also replace :shrug: with a shrug. --- Telegram/SourceFiles/chat_helpers/message_field.cpp | 3 +++ Telegram/SourceFiles/codegen/emoji/replaces.cpp | 7 +++++++ Telegram/SourceFiles/history/history.cpp | 3 ++- Telegram/ThirdParty/libtgvoip | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 99183480b1..88538c9292 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -121,6 +121,9 @@ MessageField::MessageField(QWidget *parent, not_null contro addInstantReplace("--", QString(1, QChar(8212))); addInstantReplace("<<", QString(1, QChar(171))); addInstantReplace(">>", QString(1, QChar(187))); + addInstantReplace( + ":shrug:", + QChar(175) + QString("\\_(") + QChar(12484) + ")_/" + QChar(175)); const auto &replacements = Ui::Emoji::internal::GetAllReplacements(); for (const auto &one : replacements) { const auto with = Ui::Emoji::QStringFromUTF16(one.emoji); diff --git a/Telegram/SourceFiles/codegen/emoji/replaces.cpp b/Telegram/SourceFiles/codegen/emoji/replaces.cpp index 5972fc390b..76583c50d6 100644 --- a/Telegram/SourceFiles/codegen/emoji/replaces.cpp +++ b/Telegram/SourceFiles/codegen/emoji/replaces.cpp @@ -315,6 +315,13 @@ Replaces PrepareReplaces(const QString &filename) { auto name = getString("name"); auto replacement = getString("alpha_code"); auto aliases = getString("aliases").split('|'); + const auto Exceptions = { ":shrug:" }; + for (const auto &exception : Exceptions) { + const auto index = aliases.indexOf(exception); + if (index >= 0) { + aliases.removeAt(index); + } + } if (aliases.size() == 1 && aliases[0].isEmpty()) { aliases.clear(); } diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 19f01b640f..100b38b2cc 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -2284,7 +2284,8 @@ HistoryItem *History::lastSentMessage() const { for (const auto &block : base::reversed(blocks)) { for (const auto &message : base::reversed(block->messages)) { const auto item = message->data(); - if (IsServerMsgId(item->id) && item->out()) { + if (IsServerMsgId(item->id) + && (item->out() || peer->isSelf())) { return item; } } diff --git a/Telegram/ThirdParty/libtgvoip b/Telegram/ThirdParty/libtgvoip index 3d82d03bbb..ed3a899bbe 160000 --- a/Telegram/ThirdParty/libtgvoip +++ b/Telegram/ThirdParty/libtgvoip @@ -1 +1 @@ -Subproject commit 3d82d03bbb03c0cdb11bcaa399c01a57671044d8 +Subproject commit ed3a899bbe26c56dc25e40730ca6d0e95f59717d