diff options
author | George Hazan <george.hazan@gmail.com> | 2016-03-24 09:11:43 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-03-24 09:11:43 +0000 |
commit | 5f3997157e81d4910bcc4659bee7124a9c744d2f (patch) | |
tree | a6ff27d2d8a193b7d8139d114b85eb660cedb843 | |
parent | 930b7f8aa2175f1b114e76b5687c6a4b7d6fee37 (diff) |
- db_get_ts -> db_get_tsa;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16533 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Clist_modern/src/modern_cachefuncs.cpp | 193 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 54 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcpaint.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clist.h | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 3 | ||||
-rw-r--r-- | plugins/Clist_modern/src/stdafx.h | 1 |
7 files changed, 108 insertions, 151 deletions
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 361e54249e..f6451f1849 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -117,7 +117,6 @@ void CSmileyString::AddListeningToIcon(SHORTDATA *dat, TCHAR *szText) // Add text { ClcContactTextPiece *piece = (ClcContactTextPiece *)mir_alloc(sizeof(ClcContactTextPiece)); - piece->type = TEXT_PIECE_TYPE_TEXT; piece->start_pos = 0; piece->len = text_size; @@ -127,15 +126,13 @@ void CSmileyString::AddListeningToIcon(SHORTDATA *dat, TCHAR *szText) void CSmileyString::_CopySmileyList(SortedList *plInput) { - // ASSERT( plText == NULL ); - - if (!plInput || plInput->realCount == 0) return; + if (!plInput || plInput->realCount == 0) + return; + plText = List_Create(0, 1); - for (int i = 0; i < plInput->realCount; i++) - { + for (int i = 0; i < plInput->realCount; i++) { ClcContactTextPiece *pieceFrom = (ClcContactTextPiece *)plInput->items[i]; - if (pieceFrom != NULL) - { + if (pieceFrom != NULL) { ClcContactTextPiece *piece = (ClcContactTextPiece *)mir_alloc(sizeof(ClcContactTextPiece)); *piece = *pieceFrom; if (pieceFrom->type == TEXT_PIECE_TYPE_SMILEY) @@ -147,9 +144,8 @@ void CSmileyString::_CopySmileyList(SortedList *plInput) void CSmileyString::DestroySmileyList() { - //ASSERT( plText == NULL ); - - if (plText == NULL) return; + if (plText == NULL) + return; if (IsBadReadPtr(plText, sizeof(SortedList))) { plText = NULL; @@ -175,9 +171,8 @@ void CSmileyString::DestroySmileyList() plText = NULL; } -/* -* Parsing of text for smiley -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Parsing of text for smiley void CSmileyString::ReplaceSmileys(SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR * szText, BOOL replace_smileys) { @@ -275,16 +270,16 @@ void CSmileyString::ReplaceSmileys(SHORTDATA *dat, ClcCacheEntry *pdnce, TCHAR * } } -/* -* Getting Status name -* -1 for XStatus, 1 for Status -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Getting Status name +// returns -1 for XStatus, 1 for Status + int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus_has_priority) { BOOL noAwayMsg = FALSE; BOOL noXstatus = FALSE; // Hide status text if Offline /// no offline - WORD nStatus = pdnce___GetStatus(pdnce); + WORD nStatus = pdnce->getStatus(); if ((nStatus == ID_STATUS_OFFLINE || nStatus == 0) && g_CluiData.bRemoveAwayMessageForOffline) noAwayMsg = TRUE; if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE; text[0] = '\0'; @@ -323,47 +318,40 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus return 1; } -/* -* Get Listening to information -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Get Listening to information void GetListeningTo(TCHAR *text, int text_size, ClcCacheEntry *pdnce) { - DBVARIANT dbv = { 0 }; - WORD wStatus = pdnce___GetStatus(pdnce); - text[0] = _T('\0'); + *text = _T('\0'); - if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) + if (pdnce->m_iStatus == ID_STATUS_OFFLINE || pdnce->m_iStatus == 0) return; - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "ListeningTo", &dbv)) { - CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); - db_free(&dbv); - } + ptrT tszValue(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "ListeningTo")); + if (tszValue != NULL) + CopySkipUnprintableChars(text, tszValue, text_size - 1); } -/* -* Getting Status message (Away message) -* -1 for XStatus, 1 for Status -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Getting Status message(Away message) +// returns -1 for XStatus, 1 for Status int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus_has_priority) { - DBVARIANT dbv = { 0 }; BOOL noAwayMsg = FALSE; - WORD wStatus = pdnce___GetStatus(pdnce); - text[0] = '\0'; + WORD wStatus = pdnce->getStatus(); + *text = '\0'; + // Hide status text if Offline /// no offline + if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) + noAwayMsg = TRUE; - if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) noAwayMsg = TRUE; // Get XStatusMsg if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) { - // Try to get XStatusMsg - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg", &dbv)) { - //mir_tstrncpy(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); - db_free(&dbv); - + ptrT tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); + if (tszXStatusMsg != NULL) { + CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1); if (text[0] != '\0') return -1; } @@ -371,11 +359,9 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xsta // Get StatusMsg if (pdnce->hContact && text[0] == '\0') { - if (!db_get_ts(pdnce->hContact, "CList", "StatusMsg", &dbv)) { - //mir_tstrncpy(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); - db_free(&dbv); - + ptrT tszStatusMsg(db_get_tsa(pdnce->hContact, "CList", "StatusMsg")); + if (tszStatusMsg != NULL) { + CopySkipUnprintableChars(text, tszStatusMsg, text_size - 1); if (text[0] != '\0') return 1; } @@ -384,11 +370,9 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xsta // Get XStatusMsg if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto && text[0] == '\0') { // Try to get XStatusMsg - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg", &dbv)) { - //mir_tstrncpy(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); - db_free(&dbv); - + ptrT tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); + if (tszXStatusMsg != NULL) { + CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1); if (text[0] != '\0') return -1; } @@ -397,10 +381,9 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xsta return 1; } +///////////////////////////////////////////////////////////////////////////////////////// +// Get the text for specified lines -/* -* Get the text for specified lines -*/ int Cache_GetLineText( ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority, BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus, @@ -413,56 +396,42 @@ int Cache_GetLineText( switch (type) { case TEXT_STATUS: if (GetStatusName(text, text_size, pdnce, xstatus_has_priority) == -1 && use_name_and_message_for_xstatus) { - DBVARIANT dbv = { 0 }; - // Try to get XStatusMsg - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg", &dbv)) { - if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0) { - TCHAR *tmp = NEWTSTR_ALLOCA(text); - mir_sntprintf(text, text_size, _T("%s: %s"), tmp, dbv.ptszVal); - CopySkipUnprintableChars(text, text, text_size - 1); - } - db_free(&dbv); + ptrT tszXStatusMsg(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg")); + if (tszXStatusMsg != NULL && tszXStatusMsg[0] != 0) { + TCHAR *tmp = NEWTSTR_ALLOCA(text); + mir_sntprintf(text, text_size, _T("%s: %s"), tmp, tszXStatusMsg); + CopySkipUnprintableChars(text, text, text_size - 1); } } - return TEXT_STATUS; case TEXT_NICKNAME: if (pdnce->hContact && pdnce->m_pszProto) { - DBVARIANT dbv = { 0 }; - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "Nick", &dbv)) { - mir_tstrncpy(text, dbv.ptszVal, text_size); - db_free(&dbv); + ptrT tszNick(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "Nick")); + if (tszNick != NULL) { + mir_tstrncpy(text, tszNick, text_size); CopySkipUnprintableChars(text, text, text_size - 1); } } - return TEXT_NICKNAME; case TEXT_STATUS_MESSAGE: if (GetStatusMessage(text, text_size, pdnce, xstatus_has_priority) == -1 && use_name_and_message_for_xstatus) { - DBVARIANT dbv = { 0 }; - // Try to get XStatusName - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "XStatusName", &dbv)) { - if (dbv.pszVal != NULL && dbv.pszVal[0] != 0) { - TCHAR *tmp = NEWTSTR_ALLOCA(text); - mir_sntprintf(text, text_size, _T("%s: %s"), dbv.pszVal, tmp); - } - CopySkipUnprintableChars(text, text, text_size - 1); - db_free(&dbv); + ptrT tszXStatusName(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); + if (tszXStatusName != NULL && tszXStatusName[0] != 0) { + TCHAR *tmp = NEWTSTR_ALLOCA(text); + mir_sntprintf(text, text_size, _T("%s: %s"), tszXStatusName, tmp); } + CopySkipUnprintableChars(text, text, text_size - 1); } else if (use_name_and_message_for_xstatus && xstatus_has_priority) { - DBVARIANT dbv = { 0 }; // Try to get XStatusName - if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "XStatusName", &dbv)) { - if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0) - mir_tstrncpy(text, dbv.ptszVal, text_size); - CopySkipUnprintableChars(text, text, text_size - 1); - db_free(&dbv); - } + ptrT tszXStatusName(db_get_tsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName")); + if (tszXStatusName != NULL && tszXStatusName[0] != 0) + mir_tstrncpy(text, tszXStatusName, text_size); + CopySkipUnprintableChars(text, text, text_size - 1); } if (text[0] == '\0') { @@ -472,10 +441,8 @@ int Cache_GetLineText( return TEXT_LISTENING_TO; } - if (show_status_if_no_away) { - //re-request status if no away + if (show_status_if_no_away) // re-request status if no away return Cache_GetLineText(pdnce, TEXT_STATUS, text, text_size, variable_text, xstatus_has_priority, 0, 0, use_name_and_message_for_xstatus, pdnce_time_show_only_if_different); - } } return TEXT_STATUS_MESSAGE; @@ -484,13 +451,12 @@ int Cache_GetLineText( return TEXT_LISTENING_TO; case TEXT_TEXT: - { - TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact); - mir_tstrncpy(text, tmp, text_size); - mir_free(tmp); - CopySkipUnprintableChars(text, text, text_size - 1); - } - return TEXT_TEXT; + { + ptrT tmp(variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact)); + mir_tstrncpy(text, tmp, text_size); + CopySkipUnprintableChars(text, text, text_size - 1); + } + return TEXT_TEXT; case TEXT_CONTACT_TIME: if (pdnce->hTimeZone) { @@ -498,7 +464,6 @@ int Cache_GetLineText( text[0] = 0; TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), text, text_size, 0); } - return TEXT_CONTACT_TIME; } @@ -539,9 +504,8 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) } } -/* -* Get the text for Second Line -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Get the text for Second Line void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce) { @@ -565,9 +529,9 @@ void Cache_GetSecondLineText(SHORTDATA *dat, ClcCacheEntry *pdnce) } } -/* -* Get the text for Third Line -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// Get the text for Third Line + void Cache_GetThirdLineText(SHORTDATA *dat, ClcCacheEntry *pdnce) { TCHAR Text[240 - EXTRA_ICON_COUNT] = { 0 }; @@ -599,10 +563,9 @@ void RemoveTag(TCHAR *to, TCHAR *tag) } } -/* -* Copy string with removing Escape chars from text -* And BBcodes -*/ +///////////////////////////////////////////////////////////////////////////////////////// +//Copy string with removing Escape chars from text and BBcodes + static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size) { DWORD i; @@ -679,10 +642,9 @@ static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFun return TRUE; } +///////////////////////////////////////////////////////////////////////////////////////// +// Avatar working routines -/* -* Avatar working routines -*/ BOOL UpdateAllAvatarsProxy(ClcContact *contact, BOOL, void *param) { Cache_GetAvatar((ClcData *)param, contact); @@ -704,7 +666,7 @@ BOOL ReduceAvatarPosition(ClcContact *contact, BOOL, void *param) void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) { - avatarCacheEntry * ace = contact->avatar_data; + avatarCacheEntry *ace = contact->avatar_data; int old_pos = contact->avatar_pos; if (ace == NULL || ace->dwFlags == AVS_BITMAP_EXPIRED || ace->hbmPic == NULL) { @@ -718,8 +680,7 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) return; } } - else if (contact->avatar_data->hbmPic != NULL) //Lets Add it - { + else if (contact->avatar_data->hbmPic != NULL) { // let's add it // Clipping width and height LONG width_clip = dat->avatars_maxwidth_size ? dat->avatars_maxwidth_size : dat->avatars_maxheight_size; LONG height_clip = dat->avatars_maxheight_size; @@ -777,7 +738,7 @@ void Cache_GetAvatar(ClcData *dat, ClcContact *contact) } if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) { - contact->avatar_data = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, contact->hContact, 0); + contact->avatar_data = (avatarCacheEntry*)CallService(MS_AV_GETAVATARBITMAP, contact->hContact, 0); if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) contact->avatar_data = NULL; diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 821d183cff..8f62018a4f 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1572,7 +1572,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM ClcContact *contact; if (FindItem(hwnd, dat, wParam, &contact, NULL, NULL, TRUE)) { if (contact && contact->type == CLCIT_CONTACT) { - if (!contact->image_is_special && pdnce___GetStatus(pdnce) > ID_STATUS_OFFLINE) + if (!contact->image_is_special && pdnce->getStatus() > ID_STATUS_OFFLINE) contact->iImage = corecli.pfnGetContactIcon(wParam); if (contact->isSubcontact && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT) pcli->pfnClcBroadcast(INTM_STATUSCHANGED, contact->subcontacts->hContact, 0); //forward status changing to host meta contact diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 2bca3600b7..2a9c992cf6 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -49,7 +49,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) for (int j = 0; j < subcount; j++) { MCONTACT hsub = db_mc_getSub(cont->hContact, j); cacheEntry = pcli->pfnGetCacheEntry(hsub); - WORD wStatus = pdnce___GetStatus(cacheEntry); + WORD wStatus = cacheEntry->getStatus(); if (!showOfflineHereGroup && bHideOffline && !cacheEntry->m_bNoHiddenOffline && wStatus == ID_STATUS_OFFLINE) continue; @@ -170,7 +170,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, char *szProto = cacheEntry->m_pszProto; cont->proto = szProto; - if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, pdnce___GetStatus(cacheEntry))) + if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, cacheEntry->m_iStatus)) cont->flags |= CONTACTF_ONLINE; WORD apparentMode = szProto != NULL ? cacheEntry->ApparentMode : 0; @@ -184,7 +184,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, break; default: cont->flags |= CONTACTF_VISTO | CONTACTF_INVISTO; - } + } if (cacheEntry->NotOnList) cont->flags |= CONTACTF_NOTONLIST; @@ -209,14 +209,15 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, ClcCacheEntry *cacheEntry) { - if (cacheEntry == NULL) return NULL; - if (group == NULL) return NULL; - if (dat == NULL) return NULL; + if (cacheEntry == NULL || group == NULL || dat == NULL) + return NULL; + MCONTACT hContact = cacheEntry->hContact; dat->needsResort = 1; int i; for (i = group->cl.count - 1; i >= 0; i--) - if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags&CLCIIF_BELOWCONTACTS)) break; + if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags & CLCIIF_BELOWCONTACTS)) + break; i = cli_AddItemToGroup(group, i + 1); _LoadDataToContact(group->cl.items[i], group, dat, hContact); @@ -227,29 +228,26 @@ static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, ClcCacheEntr void* AddTempGroup(HWND hwnd, ClcData *dat, const TCHAR *szName) { - int i = 0; - int f = 0; - DWORD groupFlags; - if (wildcmp(_T2A(szName), "-@-HIDDEN-GROUP-@-")) return NULL; + int i; + DWORD groupFlags; for (i = 1;; i++) { TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); - if (szGroupName == NULL) break; - if (!mir_tstrcmpi(szGroupName, szName)) f = 1; + if (szGroupName == NULL) + break; + if (!mir_tstrcmpi(szGroupName, szName)) + return NULL; } - if (f) - return NULL; - char buf[20]; _itoa_s(i - 1, buf, 10); TCHAR b2[255]; mir_sntprintf(b2, _T("#%s"), szName); b2[0] = 1 | GROUPF_EXPANDED; - db_set_ws(NULL, "CListGroups", buf, b2); + db_set_ts(NULL, "CListGroups", buf, b2); pcli->pfnGetGroupName(i, &groupFlags); return cli_AddGroup(hwnd, dat, szName, groupFlags, i, 0); } @@ -376,8 +374,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) group = cli_AddGroup(hwnd, dat, cacheEntry->tszGroup, (DWORD)-1, 0, 0); if (group != NULL) { - WORD wStatus = pdnce___GetStatus(cacheEntry); - if (wStatus == ID_STATUS_OFFLINE && PlaceOfflineToRoot) + if (cacheEntry->m_iStatus == ID_STATUS_OFFLINE && PlaceOfflineToRoot) group = &dat->list; group->totalMembers++; @@ -387,7 +384,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) if (!pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE) || cacheEntry->m_bNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) cont = AddContactToGroup(dat, group, cacheEntry); } - else if (!pcli->pfnIsHiddenMode(dat, wStatus) || cacheEntry->m_bNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) + else if (!pcli->pfnIsHiddenMode(dat, cacheEntry->m_iStatus) || cacheEntry->m_bNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) cont = AddContactToGroup(dat, group, cacheEntry); } else cont = AddContactToGroup(dat, group, cacheEntry); @@ -468,17 +465,20 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) return lastcount; } -struct SavedContactState_t { +struct SavedContactState_t +{ MCONTACT hContact; WORD iExtraImage[EXTRA_ICON_COUNT]; int checked; }; -struct SavedGroupState_t { +struct SavedGroupState_t +{ int groupId, expanded; }; -struct SavedInfoState_t { +struct SavedInfoState_t +{ int parentId; ClcContact contact; }; @@ -593,13 +593,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) nm.hdr.code = CLN_LISTREBUILT; nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm); -} - - -WORD pdnce___GetStatus(ClcCacheEntry *pdnce) -{ - return (!pdnce) ? ID_STATUS_OFFLINE : pdnce->m_iStatus; + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } ClcContact* cliCreateClcContact() diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index d3dc24da91..4638fad9f8 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -177,7 +177,7 @@ int CLCPaint::GetBasicFontID(ClcContact *contact) return (contact->flags & CONTACTF_ONLINE) ? FONTID_INVIS : FONTID_OFFINVIS;
}
- switch (pdnce___GetStatus(pdnce)) {
+ switch (pdnce->getStatus()) {
case ID_STATUS_OFFLINE: return FONTID_OFFLINE;
case ID_STATUS_AWAY: return FONTID_AWAY;
case ID_STATUS_DND: return FONTID_DND;
diff --git a/plugins/Clist_modern/src/modern_clist.h b/plugins/Clist_modern/src/modern_clist.h index 50c6f87da2..9747554acc 100644 --- a/plugins/Clist_modern/src/modern_clist.h +++ b/plugins/Clist_modern/src/modern_clist.h @@ -98,6 +98,10 @@ struct ClcCacheEntry : public ClcCacheEntryBase void getName(void);
void freeName(void);
+
+ int __forceinline getStatus() const
+ { return (this == NULL) ? ID_STATUS_OFFLINE : m_iStatus;
+ }
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 2c5c34dd59..188e0a6e7f 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -306,8 +306,7 @@ int GetContactInfosForSort(MCONTACT hContact, char **Proto, TCHAR **Name, int *S int GetContactCachedStatus(MCONTACT hContact)
{
- ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact);
- return pdnce___GetStatus(cacheEntry);
+ return pcli->pfnGetCacheEntry(hContact)->getStatus();
}
int ContactAdded(WPARAM hContact, LPARAM)
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h index c3b5549548..1ace3cf53d 100644 --- a/plugins/Clist_modern/src/stdafx.h +++ b/plugins/Clist_modern/src/stdafx.h @@ -249,7 +249,6 @@ int AniAva_RenderAvatar(MCONTACT hContact, HDC hdcMem, RECT *rc); void CListSettings_FreeCacheItemData(ClcCacheEntry *pDst);
int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam);
-WORD pdnce___GetStatus(ClcCacheEntry *pdnce);
/* move to list module */
typedef void(*ItemDestuctor)(void*);
|