summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-06 18:46:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-06 18:46:01 +0300
commit420bdbea266c864509ed58ac792d5059516dddf5 (patch)
treecec2b05e748f949c5ca1fe52f42c5de982ffb654 /protocols
parent581533039372c7022c81cc87a6926df7ff368d1d (diff)
fixes #3389 (Telegram: добавленному в Миранде контакту невозможно написать)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/proto.cpp7
-rw-r--r--protocols/Telegram/src/utils.cpp8
2 files changed, 10 insertions, 5 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 22816bd7ba..afe4cfe20f 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -184,7 +184,12 @@ MCONTACT CTelegramProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
if (flags & PALF_TEMPORARY)
Contact::RemoveFromList(pUser->hContact);
- auto cc = TD::make_object<TD::contact>(); cc->user_id_ = id;
+ auto cc = TD::make_object<TD::contact>();
+ cc->user_id_ = id;
+ if (psr->firstName.w)
+ cc->first_name_ = T2Utf(psr->firstName.w);
+ if (psr->lastName.w)
+ cc->last_name_ = T2Utf(psr->lastName.w);
SendQuery(new TD::addContact(std::move(cc), false));
return pUser->hContact;
}
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index 9a2cc15f8b..e93b40852f 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -55,7 +55,7 @@ bool CTelegramProto::CheckSearchUser(TG_USER *pUser)
void CTelegramProto::ReportSearchUser(TG_USER *pUser)
{
- CMStringW wszId(FORMAT, L"%lld", pUser->id);
+ CMStringW wszId(FORMAT, L"%lld", pUser->id), wszNick, wszLastName, wszFirstName;
PROTOSEARCHRESULT psr = {};
psr.cbSize = sizeof(psr);
@@ -63,9 +63,9 @@ void CTelegramProto::ReportSearchUser(TG_USER *pUser)
psr.id.w = wszId.GetBuffer();
if (pUser->hContact != INVALID_CONTACT_ID) {
- CMStringW wszNick = getMStringW(pUser->hContact, "Nick");
- CMStringW wszLastName = getMStringW(pUser->hContact, "LastName");
- CMStringW wszFirstName = getMStringW(pUser->hContact, "FirstName");
+ wszNick = getMStringW(pUser->hContact, "Nick");
+ wszLastName = getMStringW(pUser->hContact, "LastName");
+ wszFirstName = getMStringW(pUser->hContact, "FirstName");
psr.nick.w = wszNick.GetBuffer();
psr.lastName.w = wszLastName.GetBuffer();