From 6b91d1ea4625bb25f194b5a4597b75a7547f40f1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 4 Dec 2023 22:24:40 +0300 Subject: =?UTF-8?q?fixes=20#4013=20(Telegram:=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D1=87=D0=B0?= =?UTF-8?q?=D1=82=20=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D1=8E?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=BA=D0=B0=D0=BA=20=D0=BD=D0=B5=D0=B8?= =?UTF-8?q?=D0=B7=D0=B2=D0=B5=D1=81=D1=82=D0=BD=D1=8B=D0=B5=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B1=D1=8B=D1=82=D0=B8=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/groupchat.cpp | 10 +++++++--- protocols/Telegram/src/proto.h | 2 +- protocols/Telegram/src/utils.cpp | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'protocols') diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index 69a4ca7649..3df631aa1b 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -282,20 +282,22 @@ void CTelegramProto::Chat_SendPrivateMessage(GCHOOK *gch) ///////////////////////////////////////////////////////////////////////////////////////// -void CTelegramProto::GcChangeMember(TG_USER *pChat, TD::int53 userId, bool bJoined) +void CTelegramProto::GcChangeMember(TG_USER *pChat, const char *adminId, TD::int53 userId, bool bJoined) { if (pChat->m_si == nullptr) return; if (auto *pMember = FindUser(userId)) { CMStringW wszId(FORMAT, L"%lld", pMember->id), wszNick(pMember->getDisplayName()); + Utf2T wszAdminId(adminId); GCEVENT gce = { pChat->m_si, (bJoined) ? GC_EVENT_JOIN : GC_EVENT_PART }; gce.pszUID.w = wszId; gce.pszNick.w = wszNick; gce.bIsMe = false; gce.time = time(0); - gce.pszStatus.w = TranslateT("Visitor"); + gce.pszStatus.w = TranslateT("Participant"); + gce.pszText.w = wszAdminId; Chat_Event(&gce); } } @@ -428,12 +430,14 @@ void CTelegramProto::ProcessSuperGroup(TD::updateSupergroup *pObj) else { auto *pChat = AddUser(tmp.id, true); if (auto *si = pChat->m_si) { - CMStringW wszUserId(FORMAT, L"%lld", m_iOwnId); + CMStringW wszUserId(FORMAT, L"%lld", m_iOwnId); GCEVENT gce = { si, GC_EVENT_SETSTATUS }; gce.pszUID.w = wszUserId; gce.time = time(0); + gce.bIsMe = true; gce.pszStatus.w = getRoleById(iStatusId); + gce.pszText.w = TranslateT("Admin"); Chat_Event(&gce); } } diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index dcb85fbfe7..1ab2b23d08 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -294,7 +294,7 @@ class CTelegramProto : public PROTO bool GetGcUserId(TG_USER *pUser, const TD::message *pMsg, char *dest); void GcAddMembers(TG_USER *pChat, const TD::array> &pMembers, bool bSilent); - void GcChangeMember(TG_USER *pChat, TD::int53 userId, bool bJoined); + void GcChangeMember(TG_USER *pChat, const char *adminId, TD::int53 userId, bool bJoined); void GcChangeTopic(TG_USER *pChat, const wchar_t *pwszNewTopic); // Search diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index e110d1c5a0..2db0a384f7 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -491,12 +491,12 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg case TD::messageChatAddMembers::ID: if (auto *pDoc = (TD::messageChatAddMembers *)pBody) for (auto &it : pDoc->member_user_ids_) - GcChangeMember(pUser, it, true); + GcChangeMember(pUser, pszUserId, it, true); break; case TD::messageChatDeleteMember::ID: if (auto *pDoc = (TD::messageChatDeleteMember *)pBody) - GcChangeMember(pUser, pDoc->user_id_, false); + GcChangeMember(pUser, pszUserId, pDoc->user_id_, false); break; case TD::messageChatChangeTitle::ID: -- cgit v1.2.3