From 50041afe3f83fb2678ff1bfc2ddd139d5399555a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 10 Feb 2024 20:07:36 +0300 Subject: =?UTF-8?q?fixes=20#4177=20(Telegram:=20=D1=87=D1=83=D0=B6=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B2=20=D0=BC=D0=BE=D1=91=D0=BC=20=D0=98=D0=B7=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D0=BE=D0=BC=20=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=BE=D1=82=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=98=D0=B7=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE,=20=D0=B0=20=D0=BD=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=82=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BE=D0=B2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/server.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 762d6d121a..96d941089b 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -776,6 +776,31 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage) return; } + if (auto *pForward = pMessage->forward_info_.get()) { + CMStringW wszNick; + switch (pForward->origin_->get_id()) { + case TD::messageForwardOriginUser::ID: + if (auto *p = FindUser(((TD::messageForwardOriginUser *)pForward->origin_.get())->sender_user_id_)) + wszNick = p->getDisplayName(); + break; + case TD::messageForwardOriginChat::ID: + if (auto *p = FindChat(((TD::messageForwardOriginChat *)pForward->origin_.get())->sender_chat_id_)) + wszNick = p->getDisplayName(); + break; + case TD::messageForwardOriginChannel::ID: + if (auto *p = FindChat(((TD::messageForwardOriginChannel *)pForward->origin_.get())->chat_id_)) + wszNick = p->getDisplayName(); + break; + default: + wszNick = TranslateT("Unknown"); + } + + wchar_t wszDate[100]; + TimeZone_PrintTimeStamp(0, pForward->date_, L"d t", wszDate, _countof(wszDate), 0); + CMStringW wszForward(FORMAT, L">%s %s %s\r\n", wszDate, wszNick.c_str(), TranslateT("wrote")); + szText.Insert(0, T2Utf(wszForward)); + } + // make a temporary contact if needed if (pUser->hContact == INVALID_CONTACT_ID) { if (pUser->isGroupChat) { -- cgit v1.2.3