diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-06 19:06:45 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-06 19:06:45 +0300 |
commit | 4be3cbfb5a759d868eac6c8060967ebf0f0af456 (patch) | |
tree | f279c94f14e1a63c8693d47064d68d778ea94085 /protocols/Telegram | |
parent | 420bdbea266c864509ed58ac792d5059516dddf5 (diff) |
fixes #3394 (Telegram: невозможно написать в приват из групчата)
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/src/groupchat.cpp | 24 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/stdafx.h | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index 0aa21fb752..76fb694a5c 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -151,6 +151,7 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) break; case GC_USER_PRIVMESS: + Chat_SendPrivateMessage(gch); break; case GC_USER_LOGMENU: @@ -163,6 +164,29 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) return 1; } +void CTelegramProto::Chat_SendPrivateMessage(GCHOOK *gch) +{ + MCONTACT hContact; + TD::int53 userId = _wtoi64(gch->ptszUID); + auto *pUser = FindUser(userId); + if (pUser == nullptr || pUser->hContact == INVALID_CONTACT_ID) { + PROTOSEARCHRESULT psr = { sizeof(psr) }; + psr.id.w = (wchar_t *)gch->ptszUID; + psr.firstName.w = (wchar_t *)gch->ptszNick; + + hContact = AddToList(PALF_TEMPORARY, &psr); + if (hContact == 0) + return; + + setWString(hContact, "Nick", gch->ptszNick); + Contact::Hide(hContact); + db_set_dw(hContact, "Ignore", "Mask1", 0); + } + else hContact = pUser->hContact; + + CallService(MS_MSG_SENDMESSAGE, hContact, 0); +} + ///////////////////////////////////////////////////////////////////////////////////////// int CTelegramProto::GcMenuHook(WPARAM, LPARAM lParam) diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 6df28c5d99..f4635d44f6 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -214,6 +214,8 @@ class CTelegramProto : public PROTO<CTelegramProto> void InitGroupChat(TG_USER *pUser, const TD::chat *pChat, bool bUpdateMembers); void StartGroupChat(td::ClientManager::Response &response, void *pUserData); + + void Chat_SendPrivateMessage(GCHOOK *gch); // Search TD::array<TD::int53> m_searchIds; diff --git a/protocols/Telegram/src/stdafx.h b/protocols/Telegram/src/stdafx.h index b16b91840c..f2a60d704e 100644 --- a/protocols/Telegram/src/stdafx.h +++ b/protocols/Telegram/src/stdafx.h @@ -21,6 +21,7 @@ #include <m_extraicons.h>
#include <m_icolib.h>
#include <m_langpack.h>
+#include <m_message.h>
#include <m_netlib.h>
#include <m_options.h>
#include <m_popup.h>
|