summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-26 21:11:57 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-26 21:11:57 +0300
commitef5d5d9a996e2392d4634f8114d096e1fa98fb43 (patch)
tree5efb76e0b392cb549b9adeb9c9cf494ca94e72a8
parent592c0d89f865c44e6909e0ca1e9d0c550be890b4 (diff)
duplicate code removed
-rw-r--r--include/m_chat_int.h4
-rw-r--r--libs/win32/mir_app.libbin116844 -> 116674 bytes
-rw-r--r--libs/win64/mir_app.libbin112442 -> 112228 bytes
-rw-r--r--plugins/Scriver/src/chat_window.cpp4
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp4
-rw-r--r--src/core/stdmsg/src/chat_window.cpp4
-rw-r--r--src/mir_app/src/chat.h1
-rw-r--r--src/mir_app/src/chat_manager.cpp2
-rw-r--r--src/mir_app/src/chat_svc.cpp2
-rw-r--r--src/mir_app/src/chat_tools.cpp2
-rw-r--r--src/mir_app/src/mir_app.def4
-rw-r--r--src/mir_app/src/mir_app64.def4
-rw-r--r--src/mir_app/src/srmm_base.cpp29
13 files changed, 21 insertions, 39 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 267b145ff2..375035b9a2 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -387,6 +387,9 @@ EXTERN_C MIR_APP_DLL(DWORD) CALLBACK Srmm_MessageStreamCallback(DWORD_PTR dwCook
// updates options for all windows
EXTERN_C MIR_APP_DLL(void) Chat_UpdateOptions();
+// runs ME_GC_EVENT with the parameters passed
+EXTERN_C MIR_APP_DLL(BOOL) Chat_DoEventHook(SESSION_INFO *si, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem);
+
// chat menu creation / destruction
EXTERN_C MIR_APP_DLL(UINT) Chat_CreateGCMenu(HWND hwnd, HMENU hMenu, POINT pt, SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszWordText);
EXTERN_C MIR_APP_DLL(void) Chat_DestroyGCMenu(HMENU hMenu, int iIndex);
@@ -408,7 +411,6 @@ protected:
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
- void DoEventHook(int iType, const USERINFO *pUser, const wchar_t *pszText, INT_PTR dwItem);
bool ProcessHotkeys(int key, bool bShift, bool bCtrl, bool bAlt);
void RefreshButtonStatus(void);
void RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index ca517f6537..0a53175fda 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 995add470c..e53221b3a0 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp
index 2ab211a1bd..5b2fbf80ff 100644
--- a/plugins/Scriver/src/chat_window.cpp
+++ b/plugins/Scriver/src/chat_window.cpp
@@ -372,7 +372,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
EnableWindow(m_btnOk.GetHwnd(), FALSE);
- DoEventHook(GC_USER_MESSAGE, nullptr, ptszText, 0);
+ Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
SetFocus(m_message.GetHwnd());
}
@@ -853,7 +853,7 @@ LRESULT CChatRoomDlg::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam)
int index = m_nickList.SendMsg(LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
- DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
+ Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
}
break;
}
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 2a1e14e380..403f6f86be 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -685,7 +685,7 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*)
bool fSound = true;
if (ptszText[0] == '/' || m_si->iType == GCW_SERVER)
fSound = false;
- DoEventHook(GC_USER_MESSAGE, nullptr, ptszText, 0);
+ Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
mi->idleTimeStamp = time(0);
mi->lastIdleCheck = 0;
UpdateStatusBar();
@@ -2034,7 +2034,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_MUC_SHOWSERVER:
if (m_si->iType != GCW_SERVER)
- DoEventHook(GC_USER_MESSAGE, nullptr, L"/servershow", 0);
+ Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, L"/servershow", 0);
return _dlgReturn(m_hwnd, 1);
}
}
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 725a92e71b..675b28e2f7 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -168,7 +168,7 @@ void CChatRoomDlg::onClick_NickList(CCtrlButton *pButton)
void CChatRoomDlg::onClick_Options(CCtrlButton *pButton)
{
if (pButton->Enabled())
- DoEventHook(GC_USER_CHANMGR, nullptr, nullptr, 0);
+ Chat_DoEventHook(m_si, GC_USER_CHANMGR, nullptr, nullptr, 0);
}
void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
@@ -199,7 +199,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
EnableWindow(m_btnOk.GetHwnd(), FALSE);
- DoEventHook(GC_USER_MESSAGE, nullptr, ptszText, 0);
+ Chat_DoEventHook(m_si, GC_USER_MESSAGE, nullptr, ptszText, 0);
SetFocus(m_message.GetHwnd());
}
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 4a4b1acb14..1d2e85c3e9 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -105,7 +105,6 @@ int GetColorIndex(const char *pszModule, COLORREF cr);
void CheckColorsInModule(const char *pszModule);
int GetRichTextLength(HWND hwnd);
bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
-BOOL DoEventHook(SESSION_INFO *si, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 7e87b2a78b..7fa0e4c000 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -75,7 +75,7 @@ static void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact = false)
if (si->pDlg)
si->pDlg->CloseTab();
- DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
+ Chat_DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
if (si->hContact && bRemoveContact)
db_delete_contact(si->hContact);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 9434faed20..1dd20900a8 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -670,7 +670,7 @@ MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId
continue;
if (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS)
- DoEventHook(si, GC_USER_MESSAGE, nullptr, wszText, 0);
+ Chat_DoEventHook(si, GC_USER_MESSAGE, nullptr, wszText, 0);
if (wszId)
break;
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index ce81249be2..9b15c27218 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -606,7 +606,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
return TRUE;
}
-BOOL DoEventHook(SESSION_INFO *si, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem)
+MIR_APP_DLL(BOOL) Chat_DoEventHook(SESSION_INFO *si, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem)
{
if (si == nullptr)
return FALSE;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 0c35002a45..0657e1546c 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -409,7 +409,7 @@ ProtoGetAvatarMimeType @401
?isChat@CSrmmBaseDialog@@QBE_NXZ @411 NONAME
Srmm_LogStreamCallback @412
Srmm_MessageStreamCallback @413
-?DoEventHook@CSrmmBaseDialog@@IAEXHPBUUSERINFO@@PB_WH@Z @414 NONAME
+?RunUserMenu@CSrmmBaseDialog@@IAEXPAUHWND__@@PAUUSERINFO@@ABUtagPOINT@@@Z @414 NONAME
?ClearLog@CSrmmBaseDialog@@QAEXXZ @415 NONAME
?CloseTab@CSrmmBaseDialog@@UAEXXZ @416 NONAME
?UpdateStatusBar@CSrmmBaseDialog@@UAEXXZ @417 NONAME
@@ -439,4 +439,4 @@ Chat_UpdateOptions @418 NONAME
Chat_AddMenuItems @442 NONAME
Chat_DestroyGCMenu @443 NONAME
Chat_CreateGCMenu @444 NONAME
-?RunUserMenu@CSrmmBaseDialog@@IAEXPAUHWND__@@PAUUSERINFO@@ABUtagPOINT@@@Z @445 NONAME
+Chat_DoEventHook @445 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index bce854eeef..9a40194286 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -409,7 +409,7 @@ ProtoGetAvatarMimeType @401
?isChat@CSrmmBaseDialog@@QEBA_NXZ @411 NONAME
Srmm_LogStreamCallback @412
Srmm_MessageStreamCallback @413
-?DoEventHook@CSrmmBaseDialog@@IEAAXHPEBUUSERINFO@@PEB_W_J@Z @414 NONAME
+?RunUserMenu@CSrmmBaseDialog@@IEAAXPEAUHWND__@@PEAUUSERINFO@@AEBUtagPOINT@@@Z @414 NONAME
?ClearLog@CSrmmBaseDialog@@QEAAXXZ @415 NONAME
?CloseTab@CSrmmBaseDialog@@UEAAXXZ @416 NONAME
?UpdateStatusBar@CSrmmBaseDialog@@UEAAXXZ @417 NONAME
@@ -439,4 +439,4 @@ Chat_UpdateOptions @418 NONAME
Chat_AddMenuItems @442 NONAME
Chat_DestroyGCMenu @443 NONAME
Chat_CreateGCMenu @444 NONAME
-?RunUserMenu@CSrmmBaseDialog@@IEAAXPEAUHWND__@@PEAUUSERINFO@@AEBUtagPOINT@@@Z @445 NONAME
+Chat_DoEventHook @445 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index d55a71ff53..8dbb2ad409 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -104,11 +104,11 @@ void CSrmmBaseDialog::RunUserMenu(HWND hwndOwner, USERINFO *ui, const POINT &pt)
break;
case IDM_SENDMESSAGE:
- DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
+ Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
- DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
+ Chat_DoEventHook(m_si, GC_USER_NICKLISTMENU, ui, nullptr, uID);
break;
}
Chat_DestroyGCMenu(hMenu, 1);
@@ -290,7 +290,7 @@ LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
default:
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, uID);
+ Chat_DoEventHook(m_si, GC_USER_LOGMENU, nullptr, nullptr, uID);
break;
}
Chat_DestroyGCMenu(hMenu, 5);
@@ -690,25 +690,6 @@ void CSrmmBaseDialog::ClearLog()
m_log.SetText(L"");
}
-void CSrmmBaseDialog::DoEventHook(int iType, const USERINFO *pUser, const wchar_t *pszText, INT_PTR dwItem)
-{
- GCDEST gcd = {};
- gcd.pszModule = m_si->pszModule;
- gcd.ptszID = m_si->ptszID;
- gcd.iType = iType;
-
- GCHOOK gch = {};
- if (pUser != nullptr) {
- gch.ptszUID = pUser->pszUID;
- gch.ptszNick = pUser->pszNick;
- }
-
- gch.ptszText = (LPWSTR)pszText;
- gch.dwData = dwItem;
- gch.pDest = &gcd;
- NotifyEventHooks(chatApi.hSendEvent, 0, (WPARAM)&gch);
-}
-
void CSrmmBaseDialog::RedrawLog2()
{
m_si->LastTime = 0;
@@ -799,7 +780,7 @@ void CSrmmBaseDialog::onClick_History(CCtrlButton *pButton)
void CSrmmBaseDialog::onClick_ChanMgr(CCtrlButton *pButton)
{
if (pButton->Enabled())
- DoEventHook(GC_USER_CHANMGR, nullptr, nullptr, 0);
+ Chat_DoEventHook(m_si, GC_USER_CHANMGR, nullptr, nullptr, 0);
}
void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList)
@@ -826,7 +807,7 @@ void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList)
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
SetFocus(m_message.GetHwnd());
}
- else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
+ else Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////