summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Telegram/src/groupchat.cpp57
-rw-r--r--protocols/Telegram/src/proto.cpp4
-rw-r--r--protocols/Telegram/src/proto.h5
-rw-r--r--protocols/Telegram/src/stdafx.h2
4 files changed, 64 insertions, 4 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;
+}
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 06ac895087..9762c3c316 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -80,8 +80,8 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) :
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
- // HookProtoEvent(ME_GC_EVENT, &WhatsAppProto::GcEventHook);
- // HookProtoEvent(ME_GC_BUILDMENU, &WhatsAppProto::GcMenuHook);
+ HookProtoEvent(ME_GC_EVENT, &CTelegramProto::GcEventHook);
+ HookProtoEvent(ME_GC_BUILDMENU, &CTelegramProto::GcMenuHook);
}
CTelegramProto::~CTelegramProto()
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 476deea871..bb0238d494 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -248,12 +248,15 @@ public:
// Services //////////////////////////////////////////////////////////////////////////
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
-
+
// Events ////////////////////////////////////////////////////////////////////////////
int __cdecl OnOptionsInit(WPARAM, LPARAM);
int __cdecl OnDbMarkedRead(WPARAM, LPARAM);
+ int __cdecl GcMenuHook(WPARAM, LPARAM);
+ int __cdecl GcEventHook(WPARAM, LPARAM);
+
// Options ///////////////////////////////////////////////////////////////////////////
CMOption<uint32_t> m_iCountry; // set this status to m_iStatus1 after this interval of secs
diff --git a/protocols/Telegram/src/stdafx.h b/protocols/Telegram/src/stdafx.h
index 47564f1ee3..bce763709d 100644
--- a/protocols/Telegram/src/stdafx.h
+++ b/protocols/Telegram/src/stdafx.h
@@ -14,7 +14,7 @@
#include <m_avatars.h>
#include <m_clist.h>
-#include <m_chat.h>
+#include <m_chat_int.h>
#include <m_contacts.h>
#include <m_database.h>
#include <m_extraicons.h>