From a00c17f7006f7a001757cf952ae4ed87b5a328dd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 29 Oct 2024 11:28:35 +0300 Subject: code cleaning --- include/m_clistint.h | 1 + libs/win32/mir_app.lib | Bin 300552 -> 300878 bytes libs/win64/mir_app.lib | Bin 300596 -> 300926 bytes plugins/Clist_modern/src/modern_clcpaint.cpp | 14 ++++++-------- plugins/Clist_nicer/src/clc.h | 6 ------ plugins/Clist_nicer/src/clcpaint.cpp | 8 ++------ src/core/stdclist/src/clcpaint.cpp | 5 +---- src/mir_app/src/clcidents.cpp | 19 +++++++++++++++---- src/mir_app/src/mir_app.def | 3 ++- src/mir_app/src/mir_app64.def | 3 ++- 10 files changed, 29 insertions(+), 30 deletions(-) diff --git a/include/m_clistint.h b/include/m_clistint.h index 096ed11883..c8a45f52d7 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -246,6 +246,7 @@ struct MenuProto ///////////////////////////////////////////////////////////////////////////////////////// // functions +MIR_APP_DLL(bool) Clist_AltVisible(ClcContact *cc); MIR_APP_DLL(void) Clist_Broadcast(int msg, WPARAM wParam, LPARAM lParam); MIR_APP_DLL(void) Clist_BroadcastAsync(int msg, WPARAM wParam, LPARAM lParam); MIR_APP_DLL(void) Clist_CalcEipPosition(ClcData *dat, ClcContact *contact, ClcGroup *group, POINT *result); diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 1025bad8c7..cb8c94e86e 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index c51beade5a..e551a9b2a6 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 0c62fb0dc2..7bcd57bc33 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -158,12 +158,11 @@ int CLCPaint::GetBasicFontID(ClcContact *contact) case CLCIT_CONTACT: if (contact->flags & CONTACTF_NOTONLIST) return FONTID_NOTONLIST; - if (((contact->flags & CONTACTF_INVISTO) && Clist_GetRealStatus(contact, ID_STATUS_OFFLINE) != ID_STATUS_INVISIBLE) || - ((contact->flags & CONTACTF_VISTO && Clist_GetRealStatus(contact, ID_STATUS_OFFLINE) == ID_STATUS_INVISIBLE))) { - // the contact is in the always visible list and the proto is invisible - // the contact is in the always invisible and the proto is in any other mode + + // the contact is in the always visible list and the proto is invisible + // the contact is in the always invisible and the proto is in any other mode + if (Clist_AltVisible(contact)) return (contact->flags & CONTACTF_ONLINE) ? FONTID_INVIS : FONTID_OFFINVIS; - } switch (contact->pce->getStatus()) { case ID_STATUS_OFFLINE: return FONTID_OFFLINE; @@ -1989,9 +1988,8 @@ void CLCPaint::_GetBlendMode(IN ClcData *dat, IN ClcContact *Drawing, IN BOOL se colourFg = dat->selBkColour; mode = ILD_NORMAL; } - if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) && - Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE && - (bFlag & GIM_IDLE_AFFECT)) + if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) && + Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE && (bFlag & GIM_IDLE_AFFECT)) mode = ILD_SELECTED; if (OutColourFg) *OutColourFg = colourFg; if (OutMode) { diff --git a/plugins/Clist_nicer/src/clc.h b/plugins/Clist_nicer/src/clc.h index 0c0f7c0039..52c2d6b47d 100644 --- a/plugins/Clist_nicer/src/clc.h +++ b/plugins/Clist_nicer/src/clc.h @@ -45,12 +45,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TIMERID_REFRESH 18 #define TIMERID_PAINT 19 -#define CONTACTF_ONLINE 1 -//#define CONTACTF_INVISTO 2 -//#define CONTACTF_VISTO 4 -#define CONTACTF_NOTONLIST 8 -#define CONTACTF_CHECKED 16 -#define CONTACTF_IDLE 32 #define CONTACTF_STICKY 64 #define CONTACTF_PRIORITY 128 diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 5d71b1d53a..802a786e74 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -127,8 +127,7 @@ int GetBasicFontID(ClcContact *contact) if (contact->flags & CONTACTF_NOTONLIST) return FONTID_NOTONLIST; - if ((contact->flags & CONTACTF_INVISTO && Clist_GetRealStatus(contact, ID_STATUS_OFFLINE) != ID_STATUS_INVISIBLE) - || (contact->flags & CONTACTF_VISTO && Clist_GetRealStatus(contact, ID_STATUS_OFFLINE) == ID_STATUS_INVISIBLE)) + if (Clist_AltVisible(contact)) return contact->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS; return contact->flags & CONTACTF_ONLINE ? FONTID_CONTACTS : FONTID_OFFLINE; @@ -430,11 +429,8 @@ set_bg_l: } else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST) ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight); - else if (type == CLCIT_CONTACT && ((flags & CONTACTF_INVISTO && Clist_GetRealStatus(contact, my_status) != ID_STATUS_INVISIBLE) || (flags & CONTACTF_VISTO && Clist_GetRealStatus(contact, my_status) == ID_STATUS_INVISIBLE))) { - // the contact is in the always visible list and the proto is invisible - // the contact is in the always invisible and the proto is in any other mode + else if (type == CLCIT_CONTACT && Clist_AltVisible(contact)) ChangeToFont(hdcMem, dat, flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight); - } else if (type == CLCIT_CONTACT && !(flags & CONTACTF_ONLINE)) ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight); else diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index ed0e505732..8282eb2dd5 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -256,11 +256,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight); else if (cc->type == CLCIT_CONTACT && cc->flags & CONTACTF_NOTONLIST) ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight); - else if (cc->type == CLCIT_CONTACT && ((cc->flags & CONTACTF_INVISTO && Clist_GetRealStatus(cc, status) != ID_STATUS_INVISIBLE) || (cc->flags & CONTACTF_VISTO && Clist_GetRealStatus(cc, status) == ID_STATUS_INVISIBLE))) { - // the contact is in the always visible list and the proto is invisible - // the contact is in the always invisible and the proto is in any other mode + else if (cc->type == CLCIT_CONTACT && Clist_AltVisible(cc)) ChangeToFont(hdcMem, dat, cc->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight); - } else if (cc->type == CLCIT_CONTACT && !(cc->flags & CONTACTF_ONLINE)) ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight); else diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp index 12d70e8fd6..e5d56bde6e 100644 --- a/src/mir_app/src/clcidents.cpp +++ b/src/mir_app/src/clcidents.cpp @@ -220,17 +220,28 @@ MIR_APP_DLL(HANDLE) Clist_ContactToItemHandle(ClcContact *cc, uint32_t *nmFlags) return nullptr; } +///////////////////////////////////////////////////////////////////////////////////////// + MIR_APP_DLL(int) Clist_GetRealStatus(ClcContact *cc, int iDefaultValue) { - if (cc->pce) { - PROTOACCOUNT *pa = Proto_GetAccount(cc->pce->szProto); - if (pa) + if (cc->pce) + if (auto *pa = Proto_GetAccount(cc->pce->szProto)) return pa->iRealStatus; - } return iDefaultValue; } +MIR_APP_DLL(bool) Clist_AltVisible(ClcContact *cc) +{ + if ((cc->flags & CONTACTF_INVISTO) && Clist_GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_INVISIBLE) + return true; + + if ((cc->flags & CONTACTF_VISTO) && Clist_GetRealStatus(cc, ID_STATUS_OFFLINE) == ID_STATUS_INVISIBLE) + return true; + + return false; +} + ///////////////////////////////////////////////////////////////////////////////////////// MIR_APP_DLL(int) Clist_GetGeneralizedStatus(char **szProto) diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 79529d5e42..7d909a5ab8 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -426,6 +426,7 @@ Proto_GetAverageStatus @512 ?RegisterProtocol@CMPluginBase@@IAEXHP6APAUPROTO_INTERFACE@@PBDPB_W@ZP6AHPAU2@@Z@Z @547 NONAME Proto_GetUniqueId @548 Proto_SetUniqueId @549 +Clist_AltVisible @550 NONAME ??4PROTOACCOUNT@@QAEAAU0@ABU0@@Z @551 NONAME ?IsEnabled@PROTOACCOUNT@@QBE_NXZ @552 NONAME ?IsLocked@PROTOACCOUNT@@QBE_NXZ @553 NONAME @@ -474,7 +475,7 @@ Clist_SaveStateAndRebuildList @595 NONAME Clist_DeleteItemFromTree @596 NONAME Clist_RemoveItemFromGroup @597 NONAME Clist_ClcOptionsChanged @598 NONAME -Clist_GetRealStatus @599 NONAME +?Clist_GetRealStatus@@YGHPAUClcContact@@H@Z @599 NONAME Clist_GetGeneralizedStatus @600 NONAME Proto_GetStatus @601 ?getCache@MDatabaseCommon@@QBEPAUMIDatabaseCache@@XZ @602 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 0614b964f7..7e5827cbcf 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -426,6 +426,7 @@ Proto_GetAverageStatus @512 ?RegisterProtocol@CMPluginBase@@IEAAXHP6APEAUPROTO_INTERFACE@@PEBDPEB_W@ZP6AHPEAU2@@Z@Z @547 NONAME Proto_GetUniqueId @548 Proto_SetUniqueId @549 +Clist_AltVisible @550 NONAME ??4PROTOACCOUNT@@QEAAAEAU0@AEBU0@@Z @551 NONAME ?IsEnabled@PROTOACCOUNT@@QEBA_NXZ @552 NONAME ?IsLocked@PROTOACCOUNT@@QEBA_NXZ @553 NONAME @@ -474,7 +475,7 @@ Clist_SaveStateAndRebuildList @595 NONAME Clist_DeleteItemFromTree @596 NONAME Clist_RemoveItemFromGroup @597 NONAME Clist_ClcOptionsChanged @598 NONAME -Clist_GetRealStatus @599 NONAME +?Clist_GetRealStatus@@YAHPEAUClcContact@@H@Z @599 NONAME Clist_GetGeneralizedStatus @600 NONAME Proto_GetStatus @601 ?getCache@MDatabaseCommon@@QEBAPEAUMIDatabaseCache@@XZ @602 NONAME -- cgit v1.2.3