summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/modern_clcitems.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Clist_modern/modern_clcitems.cpp')
-rw-r--r--plugins/Clist_modern/modern_clcitems.cpp356
1 files changed, 178 insertions, 178 deletions
diff --git a/plugins/Clist_modern/modern_clcitems.cpp b/plugins/Clist_modern/modern_clcitems.cpp
index 01ed44aa02..a0684697ac 100644
--- a/plugins/Clist_modern/modern_clcitems.cpp
+++ b/plugins/Clist_modern/modern_clcitems.cpp
@@ -32,51 +32,51 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl
int subcount,i,j;
HANDLE hsub;
pdisplayNameCacheEntry cacheEntry;
- cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(cont->hContact);
- cont->SubExpanded=(db_get_b(cont->hContact,"CList","Expanded",0) && (db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)));
- subcount=(int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0);
+ cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(cont->hContact);
+ cont->SubExpanded = (db_get_b(cont->hContact,"CList","Expanded",0) && (db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)));
+ subcount = (int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0);
if (subcount <= 0) {
- cont->isSubcontact=0;
- cont->subcontacts=NULL;
- cont->SubAllocated=0;
+ cont->isSubcontact = 0;
+ cont->subcontacts = NULL;
+ cont->SubAllocated = 0;
return;
}
- cont->isSubcontact=0;
+ cont->isSubcontact = 0;
mir_free(cont->subcontacts);
- cont->subcontacts=(struct ClcContact *) mir_calloc(sizeof(struct ClcContact)*subcount);
- cont->SubAllocated=subcount;
- i=0;
- for (j=0; j<subcount; j++) {
+ cont->subcontacts = (struct ClcContact *) mir_calloc(sizeof(struct ClcContact)*subcount);
+ cont->SubAllocated = subcount;
+ i = 0;
+ for (j = 0; j < subcount; j++) {
WORD wStatus;
- hsub=(HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j);
- cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hsub);
- wStatus=pdnce___GetStatus( cacheEntry );
+ hsub = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j);
+ cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hsub);
+ wStatus = pdnce___GetStatus( cacheEntry );
if (showOfflineHereGroup||(!(db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) ||
- wStatus!=ID_STATUS_OFFLINE )
+ wStatus != ID_STATUS_OFFLINE )
//&&
//(!cacheEntry->Hidden || style&CLS_SHOWHIDDEN)
)
{
- cont->subcontacts[i].hContact=cacheEntry->m_cache_hContact;
+ cont->subcontacts[i].hContact = cacheEntry->m_cache_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->m_cache_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;
- cont->subcontacts[i].type=CLCIT_CONTACT;
- cont->subcontacts[i].flags=0;//CONTACTF_ONLINE;
- cont->subcontacts[i].isSubcontact=i+1;
- cont->subcontacts[i].lastPaintCounter=0;
- cont->subcontacts[i].subcontacts=cont;
- cont->subcontacts[i].image_is_special=FALSE;
- //cont->subcontacts[i].status=cacheEntry->status;
+ cont->subcontacts[i].proto = cacheEntry->m_cache_cszProto;
+ cont->subcontacts[i].type = CLCIT_CONTACT;
+ cont->subcontacts[i].flags = 0;//CONTACTF_ONLINE;
+ cont->subcontacts[i].isSubcontact = i+1;
+ cont->subcontacts[i].lastPaintCounter = 0;
+ cont->subcontacts[i].subcontacts = cont;
+ cont->subcontacts[i].image_is_special = FALSE;
+ //cont->subcontacts[i].status = cacheEntry->status;
Cache_GetTimezone(dat, (&cont->subcontacts[i])->hContact);
Cache_GetText(dat, &cont->subcontacts[i],1);
@@ -84,23 +84,23 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl
int apparentMode;
char *szProto;
int idleMode;
- szProto=cacheEntry->m_cache_cszProto;
- if(szProto!=NULL && !pcli->pfnIsHiddenMode(dat,wStatus))
- cont->subcontacts[i].flags|=CONTACTF_ONLINE;
- apparentMode=szProto!=NULL?cacheEntry->ApparentMode:0;
- apparentMode=szProto!=NULL?cacheEntry->ApparentMode:0;
- if(apparentMode==ID_STATUS_OFFLINE) cont->subcontacts[i].flags|=CONTACTF_INVISTO;
- else if(apparentMode==ID_STATUS_ONLINE) cont->subcontacts[i].flags|=CONTACTF_VISTO;
- else if(apparentMode) cont->subcontacts[i].flags|=CONTACTF_VISTO|CONTACTF_INVISTO;
- if(cacheEntry->NotOnList) cont->subcontacts[i].flags|=CONTACTF_NOTONLIST;
- idleMode=szProto!=NULL?cacheEntry->IdleTS:0;
- if (idleMode) cont->subcontacts[i].flags|=CONTACTF_IDLE;
+ szProto = cacheEntry->m_cache_cszProto;
+ if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,wStatus))
+ cont->subcontacts[i].flags |= CONTACTF_ONLINE;
+ apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
+ apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
+ if (apparentMode == ID_STATUS_OFFLINE) cont->subcontacts[i].flags |= CONTACTF_INVISTO;
+ else if (apparentMode == ID_STATUS_ONLINE) cont->subcontacts[i].flags |= CONTACTF_VISTO;
+ else if (apparentMode) cont->subcontacts[i].flags |= CONTACTF_VISTO|CONTACTF_INVISTO;
+ if (cacheEntry->NotOnList) cont->subcontacts[i].flags |= CONTACTF_NOTONLIST;
+ idleMode = szProto != NULL?cacheEntry->IdleTS:0;
+ if (idleMode) cont->subcontacts[i].flags |= CONTACTF_IDLE;
}
i++;
} }
- cont->SubAllocated=i;
- if (!i && cont->subcontacts != NULL) mir_free_and_nill(cont->subcontacts);
+ cont->SubAllocated = i;
+ if (!i && cont->subcontacts !=NULL) mir_free_and_nill(cont->subcontacts);
}
int cli_AddItemToGroup(struct ClcGroup *group,int iAboveItem)
@@ -140,17 +140,17 @@ void cli_FreeContact(struct ClcContact *p)
int i;
for ( i = 0 ; i < p->SubAllocated ; i++ ) {
p->subcontacts[i].ssText.DestroySmileyList();
- if ( p->subcontacts[i].avatar_pos==AVATAR_POS_ANIMATED )
+ if ( p->subcontacts[i].avatar_pos == AVATAR_POS_ANIMATED )
AniAva_RemoveAvatar( p->subcontacts[i].hContact );
- p->subcontacts[i].avatar_pos=AVATAR_POS_DONT_HAVE;
+ p->subcontacts[i].avatar_pos = AVATAR_POS_DONT_HAVE;
}
mir_free_and_nill(p->subcontacts);
} }
p->ssText.DestroySmileyList();
- if ( p->avatar_pos==AVATAR_POS_ANIMATED )
+ if ( p->avatar_pos == AVATAR_POS_ANIMATED )
AniAva_RemoveAvatar( p->hContact );
- p->avatar_pos=AVATAR_POS_DONT_HAVE;
+ p->avatar_pos = AVATAR_POS_DONT_HAVE;
corecli.pfnFreeContact( p );
}
@@ -169,94 +169,94 @@ int cli_AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText
static void _LoadDataToContact(struct ClcContact * cont, struct ClcGroup *group, struct ClcData *dat, HANDLE hContact)
{
- pdisplayNameCacheEntry cacheEntry=NULL;
+ pdisplayNameCacheEntry cacheEntry = NULL;
WORD apparentMode;
DWORD idleMode;
char * szProto;
if (!cont) return;
- cont->type=CLCIT_CONTACT;
- cont->SubAllocated=0;
- cont->isSubcontact=0;
- cont->subcontacts=NULL;
- cont->szText[0]=0;
- cont->lastPaintCounter=0;
- cont->image_is_special=FALSE;
- cont->hContact=hContact;
+ cont->type = CLCIT_CONTACT;
+ cont->SubAllocated = 0;
+ cont->isSubcontact = 0;
+ cont->subcontacts = NULL;
+ cont->szText[0] = 0;
+ cont->lastPaintCounter = 0;
+ cont->image_is_special = FALSE;
+ cont->hContact = hContact;
pcli->pfnInvalidateDisplayNameCacheEntry(hContact);
- cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
+ cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
- szProto=cacheEntry->m_cache_cszProto;
- cont->proto=szProto;
+ szProto = cacheEntry->m_cache_cszProto;
+ cont->proto = szProto;
- if(szProto!=NULL&&!pcli->pfnIsHiddenMode(dat,pdnce___GetStatus( cacheEntry )))
+ if (szProto != NULL&&!pcli->pfnIsHiddenMode(dat,pdnce___GetStatus( cacheEntry )))
cont->flags |= CONTACTF_ONLINE;
- apparentMode=szProto!=NULL?cacheEntry->ApparentMode:0;
+ apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
if (apparentMode)
switch (apparentMode)
{
case ID_STATUS_OFFLINE:
- cont->flags|=CONTACTF_INVISTO;
+ cont->flags |= CONTACTF_INVISTO;
break;
case ID_STATUS_ONLINE:
- cont->flags|=CONTACTF_VISTO;
+ cont->flags |= CONTACTF_VISTO;
break;
default:
- cont->flags|=CONTACTF_VISTO|CONTACTF_INVISTO;
+ cont->flags |= CONTACTF_VISTO|CONTACTF_INVISTO;
}
- if(cacheEntry->NotOnList)
- cont->flags|=CONTACTF_NOTONLIST;
- idleMode=szProto!=NULL?cacheEntry->IdleTS:0;
+ if (cacheEntry->NotOnList)
+ cont->flags |= CONTACTF_NOTONLIST;
+ idleMode = szProto != NULL?cacheEntry->IdleTS:0;
if (idleMode)
- cont->flags|=CONTACTF_IDLE;
+ cont->flags |= CONTACTF_IDLE;
//Add subcontacts
if (szProto)
{
- if ( g_szMetaModuleName && dat->IsMetaContactsEnabled && mir_strcmp(cont->proto,g_szMetaModuleName)==0)
+ if ( g_szMetaModuleName && dat->IsMetaContactsEnabled && mir_strcmp(cont->proto,g_szMetaModuleName) == 0)
AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group));
}
- cont->lastPaintCounter=0;
- cont->avatar_pos=AVATAR_POS_DONT_HAVE;
+ cont->lastPaintCounter = 0;
+ cont->avatar_pos = AVATAR_POS_DONT_HAVE;
Cache_GetAvatar(dat,cont);
Cache_GetText(dat,cont,1);
Cache_GetTimezone(dat,cont->hContact);
- cont->iImage=CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,1);
- cont->bContactRate=db_get_b(hContact, "CList", "Rate",0);
+ cont->iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,1);
+ cont->bContactRate = db_get_b(hContact, "CList", "Rate",0);
}
static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup *group, pdisplayNameCacheEntry cacheEntry)
{
HANDLE hContact;
int i;
- if (cacheEntry==NULL) return NULL;
- if (group==NULL) return NULL;
- if (dat==NULL) return NULL;
- hContact=cacheEntry->m_cache_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;
- i=cli_AddItemToGroup(group,i+1);
+ if (cacheEntry == NULL) return NULL;
+ if (group == NULL) return NULL;
+ if (dat == NULL) return NULL;
+ hContact = cacheEntry->m_cache_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;
+ i = cli_AddItemToGroup(group,i+1);
_LoadDataToContact(group->cl.items[i], group, dat, hContact);
- cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
+ cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
ClearRowByIndexCache();
return group->cl.items[i];
}
void * AddTempGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers)
{
- int i=0;
- int f=0;
+ int i = 0;
+ int f = 0;
TCHAR * szGroupName;
DWORD groupFlags;
- char *mbuf=mir_u2a((TCHAR *)szName);
+ char *mbuf = mir_u2a((TCHAR *)szName);
if (wildcmp(mbuf,"-@-HIDDEN-GROUP-@-",0))
{
@@ -264,23 +264,23 @@ void * AddTempGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flag
return NULL;
}
mir_free_and_nill(mbuf);
- for(i=1;;i++)
+ for(i = 1;;i++)
{
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)) f = 1;
}
if (!f)
{
char buf[20];
TCHAR b2[255];
- void * res=NULL;
+ void * res = NULL;
mir_snprintf(buf,SIZEOF(buf),"%d",(i-1));
mir_sntprintf(b2,SIZEOF(b2),_T("#%s"),szName);
- b2[0]=1|GROUPF_EXPANDED;
+ b2[0] = 1|GROUPF_EXPANDED;
db_set_ws(NULL,"CListGroups",buf,b2);
pcli->pfnGetGroupName(i,&groupFlags);
- res=cli_AddGroup(hwnd,dat,szName,groupFlags,i,0);
+ res = cli_AddGroup(hwnd,dat,szName,groupFlags,i,0);
return res;
}
return NULL;
@@ -290,8 +290,8 @@ void cli_AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int upda
{
struct ClcGroup *group;
struct ClcContact * cont;
- pdisplayNameCacheEntry cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
- if(dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_cache_nHiddenSubcontact) return; //contact should not be added
+ pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
+ if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_cache_nHiddenSubcontact) return; //contact should not be added
if (!dat->IsMetaContactsEnabled && cacheEntry && g_szMetaModuleName && !mir_strcmp(cacheEntry->m_cache_cszProto,g_szMetaModuleName)) return;
corecli.pfnAddContactToTree(hwnd,dat,hContact,updateTotalCount,checkHideOffline);
if (FindItem(hwnd,dat,hContact,&cont,&group,NULL,FALSE))
@@ -306,20 +306,20 @@ void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem)
corecli.pfnDeleteItemFromTree(hwnd, hItem);
//check here contacts are not resorting
- if (hwnd==pcli->hwndContactTree)
+ if (hwnd == pcli->hwndContactTree)
pcli->pfnFreeCacheItem(pcli->pfnGetCacheEntry(hItem));
- dat->NeedResort=1;
+ dat->NeedResort = 1;
ClearRowByIndexCache();
}
__inline BOOL CLCItems_IsShowOfflineGroup(struct ClcGroup* group)
{
- DWORD groupFlags=0;
+ DWORD groupFlags = 0;
if (!group) return FALSE;
if (group->hideOffline) return FALSE;
pcli->pfnGetGroupName(group->groupId,&groupFlags);
- return (groupFlags&GROUPF_SHOWOFFLINE)!=0;
+ return (groupFlags&GROUPF_SHOWOFFLINE) != 0;
}
HANDLE SaveSelection( struct ClcData *dat )
@@ -351,8 +351,8 @@ int RestoreSelection( struct ClcData *dat, HANDLE hSelected )
{
dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts ));
- if (dat->selection != -1 )
- dat->selection += selcontact->isSubcontact;
+ if (dat->selection !=-1 )
+ dat->selection += selcontact->isSubcontact;
}
return dat->selection;
@@ -360,13 +360,13 @@ int RestoreSelection( struct ClcData *dat, HANDLE hSelected )
void cliRebuildEntireList(HWND hwnd,struct ClcData *dat)
{
- DWORD style=GetWindowLongPtr(hwnd,GWL_STYLE);
+ DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
HANDLE hContact;
struct ClcContact * cont;
struct ClcGroup *group;
- static int rebuildCounter=0;
+ static int rebuildCounter = 0;
- BOOL PlaceOfflineToRoot=db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
+ BOOL PlaceOfflineToRoot = db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
KillTimer(hwnd,TIMERID_REBUILDAFTER);
ClearRowByIndexCache();
@@ -375,89 +375,89 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat)
RowHeights_GetMaxRowHeight(dat, hwnd);
TRACEVAR("Rebuild Entire List %d times\n",++rebuildCounter);
- dat->list.expanded=1;
- dat->list.hideOffline=db_get_b(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
+ dat->list.expanded = 1;
+ dat->list.hideOffline = db_get_b(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
dat->list.cl.count = dat->list.cl.limit = 0;
dat->list.cl.increment = 50;
- dat->NeedResort=1;
+ dat->NeedResort = 1;
HANDLE hSelected = SaveSelection( dat );
- dat->selection=-1;
- dat->HiLightMode=db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT);
+ dat->selection = -1;
+ dat->HiLightMode = db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT);
{
int i;
TCHAR *szGroupName;
DWORD groupFlags;
- for(i=1;;i++) {
- szGroupName=pcli->pfnGetGroupName(i,&groupFlags); //UNICODE
- if(szGroupName==NULL) break;
+ for(i = 1;;i++) {
+ szGroupName = pcli->pfnGetGroupName(i,&groupFlags); //UNICODE
+ if (szGroupName == NULL) break;
cli_AddGroup(hwnd,dat,szGroupName,groupFlags,i,0);
}
}
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
while(hContact)
{
- pdisplayNameCacheEntry cacheEntry=NULL;
+ pdisplayNameCacheEntry cacheEntry = NULL;
int nHiddenStatus;
- cont=NULL;
- cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
+ cont = NULL;
+ cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact);
- nHiddenStatus=CLVM_GetContactHiddenStatus(hContact, NULL, dat);
- if ( (style&CLS_SHOWHIDDEN && nHiddenStatus!=-1) || !nHiddenStatus)
+ nHiddenStatus = CLVM_GetContactHiddenStatus(hContact, NULL, dat);
+ if ( (style&CLS_SHOWHIDDEN && nHiddenStatus != -1) || !nHiddenStatus)
{
- if(lstrlen(cacheEntry->m_cache_tcsGroup)==0)
- group=&dat->list;
+ if (lstrlen(cacheEntry->m_cache_tcsGroup) == 0)
+ group = &dat->list;
else {
- group=cli_AddGroup(hwnd,dat,cacheEntry->m_cache_tcsGroup,(DWORD)-1,0,0);
+ group = cli_AddGroup(hwnd,dat,cacheEntry->m_cache_tcsGroup,(DWORD)-1,0,0);
}
- if(group!=NULL)
+ if (group != NULL)
{
- WORD wStatus=pdnce___GetStatus( cacheEntry );
- if (wStatus==ID_STATUS_OFFLINE)
+ WORD wStatus = pdnce___GetStatus( cacheEntry );
+ if (wStatus == ID_STATUS_OFFLINE)
if (PlaceOfflineToRoot)
- group=&dat->list;
+ group = &dat->list;
group->totalMembers++;
if (!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline))
{
- if(cacheEntry->m_cache_cszProto==NULL) {
+ if (cacheEntry->m_cache_cszProto == NULL) {
if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group))
- cont=AddContactToGroup(dat,group,cacheEntry);
+ cont = AddContactToGroup(dat,group,cacheEntry);
}
else
if (!pcli->pfnIsHiddenMode(dat,wStatus)||cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group))
- cont=AddContactToGroup(dat,group,cacheEntry);
+ cont = AddContactToGroup(dat,group,cacheEntry);
}
- else cont=AddContactToGroup(dat,group,cacheEntry);
+ else cont = AddContactToGroup(dat,group,cacheEntry);
}
}
if (cont)
{
- cont->SubAllocated=0;
- if (cont->proto && g_szMetaModuleName && dat->IsMetaContactsEnabled && strcmp(cont->proto,g_szMetaModuleName)==0)
+ cont->SubAllocated = 0;
+ if (cont->proto && g_szMetaModuleName && dat->IsMetaContactsEnabled && strcmp(cont->proto,g_szMetaModuleName) == 0)
AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group));
}
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
}
- if(style&CLS_HIDEEMPTYGROUPS) {
- group=&dat->list;
- group->scanIndex=0;
+ if (style&CLS_HIDEEMPTYGROUPS) {
+ group = &dat->list;
+ group->scanIndex = 0;
for (;;) {
- if(group->scanIndex==group->cl.count) {
- group=group->parent;
- if(group==NULL) break;
+ if (group->scanIndex == group->cl.count) {
+ group = group->parent;
+ if (group == NULL) break;
}
- else if(group->cl.items[group->scanIndex]->type==CLCIT_GROUP) {
- if(group->cl.items[group->scanIndex]->group->cl.count==0) {
- group=pcli->pfnRemoveItemFromGroup(hwnd,group,group->cl.items[group->scanIndex],0);
+ else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
+ if (group->cl.items[group->scanIndex]->group->cl.count == 0) {
+ group = pcli->pfnRemoveItemFromGroup(hwnd,group,group->cl.items[group->scanIndex],0);
}
else {
- group=group->cl.items[group->scanIndex]->group;
- group->scanIndex=0;
+ group = group->cl.items[group->scanIndex]->group;
+ group->scanIndex = 0;
}
continue;
}
@@ -482,27 +482,27 @@ void cli_SortCLC( HWND hwnd, struct ClcData *dat, int useInsertionSort )
int GetNewSelection(struct ClcGroup *group, int selection, int direction)
{
- int lastcount=0, count=0;//group->cl.count;
- if (selection<0) {
+ int lastcount = 0, count = 0;//group->cl.count;
+ if (selection < 0) {
return 0;
}
- group->scanIndex=0;
+ group->scanIndex = 0;
for (;;) {
- if(group->scanIndex==group->cl.count) {
- group=group->parent;
- if(group==NULL) break;
+ if (group->scanIndex == group->cl.count) {
+ group = group->parent;
+ if (group == NULL) break;
group->scanIndex++;
continue;
}
- if (count>=selection) return count;
+ if (count >= selection) return count;
lastcount = count;
count++;
if (!direction) {
if (count>selection) return lastcount;
}
- if(group->cl.items[group->scanIndex]->type==CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) {
- group=group->cl.items[group->scanIndex]->group;
- group->scanIndex=0;
+ if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) {
+ group = group->cl.items[group->scanIndex]->group;
+ group->scanIndex = 0;
continue;
}
group->scanIndex++;
@@ -526,16 +526,16 @@ struct SavedInfoState_t {
struct ClcContact contact;
};
-BOOL LOCK_RECALC_SCROLLBAR=FALSE;
+BOOL LOCK_RECALC_SCROLLBAR = FALSE;
void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat)
{
- LOCK_RECALC_SCROLLBAR=TRUE;
+ LOCK_RECALC_SCROLLBAR = TRUE;
NMCLISTCONTROL nm;
int i, j;
- OBJLIST<SavedGroupState_t> savedGroup( 4 );
- OBJLIST<SavedContactState_t> savedContact( 4 );
- OBJLIST<SavedInfoState_t> savedInfo( 4 );
+ OBJLIST < SavedGroupState_t> savedGroup( 4 );
+ OBJLIST < SavedContactState_t> savedContact( 4 );
+ OBJLIST < SavedInfoState_t> savedInfo( 4 );
struct ClcGroup *group;
struct ClcContact *contact;
@@ -642,7 +642,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat)
}
savedInfo.destroy();
- LOCK_RECALC_SCROLLBAR=FALSE;
+ LOCK_RECALC_SCROLLBAR = FALSE;
pcli->pfnRecalculateGroupCheckboxes(hwnd, dat);
pcli->pfnRecalcScrollBar(hwnd, dat);
@@ -671,11 +671,11 @@ WORD pdnce___GetStatus(pdisplayNameCacheEntry pdnce)
void pdnce___SetStatus( pdisplayNameCacheEntry pdnce, WORD wStatus )
{
- if (pdnce) pdnce->m_cache_nStatus=wStatus;
+ if (pdnce) pdnce->m_cache_nStatus = wStatus;
}
struct ClcContact* cliCreateClcContact( void )
{
- struct ClcContact* contact=(struct ClcContact*)mir_calloc(sizeof( struct ClcContact ));
+ struct ClcContact* contact = (struct ClcContact*)mir_calloc(sizeof( struct ClcContact ));
memset((void*)contact->iWideExtraImage,0xFF,sizeof(contact->iWideExtraImage));
return contact;
}
@@ -688,10 +688,10 @@ ClcCacheEntryBase* cliCreateCacheItem( HANDLE hContact )
memset(p,0,sizeof( displayNameCacheEntry ));
p->m_cache_hContact = hContact;
InvalidateDNCEbyPointer(hContact,p,0);
- p->szSecondLineText=NULL;
- p->szThirdLineText=NULL;
- p->ssSecondLine.plText=NULL;
- p->ssThirdLine.plText=NULL;
+ p->szSecondLineText = NULL;
+ p->szThirdLineText = NULL;
+ p->ssSecondLine.plText = NULL;
+ p->ssThirdLine.plText = NULL;
}
return (ClcCacheEntryBase*)p;
}
@@ -710,7 +710,7 @@ char* cli_GetGroupCountsText(struct ClcData *dat, struct ClcContact *contact)
{
char * res;
- res=corecli.pfnGetGroupCountsText(dat, contact);
+ res = corecli.pfnGetGroupCountsText(dat, contact);
return res;
}
@@ -730,14 +730,14 @@ int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly)
else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!(visibleOnly&0x01) || group->cl.items[group->scanIndex]->group->expanded)) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
- count += group->cl.count;
+ count += group->cl.count;
continue;
}
else if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) &&
(group->cl.items[group->scanIndex]->subcontacts !=NULL) &&
((group->cl.items[group->scanIndex]->SubExpanded || (!visibleOnly))))
{
- count+=group->cl.items[group->scanIndex]->SubAllocated;
+ count += group->cl.items[group->scanIndex]->SubAllocated;
}
group->scanIndex++;
}
@@ -758,23 +758,23 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
char szTemp[64];
TCHAR szGroupMask[256];
DWORD dwLocalMask;
- PDNCE pdnce=(PDNCE)pcli->pfnGetCacheEntry(hContact);
- BOOL fEmbedded=dat->force_in_dialog;
+ PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(hContact);
+ BOOL fEmbedded = dat->force_in_dialog;
// always hide subcontacts (but show them on embedded contact lists)
- if(g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0))
+ if (g_CluiData.bMetaAvail && dat !=NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0))
return -1; //subcontact
if (pdnce && pdnce->isUnknown && !fEmbedded)
return 1; //'Unknown Contact'
- if(pdnce && g_CluiData.bFilterEffective && !fEmbedded)
+ if (pdnce && g_CluiData.bFilterEffective && !fEmbedded)
{
- if(szProto == NULL)
+ if (szProto == NULL)
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
// check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set).
- if(g_CluiData.bFilterEffective & CLVM_STICKY_CONTACTS)
+ if (g_CluiData.bFilterEffective & CLVM_STICKY_CONTACTS)
{
- if ((dwLocalMask = db_get_dw(hContact, CLVM_MODULE, g_CluiData.current_viewmode, 0)) != 0) {
- if(g_CluiData.bFilterEffective & CLVM_FILTER_STICKYSTATUS)
+ if ((dwLocalMask = db_get_dw(hContact, CLVM_MODULE, g_CluiData.current_viewmode, 0)) !=0) {
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_STICKYSTATUS)
{
WORD wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return !((1 << (wStatus - ID_STATUS_OFFLINE)) & HIWORD(dwLocalMask));
@@ -783,36 +783,36 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
}
}
// check the proto, use it as a base filter result for all further checks
- if(g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS) {
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS) {
mir_snprintf(szTemp, SIZEOF(szTemp), "%s|", szProto);
filterResult = strstr(g_CluiData.protoFilter, szTemp) ? 1 : 0;
}
- if(g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
if (!DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[0]);
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0));
mir_free(dbv.ptszVal);
}
- else if(g_CluiData.filterFlags & CLVM_INCLUDED_UNGROUPED)
+ else if (g_CluiData.filterFlags & CLVM_INCLUDED_UNGROUPED)
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 1;
else
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 0;
}
- if(g_CluiData.bFilterEffective & CLVM_FILTER_STATUS) {
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_STATUS) {
WORD wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
filterResult = (g_CluiData.filterFlags & CLVM_GROUPSTATUS_OP) ? ((filterResult | ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0))) : (filterResult & ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0));
}
- if(g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG)
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG)
{
DWORD now;
- PDNCE pdnce=(PDNCE)pcli->pfnGetCacheEntry(hContact);
+ PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(hContact);
if (pdnce)
{
now = g_CluiData.t_now;
- now -= g_CluiData.lastMsgFilter;
- if(g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN)
+ now -= g_CluiData.lastMsgFilter;
+ if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN)
filterResult = filterResult & (pdnce->dwLastMsgTime < now);
- else if(g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_NEWERTHAN)
+ else if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_NEWERTHAN)
filterResult = filterResult & (pdnce->dwLastMsgTime > now);
}
}