From 1eb729352a8b1b19bc8304d97503424548bc90e3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Nov 2023 15:03:57 +0300 Subject: =?UTF-8?q?fixes=20#3798=20(Telegram:=20=D0=BD=D0=B5=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D1=91=D1=82=D1=81=D1=8F=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=20=D0=B2=20=D1=80=D0=BE=D1=81=D1=82=D0=B5=D1=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/proto.cpp | 22 ++++++++++++++++++++++ protocols/Telegram/src/proto.h | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'protocols/Telegram/src') 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(); + 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; -- cgit v1.2.3