summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-07 12:59:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-07 12:59:27 +0300
commit375c728e532139cb4ee4fe8c8266d511e5c9a289 (patch)
tree6706a48c42c64768e9f6463f1ee981a1fb5b72e6 /plugins
parenta13189ef6cfc4d797074410c4bf3cf80495f951a (diff)
Clist_GetRealStatus & Clist_GetGeneralizedStatus: common code moved to mir_app
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_blind/src/clcpaint.cpp92
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp68
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.h3
-rw-r--r--plugins/Clist_modern/src/modern_global.cpp2
-rw-r--r--plugins/Clist_nicer/src/clc.h1
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp69
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp35
7 files changed, 43 insertions, 227 deletions
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp
index 56bf6c6f66..f928f7b468 100644
--- a/plugins/Clist_blind/src/clcpaint.cpp
+++ b/plugins/Clist_blind/src/clcpaint.cpp
@@ -90,63 +90,10 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat)
SetTextColor(hdc, dat->hotTextColour);
}
-static int GetStatusOnlineness(int status)
-{
- switch (status) {
- case ID_STATUS_FREECHAT: return 110;
- case ID_STATUS_ONLINE: return 100;
- case ID_STATUS_OCCUPIED: return 60;
- case ID_STATUS_ONTHEPHONE: return 50;
- case ID_STATUS_DND: return 40;
- case ID_STATUS_AWAY: return 30;
- case ID_STATUS_OUTTOLUNCH: return 20;
- case ID_STATUS_NA: return 10;
- case ID_STATUS_INVISIBLE: return 5;
- }
- return 0;
-}
-
-static int GetGeneralisedStatus(void)
-{
- int i, status, thisStatus, statusOnlineness, thisOnlineness;
-
- status = ID_STATUS_OFFLINE;
- statusOnlineness = 0;
-
- for (i = 0; i < pcli->hClcProtoCount; i++) {
- thisStatus = pcli->clcProto[i].dwStatus;
- if (thisStatus == ID_STATUS_INVISIBLE)
- return ID_STATUS_INVISIBLE;
- thisOnlineness = GetStatusOnlineness(thisStatus);
- if (thisOnlineness > statusOnlineness) {
- status = thisStatus;
- statusOnlineness = thisOnlineness;
- }
- }
- return status;
-}
-
-static int GetRealStatus(struct ClcContact *contact, int status)
-{
- char *szProto = contact->proto;
- if (!szProto)
- return status;
- for (int i = 0; i < pcli->hClcProtoCount; i++) {
- if (!mir_strcmp(pcli->clcProto[i].szProto, szProto)) {
- return pcli->clcProto[i].dwStatus;
- }
- }
- return status;
-}
-
void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
{
- RECT clRect;
- int indent, index, fontHeight;
- struct ClcGroup *group;
- HFONT hOldFont;
LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE);
- int status = GetGeneralisedStatus();
+ int status = Clist_GetGeneralizedStatus();
int grey = 0, groupCountsFontTopShift;
HBRUSH hBrushAlternateGrey = nullptr;
// yes I know about GetSysColorBrush()
@@ -156,6 +103,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
grey = 1;
else if (GetFocus() != hwnd && dat->greyoutFlags & GREYF_UNFOCUS)
grey = 1;
+
+ RECT clRect;
GetClientRect(hwnd, &clRect);
if (rcPaint == nullptr)
rcPaint = &clRect;
@@ -165,19 +114,19 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hBmpOsb = CreateBitmap(clRect.right, clRect.bottom, 1, GetDeviceCaps(hdc, BITSPIXEL), nullptr);
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmpOsb);
- {
- TEXTMETRIC tm;
- hOldFont = (HFONT)SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPS].hFont);
- GetTextMetrics(hdcMem, &tm);
- groupCountsFontTopShift = tm.tmAscent;
- SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextMetrics(hdcMem, &tm);
- groupCountsFontTopShift -= tm.tmAscent;
- }
+
+ TEXTMETRIC tm;
+ HFONT hOldFont = (HFONT)SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPS].hFont);
+ GetTextMetrics(hdcMem, &tm);
+ groupCountsFontTopShift = tm.tmAscent;
+ SelectObject(hdcMem, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
+ GetTextMetrics(hdcMem, &tm);
+ groupCountsFontTopShift -= tm.tmAscent;
+
if (style & CLS_GREYALTERNATE)
- hBrushAlternateGrey =
- CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10)));
+ hBrushAlternateGrey = CreateSolidBrush(GetNearestColor(hdcMem, RGB(GetRValue(tmpbkcolour) - 10, GetGValue(tmpbkcolour) - 10, GetBValue(tmpbkcolour) - 10)));
+ int fontHeight;
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
SetBkMode(hdcMem, TRANSPARENT);
{
@@ -249,10 +198,10 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
}
int y = -dat->yScroll;
- group = &dat->list;
+ ClcGroup *group = &dat->list;
group->scanIndex = 0;
- indent = 0;
- for (index = 0; y < rcPaint->bottom;) {
+ int indent = 0;
+ for (int index = 0; y < rcPaint->bottom;) {
if (group->scanIndex == group->cl.getCount()) {
group = group->parent;
indent--;
@@ -295,7 +244,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
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 && GetRealStatus(cc, status) != ID_STATUS_INVISIBLE) || (cc->flags & CONTACTF_VISTO && GetRealStatus(cc, status) == ID_STATUS_INVISIBLE))) {
+ ((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
ChangeToFont(hdcMem, dat, cc->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight);
@@ -359,10 +308,9 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
colourFg = dat->fontInfo[FONTID_NOTONLIST].colour;
mode = ILD_BLEND50;
}
- if (cc->type == CLCIT_CONTACT && dat->bShowIdle && (cc->flags & CONTACTF_IDLE) && GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (cc->type == CLCIT_CONTACT && dat->bShowIdle && (cc->flags & CONTACTF_IDLE) && Clist_GetRealStatus(cc, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mode = ILD_SELECTED;
- ImageList_DrawEx(himlCListClc, iImage, hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth,
- y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
+ ImageList_DrawEx(himlCListClc, iImage, hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth, y + ((dat->rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
}
// text
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index 0ddeeabdc4..d9632a965a 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -160,8 +160,8 @@ int CLCPaint::GetBasicFontID(ClcContact *contact)
case CLCIT_CONTACT:
if (contact->flags & CONTACTF_NOTONLIST)
return FONTID_NOTONLIST;
- if (((contact->flags & CONTACTF_INVISTO) && _GetRealStatus(contact, ID_STATUS_OFFLINE) != ID_STATUS_INVISIBLE) ||
- ((contact->flags & CONTACTF_VISTO && _GetRealStatus(contact, ID_STATUS_OFFLINE) == ID_STATUS_INVISIBLE))) {
+ 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
return (contact->flags & CONTACTF_ONLINE) ? FONTID_INVIS : FONTID_OFFINVIS;
@@ -312,54 +312,6 @@ void CLCPaint::_SetHotTrackColour(HDC hdc, ClcData *dat)
SetTextColor(hdc, dat->hotTextColour);
}
-int CLCPaint::_GetStatusOnlineness(int status)
-{
- switch (status) {
- case ID_STATUS_FREECHAT: return 110;
- case ID_STATUS_ONLINE: return 100;
- case ID_STATUS_OCCUPIED: return 60;
- case ID_STATUS_ONTHEPHONE: return 50;
- case ID_STATUS_DND: return 40;
- case ID_STATUS_AWAY: return 30;
- case ID_STATUS_OUTTOLUNCH: return 20;
- case ID_STATUS_NA: return 10;
- case ID_STATUS_INVISIBLE: return 5;
- }
- return 0;
-}
-
-int CLCPaint::_GetGeneralisedStatus()
-{
- int status = ID_STATUS_OFFLINE;
- int statusOnlineness = 0;
-
- for (int i = 0; i < pcli->hClcProtoCount; i++) {
- int thisStatus = pcli->clcProto[i].dwStatus;
- if (thisStatus == ID_STATUS_INVISIBLE)
- return ID_STATUS_INVISIBLE;
-
- int thisOnlineness = _GetStatusOnlineness(thisStatus);
- if (thisOnlineness > statusOnlineness) {
- status = thisStatus;
- statusOnlineness = thisOnlineness;
- }
- }
- return status;
-}
-
-int CLCPaint::_GetRealStatus(ClcContact *pContact, int nStatus)
-{
- if (!pContact->proto)
- return nStatus;
-
- for (int i = 0; i < pcli->hClcProtoCount; i++) {
- if (!mir_strcmp(pcli->clcProto[i].szProto, pContact->proto))
- return pcli->clcProto[i].dwStatus;
- }
- return nStatus;
-}
-
-
RECT CLCPaint::_GetRectangle(ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space)
{
RECT rc = *free_row_rc;
@@ -705,7 +657,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
}
if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
mode = ILD_SELECTED;
}
_DrawStatusIcon(Drawing, dat, iImage, hdcMem, p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode);
@@ -1158,7 +1110,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
}
if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
mode = ILD_SELECTED;
}
@@ -1175,8 +1127,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
blendmode = 255;
else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST)
blendmode = 128;
- if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) && Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
blendmode = 128;
if (!hasAvatar) { // if no avatar then paint icon image
int iImage = Drawing->iImage;
@@ -1198,13 +1149,10 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
mode = ILD_NORMAL;
}
- if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) && Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mode = ILD_SELECTED;
- }
_DrawStatusIcon(Drawing, dat, iImage, hdcMem, p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode);
-
}
}
else {
@@ -1515,8 +1463,8 @@ int CLCPaint::_DetermineDrawMode(HWND hWnd, ClcData *dat)
if (!(paintMode&DM_CONTROL) && !CLUI_IsInMainWindow(hWnd))
paintMode |= DM_FLOAT;
+ int nStatus = Clist_GetGeneralizedStatus();
LONG lStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
- int nStatus = _GetGeneralisedStatus();
if ((lStyle & WS_DISABLED) || (dat->greyoutFlags & Clist_ClcStatusToPf2(nStatus)) || ((dat->greyoutFlags & GREYF_UNFOCUS) && (GetFocus() != hWnd)))
paintMode |= DM_GRAY;
@@ -2499,7 +2447,7 @@ void CLCPaint::_GetBlendMode(IN ClcData *dat, IN ClcContact *Drawing, IN BOOL se
mode = ILD_NORMAL;
}
if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags&CONTACTF_IDLE) &&
- _GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE &&
+ Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE &&
(bFlag & GIM_IDLE_AFFECT))
mode = ILD_SELECTED;
if (OutColourFg) *OutColourFg = colourFg;
diff --git a/plugins/Clist_modern/src/modern_clcpaint.h b/plugins/Clist_modern/src/modern_clcpaint.h
index 0fde745194..2496f4a0b6 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.h
+++ b/plugins/Clist_modern/src/modern_clcpaint.h
@@ -97,9 +97,6 @@ private:
void _FillQuickHash();
void _SetHotTrackColour(HDC hdc, ClcData *dat);
- int _GetStatusOnlineness(int status);
- int _GetGeneralisedStatus();
- int _GetRealStatus(ClcContact *pContact, int nStatus);
RECT _GetRectangle(ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space);
void _DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, wchar_t *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley);
void _AddParameter(MODERNMASK *mpModernMask, MASKPARAM * lpParam);
diff --git a/plugins/Clist_modern/src/modern_global.cpp b/plugins/Clist_modern/src/modern_global.cpp
index c6cbac88e2..9f1703687a 100644
--- a/plugins/Clist_modern/src/modern_global.cpp
+++ b/plugins/Clist_modern/src/modern_global.cpp
@@ -27,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//////////////////////////////////////////////////////////////////////////
// Global variables
-//int hClcProtoCount = 0;
-//ClcProtoStatus *clcProto = nullptr;
HIMAGELIST g_himlCListClc = nullptr;
HICON g_hListeningToIcon = nullptr;
char* g_szMetaModuleName = nullptr;
diff --git a/plugins/Clist_nicer/src/clc.h b/plugins/Clist_nicer/src/clc.h
index 2af07f523f..c7ccfd1c7f 100644
--- a/plugins/Clist_nicer/src/clc.h
+++ b/plugins/Clist_nicer/src/clc.h
@@ -383,7 +383,6 @@ size_t MY_pathToAbsolute(const wchar_t *pSrc, wchar_t *pOut);
int GetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt);
void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
BYTE GetCachedStatusMsg(TExtraCache* p, char *szProto);
-int __fastcall GetStatusOnlineness(int status);
void GetExtendedInfo(ClcContact *contact, struct ClcData *dat);
LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void HideShowNotifyFrame();
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 0db2306540..4b37de1d13 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -111,66 +111,7 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat)
else SetTextColor(hdc, dat->hotTextColour);
}
-int __fastcall GetStatusOnlineness(int status)
-{
- if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE)
- return 120;
-
- switch (status) {
- case ID_STATUS_FREECHAT:
- return 110;
- case ID_STATUS_ONLINE:
- return 100;
- case ID_STATUS_OCCUPIED:
- return 60;
- case ID_STATUS_ONTHEPHONE:
- return 50;
- case ID_STATUS_DND:
- return 40;
- case ID_STATUS_AWAY:
- return 30;
- case ID_STATUS_OUTTOLUNCH:
- return 20;
- case ID_STATUS_NA:
- return 10;
- case ID_STATUS_INVISIBLE:
- return 5;
- }
- return 0;
-}
-
-static int __fastcall GetGeneralisedStatus(void)
-{
- int status = ID_STATUS_OFFLINE, statusOnlineness = 0;
-
- for (int i = 0; i < pcli->hClcProtoCount; i++) {
- int thisStatus = pcli->clcProto[i].dwStatus;
- if (thisStatus == ID_STATUS_INVISIBLE)
- return ID_STATUS_INVISIBLE;
-
- int thisOnlineness = GetStatusOnlineness(thisStatus);
- if (thisOnlineness > statusOnlineness) {
- status = thisStatus;
- statusOnlineness = thisOnlineness;
- }
- }
- return status;
-}
-
-static int __fastcall GetRealStatus(ClcContact *contact, int status)
-{
- char *szProto = contact->proto;
- if (!szProto)
- return status;
-
- for (int i = 0; i < pcli->hClcProtoCount; i++)
- if (!mir_strcmp(pcli->clcProto[i].szProto, szProto))
- return pcli->clcProto[i].dwStatus;
-
- return status;
-}
-
-int GetBasicFontID(ClcContact * contact)
+int GetBasicFontID(ClcContact *contact)
{
switch (contact->type) {
case CLCIT_GROUP:
@@ -186,8 +127,8 @@ int GetBasicFontID(ClcContact * contact)
if (contact->flags & CONTACTF_NOTONLIST)
return FONTID_NOTONLIST;
- if ((contact->flags&CONTACTF_INVISTO && GetRealStatus(contact, ID_STATUS_OFFLINE) != ID_STATUS_INVISIBLE)
- || (contact->flags&CONTACTF_VISTO && GetRealStatus(contact, ID_STATUS_OFFLINE) == ID_STATUS_INVISIBLE))
+ 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))
return contact->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS;
return contact->flags & CONTACTF_ONLINE ? FONTID_CONTACTS : FONTID_OFFLINE;
@@ -489,7 +430,7 @@ 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 && GetRealStatus(contact, my_status) != ID_STATUS_INVISIBLE) || (flags & CONTACTF_VISTO && GetRealStatus(contact, my_status) == ID_STATUS_INVISIBLE))) {
+ 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
ChangeToFont(hdcMem, dat, flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS, &fontHeight);
@@ -1264,7 +1205,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint)
selBlend = db_get_b(NULL, "CLCExt", "EXBK_SelBlend", 1);
g_inCLCpaint = TRUE;
g_focusWnd = GetFocus();
- my_status = GetGeneralisedStatus();
+ my_status = Clist_GetGeneralizedStatus();
g_HDC = hdc;
/*
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index bc2f0fbfd8..378d4a0db1 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -42,11 +42,10 @@ void FreeProtocolData(void)
}
int g_maxStatus = ID_STATUS_OFFLINE;
-char g_maxProto[100] = "";
void CluiProtocolStatusChanged(int, const char*)
{
- int maxOnline = 0, onlineness = 0;
+ int maxOnline = 0;
WORD maxStatus = ID_STATUS_OFFLINE;
DBVARIANT dbv = { 0 };
int iIcon = 0;
@@ -63,7 +62,6 @@ void CluiProtocolStatusChanged(int, const char*)
FreeProtocolData();
g_maxStatus = ID_STATUS_OFFLINE;
- g_maxProto[0] = 0;
int borders[3];
SendMessage(pcli->hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders);
@@ -148,7 +146,6 @@ void CluiProtocolStatusChanged(int, const char*)
SendMessage(pcli->hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths);
// count down since built in ones tend to go at the end
- char *szMaxProto = nullptr;
partCount = 0;
for (int i = 0; i < accs.getCount(); i++) {
int idx = Clist_GetAccountIndex(i);
@@ -163,23 +160,12 @@ void CluiProtocolStatusChanged(int, const char*)
ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
PD->RealName = mir_strdup(pa->szModuleName);
PD->protopos = partCount;
- {
- int flags;
- flags = SBT_OWNERDRAW;
- if (db_get_b(NULL, "CLUI", "SBarBevel", 1) == 0)
- flags |= SBT_NOBORDERS;
- SendMessageA(pcli->hwndStatus, SB_SETTEXTA, partCount | flags, (LPARAM)PD);
- }
- int caps2 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
- int caps1 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
- if ((caps1 & PF1_IM) && (caps2 & (PF2_LONGAWAY | PF2_SHORTAWAY))) {
- onlineness = GetStatusOnlineness(status);
- if (onlineness > maxOnline) {
- maxStatus = status;
- maxOnline = onlineness;
- szMaxProto = pa->szModuleName;
- }
- }
+
+ int flags = SBT_OWNERDRAW;
+ if (db_get_b(NULL, "CLUI", "SBarBevel", 1) == 0)
+ flags |= SBT_NOBORDERS;
+ SendMessageA(pcli->hwndStatus, SB_SETTEXTA, partCount | flags, (LPARAM)PD);
+
partCount++;
}
// update the clui button
@@ -193,11 +179,10 @@ void CluiProtocolStatusChanged(int, const char*)
mir_free(dbv.pszVal);
}
else {
- wStatus = maxStatus;
- iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : nullptr, (int)wStatus, 0, &hIcon);
+ char *szMaxProto = nullptr;
+ wStatus = Clist_GetGeneralizedStatus(&szMaxProto);
+ iIcon = IconFromStatusMode(szMaxProto, wStatus, 0, &hIcon);
g_maxStatus = (int)wStatus;
- if (szMaxProto)
- strncpy_s(g_maxProto, _countof(g_maxProto), szMaxProto, _TRUNCATE);
}
/*