diff options
Diffstat (limited to 'plugins/Clist_modern/modern_contact.cpp')
-rw-r--r-- | plugins/Clist_modern/modern_contact.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/plugins/Clist_modern/modern_contact.cpp b/plugins/Clist_modern/modern_contact.cpp index 1b43db4610..9f5a98d492 100644 --- a/plugins/Clist_modern/modern_contact.cpp +++ b/plugins/Clist_modern/modern_contact.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct
{
int m_cache_nStatus,order;
-} statusModeOrder[]={
+} statusModeOrder[] = {
{ID_STATUS_OFFLINE,500},
{ID_STATUS_ONLINE,10},
{ID_STATUS_AWAY,200},
@@ -54,8 +54,8 @@ void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add) static int GetStatusModeOrdering(int statusMode)
{
int i;
- for(i=0;i<SIZEOF(statusModeOrder);i++)
- if(statusModeOrder[i].m_cache_nStatus==statusMode) return statusModeOrder[i].order;
+ for(i = 0;i < SIZEOF(statusModeOrder);i++)
+ if (statusModeOrder[i].m_cache_nStatus == statusMode) return statusModeOrder[i].order;
return 1000;
}
@@ -71,7 +71,7 @@ DWORD CompareContacts2_getLMTime(HANDLE hContact) dbei.pBlob = 0;
dbei.cbBlob = 0;
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
- if(dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
+ if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
return dbei.timestamp;
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
}
@@ -83,12 +83,12 @@ DWORD CompareContacts2_getLMTime(HANDLE hContact) int GetProtoIndex(char * szName)
{
- PROTOACCOUNT **accs=NULL;
- int accCount=0;
+ PROTOACCOUNT **accs = NULL;
+ int accCount = 0;
int i;
if (!szName) return -1;
ProtoEnumAccounts( &accCount, &accs );
- for (i=0; i<accCount; i++)
+ for (i = 0; i < accCount; i++)
if (!mir_strcmpi(szName,accs[i]->szModuleName))
return accs[i]->iOrder;
return -1;
@@ -103,57 +103,57 @@ int CompareContacts2(const struct ClcContact *contact1,const struct ClcContact * int statusa,statusb;
char *szProto1,*szProto2;
- if ((INT_PTR)contact1<100 || (INT_PTR)contact2<100) return 0;
+ if ((INT_PTR)contact1 < 100 || (INT_PTR)contact2 < 100) return 0;
- a=contact1->hContact;
- b=contact2->hContact;
+ a = contact1->hContact;
+ b = contact2->hContact;
- namea=(TCHAR *)contact1->szText;
- statusa=GetContactCachedStatus(contact1->hContact);
- szProto1=contact1->proto;
+ namea = (TCHAR *)contact1->szText;
+ statusa = GetContactCachedStatus(contact1->hContact);
+ szProto1 = contact1->proto;
- nameb=(TCHAR *)contact2->szText;
- statusb=GetContactCachedStatus(contact2->hContact);
- szProto2=contact2->proto;
+ nameb = (TCHAR *)contact2->szText;
+ statusb = GetContactCachedStatus(contact2->hContact);
+ szProto2 = contact2->proto;
- if (by==SORTBY_STATUS)
+ if (by == SORTBY_STATUS)
{ //status
int ordera,orderb;
- ordera=GetStatusModeOrdering(statusa);
- orderb=GetStatusModeOrdering(statusb);
- if(ordera!=orderb) return ordera-orderb;
+ ordera = GetStatusModeOrdering(statusa);
+ orderb = GetStatusModeOrdering(statusb);
+ if (ordera != orderb) return ordera-orderb;
else return 0;
}
- if(g_CluiData.fSortNoOfflineBottom==0 && (statusa==ID_STATUS_OFFLINE)!=(statusb==ID_STATUS_OFFLINE)) { //one is offline: offline goes below online
- return 2*(statusa==ID_STATUS_OFFLINE)-1;
+ if (g_CluiData.fSortNoOfflineBottom == 0 && (statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { //one is offline: offline goes below online
+ return 2*(statusa == ID_STATUS_OFFLINE)-1;
}
- if (by==SORTBY_NAME)
+ if (by == SORTBY_NAME)
{ //name
return mir_tstrcmpi(namea,nameb);
}
- if (by==SORTBY_NAME_LOCALE)
+ if (by == SORTBY_NAME_LOCALE)
{ //name
- static int LocaleId=-1;
- if (LocaleId==-1) LocaleId=CallService(MS_LANGPACK_GETLOCALE,0,0);
+ static int LocaleId = -1;
+ if (LocaleId == -1) LocaleId = CallService(MS_LANGPACK_GETLOCALE,0,0);
return (CompareString(LocaleId,NORM_IGNORECASE,SAFETSTRING(namea),-1,SAFETSTRING(nameb),-1))-2;
}
- else if (by==SORTBY_LASTMSG)
+ else if (by == SORTBY_LASTMSG)
{ //last message
- DWORD ta=CompareContacts2_getLMTime(a);
- DWORD tb=CompareContacts2_getLMTime(b);
+ DWORD ta = CompareContacts2_getLMTime(a);
+ DWORD tb = CompareContacts2_getLMTime(b);
return tb-ta;
}
- else if (by==SORTBY_PROTO)
+ else if (by == SORTBY_PROTO)
{
- int rc=GetProtoIndex(szProto1)-GetProtoIndex(szProto2);
+ int rc = GetProtoIndex(szProto1)-GetProtoIndex(szProto2);
- if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) return rc;
+ if (rc !=0 && (szProto1 !=NULL && szProto2 !=NULL)) return rc;
}
- else if (by==SORTBY_RATE)
+ else if (by == SORTBY_RATE)
return contact2->bContactRate-contact1->bContactRate;
// else :o)
return 0;
@@ -162,10 +162,10 @@ int CompareContacts2(const struct ClcContact *contact1,const struct ClcContact * int cliCompareContacts(const struct ClcContact *contact1,const struct ClcContact *contact2)
{
int i, r;
- for (i=0; i<SIZEOF(g_CluiData.bSortByOrder); i++)
+ for (i = 0; i < SIZEOF(g_CluiData.bSortByOrder); i++)
{
- r=CompareContacts2(contact1, contact2, g_CluiData.bSortByOrder[i]);
- if (r!=0)
+ r = CompareContacts2(contact1, contact2, g_CluiData.bSortByOrder[i]);
+ if (r != 0)
return r;
}
return 0;
@@ -176,7 +176,7 @@ int cliCompareContacts(const struct ClcContact *contact1,const struct ClcContact INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam)
{
CallService(MS_CLUI_CONTACTDELETED,wParam,0);
- if ((HANDLE)lParam==NULL)
+ if ((HANDLE)lParam == NULL)
db_unset((HANDLE)wParam,"CList","Group");
else
db_set_ws((HANDLE)wParam,"CList","Group",pcli->pfnGetGroupName(lParam, NULL));
@@ -200,8 +200,8 @@ INT_PTR ToggleGroups(WPARAM wParam,LPARAM lParam) INT_PTR SetUseGroups(WPARAM wParam, LPARAM lParam)
{
- int newVal= !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS);
- if ( wParam != -1 )
+ int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS);
+ if ( wParam !=-1 )
{
if ( !newVal == wParam ) return 0;
newVal = wParam;
|