diff options
author | George Hazan <ghazan@miranda.im> | 2023-02-07 20:23:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-02-07 20:23:35 +0300 |
commit | 138ef5cc83e69cb37632c8f039d5a4e8dbb0ed45 (patch) | |
tree | 64744be2cb869d49f73a49fcb80523dd022b89d2 /protocols/Telegram/src/groupchat.cpp | |
parent | 377d86974a99842a487d6e3a782f9ae6ed1bb913 (diff) |
Telegram: ability to send messages to group chats
Diffstat (limited to 'protocols/Telegram/src/groupchat.cpp')
-rw-r--r-- | protocols/Telegram/src/groupchat.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index c0f815aa8a..fdcb45faa7 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -123,3 +123,60 @@ void CTelegramProto::StartGroupChat(td::ClientManager::Response &response, void Chat_Control(pUser->m_si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE); Chat_Control(pUser->m_si, SESSION_ONLINE); } + +///////////////////////////////////////////////////////////////////////////////////////// + +int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) +{ + GCHOOK *gch = (GCHOOK *)lParam; + if (gch == nullptr) + return 0; + + if (mir_strcmpi(gch->si->pszModule, m_szModuleName)) + return 0; + + auto userId = _wtoi64(gch->si->ptszID); + + switch (gch->iType) { + case GC_USER_MESSAGE: + if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) { + rtrimw(gch->ptszText); + Chat_UnescapeTags(gch->ptszText); + SendTextMessage(-userId, T2Utf(gch->ptszText)); + } + break; + + case GC_USER_PRIVMESS: + break; + + case GC_USER_LOGMENU: + break; + + case GC_USER_NICKLISTMENU: + break; + } + + return 1; +} + +///////////////////////////////////////////////////////////////////////////////////////// + +int CTelegramProto::GcMenuHook(WPARAM, LPARAM lParam) +{ + GCMENUITEMS *gcmi = (GCMENUITEMS *)lParam; + if (gcmi == nullptr) + return 0; + + if (mir_strcmpi(gcmi->pszModule, m_szModuleName)) + return 0; + + auto *pUser = FindUser(T2Utf(gcmi->pszID)); + if (pUser == nullptr) + return 0; + + if (gcmi->Type == MENU_ON_LOG) { + } + else if (gcmi->Type == MENU_ON_NICKLIST) { + } + return 0; +} |