summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-09 18:11:33 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-09 18:11:33 +0300
commit49e7758046391bb9c49faf37020c27523f913b57 (patch)
tree2ea6ce10624e05bd59f43fe0ece9667868444530 /protocols/Telegram/src
parent96ef0bf6f03191bcf8dfcab8d43627a807eaa0b6 (diff)
fixes #4027 (Telegram: при входе в супергруппу в списке контактов появляются боты этой группы)
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/server.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index c84cec8f95..4b91e3fae8 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -938,7 +938,6 @@ void CTelegramProto::ProcessUser(TD::updateUser *pObj)
return;
}
- auto *pu = AddUser(pUser->id_, false);
std::string szFirstName = pUser->first_name_, szLastName = pUser->last_name_;
if (szLastName.empty()) {
size_t p = szFirstName.rfind(' ');
@@ -948,6 +947,20 @@ void CTelegramProto::ProcessUser(TD::updateUser *pObj)
}
}
+ // if that's just a bot, keep it as a virtual contact in memory
+ if (typeID == TD::userTypeBot::ID) {
+ auto *pu = AddFakeUser(pUser->id_, false);
+ if (pu->hContact == INVALID_CONTACT_ID) {
+ pu->wszFirstName = Utf2T(szFirstName.c_str());
+ pu->wszLastName = Utf2T(szLastName.c_str());
+ if (pUser->usernames_)
+ pu->wszNick = Utf2T(pUser->usernames_->editable_username_.c_str());
+ return;
+ }
+ }
+
+ auto *pu = AddUser(pUser->id_, false);
+
setUString(pu->hContact, "FirstName", szFirstName.c_str());
setUString(pu->hContact, "LastName", szLastName.c_str());
if (pu->hContact)