diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-26 21:11:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-26 21:11:57 +0300 |
commit | ef5d5d9a996e2392d4634f8114d096e1fa98fb43 (patch) | |
tree | 5efb76e0b392cb549b9adeb9c9cf494ca94e72a8 /src | |
parent | 592c0d89f865c44e6909e0ca1e9d0c550be890b4 (diff) |
duplicate code removed
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/chat.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/chat_manager.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_svc.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 4 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 4 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 29 |
8 files changed, 14 insertions, 34 deletions
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); } ///////////////////////////////////////////////////////////////////////////////////////// |