From 00a9149e272b38b002d2a2711c54fab25bcf733f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 18 Jan 2014 12:41:41 +0000 Subject: - log writing fixed; - DoPopup & DoTrayIcons now use inheritance; - massive cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@7716 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/chat.h | 1 - plugins/Scriver/src/chat/main.cpp | 22 +++++++++++++++++++++- plugins/Scriver/src/chat/window.cpp | 14 +++++++------- 3 files changed, 28 insertions(+), 9 deletions(-) (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index 00598c44e1..44623a8f68 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -112,7 +112,6 @@ int GetColorIndex(const char* pszModule, COLORREF cr); TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) ; UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText); void DestroyGCMenu(HMENU *hMenu, int iIndex); -BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem); // message.c TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO *si); diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index b8d2dbc0b4..6e991c12d9 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h" // globals -CHAT_MANAGER *pci; +CHAT_MANAGER *pci, saveCI; HMENU g_hMenu = NULL; GlobalLogSettings g_Settings; @@ -116,6 +116,20 @@ static void OnCreateModule(MODULEINFO *mi) mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE); } +static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) +{ + if (gce->pDest->iType & g_Settings.dwTrayIconFlags) + return saveCI.DoTrayIcon(si, gce); + return TRUE; +} + +static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) +{ + if (gce->pDest->iType & g_Settings.dwPopupFlags) + return saveCI.DoPopup(si, gce); + return TRUE; +} + static void RegisterFonts() { ColourIDT colourid = { sizeof(colourid) }; @@ -148,6 +162,8 @@ int Chat_Load() { CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats") }; mir_getCI(&data); + saveCI = *pci; + pci->OnCreateModule = OnCreateModule; pci->OnNewUser = OnNewUser; @@ -164,6 +180,9 @@ int Chat_Load() pci->OnSetStatusBar = OnSetStatusBar; pci->OnFlashWindow = OnFlashWindow; pci->ShowRoom = ShowRoom; + + pci->DoPopup = DoPopup; + pci->DoTrayIcon = DoTrayIcon; pci->ReloadSettings(); g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU)); @@ -176,6 +195,7 @@ int Chat_Unload(void) db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); DestroyMenu(g_hMenu); + *pci = saveCI; return 0; } diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 12047a4ab6..cbcd8c270a 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -741,7 +741,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR default: PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0); - DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID); + pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID); break; } DestroyGCMenu(&hMenu, 5); @@ -916,11 +916,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; case ID_MESS: - 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->pszUID, NULL, 0); break; default: - DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID); + pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID); break; } DestroyGCMenu(&hMenu, 1); @@ -948,7 +948,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); - 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->pszUID, NULL, 0); } break; } @@ -1724,7 +1724,7 @@ LABEL_SHOWWINDOW: SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName); PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); } - else 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->pszUID, NULL, 0); } return TRUE; @@ -1756,7 +1756,7 @@ LABEL_SHOWWINDOW: EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); - DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); + pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); mir_free(pszRtf); mir_free(ptszText); SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); @@ -1815,7 +1815,7 @@ LABEL_SHOWWINDOW: case IDC_CHAT_CHANMGR: if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_CHANMGR))) break; - DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); + pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); break; case IDC_CHAT_FILTER: -- cgit v1.2.3