summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_contact.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 08:04:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 08:04:30 +0000
commitddba4ede6b451d0cfcd0d32b5180fbd0689966bf (patch)
tree5d74f37a7013d13b92c182628d6b68a58e148ae4 /plugins/Clist_modern/src/modern_contact.cpp
parentc39340bf493a1745a41317bbf937fc7eb6cbb26a (diff)
- HANDLE hContact => HCONTACT
- GCF_* prefix was added to chat constants to avoid name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@8078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/modern_contact.cpp')
-rw-r--r--plugins/Clist_modern/src/modern_contact.cpp46
1 files changed, 20 insertions, 26 deletions
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp
index b1e297d58b..a4390b70d6 100644
--- a/plugins/Clist_modern/src/modern_contact.cpp
+++ b/plugins/Clist_modern/src/modern_contact.cpp
@@ -42,15 +42,15 @@ struct
{ID_STATUS_ONTHEPHONE,150},
{ID_STATUS_OUTTOLUNCH,425}};
-static int GetContactStatus(HANDLE hContact)
+static int GetContactStatus(HCONTACT hContact)
{
return (GetContactCachedStatus(hContact));
}
-void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add)
+void cli_ChangeContactIcon(HCONTACT hContact, int iIcon, int add)
{
- corecli.pfnChangeContactIcon((HANDLE) hContact,(int)iIcon,(int)add);
+ corecli.pfnChangeContactIcon(hContact, iIcon, add);
}
static int GetStatusModeOrdering(int statusMode)
@@ -62,7 +62,7 @@ static int GetStatusModeOrdering(int statusMode)
}
-DWORD CompareContacts2_getLMTime(HANDLE hContact)
+DWORD CompareContacts2_getLMTime(HCONTACT hContact)
{
HANDLE hDbEvent = db_event_last(hContact);
while(hDbEvent) {
@@ -95,16 +95,14 @@ int GetProtoIndex(char * szName)
int CompareContacts2(const ClcContact *contact1,const ClcContact *contact2, int by)
{
- HANDLE a;
- HANDLE b;
TCHAR *namea, *nameb;
int statusa,statusb;
char *szProto1,*szProto2;
if ((INT_PTR)contact1 < 100 || (INT_PTR)contact2 < 100) return 0;
- a = contact1->hContact;
- b = contact2->hContact;
+ HCONTACT a = contact1->hContact;
+ HCONTACT b = contact2->hContact;
namea = (TCHAR *)contact1->szText;
statusa = GetContactCachedStatus(contact1->hContact);
@@ -118,39 +116,35 @@ int CompareContacts2(const ClcContact *contact1,const ClcContact *contact2, int
int ordera,orderb;
ordera = GetStatusModeOrdering(statusa);
orderb = GetStatusModeOrdering(statusb);
- if (ordera != orderb) return ordera-orderb;
- else return 0;
+ return (ordera != orderb) ? ordera - orderb : 0;
}
-
- if (g_CluiData.fSortNoOfflineBottom == 0 && (statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { //one is offline: offline goes below online
+ //one is offline: offline goes below online
+ if (g_CluiData.fSortNoOfflineBottom == 0 && (statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE))
return 2*(statusa == ID_STATUS_OFFLINE)-1;
- }
- if (by == SORTBY_NAME)
- { //name
+ if (by == SORTBY_NAME) //name
return mir_tstrcmpi(namea,nameb);
- }
- if (by == SORTBY_NAME_LOCALE)
- { //name
+
+ if (by == SORTBY_NAME_LOCALE) {
+ //name
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)
- { //last message
+ if (by == SORTBY_LASTMSG) {
+ //last message
DWORD ta = CompareContacts2_getLMTime(a);
DWORD tb = CompareContacts2_getLMTime(b);
return tb-ta;
}
- else if (by == SORTBY_PROTO)
- {
+ if (by == SORTBY_PROTO) {
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)
- return contact2->bContactRate-contact1->bContactRate;
+ else if (by == SORTBY_RATE)
+ return contact2->bContactRate - contact1->bContactRate;
// else :o)
return 0;
}