summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-23 21:38:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-23 21:38:21 +0300
commit0960c4ae216d12ad03a8bff4071ff55cb0d48129 (patch)
tree16ef5867f25d63b53939823f6b1aa70ca13f6057 /src
parentffc1007914c3ffdc4cf322828907f35dd4101773 (diff)
shit fixed in chat api
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_window.cpp6
-rw-r--r--src/mir_app/src/chat.h4
-rw-r--r--src/mir_app/src/chat_tools.cpp18
3 files changed, 19 insertions, 9 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 13bc183055..8ae008ae0a 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -807,11 +807,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->pszUID, NULL, 0);
+ pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, uID);
+ pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -1117,7 +1117,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->pszUID, NULL, 0);
+ else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
}
void CChatRoomDlg::SetWindowPosition()
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 2d3c5b3130..66c39fa753 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -103,8 +103,8 @@ 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 wchar_t* pszUID, const wchar_t* pszText, INT_PTR dwItem);
-BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType, const wchar_t *pszUID, 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 DoEventHook(const wchar_t *pszID, const char *pszModule, 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_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 5501a5e9ba..5dc9bd26f2 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 DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const wchar_t* pszUID, 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)
{
SESSION_INFO *si = chatApi.SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -618,7 +618,12 @@ BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, in
gcd->iType = iType;
GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
- gch->ptszUID = mir_wstrdup(pszUID);
+ 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;
@@ -626,7 +631,7 @@ BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, in
return TRUE;
}
-BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType, const wchar_t *pszUID, const wchar_t* pszText, INT_PTR dwItem)
+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);
if (si == NULL)
@@ -634,7 +639,12 @@ BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType, const w
GCDEST gcd = { (char*)pszModule, pszID, iType };
GCHOOK gch = { 0 };
- gch.ptszUID = (LPTSTR)pszUID;
+ if (pUser != NULL) {
+ gch.ptszUID = pUser->pszUID;
+ gch.ptszNick = pUser->pszNick;
+ }
+ else gch.ptszUID = gch.ptszNick = nullptr;
+
gch.ptszText = (LPTSTR)pszText;
gch.dwData = dwItem;
gch.pDest = &gcd;