summaryrefslogtreecommitdiff
path: root/protocols/Telegram
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-11-07 15:03:57 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-11-07 15:04:01 +0300
commit1eb729352a8b1b19bc8304d97503424548bc90e3 (patch)
tree7d540d4552d9f77cca909a606c2aea198d637126 /protocols/Telegram
parentc95e25f0865ca0ed3b8f1a25988f936ad1761fea (diff)
fixes #3798 (Telegram: не удаётся добавить контакт в ростер)
Diffstat (limited to 'protocols/Telegram')
-rw-r--r--protocols/Telegram/src/proto.cpp22
-rw-r--r--protocols/Telegram/src/proto.h5
2 files changed, 25 insertions, 2 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index e6de52e581..9a79af6d94 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -278,6 +278,28 @@ MCONTACT CTelegramProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
return pUser->hContact;
}
+int CTelegramProto::AuthRequest(MCONTACT hContact, const wchar_t *)
+{
+ auto *pUser = FindUser(GetId(hContact));
+ if (pUser == nullptr)
+ return 1; // error
+
+ auto cc = TD::make_object<TD::contact>();
+ cc->user_id_ = pUser->id;
+ if (!pUser->wszFirstName.IsEmpty())
+ cc->first_name_ = T2Utf(pUser->wszFirstName);
+ else
+ cc->first_name_ = getMStringU(hContact, "FirstName").c_str();
+
+ if (!pUser->wszLastName.IsEmpty())
+ cc->last_name_ = T2Utf(pUser->wszLastName);
+ else
+ cc->last_name_ = getMStringU(hContact, "LastName").c_str();
+
+ SendQuery(new TD::addContact(std::move(cc), false));
+ return 0;
+}
+
INT_PTR CTelegramProto::GetCaps(int type, MCONTACT)
{
switch (type) {
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index dd2e1263d3..b90f6e9d45 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -335,8 +335,9 @@ public:
//////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
- MCONTACT AddToList(int flags, PROTOSEARCHRESULT *psr);
-
+ MCONTACT AddToList(int flags, PROTOSEARCHRESULT *psr) override;
+ int AuthRequest(MCONTACT hContact, const wchar_t *) override;
+
INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override;