summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-05-20 21:51:34 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-05-20 21:51:34 +0300
commitf2daa4597c4b35578ccfba1127604cd5e07d6aa2 (patch)
tree195273b5afe43feca95382d2dca193544d1baeec
parent451303889fcd3e4a8ca4ec4928c3788641e8e755 (diff)
fixes #4422 (Telegram: добавление в чат средствами Миранды)
-rw-r--r--protocols/Telegram/src/groupchat.cpp3
-rw-r--r--protocols/Telegram/src/proto.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp
index 80d217aff6..1d45d5630c 100644
--- a/protocols/Telegram/src/groupchat.cpp
+++ b/protocols/Telegram/src/groupchat.cpp
@@ -477,6 +477,9 @@ void CTelegramProto::ProcessSuperGroup(TD::updateSupergroup *pObj)
if (!pGroup->group->is_channel_)
pChat->bLoadMembers = true;
+ if (!Contact::OnList(pChat->hContact))
+ Contact::PutOnList(pChat->hContact);
+
if (pChat->bStartChat)
InitGroupChat(pChat, pChat->wszNick);
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 94c26a3d62..5c3316484b 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -287,10 +287,18 @@ MCONTACT CTelegramProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
return 0;
auto id = _wtoi64(psr->id.w);
+
auto *pUser = AddUser(id, false);
if (flags & PALF_TEMPORARY)
Contact::RemoveFromList(pUser->hContact);
+ if (auto *pChat = FindUser(id)) {
+ if (pChat->isGroupChat) {
+ SendQuery(new TD::joinChat(pChat->chatId));
+ return pUser->hContact;
+ }
+ }
+
auto cc = TD::make_object<TD::contact>();
cc->user_id_ = id;
if (psr->firstName.w)