summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-06-22 17:42:11 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-06-22 17:42:11 +0300
commit690e3433c5bcfea991a8efce03e0ae2ef389df44 (patch)
tree13fe60901be505e30559f4b96b223d375f561b8e /protocols/Telegram/src/proto.cpp
parentac1dc0145598426c99e983829b5daa8b5bde4e6f (diff)
fixes #5049 (Telegram: добавить в юзеринфо канала описание канала)
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r--protocols/Telegram/src/proto.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 28202199b8..a233395481 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -392,6 +392,51 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT hContact)
/////////////////////////////////////////////////////////////////////////////////////////
+int CTelegramProto::GetInfo(MCONTACT hContact, int)
+{
+ if (auto *pUser = FindUser(GetId(hContact))) {
+ if (!pUser->isGroupChat)
+ SendQuery(new TD::getUserFullInfo(pUser->id), &CTelegramProto::OnGetUserInfo, pUser);
+ else {
+ TG_SUPER_GROUP tmp(pUser->id, 0);
+ if (m_arSuperGroups.find(&tmp))
+ SendQuery(new TD::getSupergroupFullInfo(pUser->id), &CTelegramProto::OnGetUserInfo, pUser);
+ else
+ SendQuery(new TD::getBasicGroupFullInfo(pUser->id), &CTelegramProto::OnGetUserInfo, pUser);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+void CTelegramProto::OnGetUserInfo(td::ClientManager::Response &response, void *pUserInfo)
+{
+ if (!response.object)
+ return;
+
+ auto *pUser = (TG_USER *)pUserInfo;
+
+ switch (response.object->get_id()) {
+ case TD::basicGroupFullInfo::ID:
+ ProcessBasicGroupInfo(pUser, (TD::basicGroupFullInfo *)response.object.get());
+ break;
+ case TD::supergroupFullInfo::ID:
+ ProcessSuperGroupInfo(pUser, (TD::supergroupFullInfo *)response.object.get());
+ break;
+ case TD::updateUserFullInfo::ID:
+ ProcessUserInfo(pUser->id, (TD::userFullInfo *)response.object.get());
+ break;
+
+ default:
+ debugLogA("Gotten class ID %d instead of %d, exiting", response.object->get_id(), TD::chats::ID);
+ return;
+ }
+
+ ProtoBroadcastAck(pUser->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, HANDLE(1));
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CTelegramProto::OnSearchResults(td::ClientManager::Response &response)
{
int iCount = ::InterlockedDecrement(&m_iSearchCount);