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 | |
parent | ffc1007914c3ffdc4cf322828907f35dd4101773 (diff) |
shit fixed in chat api
-rw-r--r-- | include/m_chat.h | 1 | ||||
-rw-r--r-- | include/m_chat_int.h | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 9 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 10 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/chat.h | 4 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 18 |
7 files changed, 32 insertions, 20 deletions
diff --git a/include/m_chat.h b/include/m_chat.h index 7b1a0b569f..02c9dee93a 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -491,6 +491,7 @@ struct GCHOOK GCDEST *pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered
LPTSTR ptszText; // usage depends on type of event
LPTSTR ptszUID; // unique identifier, usage depends on type of event
+ LPTSTR ptszNick; // user nick, as displayed in a nicklist
INT_PTR dwData; // user defined data, usage depends on type of event
};
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 1b24962ae4..c2a29e3d00 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -351,8 +351,8 @@ 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 wchar_t *pszUID, const wchar_t* pszText, INT_PTR dwItem);
- 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 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);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 47ec5ed001..db29862b00 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -786,11 +786,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, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -818,7 +818,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
- 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;
}
@@ -1382,6 +1382,7 @@ LABEL_SHOWWINDOW: }
mir_free(gch->ptszText);
mir_free(gch->ptszUID);
+ mir_free(gch->ptszNick);
mir_free(gch);
}
break;
@@ -1537,7 +1538,7 @@ LABEL_SHOWWINDOW: SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
}
- else pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ else pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
}
return TRUE;
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 2221b549c7..3d932bcf5d 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1499,7 +1499,7 @@ 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: @@ -1513,7 +1513,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM 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->pszUID, NULL, (LPARAM)uID); + pci->DoEventHookAsync(hwndParent, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui1, nullptr, (LPARAM)uID); } } mir_free(pItems); @@ -2500,11 +2500,11 @@ LABEL_SHOWWINDOW: break; case ID_MESS: - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0); + pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); break; default: - pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID); + pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, (LPARAM)uID); break; } DestroyGCMenu(&hMenu, 1); @@ -2631,7 +2631,7 @@ LABEL_SHOWWINDOW: PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); } - else pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0); + else pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); } return TRUE; } 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;
|