From 690e3433c5bcfea991a8efce03e0ae2ef389df44 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 22 Jun 2025 17:42:11 +0300 Subject: =?UTF-8?q?fixes=20#5049=20(Telegram:=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D0=B2=20=D1=8E=D0=B7=D0=B5=D1=80?= =?UTF-8?q?=D0=B8=D0=BD=D1=84=D0=BE=20=D0=BA=D0=B0=D0=BD=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=D0=BB=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/proto.cpp | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'protocols/Telegram/src/proto.cpp') 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); -- cgit v1.2.3