diff options
author | George Hazan <ghazan@miranda.im> | 2022-12-25 21:02:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-12-25 21:02:38 +0300 |
commit | 815d356584371b59545f5a2918a48cebd3a3b396 (patch) | |
tree | da2ab9dfd087c5d39eb4b2224677e7c13dbef689 /protocols/Telegram/src/mt_proto.cpp | |
parent | 0c66b748a7b6b223d34374994e4d7d207e3d2c71 (diff) |
Telegram: text message sending
Diffstat (limited to 'protocols/Telegram/src/mt_proto.cpp')
-rw-r--r-- | protocols/Telegram/src/mt_proto.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/protocols/Telegram/src/mt_proto.cpp b/protocols/Telegram/src/mt_proto.cpp index 9e0cffd97c..e3dd7b6d29 100644 --- a/protocols/Telegram/src/mt_proto.cpp +++ b/protocols/Telegram/src/mt_proto.cpp @@ -1,5 +1,13 @@ #include "stdafx.h" +static int CompareRequests(const TG_REQUEST_BASE *p1, const TG_REQUEST_BASE *p2) +{ + if (p1->requestId == p2->requestId) + return 0; + + return (p1->requestId < p2->requestId) ? -1 : 1; +} + static int CompareUsers(const TG_USER *p1, const TG_USER *p2) { if (p1->id == p2->id) @@ -12,7 +20,7 @@ CMTProto::CMTProto(const char* protoName, const wchar_t* userName) : PROTO<CMTProto>(protoName, userName), m_pClientMmanager(std::make_unique<td::ClientManager>()), m_arUsers(10, CompareUsers), - m_arRequests(10, NumericKeySortT), + m_arRequests(10, CompareRequests), m_szOwnPhone(this, "Phone"), m_wszDefaultGroup(this, "DefaultGroup", L"Telegram"), m_bUsePopups(this, "UsePopups", true), @@ -90,6 +98,15 @@ INT_PTR CMTProto::GetCaps(int type, MCONTACT) return 0; } +int CMTProto::SendMsg(MCONTACT hContact, int, const char *pszMessage) +{ + ptrA szId(getStringA(hContact, DBKEY_ID)); + if (szId == nullptr) + return 0; + + return SendTextMessage(_atoi64(szId), pszMessage); +} + int CMTProto::SetStatus(int iNewStatus) { if (m_iDesiredStatus == iNewStatus) |