diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-23 21:38:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-23 21:38:21 +0300 |
commit | 0960c4ae216d12ad03a8bff4071ff55cb0d48129 (patch) | |
tree | 16ef5867f25d63b53939823f6b1aa70ca13f6057 /src/mir_app | |
parent | ffc1007914c3ffdc4cf322828907f35dd4101773 (diff) |
shit fixed in chat api
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/chat.h | 4 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 18 |
2 files changed, 16 insertions, 6 deletions
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;
|