From 6a53de3a1f093a92126c0a86ec5f7ad52e3caf15 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 13 Mar 2021 17:50:26 +0300 Subject: Group chats API: - for #2574: fixes icons problem after unloading tabSRMM; - status icons extracted to the separate array; - another group chat icons are hidden completely to restrict access to them --- plugins/TabSRMM/src/chat_options.cpp | 7 ------- plugins/TabSRMM/src/chat_tools.cpp | 11 ++++++----- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index eb503962bd..8dc2d8a2b6 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -183,13 +183,6 @@ static IconItem _icons[] = { { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR }, { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY }, - - { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0 }, - { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1 }, - { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2 }, - { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3 }, - { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4 }, - { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5 } }; static IconItem _logicons[] = diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 612f82a317..6d06b3c25c 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -194,7 +194,7 @@ passed: } if (iNewEvent == GC_EVENT_MESSAGE) { - ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : g_chatApi.aFonts[9].color, + ShowPopup(si->hContact, si, g_chatApi.getIcon(GC_EVENT_MESSAGE), si->pszModule, si->ptszName, clr ? clr : g_chatApi.aFonts[9].color, TranslateT("%s%s says:%s %s"), bbStart, gce->pszNick.w, bbEnd, g_chatApi.RemoveFormatting(gce->pszText.w)); } else oldDoPopup(si, gce); @@ -292,15 +292,16 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight // dialog event processing if (dat) { + HICON hIconHighlight = g_chatApi.getIcon(GC_EVENT_HIGHLIGHT), hIconMessage = g_chatApi.getIcon(GC_EVENT_MESSAGE); HICON hNotifyIcon = (bManyFix && !bInactive) ? 0 : g_chatApi.getIcon(iEvent); - BOOL bForcedIcon = (hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || hNotifyIcon == g_chatApi.hIcons[ICON_MESSAGE]); + BOOL bForcedIcon = (hNotifyIcon == hIconHighlight || hNotifyIcon == hIconMessage); if ((iEvent & si->iLogTrayFlags) || bForcedIcon) { if (!bActiveTab) { - if (hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT]) + if (hNotifyIcon == hIconHighlight) dat->m_iFlashIcon = hNotifyIcon; else { - if (dat->m_iFlashIcon != g_chatApi.hIcons[ICON_HIGHLIGHT] && dat->m_iFlashIcon != g_chatApi.hIcons[ICON_MESSAGE]) + if (dat->m_iFlashIcon != hIconHighlight && dat->m_iFlashIcon != hIconMessage) dat->m_iFlashIcon = hNotifyIcon; } dat->m_bCanFlashTab = TRUE; @@ -344,7 +345,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight } HICON hIcon = (HICON)SendMessage(dat->m_pContainer->m_hwnd, WM_GETICON, ICON_BIG, 0); - if (hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || (hIcon != g_chatApi.hIcons[ICON_MESSAGE] && hIcon != g_chatApi.hIcons[ICON_HIGHLIGHT])) { + if (hNotifyIcon == hIconHighlight || (hIcon != hIconMessage && hIcon != hIconHighlight)) { dat->m_pContainer->SetIcon(dat, hNotifyIcon); dat->m_pContainer->m_flags.m_bNeedsUpdateTitle = true; } diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 36c712279d..547105fd7a 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -198,7 +198,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HICON hIcon; if (dis->itemData > 0) - hIcon = (dis->itemData & 0x10000000) ? g_chatApi.hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent; + hIcon = (dis->itemData & 0x10000000) ? g_chatApi.getIcon(GC_EVENT_HIGHLIGHT) : PluginConfig.g_IconMsgEvent; else if (dat != nullptr) { hIcon = dat->GetMyContactIcon(nullptr); idle = dat->m_idle; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 0350f55db8..677efc63e9 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2923,7 +2923,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int nickIndex = 0; for (int i = 0; i < STATUSICONCOUNT; i++) { - if (hIcon == g_chatApi.hIcons[ICON_STATUS0 + i]) { + if (hIcon == g_chatApi.hStatusIcons[i]) { nickIndex = i; break; } -- cgit v1.2.3