diff options
author | George Hazan <george.hazan@gmail.com> | 2025-03-20 17:15:42 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-03-20 17:15:42 +0300 |
commit | b07063023ffb6bac667bb865e4d30212b88ff8e2 (patch) | |
tree | 3ab8ee290d8cdfe25f1ef0c5bc6f1127367a3be0 /protocols/Telegram/src/proto.cpp | |
parent | 0be93f29ef172bc008e4b5787f3d01a39c06dad9 (diff) |
core helper for setting birthday & age
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 3732e1a5e5..327cc9a090 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -635,6 +635,11 @@ HANDLE CTelegramProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, ///////////////////////////////////////////////////////////////////////////////////////// +void CTelegramProto::OnChatCreated(td::ClientManager::Response &response, void *pUserInfo) +{ + SetEvent(pUserInfo); +} + int CTelegramProto::SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszMessage) { ptrA szId(getStringA(hContact, DBKEY_ID)); @@ -653,6 +658,13 @@ int CTelegramProto::SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *p iReplyId = dbei2id(dbei); } + if (pUser->chatId == -1) { + HANDLE hEvent = ::CreateEvent(0, TRUE, FALSE, 0); + SendQuery(new TD::createNewPrivateChat(pUser->id, false), &CTelegramProto::OnChatCreated, hEvent); + WaitForSingleObject(hEvent, INFINITE); + CloseHandle(hEvent); + } + int msgid = SendTextMessage(pUser->chatId, 0, iReplyId, pszMessage); if (msgid != -1) m_arOwnMsg.insert(new TG_OWN_MESSAGE(hContact, (HANDLE)msgid, "")); |