diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-15 21:04:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-15 21:04:26 +0000 |
commit | d949a7ed17fd90bfc1ee5d85c83812b974037531 (patch) | |
tree | c33e397185df5c4c974afa4ad385fa63dc48e637 /plugins/Clist_mw/src/contact.cpp | |
parent | 90b4d09356a49c0f1c9f4ca0dc1cbc27f11fc2ae (diff) |
- fix for the Online/Offline button in clist_mw
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@2320 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw/src/contact.cpp')
-rw-r--r-- | plugins/Clist_mw/src/contact.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index 6899374b7b..088e125d51 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -53,7 +53,7 @@ static int GetContactStatus(HANDLE hContact) szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
if (szProto == NULL) return ID_STATUS_OFFLINE;
- return DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE);
+ return db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE);
*/
return (GetContactCachedStatus(hContact));
}
@@ -75,30 +75,22 @@ static int GetStatusModeOrdering(int statusMode) void LoadContactTree(void)
{
- HANDLE hContact;
- int i,hideOffline,status,tick;
- pClcCacheEntry cacheEntry;
-
-
-
- tick = GetTickCount();
+ int tick = GetTickCount();
CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
- for (i = 1;;i++) {
- if ((char*)CallService(MS_CLIST_GROUPGETNAME2,i,(LPARAM)(int*)NULL) == NULL) break;
- CallService(MS_CLUI_GROUPADDED,i,0);
- }
+ for (int i=1;; i++)
+ if ((char*)CallService(MS_CLIST_GROUPGETNAME2, i, 0) != NULL)
+ CallService(MS_CLUI_GROUPADDED, i, 0);
- hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
- hContact = db_find_first();
+ int hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
+ HANDLE hContact = db_find_first();
while(hContact != NULL) {
- cacheEntry = GetContactFullCacheEntry(hContact);
- if (cacheEntry == NULL)
- {
+ ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(hContact);
+ if (cacheEntry == NULL) {
MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!",0);
break;
}
- status = cacheEntry->status;
+ int status = cacheEntry->status;
if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->bIsHidden)
ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1);
hContact = db_find_next(hContact);
@@ -111,13 +103,10 @@ void LoadContactTree(void) CallService(MS_CLUI_LISTENDREBUILD,0,0);
tick = GetTickCount()-tick;
- {
+
char buf[255];
- //sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick);
sprintf(buf,"LoadContactTree %d \r\n",tick);
-
OutputDebugStringA(buf);
- }
}
#define SAFESTRING(a) a?a:""
@@ -191,7 +180,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam) if ((HANDLE)lParam == NULL)
DBDeleteContactSetting((HANDLE)wParam,"CList","Group");
else
- DBWriteContactSettingString((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL));
+ db_set_s((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL));
CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0),GetContactStatus((HANDLE)wParam)));
return 0;
}
|