From a00c17f7006f7a001757cf952ae4ed87b5a328dd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 29 Oct 2024 11:28:35 +0300 Subject: code cleaning --- 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 ++- 4 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src') 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