summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index 920d772902..469db0e971 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -530,7 +530,7 @@ void CTelegramProto::ProcessMarkRead(TD::updateChatReadInbox *pObj)
void CTelegramProto::ProcessMessage(TD::updateNewMessage *pObj)
{
- auto &pMessage = pObj->message_;
+ auto *pMessage = pObj->message_.get();
auto *pUser = FindChat(pMessage->chat_id_);
if (pUser == nullptr) {
@@ -538,7 +538,7 @@ void CTelegramProto::ProcessMessage(TD::updateNewMessage *pObj)
return;
}
- CMStringA szText(GetMessageText(pUser, pMessage->content_.get()));
+ CMStringA szText(GetMessageText(pUser, pMessage));
if (szText.IsEmpty()) {
debugLogA("this message was not processed, ignored");
return;
@@ -564,14 +564,8 @@ void CTelegramProto::ProcessMessage(TD::updateNewMessage *pObj)
pre.timestamp = pMessage->date_;
if (pMessage->is_outgoing_)
pre.flags |= PREF_SENT;
- if (pUser->isGroupChat) {
- if (auto *pSender = GetSender(pMessage->sender_id_.get())) {
- _i64toa(pSender->id, szUserId, 10);
- pre.szUserId = szUserId;
- if (pUser->m_si && !pSender->wszFirstName.IsEmpty())
- g_chatApi.UM_AddUser(pUser->m_si, Utf2T(szUserId), pSender->getDisplayName(), ID_STATUS_ONLINE);
- }
- }
+ if (GetGcUserId(pUser, pMessage, szUserId))
+ pre.szUserId = szUserId;
ProtoChainRecvMsg(pUser->hContact, &pre);
}