diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-04 22:24:40 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-04 22:24:40 +0300 |
commit | 6b91d1ea4625bb25f194b5a4597b75a7547f40f1 (patch) | |
tree | dbe14c29836e9d13d64acd7dd0f173d6e20673c0 /protocols | |
parent | d69c39adad9038702c055363c2f0dcf8e4fe7b8f (diff) |
fixes #4013 (Telegram: добавления в чат показываются как неизвестные события)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/groupchat.cpp | 10 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 4 |
3 files changed, 10 insertions, 6 deletions
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<CTelegramProto> bool GetGcUserId(TG_USER *pUser, const TD::message *pMsg, char *dest); void GcAddMembers(TG_USER *pChat, const TD::array<TD::object_ptr<TD::chatMember>> &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:
|