summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/server.cpp9
-rw-r--r--protocols/Telegram/src/utils.cpp17
-rw-r--r--protocols/Telegram/src/utils.h2
3 files changed, 22 insertions, 6 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index b411cba637..59da2a3c9f 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -393,18 +393,13 @@ void CTelegramProto::ProcessMessage(TD::updateNewMessage *pObj)
return;
}
- if (pUser->isGroupChat) {
- debugLogA("message from group chat, ignored");
- return;
- }
-
CMStringA szText(GetMessageText(pMessage->content_.get()));
if (szText.IsEmpty()) {
debugLogA("this message was not processed, ignored");
return;
}
- char szId[100];
+ char szId[100], szUserId[100];
_i64toa(pMessage->id_, szId, 10);
PROTORECVEVENT pre = {};
@@ -413,6 +408,8 @@ void CTelegramProto::ProcessMessage(TD::updateNewMessage *pObj)
pre.timestamp = pMessage->date_;
if (pMessage->is_outgoing_)
pre.flags |= PREF_SENT;
+ if (pUser->isGroupChat)
+ pre.szUserId = getSender(pMessage->sender_id_.get(), szUserId, sizeof(szUserId));
ProtoChainRecvMsg(pUser->hContact, &pre);
}
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index d921927a60..b725ba5f90 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -17,6 +17,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+char* getSender(const TD::MessageSender *pSender, char *pDest, size_t cbSize)
+{
+ switch (pSender->get_id()) {
+ case TD::messageSenderChat::ID:
+ _i64toa_s(((TD::messageSenderChat *)pSender)->chat_id_, pDest, cbSize, 10);
+ break;
+ case TD::messageSenderUser::ID:
+ _i64toa_s(((TD::messageSenderUser *)pSender)->user_id_, pDest, cbSize, 10);
+ break;
+ default:
+ *pDest = 0;
+ }
+ return pDest;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CTelegramProto::UpdateString(MCONTACT hContact, const char *pszSetting, const std::string &str)
{
if (str.empty())
diff --git a/protocols/Telegram/src/utils.h b/protocols/Telegram/src/utils.h
index 50e96676b7..846428a086 100644
--- a/protocols/Telegram/src/utils.h
+++ b/protocols/Telegram/src/utils.h
@@ -1 +1,3 @@
#pragma once
+
+char *getSender(const TD::MessageSender *pSender, char *pDest, size_t cbSize);