diff options
23 files changed, 263 insertions, 293 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h index fc628e8f50..1f93b4a422 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -185,12 +185,9 @@ typedef struct { typedef struct
{
HANDLE hContact;
- TCHAR* name;
- #if defined(_UNICODE)
- char* szName;
- #endif
- TCHAR* group;
- int isHidden;
+ TCHAR* tszName;
+ TCHAR* tszGroup;
+ int bIsHidden;
}
ClcCacheEntryBase;
diff --git a/plugins/Clist_modern/hdr/modern_clist.h b/plugins/Clist_modern/hdr/modern_clist.h index f82e4c75bd..527bf18b64 100644 --- a/plugins/Clist_modern/hdr/modern_clist.h +++ b/plugins/Clist_modern/hdr/modern_clist.h @@ -40,6 +40,8 @@ extern pfnMyMonitorFromWindow MyMonitorFromWindow; typedef BOOL(WINAPI *pfnMyGetMonitorInfo) (HMONITOR, LPMONITORINFO);
extern pfnMyGetMonitorInfo MyGetMonitorInfo;
+///////////////////////////////////////////////////////////////////////////////
+
class CSmileyString
{
public:
@@ -66,23 +68,20 @@ public: DestroySmileyList();
}
- void ReplaceSmileys(struct SHORTDATA *dat, struct tag_DNCE * pdnce, TCHAR *szText, BOOL replace_smileys);
+ void ReplaceSmileys(struct SHORTDATA *dat, struct displayNameCacheEntry *pdnce, TCHAR *szText, BOOL replace_smileys);
/** Destroy smiley list */
void DestroySmileyList();
/** Copy Smiley List */
void _CopySmileyList( SortedList *plInput );
- void AddListeningToIcon(struct SHORTDATA *dat, struct tag_DNCE * pdnce, TCHAR *szText, BOOL replace_smileys);
+ void AddListeningToIcon(struct SHORTDATA *dat, struct displayNameCacheEntry *pdnce, TCHAR *szText, BOOL replace_smileys);
};
-struct tag_DNCE
-{
- HANDLE m_cache_hContact;
- TCHAR* m_cache_tcsName;
+///////////////////////////////////////////////////////////////////////////////
- TCHAR* m_cache_tcsGroup;
- int m_cache_nHidden;
+struct displayNameCacheEntry : public ClcCacheEntryBase
+{
int m_cache_nNoHiddenOffline;
char* m_cache_cszProto;
@@ -111,7 +110,9 @@ struct tag_DNCE void freeName(void);
};
-typedef tag_DNCE displayNameCacheEntry,*pdisplayNameCacheEntry, *PDNCE;
+typedef displayNameCacheEntry *pdisplayNameCacheEntry, *PDNCE;
+
+///////////////////////////////////////////////////////////////////////////////
typedef struct tagEXTRASLOTINFO
{
diff --git a/plugins/Clist_modern/modern_awaymsg.cpp b/plugins/Clist_modern/modern_awaymsg.cpp index 52d59881d3..342b3eefad 100644 --- a/plugins/Clist_modern/modern_awaymsg.cpp +++ b/plugins/Clist_modern/modern_awaymsg.cpp @@ -140,7 +140,7 @@ static int amThreadProc(HWND hwnd) }
}
CListSettings_FreeCacheItemData(&dnce);
- dnce.m_cache_hContact = (HANDLE)hContact;
+ dnce.hContact = (HANDLE)hContact;
Sync(CLUI_SyncGetPDNCE, (WPARAM) 0,(LPARAM)&dnce);
if (dnce.ApparentMode != ID_STATUS_OFFLINE) //don't ask if contact is always invisible (should be done with protocol)
ACK = (HANDLE)CallContactService(hContact,PSS_GETAWAYMSG,0,0);
diff --git a/plugins/Clist_modern/modern_cachefuncs.cpp b/plugins/Clist_modern/modern_cachefuncs.cpp index 68ec4ba42c..2a14c77224 100644 --- a/plugins/Clist_modern/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/modern_cachefuncs.cpp @@ -83,7 +83,7 @@ void Cache_GetText(struct ClcData *dat, struct ClcContact *contact, BOOL forceRe }
}
-void CSmileyString::AddListeningToIcon(struct SHORTDATA *dat, PDNCE pdnce, TCHAR *szText, BOOL replace_smileys)
+void CSmileyString::AddListeningToIcon(struct SHORTDATA *dat, pdisplayNameCacheEntry pdnce, TCHAR *szText, BOOL replace_smileys)
{
iMaxSmileyHeight = 0;
DestroySmileyList();
@@ -210,7 +210,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, PDNCE pdnce, TCHAR * s sp.Protocolname = pdnce->m_cache_cszProto;
if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0) {
- HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->m_cache_hContact, 0);
+ HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->hContact, 0);
if (hContact != 0)
sp.Protocolname = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (LPARAM)hContact, 0);
}
@@ -300,9 +300,9 @@ int GetStatusName(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_prio if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE;
text[0] = '\0';
// Get XStatusName
- if ( !noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) {
+ if ( !noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -322,9 +322,9 @@ int GetStatusName(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_prio }
// Get XStatusName
- if ( !noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) {
+ if ( !noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -350,7 +350,7 @@ void GetListeningTo(TCHAR *text, int text_size, PDNCE pdnce) if (wStatus == ID_STATUS_OFFLINE || wStatus == 0)
return;
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) {
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
}
@@ -371,9 +371,9 @@ int GetStatusMessage(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_ if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) noAwayMsg = TRUE;
// Get XStatusMsg
- if ( !noAwayMsg && xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) {
+ if ( !noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) {
// Try to get XStatusMsg
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -384,8 +384,8 @@ int GetStatusMessage(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_ }
// Get StatusMsg
- if (pdnce->m_cache_hContact && text[0] == '\0') {
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, "CList", "StatusMsg", &dbv)) {
+ if (pdnce->hContact && text[0] == '\0') {
+ if ( !DBGetContactSettingTString(pdnce->hContact, "CList", "StatusMsg", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -396,9 +396,9 @@ int GetStatusMessage(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_ }
// Get XStatusMsg
- if ( !noAwayMsg && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto && text[0] == '\0') {
+ if ( !noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto && text[0] == '\0') {
// Try to get XStatusMsg
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
//lstrcpyn(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
db_free(&dbv);
@@ -426,7 +426,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * DBVARIANT dbv = {0};
// Try to get XStatusMsg
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "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);
@@ -439,9 +439,9 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * return TEXT_STATUS;
case TEXT_NICKNAME:
- if (pdnce->m_cache_hContact && pdnce->m_cache_cszProto) {
+ if (pdnce->hContact && pdnce->m_cache_cszProto) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
lstrcpyn(text, dbv.ptszVal, text_size);
db_free(&dbv);
CopySkipUnprintableChars(text, text, text_size-1);
@@ -455,7 +455,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * DBVARIANT dbv = {0};
// Try to get XStatusName
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "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);
@@ -467,7 +467,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * else if (use_name_and_message_for_xstatus && xstatus_has_priority) {
DBVARIANT dbv = {0};
// Try to get XStatusName
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) {
if (dbv.pszVal != NULL && dbv.pszVal[0] != 0)
mir_sntprintf(text, text_size, _T("%s"), dbv.pszVal);
CopySkipUnprintableChars(text, text, text_size-1);
@@ -495,7 +495,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * case TEXT_TEXT:
{
- TCHAR *tmp = variables_parsedup(variable_text, pdnce->m_cache_tcsName, pdnce->m_cache_hContact);
+ TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact);
lstrcpyn(text, tmp, text_size);
mir_free(tmp);
CopySkipUnprintableChars(text, text, text_size-1);
@@ -527,7 +527,7 @@ void Cache_GetFirstLineText(struct ClcData *dat, struct ClcContact *contact) TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0);
if (dat->first_line_append_nick && (!dat->force_in_dialog)) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
+ if ( !DBGetContactSettingTString(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) {
TCHAR nick[SIZEOF(contact->szText)];
lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText));
db_free(&dbv);
diff --git a/plugins/Clist_modern/modern_clc.cpp b/plugins/Clist_modern/modern_clc.cpp index 3967d9e465..d1d0afed53 100644 --- a/plugins/Clist_modern/modern_clc.cpp +++ b/plugins/Clist_modern/modern_clc.cpp @@ -1856,12 +1856,12 @@ static LRESULT clcOnIntmStatusChanged(struct ClcData *dat, HWND hwnd, UINT msg, if (pdnce && pdnce->m_cache_cszProto)
{
struct ClcContact *contact = NULL;
- pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->m_cache_hContact,pdnce->m_cache_cszProto));
+ pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->hContact,pdnce->m_cache_cszProto));
if ( !dat->force_in_dialog && (
(dat->second_line_show)// && dat->second_line_type == TEXT_STATUS)
|| (dat->third_line_show)// && dat->third_line_type == TEXT_STATUS)
))
- gtaRenewText(pdnce->m_cache_hContact);
+ gtaRenewText(pdnce->hContact);
SendMessage(hwnd,INTM_ICONCHANGED, wParam, (LPARAM) CallService(MS_CLIST_GETCONTACTICON, wParam, 1));
if (FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,TRUE))
{
diff --git a/plugins/Clist_modern/modern_clcitems.cpp b/plugins/Clist_modern/modern_clcitems.cpp index 1bdb89655f..4cde320858 100644 --- a/plugins/Clist_modern/modern_clcitems.cpp +++ b/plugins/Clist_modern/modern_clcitems.cpp @@ -61,12 +61,12 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl )
{
- cont->subcontacts[i].hContact = cacheEntry->m_cache_hContact;
+ cont->subcontacts[i].hContact = cacheEntry->hContact;
cont->subcontacts[i].avatar_pos = AVATAR_POS_DONT_HAVE;
Cache_GetAvatar(dat, &cont->subcontacts[i]);
- cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->m_cache_hContact,1);
+ cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,1);
memset(cont->subcontacts[i].iExtraImage,0xFF,sizeof(cont->subcontacts[i].iExtraImage));
memset((void*)cont->subcontacts[i].iWideExtraImage,0xFF,sizeof(cont->subcontacts[i].iWideExtraImage));
cont->subcontacts[i].proto = cacheEntry->m_cache_cszProto;
@@ -239,7 +239,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup if (cacheEntry == NULL) return NULL;
if (group == NULL) return NULL;
if (dat == NULL) return NULL;
- hContact = cacheEntry->m_cache_hContact;
+ hContact = cacheEntry->hContact;
dat->NeedResort = 1;
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;
@@ -404,10 +404,10 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) if ( (style&CLS_SHOWHIDDEN && nHiddenStatus != -1) || !nHiddenStatus)
{
- if (lstrlen(cacheEntry->m_cache_tcsGroup) == 0)
+ if (lstrlen(cacheEntry->tszGroup) == 0)
group = &dat->list;
else {
- group = cli_AddGroup(hwnd,dat,cacheEntry->m_cache_tcsGroup,(DWORD)-1,0,0);
+ group = cli_AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0);
}
if (group != NULL)
{
@@ -659,8 +659,8 @@ WORD pdnce___GetStatus(pdisplayNameCacheEntry pdnce) // this stub will replace direct usage of m_cache_nStatus and will be substituted by getting info from DB directrly
if ( !pdnce) return ID_STATUS_OFFLINE;
if ( !pdnce->m_cache_cszProto) return ID_STATUS_OFFLINE;
- if ( !pdnce->m_cache_hContact) return ID_STATUS_OFFLINE;
- return DBGetContactSettingWord( pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Status" , ID_STATUS_OFFLINE );
+ if ( !pdnce->hContact) return ID_STATUS_OFFLINE;
+ return DBGetContactSettingWord( pdnce->hContact, pdnce->m_cache_cszProto, "Status" , ID_STATUS_OFFLINE );
*/
}
@@ -682,7 +682,7 @@ ClcCacheEntryBase* cliCreateCacheItem( HANDLE hContact ) if ( p )
{
memset(p,0,sizeof( displayNameCacheEntry ));
- p->m_cache_hContact = hContact;
+ p->hContact = hContact;
InvalidateDNCEbyPointer(hContact,p,0);
p->szSecondLineText = NULL;
p->szThirdLineText = NULL;
diff --git a/plugins/Clist_modern/modern_clistmod.cpp b/plugins/Clist_modern/modern_clistmod.cpp index ffbddbb93c..2b3b584e11 100644 --- a/plugins/Clist_modern/modern_clistmod.cpp +++ b/plugins/Clist_modern/modern_clistmod.cpp @@ -178,7 +178,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) int GetContactIconC(pdisplayNameCacheEntry cacheEntry)
{
- return ExtIconFromStatusMode(cacheEntry->m_cache_hContact,cacheEntry->m_cache_cszProto,cacheEntry->m_cache_cszProto == NULL ? ID_STATUS_OFFLINE : pdnce___GetStatus( cacheEntry ));
+ return ExtIconFromStatusMode(cacheEntry->hContact,cacheEntry->m_cache_cszProto,cacheEntry->m_cache_cszProto == NULL ? ID_STATUS_OFFLINE : pdnce___GetStatus( cacheEntry ));
}
//lParam
diff --git a/plugins/Clist_modern/modern_clistsettings.cpp b/plugins/Clist_modern/modern_clistsettings.cpp index cfa9bc70d6..cbea7018e0 100644 --- a/plugins/Clist_modern/modern_clistsettings.cpp +++ b/plugins/Clist_modern/modern_clistsettings.cpp @@ -49,8 +49,8 @@ static int handleCompare( void* c1, void* c2 ) displayNameCacheEntry * dnce1 = (displayNameCacheEntry *)c1;
displayNameCacheEntry * dnce2 = (displayNameCacheEntry *)c2;
- p1 = (INT_PTR)dnce1->m_cache_hContact;
- p2 = (INT_PTR)dnce2->m_cache_hContact;
+ p1 = (INT_PTR)dnce1->hContact;
+ p2 = (INT_PTR)dnce2->hContact;
if ( p1 == p2 )
return 0;
@@ -117,7 +117,7 @@ void CListSettings_FreeCacheItemDataOption( pdisplayNameCacheEntry pDst, DWORD f pDst->freeName();
if ( flag & CCI_GROUP )
- mir_free_and_nil(pDst->m_cache_tcsGroup);
+ mir_free_and_nil(pDst->tszGroup);
if ( flag & CCI_LINES ) {
mir_free_and_nil(pDst->szSecondLineText);
@@ -139,13 +139,13 @@ void CListSettings_CopyCacheItems(pdisplayNameCacheEntry pDst, pdisplayNameCache if ( flag & CCI_NAME ) {
pDst->isUnknown = pSrc->isUnknown;
if (pSrc->isUnknown)
- pDst->m_cache_tcsName = pSrc->m_cache_tcsName;
+ pDst->tszName = pSrc->tszName;
else
- pDst->m_cache_tcsName = mir_tstrdup(pSrc->m_cache_tcsName);
+ pDst->tszName = mir_tstrdup(pSrc->tszName);
}
- if ( flag & CCI_GROUP ) pDst->m_cache_tcsGroup = mir_tstrdup(pSrc->m_cache_tcsGroup);
- if ( flag & CCI_PROTO ) pDst->m_cache_cszProto = pSrc->m_cache_cszProto;
+ if ( flag & CCI_GROUP ) pDst->tszGroup = mir_tstrdup(pSrc->tszGroup);
+ if ( flag & CCI_PROTO ) pDst->m_cache_cszProto = pSrc->m_cache_cszProto;
if ( flag & CCI_STATUS ) pDst->m_cache_nStatus = pSrc->m_cache_nStatus;
if ( flag & CCI_LINES ) {
@@ -163,7 +163,7 @@ void CListSettings_CopyCacheItems(pdisplayNameCacheEntry pDst, pdisplayNameCache pDst->hTimeZone = pSrc->hTimeZone;
if ( flag & CCI_OTHER) {
- pDst->m_cache_nHidden = pSrc->m_cache_nHidden;
+ pDst->bIsHidden = pSrc->bIsHidden;
pDst->m_cache_nNoHiddenOffline = pSrc->m_cache_nNoHiddenOffline;
pDst->m_cache_bProtoNotExists = pSrc->m_cache_bProtoNotExists;
@@ -179,10 +179,10 @@ void CListSettings_CopyCacheItems(pdisplayNameCacheEntry pDst, pdisplayNameCache int CListSettings_GetCopyFromCache(pdisplayNameCacheEntry pDest, DWORD flag)
{
- if ( !pDest || !pDest->m_cache_hContact)
+ if ( !pDest || !pDest->hContact)
return -1;
- pdisplayNameCacheEntry pSource = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pDest->m_cache_hContact);
+ pdisplayNameCacheEntry pSource = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pDest->hContact);
if ( !pSource)
return -1;
@@ -192,10 +192,10 @@ int CListSettings_GetCopyFromCache(pdisplayNameCacheEntry pDest, DWORD flag) int CListSettings_SetToCache(pdisplayNameCacheEntry pSrc, DWORD flag)
{
- if ( !pSrc || !pSrc->m_cache_hContact)
+ if ( !pSrc || !pSrc->hContact)
return -1;
- pdisplayNameCacheEntry pDst = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pSrc->m_cache_hContact);
+ pdisplayNameCacheEntry pDst = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pSrc->hContact);
if ( !pDst)
return -1;
@@ -205,10 +205,10 @@ int CListSettings_SetToCache(pdisplayNameCacheEntry pSrc, DWORD flag) void cliFreeCacheItem( pdisplayNameCacheEntry p )
{
- HANDLE hContact = p->m_cache_hContact;
+ HANDLE hContact = p->hContact;
TRACEVAR("cliFreeCacheItem hContact = %d",hContact);
p->freeName();
- mir_free_and_nil(p->m_cache_tcsGroup);
+ mir_free_and_nil(p->tszGroup);
mir_free_and_nil(p->szSecondLineText);
mir_free_and_nil(p->szThirdLineText);
p->ssSecondLine.DestroySmileyList();
@@ -220,23 +220,23 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) if (pdnce == NULL)
return;
- if (pdnce->m_cache_hContact == NULL) { //selfcontact
- if ( !pdnce->m_cache_tcsName)
+ if (pdnce->hContact == NULL) { //selfcontact
+ if ( !pdnce->tszName)
pdnce->getName();
return;
}
if (pdnce->m_cache_cszProto == NULL && pdnce->m_cache_bProtoNotExists == FALSE) {
- pdnce->m_cache_cszProto = GetProtoForContact(pdnce->m_cache_hContact);
+ pdnce->m_cache_cszProto = GetProtoForContact(pdnce->hContact);
if (pdnce->m_cache_cszProto == NULL)
pdnce->m_cache_bProtoNotExists = FALSE;
else if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->m_cache_cszProto) == (int)NULL && 0)
pdnce->m_cache_bProtoNotExists = TRUE;
- else if (pdnce->m_cache_cszProto && pdnce->m_cache_tcsName)
+ else if (pdnce->m_cache_cszProto && pdnce->tszName)
pdnce->freeName();
}
- if (pdnce->m_cache_tcsName == NULL)
+ if (pdnce->tszName == NULL)
pdnce->getName();
else if (pdnce->isUnknown && pdnce->m_cache_cszProto && pdnce->m_cache_bProtoNotExists == TRUE && g_flag_bOnModulesLoadedCalled) {
@@ -247,41 +247,41 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) }
if (pdnce___GetStatus( pdnce ) == 0) //very strange look status sort is broken let always reread status
- pdnce___SetStatus( pdnce , GetStatusForContact(pdnce->m_cache_hContact,pdnce->m_cache_cszProto));
+ pdnce___SetStatus( pdnce , GetStatusForContact(pdnce->hContact,pdnce->m_cache_cszProto));
- if (pdnce->m_cache_tcsGroup == NULL) {
+ if (pdnce->tszGroup == NULL) {
DBVARIANT dbv = {0};
- if ( !DBGetContactSettingTString(pdnce->m_cache_hContact,"CList","Group",&dbv)) {
- pdnce->m_cache_tcsGroup = mir_tstrdup(dbv.ptszVal);
+ if ( !DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv)) {
+ pdnce->tszGroup = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else pdnce->m_cache_tcsGroup = mir_tstrdup(_T(""));
+ else pdnce->tszGroup = mir_tstrdup(_T(""));
}
- if (pdnce->m_cache_nHidden == -1)
- pdnce->m_cache_nHidden = db_get_b(pdnce->m_cache_hContact,"CList","Hidden",0);
+ if (pdnce->bIsHidden == -1)
+ pdnce->bIsHidden = db_get_b(pdnce->hContact,"CList","Hidden",0);
- pdnce->m_cache_nHiddenSubcontact = g_szMetaModuleName && db_get_b(pdnce->m_cache_hContact,g_szMetaModuleName,"IsSubcontact",0);
+ pdnce->m_cache_nHiddenSubcontact = g_szMetaModuleName && db_get_b(pdnce->hContact,g_szMetaModuleName,"IsSubcontact",0);
if (pdnce->m_cache_nNoHiddenOffline == -1)
- pdnce->m_cache_nNoHiddenOffline = db_get_b(pdnce->m_cache_hContact,"CList","noOffline",0);
+ pdnce->m_cache_nNoHiddenOffline = db_get_b(pdnce->hContact,"CList","noOffline",0);
if (pdnce->IdleTS == -1)
- pdnce->IdleTS = db_get_dw(pdnce->m_cache_hContact,pdnce->m_cache_cszProto,"IdleTS",0);
+ pdnce->IdleTS = db_get_dw(pdnce->hContact,pdnce->m_cache_cszProto,"IdleTS",0);
if (pdnce->ApparentMode == -1)
- pdnce->ApparentMode = db_get_w(pdnce->m_cache_hContact,pdnce->m_cache_cszProto,"ApparentMode",0);
+ pdnce->ApparentMode = db_get_w(pdnce->hContact,pdnce->m_cache_cszProto,"ApparentMode",0);
if (pdnce->NotOnList == -1)
- pdnce->NotOnList = db_get_b(pdnce->m_cache_hContact,"CList","NotOnList",0);
+ pdnce->NotOnList = db_get_b(pdnce->hContact,"CList","NotOnList",0);
if (pdnce->IsExpanded == -1)
- pdnce->IsExpanded = db_get_b(pdnce->m_cache_hContact,"CList","Expanded",0);
+ pdnce->IsExpanded = db_get_b(pdnce->hContact,"CList","Expanded",0);
if (pdnce->dwLastMsgTime == 0) {
- pdnce->dwLastMsgTime = db_get_dw(pdnce->m_cache_hContact, "CList", "mf_lastmsg", 0);
+ pdnce->dwLastMsgTime = db_get_dw(pdnce->hContact, "CList", "mf_lastmsg", 0);
if (pdnce->dwLastMsgTime == 0)
- pdnce->dwLastMsgTime = CompareContacts2_getLMTime(pdnce->m_cache_hContact);
+ pdnce->dwLastMsgTime = CompareContacts2_getLMTime(pdnce->hContact);
}
}
@@ -295,7 +295,7 @@ void IvalidateDisplayNameCache(DWORD mode) PDNCE pdnce = (PDNCE)clistCache->items[i];
if (mode&16)
{
- InvalidateDNCEbyPointer(pdnce->m_cache_hContact,pdnce,16);
+ InvalidateDNCEbyPointer(pdnce->hContact,pdnce,16);
}
}
}
@@ -315,26 +315,26 @@ void InvalidateDNCEbyPointer(HANDLE hContact, pdisplayNameCacheEntry pdnce, int pdnce->ssThirdLine.iMaxSmileyHeight = 0;
pdnce->hTimeZone = NULL;
pdnce->dwLastMsgTime = 0;
- Cache_GetTimezone(NULL,pdnce->m_cache_hContact);
+ Cache_GetTimezone(NULL,pdnce->hContact);
SettingType &= ~16;
}
if (SettingType >= DBVT_WCHAR) {
pdnce->freeName();
- mir_free_and_nil(pdnce->m_cache_tcsGroup);
+ mir_free_and_nil(pdnce->tszGroup);
pdnce->m_cache_cszProto = NULL;
return;
}
if (SettingType == -1 || SettingType == DBVT_DELETED) {
pdnce->freeName();
- mir_free_and_nil(pdnce->m_cache_tcsGroup);
+ mir_free_and_nil(pdnce->tszGroup);
pdnce->m_cache_cszProto = NULL;
}
// in other cases clear all binary cache
else pdnce->dwLastMsgTime = 0;
- pdnce->m_cache_nHidden = -1;
+ pdnce->bIsHidden = -1;
pdnce->m_cache_nHiddenSubcontact = -1;
pdnce->m_cache_bProtoNotExists = FALSE;
pdnce___SetStatus(pdnce, 0);
@@ -369,10 +369,10 @@ int GetStatusForContact(HANDLE hContact,char *szProto) void displayNameCacheEntry::freeName()
{
if ( !isUnknown)
- mir_free(m_cache_tcsName);
+ mir_free(tszName);
else
isUnknown = false;
- m_cache_tcsName = NULL;
+ tszName = NULL;
}
void displayNameCacheEntry::getName()
@@ -384,14 +384,14 @@ void displayNameCacheEntry::getName() if (m_cache_bProtoNotExists || !m_cache_cszProto) {
LBL_Unknown:
- m_cache_tcsName = UnknownConctactTranslatedName;
+ tszName = UnknownConctactTranslatedName;
isUnknown = true;
return;
}
- m_cache_tcsName = pcli->pfnGetContactDisplayName(m_cache_hContact, GCDNF_NOCACHE);
- if ( !lstrcmp(m_cache_tcsName, UnknownConctactTranslatedName)) {
- mir_free(m_cache_tcsName);
+ tszName = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOCACHE);
+ if ( !lstrcmp(tszName, UnknownConctactTranslatedName)) {
+ mir_free(tszName);
goto LBL_Unknown;
}
@@ -404,8 +404,8 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
if (cacheEntry != NULL)
{
- if (Proto != NULL) *Proto = cacheEntry->m_cache_cszProto;
- if (Name != NULL) *Name = cacheEntry->m_cache_tcsName;
+ if (Proto != NULL) *Proto = cacheEntry->m_cache_cszProto;
+ if (Name != NULL) *Name = cacheEntry->tszName;
if (Status != NULL) *Status = pdnce___GetStatus( cacheEntry );
}
return (0);
@@ -457,19 +457,19 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled)
res = PostAutoRebuidMessage(pcli->hwndContactTree);
- if ((db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
+ if ((db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_cache_cszProto)
amRequestAwayMsg(hContact);
return 0;
}
- if (pdnce->m_cache_nHidden != 1) {
+ if (pdnce->bIsHidden != 1) {
pdnce___SetStatus( pdnce , cws->value.wVal ); //dont use direct set
if (cws->value.wVal == ID_STATUS_OFFLINE)
if (g_CluiData.bRemoveAwayMessageForOffline)
db_set_s(hContact,"CList","StatusMsg","");
- if ((db_get_w(NULL,"CList","SecondLineType",0) == TEXT_STATUS_MESSAGE || db_get_w(NULL,"CList","ThirdLineType",0) == TEXT_STATUS_MESSAGE) && pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
+ if ((db_get_w(NULL,"CList","SecondLineType",0) == TEXT_STATUS_MESSAGE || db_get_w(NULL,"CList","ThirdLineType",0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_cache_cszProto)
amRequestAwayMsg(hContact);
pcli->pfnClcBroadcast( INTM_STATUSCHANGED,wParam,0);
@@ -490,7 +490,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) if ( !strcmp(cws->szSetting,"Rate"))
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- else if (pdnce->m_cache_tcsName == NULL || !strcmp(cws->szSetting,"MyHandle"))
+ else if (pdnce->tszName == NULL || !strcmp(cws->szSetting,"MyHandle"))
InvalidateDNCEbyPointer(hContact,pdnce,cws->value.type);
else if ( !strcmp(cws->szSetting,"Group"))
diff --git a/plugins/Clist_modern/modern_clui.cpp b/plugins/Clist_modern/modern_clui.cpp index 4bc4bb922c..d6c7cf9623 100644 --- a/plugins/Clist_modern/modern_clui.cpp +++ b/plugins/Clist_modern/modern_clui.cpp @@ -2857,9 +2857,9 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc ) }
};
if (pnmc->iColumn == w) {
- char *homepage = db_get_sa(pdnce->m_cache_hContact,"UserInfo", "Homepage");
+ char *homepage = db_get_sa(pdnce->hContact,"UserInfo", "Homepage");
if ( !homepage)
- homepage = db_get_sa(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage");
+ homepage = db_get_sa(pdnce->hContact,pdnce->m_cache_cszProto, "Homepage");
if (homepage != NULL)
{
CallService(MS_UTILS_OPENURL, 1, (LPARAM)homepage);
diff --git a/plugins/Clist_modern/modern_extraimage.cpp b/plugins/Clist_modern/modern_extraimage.cpp index 402c87d26d..3a306081fe 100644 --- a/plugins/Clist_modern/modern_extraimage.cpp +++ b/plugins/Clist_modern/modern_extraimage.cpp @@ -326,9 +326,9 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) if (szProto != NULL)
{
char *homepage;
- homepage = db_get_sa(pdnce->m_cache_hContact,"UserInfo", "Homepage");
+ homepage = db_get_sa(pdnce->hContact,"UserInfo", "Homepage");
if ( !homepage)
- homepage = db_get_sa(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage");
+ homepage = db_get_sa(pdnce->hContact,pdnce->m_cache_cszProto, "Homepage");
if (homepage != NULL)
{
showweb = TRUE;
diff --git a/plugins/Clist_modern/modern_gettextasync.cpp b/plugins/Clist_modern/modern_gettextasync.cpp index 52b73f96dc..0e01838ae4 100644 --- a/plugins/Clist_modern/modern_gettextasync.cpp +++ b/plugins/Clist_modern/modern_gettextasync.cpp @@ -110,7 +110,7 @@ static int gtaThreadProc(void * lpParam) {
displayNameCacheEntry cacheEntry;
memset( &cacheEntry, 0, sizeof(cacheEntry));
- cacheEntry.m_cache_hContact = mpChain.hContact;
+ cacheEntry.hContact = mpChain.hContact;
if ( !Sync(CLUI_SyncGetPDNCE, (WPARAM) 0,(LPARAM)&cacheEntry))
{
if ( !MirandaExiting())
diff --git a/plugins/Clist_modern/modern_rowheight_funcs.cpp b/plugins/Clist_modern/modern_rowheight_funcs.cpp index a651bce180..d9290ad2c1 100644 --- a/plugins/Clist_modern/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/modern_rowheight_funcs.cpp @@ -164,7 +164,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact * case TC_TEXT2:
{
int tmp = 0;
- HANDLE hContact = pdnce->m_cache_hContact;
+ HANDLE hContact = pdnce->hContact;
if (dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0] )
{
tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight;
@@ -191,7 +191,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact * case TC_TEXT3:
{
int tmp = 0;
- HANDLE hContact = pdnce->m_cache_hContact;
+ HANDLE hContact = pdnce->hContact;
if (dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0])
{
tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight;
@@ -639,7 +639,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon {
if ( !dat->text_ignore_size_for_row_height)
{
- HANDLE hContact = pdnce->m_cache_hContact;
+ HANDLE hContact = pdnce->hContact;
tmp = dat->fontModernInfo[g_clcPainter.GetBasicFontID(contact)].fontHeight;
if (dat->text_replace_smileys && dat->first_line_draw_smileys && !dat->text_resize_smileys)
{
diff --git a/plugins/Clist_modern/modern_tbbutton.cpp b/plugins/Clist_modern/modern_tbbutton.cpp index 8b4941f69d..c273719cc8 100644 --- a/plugins/Clist_modern/modern_tbbutton.cpp +++ b/plugins/Clist_modern/modern_tbbutton.cpp @@ -14,6 +14,8 @@ #define BUTTON_POLLDELAY 50
#define b2str(a) ((a) ? "True" : "False")
+void CustomizeToolbar(HWND);
+
struct TBBUTTONDATA : public MButtonCtrl
{
char szButtonID[64]; // Unique stringID of button in form Module.Name
@@ -112,61 +114,55 @@ static void PaintWorker(TBBUTTONDATA *lpSBData, HDC hdcPaint , POINT * pOffset) SkinDrawGlyph(hdcMem,&rcClient,&rcClient,szRequest);
}
- else
- {
- if (xpt_IsThemed(lpSBData->hThemeToolbar))
- {
- RECT *rc = &rcClient;
- int state = IsWindowEnabled(lpSBData->hwnd) ? /*(lpSBData->stateId == PBS_PRESSED || lpSBData->bIsPushed == TRUE) ? PBS_PRESSED :*/ (lpSBData->stateId == PBS_NORMAL && lpSBData->bIsDefault ? PBS_DEFAULTED : lpSBData->stateId) : PBS_DISABLED;
- xpt_DrawTheme(lpSBData->hThemeToolbar,lpSBData->hwnd,hdcMem,TP_BUTTON, TBStateConvert2Flat(state), rc, rc);
- }
- else
- {
- HBRUSH hbr = NULL;
-
- if (lpSBData->stateId == PBS_PRESSED || lpSBData->stateId == PBS_HOT)
- hbr = GetSysColorBrush(COLOR_3DLIGHT);
- else {
- RECT btnRect;
- POINT pt = {0};
- int ret;
- HWND hwndParent = GetParent(lpSBData->hwnd);
- HDC dc = CreateCompatibleDC(NULL);
- HBITMAP memBM, oldBM;
- GetWindowRect(hwndParent,&btnRect);
- memBM = ske_CreateDIB32( btnRect.right-btnRect.left, btnRect.bottom-btnRect.top );
- oldBM = (HBITMAP)SelectObject ( dc, memBM );
- ret = SendMessage(hwndParent,WM_ERASEBKGND,(WPARAM)dc,0);
- GetWindowRect(lpSBData->hwnd,&btnRect);
- ClientToScreen(hwndParent,&pt);
- OffsetRect(&btnRect,-pt.x,-pt.y);
- if (ret)
- BitBlt(hdcMem,0,0,btnRect.right-btnRect.left,btnRect.bottom-btnRect.top,dc,btnRect.left,btnRect.top,SRCCOPY);
- oldBM = (HBITMAP)SelectObject ( dc, oldBM );
- DeleteObject(memBM);
- DeleteDC(dc);
- if ( !ret) //WM_ERASEBKG return false need to paint
- {
- HDC pdc = GetDC(hwndParent);
- HBRUSH oldBrush = (HBRUSH)GetCurrentObject( pdc, OBJ_BRUSH );
- hbr = (HBRUSH)SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM)pdc, (LPARAM)hwndParent);
- SelectObject(pdc,oldBrush);
- ReleaseDC(hwndParent,pdc);
- }
+ else if (xpt_IsThemed(lpSBData->hThemeToolbar)) {
+ RECT *rc = &rcClient;
+ int state = IsWindowEnabled(lpSBData->hwnd) ? /*(lpSBData->stateId == PBS_PRESSED || lpSBData->bIsPushed == TRUE) ? PBS_PRESSED :*/ (lpSBData->stateId == PBS_NORMAL && lpSBData->bIsDefault ? PBS_DEFAULTED : lpSBData->stateId) : PBS_DISABLED;
+ xpt_DrawTheme(lpSBData->hThemeToolbar,lpSBData->hwnd,hdcMem,TP_BUTTON, TBStateConvert2Flat(state), rc, rc);
+ }
+ else {
+ HBRUSH hbr = NULL;
+ if (lpSBData->stateId == PBS_PRESSED || lpSBData->stateId == PBS_HOT)
+ hbr = GetSysColorBrush(COLOR_3DLIGHT);
+ else {
+ RECT btnRect;
+ POINT pt = {0};
+ int ret;
+ HWND hwndParent = GetParent(lpSBData->hwnd);
+ HDC dc = CreateCompatibleDC(NULL);
+ HBITMAP memBM, oldBM;
+ GetWindowRect(hwndParent,&btnRect);
+ memBM = ske_CreateDIB32( btnRect.right-btnRect.left, btnRect.bottom-btnRect.top );
+ oldBM = (HBITMAP)SelectObject ( dc, memBM );
+ ret = SendMessage(hwndParent,WM_ERASEBKGND,(WPARAM)dc,0);
+ GetWindowRect(lpSBData->hwnd,&btnRect);
+ ClientToScreen(hwndParent,&pt);
+ OffsetRect(&btnRect,-pt.x,-pt.y);
+ if (ret)
+ BitBlt(hdcMem,0,0,btnRect.right-btnRect.left,btnRect.bottom-btnRect.top,dc,btnRect.left,btnRect.top,SRCCOPY);
+ oldBM = (HBITMAP)SelectObject ( dc, oldBM );
+ DeleteObject(memBM);
+ DeleteDC(dc);
+ if ( !ret) { //WM_ERASEBKG return false need to paint
+ HDC pdc = GetDC(hwndParent);
+ HBRUSH oldBrush = (HBRUSH)GetCurrentObject( pdc, OBJ_BRUSH );
+ hbr = (HBRUSH)SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM)pdc, (LPARAM)hwndParent);
+ SelectObject(pdc,oldBrush);
+ ReleaseDC(hwndParent,pdc);
}
- if (hbr) {
- FillRect(hdcMem, &rcClient, hbr);
- DeleteObject(hbr);
- }
- if (lpSBData->stateId == PBS_HOT || lpSBData->fFocused) {
- if (lpSBData->bIsPushed)
- DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT);
- else DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT);
- }
- else if (lpSBData->stateId == PBS_PRESSED)
- DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER,BF_RECT|BF_SOFT);
}
+ if (hbr) {
+ FillRect(hdcMem, &rcClient, hbr);
+ DeleteObject(hbr);
+ }
+ if (lpSBData->stateId == PBS_HOT || lpSBData->fFocused) {
+ if (lpSBData->bIsPushed)
+ DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT);
+ else
+ DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT);
+ }
+ else if (lpSBData->stateId == PBS_PRESSED)
+ DrawEdge(hdcMem, &rcClient, BDR_SUNKENOUTER,BF_RECT|BF_SOFT);
}
RECT rcTemp = rcClient; //content rect
@@ -361,8 +357,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam lpSBData->bIsPushed = TRUE;
}
- if (lpSBData->stateId != PBS_DISABLED)
- {
+ if (lpSBData->stateId != PBS_DISABLED) {
// don't change states if disabled
if (msg == WM_LBUTTONUP)
lpSBData->stateId = PBS_HOT;
@@ -385,31 +380,25 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam GetWindowRect(hwndDlg, &rc);
GetCursorPos(&pt);
BOOL inClient = PtInRect(&rc, pt);
- if ( inClient )
- {
+ if ( inClient ) {
SetCapture( lpSBData->hwnd );
- if ( lpSBData->stateId == PBS_NORMAL )
- {
+ if ( lpSBData->stateId == PBS_NORMAL ) {
lpSBData->stateId = PBS_HOT;
InvalidateParentRect(lpSBData->hwnd, NULL, TRUE);
}
}
- if ( !inClient && lpSBData->stateId == PBS_PRESSED )
- {
+ if ( !inClient && lpSBData->stateId == PBS_PRESSED ) {
lpSBData->stateId = PBS_HOT;
InvalidateParentRect(lpSBData->hwnd, NULL, TRUE);
}
- else if ( inClient && lpSBData->stateId == PBS_HOT && bPressed )
- {
- if ( lpSBData->fHotMark )
- {
+ else if ( inClient && lpSBData->stateId == PBS_HOT && bPressed ) {
+ if ( lpSBData->fHotMark ) {
lpSBData->stateId = PBS_PRESSED;
InvalidateParentRect(lpSBData->hwnd, NULL, TRUE);
}
}
- else if ( !inClient && !bPressed)
- {
+ else if ( !inClient && !bPressed) {
lpSBData->fHotMark = FALSE;
ReleaseCapture();
}
@@ -519,6 +508,11 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam static void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam)
{
+ if (ttbid == (HANDLE)-1) {
+ //CustomizeToolbar(hWnd);
+ return;
+ }
+
MButtonCustomize Custom;
Custom.cbLen = sizeof(TBBUTTONDATA);
Custom.fnPainter = (pfnPainterFunc)PaintWorker;
diff --git a/plugins/Clist_modern/modern_viewmodebar.cpp b/plugins/Clist_modern/modern_viewmodebar.cpp index b681c01d6b..c771e4b6f6 100644 --- a/plugins/Clist_modern/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/modern_viewmodebar.cpp @@ -1517,7 +1517,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) for (i=0; i < clistCache->realCount; i++)
{
PDNCE pdnce = (PDNCE)clistCache->items[i];
- pdnce->dwLastMsgTime = CompareContacts2_getLMTime(pdnce->m_cache_hContact);
+ pdnce->dwLastMsgTime = CompareContacts2_getLMTime(pdnce->hContact);
}
g_CluiData.bSortByOrder[0] = bSaved;
diff --git a/plugins/Clist_mw/clc.cpp b/plugins/Clist_mw/clc.cpp index d238f5a6bb..1b57dcf9bd 100644 --- a/plugins/Clist_mw/clc.cpp +++ b/plugins/Clist_mw/clc.cpp @@ -158,7 +158,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L else
status = cacheEntry->status;
- shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_SHOWHIDDEN || !cacheEntry->Hidden) && (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline || CallService(MS_CLIST_GETCONTACTICON,wParam,0) != LOWORD(lParam)); //this means an offline msg is flashing, so the contact should be shown
+ shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) && (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline || CallService(MS_CLIST_GETCONTACTICON,wParam,0) != LOWORD(lParam)); //this means an offline msg is flashing, so the contact should be shown
if (!FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1)
diff --git a/plugins/Clist_mw/clcitems.cpp b/plugins/Clist_mw/clcitems.cpp index 0a483fb76d..d1d5561b90 100644 --- a/plugins/Clist_mw/clcitems.cpp +++ b/plugins/Clist_mw/clcitems.cpp @@ -61,7 +61,7 @@ void AddSubcontacts(struct ClcContact * cont) cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,0);
memset(cont->subcontacts[i].iExtraImage,0xFF,SIZEOF(cont->subcontacts[i].iExtraImage));
cont->subcontacts[i].proto = cacheEntry->szProto;
- lstrcpyn(cont->subcontacts[i].szText,cacheEntry->name,SIZEOF(cont->subcontacts[i].szText));
+ lstrcpyn(cont->subcontacts[i].szText,cacheEntry->tszName,SIZEOF(cont->subcontacts[i].szText));
cont->subcontacts[i].type = CLCIT_CONTACT;
//cont->flags = 0;//CONTACTF_ONLINE;
cont->subcontacts[i].isSubcontact = 1;
@@ -164,7 +164,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup idleMode = szProto != NULL?cacheEntry->IdleTS:0;
if (idleMode) group->cl.items[i]->flags |= CONTACTF_IDLE;
- lstrcpyn(group->cl.items[i]->szText,cacheEntry->name, SIZEOF(group->cl.items[i]->szText));
+ lstrcpyn(group->cl.items[i]->szText,cacheEntry->tszName, SIZEOF(group->cl.items[i]->szText));
group->cl.items[i]->proto = szProto;
if (dat->style & CLS_SHOWSTATUSMESSAGES) {
@@ -211,10 +211,10 @@ void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTo }
ClcGroup *group;
- if (lstrlen(cacheEntry->szGroup) == 0)
+ if (lstrlen(cacheEntry->tszGroup) == 0)
group = &dat->list;
else {
- group = AddGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0);
+ group = AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0);
if (group == NULL) {
DWORD groupFlags;
int i;
@@ -226,7 +226,7 @@ void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTo TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags);
if (szGroupName == NULL)
return; //never happens
- if ( !lstrcmp(szGroupName,cacheEntry->szGroup))
+ if ( !lstrcmp(szGroupName,cacheEntry->tszGroup))
break;
}
if (groupFlags & GROUPF_HIDEOFFLINE)
@@ -236,13 +236,13 @@ void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTo TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags);
if (szGroupName == NULL)
return; //never happens
- if (!lstrcmp(szGroupName,cacheEntry->szGroup))
+ if (!lstrcmp(szGroupName,cacheEntry->tszGroup))
break;
size_t len = lstrlen(szGroupName);
- if (!_tcsncmp(szGroupName,cacheEntry->szGroup,len) && cacheEntry->szGroup[len] == '\\')
+ if (!_tcsncmp(szGroupName,cacheEntry->tszGroup,len) && cacheEntry->tszGroup[len] == '\\')
AddGroup(hwnd,dat,szGroupName,groupFlags,i,1);
}
- group = AddGroup(hwnd,dat,cacheEntry->szGroup,groupFlags,i,1);
+ group = AddGroup(hwnd,dat,cacheEntry->tszGroup,groupFlags,i,1);
}
}
@@ -365,11 +365,11 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) if (cacheEntry == NULL)
MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!!!!",0);
- if (style&CLS_SHOWHIDDEN || !cacheEntry->Hidden) {
- if (lstrlen(cacheEntry->szGroup) == 0)
+ if (style&CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) {
+ if (lstrlen(cacheEntry->tszGroup) == 0)
group = &dat->list;
else {
- group = AddGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0);
+ group = AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1,0,0);
//mir_free(dbv.pszVal);
}
diff --git a/plugins/Clist_mw/clist.h b/plugins/Clist_mw/clist.h index 32effbad84..20c8a7ce80 100644 --- a/plugins/Clist_mw/clist.h +++ b/plugins/Clist_mw/clist.h @@ -31,12 +31,8 @@ void SortContacts(void); void ChangeContactIcon(HANDLE hContact,int iIcon,int add);
int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status);
-typedef struct {
- HANDLE hContact;
- TCHAR *name;
- char *szName;
- TCHAR* szGroup;
- int Hidden;
+struct displayNameCacheEntry : public ClcCacheEntryBase
+{
int noHiddenOffline;
char *szProto;
@@ -50,8 +46,9 @@ typedef struct { void *ClcContact;
BYTE IsExpanded;
boolean isUnknown;
-}
- displayNameCacheEntry,*pdisplayNameCacheEntry;
+};
+
+typedef displayNameCacheEntry *pdisplayNameCacheEntry;
pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact);
diff --git a/plugins/Clist_mw/clistsettings.cpp b/plugins/Clist_mw/clistsettings.cpp index fcfbb58992..ecdb3d8089 100644 --- a/plugins/Clist_mw/clistsettings.cpp +++ b/plugins/Clist_mw/clistsettings.cpp @@ -62,10 +62,9 @@ void InitDisplayNameCache(SortedList *list) void FreeDisplayNameCacheItem(ClcCacheEntryBase *_p)
{
pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)_p;
- if ( p->name) { mir_free(p->name); p->name = NULL; }
- if ( p->szName) { mir_free(p->szName); p->szName = NULL; }
+ if ( p->tszName) { mir_free(p->tszName); p->tszName = NULL; }
if ( p->szProto) { mir_free(p->szProto); p->szProto = NULL; }
- if ( p->szGroup) { mir_free(p->szGroup); p->szGroup = NULL; }
+ if ( p->tszGroup) { mir_free(p->tszGroup); p->tszGroup = NULL; }
}
void FreeDisplayNameCache(SortedList *list)
@@ -94,46 +93,46 @@ void CheckPDNCE(ClcCacheEntryBase *_pdnce) if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->szProto) == 0)
pdnce->protoNotExists = TRUE;
else {
- if ( pdnce->szProto && pdnce->name ) {
- mir_free(pdnce->name);
- pdnce->name = NULL;
+ if ( pdnce->szProto && pdnce->tszName ) {
+ mir_free(pdnce->tszName);
+ pdnce->tszName = NULL;
} } } }
- if (pdnce->name == NULL)
+ if (pdnce->tszName == NULL)
{
if (pdnce->protoNotExists)
- pdnce->name = mir_tstrdup(TranslateT("_NoProtocol_"));
+ pdnce->tszName = mir_tstrdup(TranslateT("_NoProtocol_"));
else {
if (OnModulesLoadedCalled)
- pdnce->name = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown);
+ pdnce->tszName = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown);
else
- pdnce->name = GetNameForContact(pdnce->hContact,0,NULL);
+ pdnce->tszName = GetNameForContact(pdnce->hContact,0,NULL);
}
}
else {
if (pdnce->isUnknown&&pdnce->szProto&&pdnce->protoNotExists == TRUE&&OnModulesLoadedCalled) {
pdnce->protoNotExists = FALSE;
- mir_free(pdnce->name);
- pdnce->name = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown);
+ mir_free(pdnce->tszName);
+ pdnce->tszName = GetNameForContact(pdnce->hContact,0,&pdnce->isUnknown);
} }
if (pdnce->status == 0)
pdnce->status = GetStatusForContact(pdnce->hContact,pdnce->szProto);
- if (pdnce->szGroup == NULL)
+ if (pdnce->tszGroup == NULL)
{
DBVARIANT dbv;
if (!DBGetContactSettingTString(pdnce->hContact,"CList","Group",&dbv))
{
- pdnce->szGroup = mir_tstrdup(dbv.ptszVal);
+ pdnce->tszGroup = mir_tstrdup(dbv.ptszVal);
mir_free(dbv.pszVal);
}
- else pdnce->szGroup = mir_tstrdup( _T(""));
+ else pdnce->tszGroup = mir_tstrdup( _T(""));
}
- if (pdnce->Hidden == -1)
- pdnce->Hidden = DBGetContactSettingByte(pdnce->hContact,"CList","Hidden",0);
+ if (pdnce->bIsHidden == -1)
+ pdnce->bIsHidden = DBGetContactSettingByte(pdnce->hContact,"CList","bIsHidden",0);
if (pdnce->noHiddenOffline == -1)
pdnce->noHiddenOffline = DBGetContactSettingByte(pdnce->hContact,"CList","noOffline",0);
@@ -158,12 +157,12 @@ void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntr if ( SettingType == -1 || SettingType == DBVT_DELETED )
{
- mir_free(pdnce->name);
- pdnce->name = NULL;
- mir_free(pdnce->szGroup);
- pdnce->szGroup = NULL;
+ mir_free(pdnce->tszName);
+ pdnce->tszName = NULL;
+ mir_free(pdnce->tszGroup);
+ pdnce->tszGroup = NULL;
- pdnce->Hidden = -1;
+ pdnce->bIsHidden = -1;
pdnce->protoNotExists = FALSE;
mir_free(pdnce->szProto);
pdnce->szProto = NULL;
@@ -179,17 +178,17 @@ void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntr if (SettingType >= DBVT_WCHAR)
{
- mir_free(pdnce->name);
- pdnce->name = NULL;
- mir_free(pdnce->szGroup);
- pdnce->szGroup = NULL;
+ mir_free(pdnce->tszName);
+ pdnce->tszName = NULL;
+ mir_free(pdnce->tszGroup);
+ pdnce->tszGroup = NULL;
mir_free(pdnce->szProto);
pdnce->szProto = NULL;
return;
}
// in other cases clear all binary cache
- pdnce->Hidden = -1;
+ pdnce->bIsHidden = -1;
pdnce->protoNotExists = FALSE;
pdnce->status = 0;
pdnce->IdleTS = -1;
@@ -263,7 +262,7 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status if (cacheEntry != NULL)
{
if (Proto != NULL) *Proto = cacheEntry->szProto;
- if (Name != NULL) *Name = cacheEntry->name;
+ if (Name != NULL) *Name = cacheEntry->tszName;
if (Status != NULL) *Status = cacheEntry->status;
}
return 0;
@@ -301,7 +300,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type);
if (cws->value.type == DBVT_WORD&&!strcmp(cws->szSetting, "Status")) {
- if (!(pdnce->Hidden == 1)) {
+ if (!(pdnce->bIsHidden == 1)) {
if (DBGetContactSettingByte((HANDLE)NULL,"CList","ShowStatusMsg",0)||DBGetContactSettingByte((HANDLE)wParam,"CList","StatusMsgAuto",0))
DBWriteContactSettingString((HANDLE)wParam, "CList", "StatusMsg", "");
@@ -338,13 +337,13 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) */
//name is null or (setting is myhandle)
- if (pdnce->name == NULL||(!strcmp(cws->szSetting,"MyHandle")))
+ if (pdnce->tszName == NULL||(!strcmp(cws->szSetting,"MyHandle")))
InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type);
if ((!strcmp(cws->szSetting,"Group")))
InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type);
- if (!strcmp(cws->szSetting,"Hidden")) {
+ if (!strcmp(cws->szSetting,"bIsHidden")) {
InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type);
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) {
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
diff --git a/plugins/Clist_mw/contact.cpp b/plugins/Clist_mw/contact.cpp index 54474e3b85..d8cf0f37d4 100644 --- a/plugins/Clist_mw/contact.cpp +++ b/plugins/Clist_mw/contact.cpp @@ -99,7 +99,7 @@ void LoadContactTree(void) break;
}
status = cacheEntry->status;
- if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->Hidden)
+ if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->bIsHidden)
ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1);
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
}
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 7dc3535efb..70019d75b9 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -727,16 +727,12 @@ static TCHAR pluginname[] = _T("TopToolBar"); int addTopToolBarWindow(HWND parent)
{
- WNDCLASS wndclass;
- wndclass.style = 0;
+ WNDCLASS wndclass = { 0 };
wndclass.lpfnWndProc = TopToolBarProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
+ wndclass.cbWndExtra = sizeof(void*);
wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);//NULL;//(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = pluginname;
RegisterClass(&wndclass);
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 37aa09bb46..7c0feb52ba 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -109,7 +109,7 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact) {
ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
- if ( !lstrcmp(cache->group, szName) && (style & CLS_SHOWHIDDEN || !cache->isHidden))
+ if ( !lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden))
group->totalMembers++;
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
@@ -209,8 +209,8 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon { ClcCacheEntryBase* p = cli.pfnGetCacheEntry(hContact);
if (p != NULL) {
- if (p->group) mir_free(p->group);
- p->group = NULL;
+ if (p->tszGroup) mir_free(p->tszGroup);
+ p->tszGroup = NULL;
} }
return i;
@@ -297,8 +297,8 @@ struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct { ClcCacheEntryBase* p = cli.pfnGetCacheEntry(contact->hContact);
if (p != NULL) {
- if (p->group) mir_free(p->group);
- p->group = NULL;
+ if (p->tszGroup) mir_free(p->tszGroup);
+ p->tszGroup = NULL;
} }
cli.pfnFreeContact(group->cl.items[iContact]);
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 2e6f065628..8b39b3cfd9 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -65,24 +65,23 @@ ClcCacheEntryBase* fnCreateCacheItem(HANDLE hContact) void fnCheckCacheItem(ClcCacheEntryBase* p)
{
DBVARIANT dbv;
- if (p->group == NULL) {
+ if (p->tszGroup == NULL) {
if ( !DBGetContactSettingTString(p->hContact, "CList", "Group", &dbv)) {
- p->group = mir_tstrdup(dbv.ptszVal);
+ p->tszGroup = mir_tstrdup(dbv.ptszVal);
mir_free(dbv.ptszVal);
}
- else p->group = mir_tstrdup(_T(""));
+ else p->tszGroup = mir_tstrdup(_T(""));
}
- if (p->isHidden == -1)
- p->isHidden = DBGetContactSettingByte(p->hContact, "CList", "Hidden", 0);
+ if (p->bIsHidden == -1)
+ p->bIsHidden = DBGetContactSettingByte(p->hContact, "CList", "Hidden", 0);
}
void fnFreeCacheItem(ClcCacheEntryBase* p)
{
- if (p->name) { mir_free(p->name); p->name = NULL; }
- if (p->szName) { mir_free(p->szName); p->szName = NULL; }
- if (p->group) { mir_free(p->group); p->group = NULL; }
- p->isHidden = -1;
+ if (p->tszName) { mir_free(p->tszName); p->tszName = NULL; }
+ if (p->tszGroup) { mir_free(p->tszGroup); p->tszGroup = NULL; }
+ p->bIsHidden = -1;
}
ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact)
@@ -116,17 +115,17 @@ void fnInvalidateDisplayNameCacheEntry(HANDLE hContact) TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode)
{
- CONTACTINFO ci;
- TCHAR *buffer;
ClcCacheEntryBase* cacheEntry = NULL;
if (mode & GCDNF_NOCACHE)
mode &= ~GCDNF_NOCACHE;
else if (mode != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
- if (cacheEntry->name)
- return cacheEntry->name;
+ if (cacheEntry->tszName)
+ return cacheEntry->tszName;
}
+
+ CONTACTINFO ci;
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
ci.hContact = hContact;
@@ -135,36 +134,26 @@ TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode) ci.dwFlag = ((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
- if (cacheEntry == NULL)
- return ci.pszVal;
-
- cacheEntry->name = ci.pszVal;
- cacheEntry->szName = mir_u2a(ci.pszVal);
+ if (cacheEntry != NULL)
+ cacheEntry->tszName = ci.pszVal;
return ci.pszVal;
}
if (ci.type == CNFT_DWORD) {
- if (cacheEntry == NULL) {
- buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
- _ltot(ci.dVal, buffer, 10);
- return buffer;
- }
- else {
- buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
- _ltot(ci.dVal, buffer, 10);
- cacheEntry->name = buffer;
- cacheEntry->szName = mir_u2a(buffer);
- return buffer;
- } } }
+ TCHAR *buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
+ _ltot(ci.dVal, buffer, 10);
+ if (cacheEntry != NULL)
+ cacheEntry->tszName = buffer;
+ return buffer;
+ } }
CallContactService(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
- buffer = TranslateT("(Unknown Contact)");
+ TCHAR *buffer = TranslateT("(Unknown Contact)");
return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
}
INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
{
- CONTACTINFO ci;
ClcCacheEntryBase* cacheEntry = NULL;
char *buffer;
HANDLE hContact = (HANDLE)wParam;
@@ -172,15 +161,19 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) if (lParam & GCDNF_UNICODE)
return (INT_PTR)cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE);
- if ((int) lParam != GCDNF_NOMYHANDLE) {
+ if (lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
- if (cacheEntry->szName)
- return (INT_PTR)cacheEntry->szName;
+ if (cacheEntry->tszName) {
+ static char retVal[200];
+ strncpy(retVal, _T2A(cacheEntry->tszName), SIZEOF(retVal));
+ return (INT_PTR)retVal;
+ }
}
- ZeroMemory(&ci, sizeof(ci));
+
+ CONTACTINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.hContact = hContact;
- if (ci.hContact == NULL)
+ if (ci.hContact == NULL) // killme !!!!!!!!!!
ci.szProto = "ICQ";
ci.dwFlag = ((lParam == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
@@ -190,25 +183,18 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) mir_free(ci.pszVal);
return (INT_PTR) buffer;
}
- else {
- cacheEntry->name = ci.pszVal;
- cacheEntry->szName = mir_u2a(ci.pszVal);
- return (INT_PTR)cacheEntry->szName;
- }
+
+ cacheEntry->tszName = ci.pszVal;
+ return (INT_PTR)cacheEntry->tszName;
}
if (ci.type == CNFT_DWORD) {
- if (cacheEntry == NULL) {
- buffer = (char*)mir_alloc(15);
- _ltoa(ci.dVal, buffer, 10);
- return (INT_PTR) buffer;
- }
- else {
- buffer = (char*)mir_alloc(15);
- _ltoa(ci.dVal, buffer, 10);
- cacheEntry->szName = buffer;
- cacheEntry->name = mir_a2u(buffer);
- return (INT_PTR) buffer;
- } } }
+ buffer = (char*)mir_alloc(15);
+ _ltoa(ci.dVal, buffer, 10);
+ if (cacheEntry != NULL)
+ cacheEntry->tszName = mir_a2u(buffer);
+ return (INT_PTR) buffer;
+ }
+ }
CallContactService(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
buffer = Translate("(Unknown Contact)");
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index c3a6403fe0..740ed163a8 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -276,10 +276,10 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
do {
ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
- if ( !lstrcmp(cache->group, oldName)) {
+ if ( !lstrcmp(cache->tszGroup, oldName)) {
DBWriteContactSettingTString(hContact, "CList", "Group", szName);
- mir_free(cache->group);
- cache->group = 0;
+ mir_free(cache->tszGroup);
+ cache->tszGroup = 0;
cli.pfnCheckCacheItem(cache);
}
}
|