summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-09 23:27:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-09 23:27:40 +0300
commit063a61cf745e1c51f4c9791d03832740f7dc0347 (patch)
tree960bae1ec8b3869c561cf95e9717c01dd08c735b
parentf3ff9ad5341bb0b0a0453e61a2d419e8c02f14b0 (diff)
- GCSessionInfoBase fields iWidth and iHeight moved to StdMSg;
- CHAT_MANAGER methods DoEventHook & DoEventHookAsync removed from CHAT_API; - CSrmmBaseDialog::DoEventHook introduced instead
-rw-r--r--include/m_chat_int.h15
-rw-r--r--libs/win32/mir_app.libbin106740 -> 107140 bytes
-rw-r--r--libs/win64/mir_app.libbin102150 -> 102570 bytes
-rw-r--r--plugins/Scriver/src/chat/window.cpp30
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp2
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp33
-rw-r--r--plugins/TabSRMM/src/msgs.h2
-rw-r--r--protocols/IRCG/src/services.cpp60
-rw-r--r--src/core/stdmsg/src/chat_window.cpp49
-rw-r--r--src/core/stdmsg/src/stdafx.h2
-rw-r--r--src/mir_app/src/chat.h1
-rw-r--r--src/mir_app/src/chat_manager.cpp31
-rw-r--r--src/mir_app/src/chat_tools.cpp41
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/srmm_base.cpp127
16 files changed, 166 insertions, 229 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 1b28c454ab..5ca6c8f021 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -48,7 +48,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GC_SETVISIBILITY (WM_USER+107)
#define GC_SETWNDPROPS (WM_USER+108)
#define GC_REDRAWLOG (WM_USER+109)
-#define GC_FIREHOOK (WM_USER+110)
#define GC_FILTERFIX (WM_USER+111)
#define GC_CHANGEFILTERFLAG (WM_USER+112)
#define GC_SHOWFILTERMENU (WM_USER+113)
@@ -168,9 +167,9 @@ struct USERINFO
{
wchar_t* pszNick;
wchar_t* pszUID;
- WORD Status;
- int iStatusEx;
- WORD ContactStatus;
+ WORD Status;
+ int iStatusEx;
+ WORD ContactStatus;
USERINFO *next;
};
@@ -191,8 +190,6 @@ struct GCSessionInfoBase
int iType;
int nUsersInNicklist;
int iEventCount;
- int iWidth;
- int iHeight;
int iStatusCount;
WORD wStatus;
@@ -345,9 +342,6 @@ struct CHAT_MANAGER
void (*LoadMsgDlgFont)(int i, LOGFONT *lf, COLORREF *color);
wchar_t* (*MakeTimeStamp)(wchar_t *pszStamp, time_t time);
- BOOL (*DoEventHook)(const wchar_t *pszID, const char *pszModule, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem);
- BOOL (*DoEventHookAsync)(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem);
-
BOOL (*DoSoundsFlashPopupTrayStuff)(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
BOOL (*DoTrayIcon)(SESSION_INFO *si, GCEVENT *gce);
BOOL (*DoPopup)(SESSION_INFO *si, GCEVENT *gce);
@@ -422,9 +416,10 @@ class MIR_APP_EXPORT CSrmmBaseDialog : public CDlgBase
protected:
CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si = nullptr);
-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);
+
protected:
CCtrlEdit *m_pLog, *m_pEntry;
SESSION_INFO *m_si;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 1af7147fb5..6d5435815a 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 c67e4b17a4..3d8a67f831 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 b1f3bad9ad..9dd59362d8 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -566,7 +566,7 @@ LRESULT CALLBACK CChatRoomDlg::LogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
default:
PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, uID);
+ pDlg->DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 5);
@@ -678,11 +678,11 @@ LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM
break;
case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ pDlg->DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID);
+ pDlg->DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -710,7 +710,7 @@ LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM
int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
USERINFO *ui = pci->SM_GetUserFromIndex(pDlg->m_si->ptszID, pDlg->m_si->pszModule, index);
- pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ pDlg->DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
}
break;
}
@@ -1037,7 +1037,7 @@ void CChatRoomDlg::onDblClick_List(CCtrlListBox*)
m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
- else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
}
}
@@ -1076,7 +1076,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton)
EnableWindow(m_btnOk.GetHwnd(), FALSE);
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0);
+ DoEventHook(GC_USER_MESSAGE, nullptr, ptszText, 0);
SetFocus(m_message.GetHwnd());
}
@@ -1093,7 +1093,7 @@ void CChatRoomDlg::onClick_History(CCtrlButton *pButton)
void CChatRoomDlg::onClick_ChanMgr(CCtrlButton *pButton)
{
if (pButton->Enabled())
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0);
+ DoEventHook(GC_USER_CHANMGR, nullptr, nullptr, 0);
}
void CChatRoomDlg::onClick_ShowList(CCtrlButton *pButton)
@@ -1593,22 +1593,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
- case GC_FIREHOOK:
- if (lParam) {
- NotifyEventHooks(pci->hSendEvent, 0, lParam);
- GCHOOK *gch = (GCHOOK*)lParam;
- if (gch->pDest) {
- mir_free((void*)gch->pDest->ptszID);
- mir_free((void*)gch->pDest->pszModule);
- mir_free(gch->pDest);
- }
- mir_free(gch->ptszText);
- mir_free(gch->ptszUID);
- mir_free(gch->ptszNick);
- mir_free(gch);
- }
- break;
-
case GC_CHANGEFILTERFLAG:
m_iLogFilterFlags = lParam;
break;
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index ab6fe6b62f..945ca7e475 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -37,7 +37,7 @@ pfnDoTrayIcon oldDoTrayIcon;
CHAT_MANAGER *pci;
TMUCSettings g_Settings;
-static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi)
+static void OnCreateSession(SESSION_INFO*, MODULEINFO *mi)
{
if (mi) {
mi->idleTimeStamp = time(0);
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 8e588f8c2f..3869504ee2 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -1449,7 +1449,7 @@ LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM
break;
case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ dat->DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
@@ -1463,7 +1463,7 @@ LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM
for (int i = 0; i < iSelectedItems; i++) {
USERINFO *ui1 = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, pItems[i]);
if (ui1)
- pci->DoEventHookAsync(hwndParent, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui1, nullptr, (LPARAM)uID);
+ dat->DoEventHook(GC_USER_NICKLISTMENU, ui1, nullptr, uID);
}
}
mir_free(pItems);
@@ -1751,7 +1751,7 @@ void CChatRoomDlg::OnClick_OK(CCtrlButton*)
bool fSound = true;
if (ptszText[0] == '/' || m_si->iType == GCW_SERVER)
fSound = false;
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0);
+ DoEventHook(GC_USER_MESSAGE, nullptr, ptszText, 0);
mi->idleTimeStamp = time(0);
mi->lastIdleCheck = 0;
pci->SM_BroadcastMessage(m_si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE);
@@ -1819,7 +1819,7 @@ void CChatRoomDlg::OnClick_ShowNickList(CCtrlButton *pButton)
void CChatRoomDlg::OnClick_ChanMgr(CCtrlButton *pButton)
{
if (pButton->Enabled())
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0);
+ DoEventHook(GC_USER_CHANMGR, nullptr, nullptr, 0);
}
void CChatRoomDlg::OnClick_BIU(CCtrlButton *pButton)
@@ -1943,7 +1943,7 @@ void CChatRoomDlg::OnDblClick_List(CCtrlListBox*)
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
SetFocus(m_message.GetHwnd());
}
- else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
}
INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -2454,21 +2454,6 @@ LABEL_SHOWWINDOW:
}
break;
- case GC_FIREHOOK:
- if (lParam) {
- GCHOOK *gch = (GCHOOK*)lParam;
- NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)gch);
- if (gch->pDest) {
- mir_free((void*)gch->pDest->ptszID);
- mir_free((void*)gch->pDest->pszModule);
- mir_free(gch->pDest);
- }
- mir_free(gch->ptszText);
- mir_free(gch->ptszUID);
- mir_free(gch);
- }
- break;
-
case GC_CHANGEFILTERFLAG:
if (m_iLogFilterFlags == 0 && m_bFilterEnabled)
SendMessage(m_hwnd, WM_COMMAND, IDC_FILTER, 0);
@@ -2584,7 +2569,7 @@ LABEL_SHOWWINDOW:
return _dlgReturn(m_hwnd, 1);
case TABSRMM_HK_MUC_SHOWSERVER:
if (m_si->iType != GCW_SERVER)
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, L"/servershow", 0);
+ DoEventHook(GC_USER_MESSAGE, nullptr, L"/servershow", 0);
return _dlgReturn(m_hwnd, 1);
}
}
@@ -2677,7 +2662,7 @@ LABEL_SHOWWINDOW:
default:
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, (LPARAM)uID);
+ DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, (LPARAM)uID);
break;
}
@@ -2732,11 +2717,11 @@ LABEL_SHOWWINDOW:
break;
case ID_MESS:
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, (LPARAM)uID);
+ DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, (LPARAM)uID);
break;
}
DestroyGCMenu(&hMenu, 1);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index e2e8960a26..879b9bd1eb 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -354,7 +354,7 @@ public:
public:
CTabBaseDlg(int iDialogId, SESSION_INFO* = nullptr);
- virtual ~CTabBaseDlg() override;
+ virtual ~CTabBaseDlg();
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index e60957ab47..28b070caf3 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -410,14 +410,14 @@ static void DoChatFormatting(wchar_t* pszText)
iRemoveChars = 2;
break;
case 'c':
- {
- mir_wstrcpy(InsertThis, L"\003");
- iRemoveChars = 2;
+ {
+ mir_wstrcpy(InsertThis, L"\003");
+ iRemoveChars = 2;
- wchar_t szTemp[3];
- mir_wstrncpy(szTemp, p1 + 2, 3);
- iFG = _wtoi(szTemp);
- }
+ wchar_t szTemp[3];
+ mir_wstrncpy(szTemp, p1 + 2, 3);
+ iFG = _wtoi(szTemp);
+ }
break;
case 'C':
if (p1[2] == '%' && p1[3] == 'F') {
@@ -505,11 +505,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
break;
case GC_USER_PRIVMESS:
- {
- wchar_t szTemp[4000];
- mir_snwprintf(szTemp, L"/QUERY %s", gch->ptszUID);
- PostIrcMessageWnd(p1, NULL, szTemp);
- }
+ PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/QUERY %s", gch->ptszUID));
break;
case GC_USER_LOGMENU:
@@ -544,29 +540,29 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
PostIrcMessage(L"/nickserv DROP");
break;
case 8: // nickserv Identify
- {
- CQuestionDlg* dlg = new CQuestionDlg(this);
- dlg->Show();
- HWND question_hWnd = dlg->GetHwnd();
- HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT);
- SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick"));
- SetDlgItemText(question_hWnd, IDC_TEXT, TranslateT("Please enter your password"));
- SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, L"/nickserv IDENTIFY %question=\"%s\",\"%s\"");
- SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE,
- (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD);
- SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)'*', 0);
- SetFocus(hEditCtrl);
- dlg->Activate();
- }
+ {
+ CQuestionDlg* dlg = new CQuestionDlg(this);
+ dlg->Show();
+ HWND question_hWnd = dlg->GetHwnd();
+ HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT);
+ SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick"));
+ SetDlgItemText(question_hWnd, IDC_TEXT, TranslateT("Please enter your password"));
+ SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, L"/nickserv IDENTIFY %question=\"%s\",\"%s\"");
+ SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE,
+ (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD);
+ SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)'*', 0);
+ SetFocus(hEditCtrl);
+ dlg->Activate();
+ }
break;
case 9: // nickserv remind password
- {
- DBVARIANT dbv;
- if (!getWString("Nick", &dbv)) {
- PostIrcMessage(L"/nickserv SENDPASS %s", dbv.ptszVal);
- db_free(&dbv);
+ {
+ DBVARIANT dbv;
+ if (!getWString("Nick", &dbv)) {
+ PostIrcMessage(L"/nickserv SENDPASS %s", dbv.ptszVal);
+ db_free(&dbv);
+ }
}
- }
break;
case 10: // nickserv set new password
PostIrcMessage(L"/nickserv SET PASSWORD %%question=\"%s\",\"%s\"",
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 00f630271b..5e98c0f0f6 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -689,7 +689,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
}
-static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -781,11 +781,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ si->pDlg->DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID);
+ si->pDlg->DoEventHook(GC_USER_NICKLISTMENU, ui, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -1047,7 +1047,7 @@ void CChatRoomDlg::OnClick_NickList(CCtrlButton *pButton)
void CChatRoomDlg::OnClick_Options(CCtrlButton *pButton)
{
if (pButton->Enabled())
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0);
+ DoEventHook(GC_USER_CHANMGR, nullptr, nullptr, 0);
}
void CChatRoomDlg::OnClick_Ok(CCtrlButton *pButton)
@@ -1078,7 +1078,7 @@ void CChatRoomDlg::OnClick_Ok(CCtrlButton *pButton)
EnableWindow(m_btnOk.GetHwnd(), FALSE);
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0);
+ DoEventHook(GC_USER_MESSAGE, nullptr, ptszText, 0);
SetFocus(m_message.GetHwnd());
}
@@ -1101,7 +1101,7 @@ void CChatRoomDlg::OnListDblclick(CCtrlListBox*)
SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)buf.c_str());
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
- else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0);
}
void CChatRoomDlg::OnSplitterX(CSplitter *pSplitter)
@@ -1321,10 +1321,10 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!IsIconic(m_hwnd)) {
SendMessage(m_hwndStatus, WM_SIZE, 0, 0);
- BOOL bControl = (BOOL)db_get_b(0, CHAT_MODULE, "ShowTopButtons", 1);
- BOOL bFormat = (BOOL)db_get_b(0, CHAT_MODULE, "ShowFormatButtons", 1);
- BOOL bSend = (BOOL)db_get_b(0, CHAT_MODULE, "ShowSend", 0);
- BOOL bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled;
+ bool bSend = db_get_b(0, CHAT_MODULE, "ShowSend", 0) != 0;
+ bool bFormat = db_get_b(0, CHAT_MODULE, "ShowFormatButtons", 1) != 0;
+ bool bControl = db_get_b(0, CHAT_MODULE, "ShowTopButtons", 1) != 0;
+ bool bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled;
ShowWindow(m_btnBold.GetHwnd(), bFormat ? SW_SHOW : SW_HIDE);
ShowWindow(m_btnItalic.GetHwnd(), bFormat ? SW_SHOW : SW_HIDE);
@@ -1344,13 +1344,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
ShowWindow(m_nickList.GetHwnd(), SW_HIDE);
if (m_si->iType == GCW_SERVER) {
- EnableWindow(m_btnNickList.GetHwnd(), FALSE);
- EnableWindow(m_btnFilter.GetHwnd(), FALSE);
- EnableWindow(m_btnChannelMgr.GetHwnd(), FALSE);
+ EnableWindow(m_btnNickList.GetHwnd(), false);
+ EnableWindow(m_btnFilter.GetHwnd(), false);
+ EnableWindow(m_btnChannelMgr.GetHwnd(), false);
}
else {
- EnableWindow(m_btnNickList.GetHwnd(), TRUE);
- EnableWindow(m_btnFilter.GetHwnd(), TRUE);
+ EnableWindow(m_btnNickList.GetHwnd(), true);
+ EnableWindow(m_btnFilter.GetHwnd(), true);
if (m_si->iType == GCW_CHATROOM)
EnableWindow(m_btnChannelMgr.GetHwnd(), pci->MM_FindModule(m_si->pszModule)->bChanMgr);
}
@@ -1358,7 +1358,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
CSrmmBaseDialog::DlgProc(uMsg, wParam, lParam); // call built-in resizer
SetButtonsPos(m_hwnd, true);
- InvalidateRect(m_hwndStatus, nullptr, TRUE);
+ InvalidateRect(m_hwndStatus, nullptr, true);
RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
RedrawWindow(m_btnOk.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
SaveWindowPosition(false);
@@ -1549,21 +1549,6 @@ LABEL_SHOWWINDOW:
}
break;
- case GC_FIREHOOK:
- if (lParam) {
- GCHOOK *gch = (GCHOOK *)lParam;
- NotifyEventHooks(pci->hSendEvent, 0, lParam);
- if (gch->pDest) {
- mir_free((void*)gch->pDest->ptszID);
- mir_free((void*)gch->pDest->pszModule);
- mir_free(gch->pDest);
- }
- mir_free((void*)gch->ptszText);
- mir_free((void*)gch->ptszUID);
- mir_free(gch);
- }
- break;
-
case GC_CLOSEWINDOW:
if (g_Settings.bTabsEnable)
SendMessage(GetParent(m_hwndParent), GC_REMOVETAB, 0, (LPARAM)this);
@@ -1725,7 +1710,7 @@ LABEL_SHOWWINDOW:
default:
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, uID);
+ DoEventHook(GC_USER_LOGMENU, nullptr, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 5);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index b18ac615ae..5821959568 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -92,6 +92,7 @@ struct MODULEINFO : public GCModuleInfoBase
struct SESSION_INFO : public GCSessionInfoBase
{
int iX, iY;
+ int iWidth, iHeight;
};
struct LOGSTREAMDATA : public GCLogStreamDataBase {};
@@ -174,6 +175,7 @@ class CChatRoomDlg : public CSrmmBaseDialog
friend struct CTabbedWindow;
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND m_hwndStatus;
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index fbfc8872f6..d081407ac6 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -109,7 +109,6 @@ int GetRichTextLength(HWND hwnd);
bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
-BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem);
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);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index bdd3604861..59e7bb27cc 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -187,12 +187,12 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool bIsHighlighted)
{
- SESSION_INFO *p = SM_FindSession(pszID, pszModule);
- if (p == nullptr)
+ SESSION_INFO *si = SM_FindSession(pszID, pszModule);
+ if (si == nullptr)
return TRUE;
- LOGINFO *li = chatApi.LM_AddEvent(&p->pLog, &p->pLogEnd);
- p->iEventCount += 1;
+ LOGINFO *li = chatApi.LM_AddEvent(&si->pLog, &si->pLogEnd);
+ si->iEventCount++;
li->iType = gce->pDest->iType;
li->ptszNick = mir_wstrdup(gce->ptszNick);
@@ -204,10 +204,10 @@ BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool
li->time = gce->time;
li->bIsHighlighted = bIsHighlighted;
- if (g_Settings->iEventLimit > 0 && p->iEventCount > g_Settings->iEventLimit + 20) {
- chatApi.LM_TrimLog(&p->pLog, &p->pLogEnd, p->iEventCount - g_Settings->iEventLimit);
- p->bTrimmed = true;
- p->iEventCount = g_Settings->iEventLimit;
+ if (g_Settings->iEventLimit > 0 && si->iEventCount > g_Settings->iEventLimit + 20) {
+ chatApi.LM_TrimLog(&si->pLog, &si->pLogEnd, si->iEventCount - g_Settings->iEventLimit);
+ si->bTrimmed = true;
+ si->iEventCount = g_Settings->iEventLimit;
return FALSE;
}
return TRUE;
@@ -437,7 +437,9 @@ static void SM_AddCommand(const wchar_t *pszID, const char *pszModule, const cha
if (si->wCommandsNum > WINDOWS_COMMANDS_MAX) {
COMMANDINFO *pCurComm = si->lpCommands;
- while (pCurComm->next != nullptr) { pCurComm = pCurComm->next; }
+ while (pCurComm->next != nullptr)
+ pCurComm = pCurComm->next;
+
COMMANDINFO *pLast = pCurComm->last;
mir_free(pCurComm->lpCommand);
mir_free(pCurComm);
@@ -527,7 +529,7 @@ char* SM_GetUsers(SESSION_INFO *si)
if (utemp == nullptr)
return nullptr;
- char* p = nullptr;
+ char *p = nullptr;
size_t alloced = 0;
do {
size_t pLen = mir_strlen(p), nameLen = mir_wstrlen(utemp->pszUID);
@@ -1041,12 +1043,6 @@ static BOOL LM_RemoveAll(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd)
return TRUE;
}
-static BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem)
-{
- SESSION_INFO *si = chatApi.SM_FindSession(pszID, pszModule);
- return (si) ? DoEventHook(si, iType, pUser, pszText, dwItem) : FALSE;
-}
-
MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _hLangpack)
{
if (pInit == nullptr)
@@ -1146,9 +1142,6 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _
chatApi.LoadMsgDlgFont = LoadMsgDlgFont;
chatApi.MakeTimeStamp = MakeTimeStamp;
- chatApi.DoEventHook = DoEventHook;
- chatApi.DoEventHookAsync = DoEventHookAsync;
-
chatApi.DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
chatApi.DoTrayIcon = DoTrayIcon;
chatApi.DoPopup = DoPopup;
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 13f573a2c4..0257297ead 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -606,31 +606,6 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
return TRUE;
}
-BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem)
-{
- SESSION_INFO *si = chatApi.SM_FindSession(pszID, pszModule);
- if (si == NULL)
- return FALSE;
-
- GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
- gcd->pszModule = mir_strdup(pszModule);
- gcd->ptszID = mir_wstrdup(pszID);
- gcd->iType = iType;
-
- GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
- if (pUser != NULL) {
- gch->ptszUID = mir_wstrdup(pUser->pszUID);
- gch->ptszNick = mir_wstrdup(pUser->pszNick);
- }
- else gch->ptszUID = gch->ptszNick = nullptr;
-
- gch->ptszText = mir_wstrdup(pszText);
- gch->dwData = dwItem;
- gch->pDest = gcd;
- PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch);
- return TRUE;
-}
-
BOOL DoEventHook(SESSION_INFO *si, int iType, const USERINFO *pUser, const wchar_t* pszText, INT_PTR dwItem)
{
if (si == nullptr)
@@ -851,22 +826,22 @@ static void CALLBACK ChatTimerProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD)
USERINFO *ui1 = chatApi.SM_GetUserFromIndex(si->ptszID, si->pszModule, si->currentHovered);
if (ui1) {
- wchar_t tszBuf[1024]; tszBuf[0] = 0;
+ CMStringW wszBuf;
if (ProtoServiceExists(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
wchar_t *p = (wchar_t*)CallProtoService(si->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)si->ptszID, (LPARAM)ui1->pszUID);
if (p) {
- wcsncpy_s(tszBuf, p, _TRUNCATE);
+ wszBuf = p;
mir_free(p);
}
}
- if (tszBuf[0] == 0)
- mir_snwprintf(tszBuf, L"<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s",
- TranslateT("Nick"), ui1->pszNick,
- TranslateT("Unique ID"), ui1->pszUID,
- TranslateT("Status"), chatApi.TM_WordToString(si->pStatuses, ui1->Status));
+ if (wszBuf.IsEmpty())
+ wszBuf.Format(L"<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s",
+ TranslateT("Nick"), ui1->pszNick,
+ TranslateT("Unique ID"), ui1->pszUID,
+ TranslateT("Status"), chatApi.TM_WordToString(si->pStatuses, ui1->Status));
CLCINFOTIP ti = { sizeof(ti) };
- if (CallService("mToolTip/ShowTipW", (WPARAM)tszBuf, (LPARAM)&ti))
+ if (CallService("mToolTip/ShowTipW", (WPARAM)wszBuf.c_str(), (LPARAM)&ti))
si->bHasToolTip = true;
}
KillTimer(hwnd, idEvent);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index d6414d4a10..c2562b7c58 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -410,3 +410,4 @@ ProtoGetAvatarMimeType @401
?isChat@CSrmmBaseDialog@@QBE_NXZ @411 NONAME
Srmm_LogStreamCallback @412
Srmm_MessageStreamCallback @413
+?DoEventHook@CSrmmBaseDialog@@IAEXHPBUUSERINFO@@PB_WH@Z @414 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 1c66d0534a..8c86e46402 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -410,3 +410,4 @@ ProtoGetAvatarMimeType @401
?isChat@CSrmmBaseDialog@@QEBA_NXZ @411 NONAME
Srmm_LogStreamCallback @412
Srmm_MessageStreamCallback @413
+?DoEventHook@CSrmmBaseDialog@@IEAAXHPEBUUSERINFO@@PEB_W_J@Z @414 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 0d007ea68f..cb7e7430de 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HCURSOR g_hCurHyperlinkHand;
-CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si) :
- CDlgBase(hInst, idDialog),
+CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si)
+ : CDlgBase(hInst, idDialog),
m_si(si),
m_pLog(nullptr),
m_pEntry(nullptr),
@@ -57,71 +57,92 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si
INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
- CHARRANGE sel;
-
- if (msg == WM_NOTIFY && m_pLog != nullptr) {
- LPNMHDR hdr = (LPNMHDR)lParam;
- if (hdr->hwndFrom == m_pLog->GetHwnd() && hdr->code == EN_LINK) {
- ENLINK *pLink = (ENLINK*)lParam;
- switch (pLink->msg) {
- case WM_SETCURSOR:
- SetCursor(g_hCurHyperlinkHand);
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
-
- case WM_RBUTTONDOWN:
- case WM_LBUTTONUP:
- case WM_LBUTTONDBLCLK:
- m_pLog->SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax)
- break;
-
- CMStringW wszText(' ', pLink->chrg.cpMax - pLink->chrg.cpMin + 1);
- {
+ switch (msg) {
+ case WM_NOTIFY:
+ if (m_pLog != nullptr) {
+ LPNMHDR hdr = (LPNMHDR)lParam;
+ if (hdr->hwndFrom == m_pLog->GetHwnd() && hdr->code == EN_LINK) {
+ ENLINK *pLink = (ENLINK*)lParam;
+ switch (pLink->msg) {
+ case WM_SETCURSOR:
+ SetCursor(g_hCurHyperlinkHand);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_LBUTTONDBLCLK:
+ CHARRANGE sel;
+ m_pLog->SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin != sel.cpMax)
+ break;
+
+ CMStringW wszText(' ', pLink->chrg.cpMax - pLink->chrg.cpMin + 1);
+
TEXTRANGE tr;
tr.chrg = pLink->chrg;
tr.lpstrText = wszText.GetBuffer();
m_pLog->SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL)
wszText.Insert(0, L"mailto:");
- }
-
- if (pLink->msg == WM_RBUTTONDOWN) {
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hSubMenu = GetSubMenu(hMenu, 6);
- TranslateMenu(hSubMenu);
-
- POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) };
- ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt);
-
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) {
- case IDM_OPENLINK:
- Utils_OpenUrlW(wszText);
- break;
- case IDM_COPYLINK:
- if (OpenClipboard(m_hwnd)) {
- EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (wszText.GetLength()+1) * sizeof(wchar_t));
- mir_wstrcpy((wchar_t*)GlobalLock(hData), wszText);
- GlobalUnlock(hData);
- SetClipboardData(CF_UNICODETEXT, hData);
- CloseClipboard();
+ if (pLink->msg == WM_RBUTTONDOWN) {
+ HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 6);
+ TranslateMenu(hSubMenu);
+
+ POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) };
+ ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt);
+
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) {
+ case IDM_OPENLINK:
+ Utils_OpenUrlW(wszText);
+ break;
+
+ case IDM_COPYLINK:
+ if (OpenClipboard(m_hwnd)) {
+ EmptyClipboard();
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (wszText.GetLength() + 1) * sizeof(wchar_t));
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), wszText);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_UNICODETEXT, hData);
+ CloseClipboard();
+ }
+ break;
}
- break;
+
+ DestroyMenu(hMenu);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
}
- DestroyMenu(hMenu);
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
+ Utils_OpenUrlW(wszText);
+ if (m_pEntry != nullptr)
+ SetFocus(m_pEntry->GetHwnd());
}
-
- Utils_OpenUrlW(wszText);
- if (m_pEntry != nullptr)
- SetFocus(m_pEntry->GetHwnd());
}
}
+ break;
}
return CDlgBase::DlgProc(msg, wParam, lParam);
}
+
+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);
+}