summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-10 20:07:36 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-10 20:07:36 +0300
commit50041afe3f83fb2678ff1bfc2ddd139d5399555a (patch)
tree5f5ccdbba339e23c28f0321ddac1d8e7a2cd64fa
parentc0895c25140c630b03e4c9ece9d290bc0e0b1227 (diff)
fixes #4177 (Telegram: чужие сообщения в моём Избранном показываются от имени Избранного, а не от имени реальных авторов)
-rw-r--r--protocols/Telegram/src/server.cpp25
1 files changed, 25 insertions, 0 deletions
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) {