summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;