From 40eb6363bb4e66bbd3bbc1e4191baaa46e1c21c0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 22 Jun 2025 19:32:45 +0300 Subject: =?UTF-8?q?fixes=20#5051=20(Telegram:=20=D0=BD=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D1=83=D0=B2=D0=B8=D0=B4=D0=B5=D1=82=D1=8C=20=D1=81?= =?UTF-8?q?=D1=81=D1=8B=D0=BB=D0=BA=D1=83=20=D0=BD=D0=B0=20=D0=BA=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/groupchat.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'protocols/Telegram/src/groupchat.cpp') diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index 38ab04a307..c4f134f6d9 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -404,6 +404,19 @@ void CTelegramProto::ProcessBasicGroupInfo(TG_USER *pChat, TD::basicGroupFullInf void CTelegramProto::ProcessSuperGroupInfo(TG_USER *pUser, TD::supergroupFullInfo *pInfo) { + setDword(pUser->hContact, "MemberCount", pInfo->member_count_); + + if (auto *pLink = pInfo->invite_link_.get()) + setUString(pUser->hContact, "Link", pLink->invite_link_.c_str()); + else if (auto *pGroup = FindSuperGroup(pUser->id)) { + if (pGroup->group->usernames_) { + CMStringA szLink(FORMAT, "https://t.me/%s", pGroup->group->usernames_->editable_username_.c_str()); + setString(pUser->hContact, "Link", szLink); + } + else delSetting(pUser->hContact, "Link"); + } + else delSetting(pUser->hContact, "Link"); + if (!pInfo->description_.empty()) { setUString(pUser->hContact, "About", pInfo->description_.c_str()); GcChangeTopic(pUser, pInfo->description_); @@ -418,16 +431,16 @@ void CTelegramProto::ProcessSuperGroup(TD::updateSupergroup *pObj) return; } - TG_SUPER_GROUP tmp(pObj->supergroup_->id_, 0); - auto *pGroup = m_arSuperGroups.find(&tmp); + auto id = pObj->supergroup_->id_; + auto *pGroup = FindSuperGroup(id); if (pGroup == nullptr) { - pGroup = new TG_SUPER_GROUP(tmp.id, std::move(pObj->supergroup_)); + pGroup = new TG_SUPER_GROUP(id, std::move(pObj->supergroup_)); m_arSuperGroups.insert(pGroup); } else pGroup->group = std::move(pObj->supergroup_); if (iStatusId == TD::chatMemberStatusLeft::ID) { - auto *pUser = AddFakeUser(tmp.id, true); + auto *pUser = AddFakeUser(id, true); pUser->isForum = pGroup->group->is_forum_; if (pUser->hContact == INVALID_CONTACT_ID) { // cache some information for the search @@ -438,7 +451,7 @@ void CTelegramProto::ProcessSuperGroup(TD::updateSupergroup *pObj) else RemoveFromClist(pUser); } else { - auto *pChat = AddUser(tmp.id, true); + auto *pChat = AddUser(id, true); pChat->isForum = pGroup->group->is_forum_; if (!pGroup->group->is_channel_) pChat->bLoadMembers = true; -- cgit v1.2.3