From f0157cebda12743f081e1e43e1c986dde60e2cd0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Feb 2020 15:33:26 +0300 Subject: minor code cleaning --- plugins/TabSRMM/src/chat.h | 4 ++-- plugins/TabSRMM/src/chat_tools.cpp | 18 +++++++++--------- plugins/TabSRMM/src/hotkeyhandler.cpp | 10 ++++------ plugins/TabSRMM/src/msgdlgother.cpp | 3 +-- 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h index ab05c48688..8e64d6c09b 100644 --- a/plugins/TabSRMM/src/chat.h +++ b/plugins/TabSRMM/src/chat.h @@ -80,13 +80,13 @@ struct TMUCSettings : public GlobalLogSettingsBase CMUCHighlight *Highlight; }; -struct FLASH_PARAMS +struct FLASH_PARAMS : public MZeroedObject { MCONTACT hContact; const char* sound; int iEvent; HICON hNotifyIcon; - bool bActiveTab, bHighlight, bInactive, bMustFlash, bMustAutoswitch; + bool bActiveTab, bInactive, bMustFlash, bMustAutoswitch; HWND hWnd; }; diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 8a34696804..dd284321d7 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -283,7 +283,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) UpdateTrayMenu(dat, si->wStatus, si->pszModule, dat->m_wszStatus, si->hContact, 1); } - mir_free(p); + delete p; } BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix) @@ -292,15 +292,15 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight return FALSE; CMsgDialog *dat = nullptr; - FLASH_PARAMS *params = (FLASH_PARAMS*)mir_calloc(sizeof(FLASH_PARAMS)); + auto *params = new FLASH_PARAMS(); params->hContact = si->hContact; - params->bInactive = TRUE; + params->bInactive = true; if (si->pDlg) { dat = si->pDlg; if ((si->pDlg->GetHwnd() == si->pDlg->m_pContainer->m_hwndActive) && GetForegroundWindow() == si->pDlg->m_pContainer->m_hwnd) - params->bInactive = FALSE; + params->bInactive = false; } - params->bActiveTab = params->bMustFlash = params->bMustAutoswitch = FALSE; + params->bActiveTab = params->bMustFlash = params->bMustAutoswitch = false; params->iEvent = gce->iType; WPARAM wParamForHighLight = 0; @@ -326,8 +326,8 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (dat || !nen_options.iMUCDisable) DoPopup(si, gce); if (g_Settings.bFlashWindowHighlight && params->bInactive) - params->bMustFlash = TRUE; - params->bMustAutoswitch = TRUE; + params->bMustFlash = true; + params->bMustAutoswitch = true; params->hNotifyIcon = g_chatApi.hIcons[ICON_HIGHLIGHT]; } else { @@ -436,9 +436,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight } if (params->iEvent == GC_EVENT_MESSAGE) { - params->bMustAutoswitch = TRUE; + params->bMustAutoswitch = true; if (g_Settings.bFlashWindow) - params->bMustFlash = TRUE; + params->bMustFlash = true; params->hNotifyIcon = g_chatApi.hIcons[ICON_MESSAGE]; } } diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 9e9ee3f502..f33bc99ac3 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -462,15 +462,13 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP FLASH_PARAMS *p = reinterpret_cast(lParam); if (1 == wParam) { Clist_ContactDoubleClicked(p->hContact); - p->bActiveTab = TRUE; - p->bInactive = FALSE; - p->bMustAutoswitch = p->bMustFlash = FALSE; + p->bActiveTab = true; + p->bInactive = p->bMustAutoswitch = p->bMustFlash = false; } if (2 == wParam) { - p->bActiveTab = TRUE; - p->bInactive = FALSE; - p->bMustAutoswitch = p->bMustFlash = FALSE; + p->bActiveTab = true; + p->bInactive = p->bMustAutoswitch = p->bMustFlash = false; SendMessage(p->hWnd, DM_ACTIVATEME, 0, 0); } DoFlashAndSoundWorker(p); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index e74ea6b5ba..18b902763b 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -49,8 +49,7 @@ void CMsgDialog::AddLog() DM_AddDivider(); } else { - bool bInactive = !IsActive(); - if (bInactive) + if (!IsActive()) DM_AddDivider(); else if (m_pContainer->m_hwndActive != m_hwnd) DM_AddDivider(); -- cgit v1.2.3