diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-09 21:40:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-09 21:40:22 +0000 |
commit | 3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c (patch) | |
tree | efee912ee654baafeb98efcd117921db6b7489bc /plugins/QuickContacts | |
parent | bcb27264ba737778e5d3edad36088bacf74f0236 (diff) |
- the kernel filters out contacts by proto names much faster than a plugin;
- database cycles simplified
git-svn-id: http://svn.miranda-ng.org/main/trunk@4404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/QuickContacts')
-rw-r--r-- | plugins/QuickContacts/src/quickcontacts.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 1a978df72b..d554ecf031 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -361,89 +361,89 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *pszProto = GetContactProto(hContact);
- if(pszProto != NULL)
+ if(pszProto == NULL)
+ continue;
+
+ // Get meta
+ HANDLE hMeta = NULL;
+ if (metacontactsEnabled)
{
- // Get meta
- HANDLE hMeta = NULL;
- if (metacontactsEnabled)
- {
- if ((!show_all && opts.hide_subcontacts) || opts.group_append)
- hMeta = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
- }
- else
- {
- if (metacontacts_proto != NULL && strcmp(metacontacts_proto, pszProto) == 0)
- continue;
- }
+ if ((!show_all && opts.hide_subcontacts) || opts.group_append)
+ hMeta = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
+ }
+ else
+ {
+ if (metacontacts_proto != NULL && strcmp(metacontacts_proto, pszProto) == 0)
+ continue;
+ }
- if (!show_all)
+ if (!show_all)
+ {
+ // Check if is offline and have to show
+ if (GetStatus(hContact, pszProto) <= ID_STATUS_OFFLINE)
{
- // Check if is offline and have to show
- if (GetStatus(hContact, pszProto) <= ID_STATUS_OFFLINE)
- {
- // See if has to show
- char setting[128];
- mir_snprintf(setting, sizeof(setting), "ShowOffline%s", pszProto);
+ // See if has to show
+ char setting[128];
+ mir_snprintf(setting, sizeof(setting), "ShowOffline%s", pszProto);
- if (!db_get_b(NULL, MODULE_NAME, setting, FALSE))
- continue;
+ if (!db_get_b(NULL, MODULE_NAME, setting, FALSE))
+ continue;
- // Check if proto offline
- else if (opts.hide_from_offline_proto
- && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) <= ID_STATUS_OFFLINE)
- continue;
+ // Check if proto offline
+ else if (opts.hide_from_offline_proto
+ && CallProtoService(pszProto, PS_GETSTATUS, 0, 0) <= ID_STATUS_OFFLINE)
+ continue;
- }
+ }
- // Check if is subcontact
- if (opts.hide_subcontacts && hMeta != NULL)
- {
- if (!opts.keep_subcontacts_from_offline)
- continue;
+ // Check if is subcontact
+ if (opts.hide_subcontacts && hMeta != NULL)
+ {
+ if (!opts.keep_subcontacts_from_offline)
+ continue;
- if (GetStatus(hMeta, metacontacts_proto) > ID_STATUS_OFFLINE)
- {
+ if (GetStatus(hMeta, metacontacts_proto) > ID_STATUS_OFFLINE)
+ {
+ continue;
+ }
+ else
+ {
+ char setting[128];
+ mir_snprintf(setting, sizeof(setting), "ShowOffline%s", metacontacts_proto);
+ if (db_get_b(NULL, MODULE_NAME, setting, FALSE))
continue;
- }
- else
- {
- char setting[128];
- mir_snprintf(setting, sizeof(setting), "ShowOffline%s", metacontacts_proto);
- if (db_get_b(NULL, MODULE_NAME, setting, FALSE))
- continue;
- }
}
}
+ }
- // Add to list
+ // Add to list
- // Get group
- c_struct *contact = new c_struct();
+ // Get group
+ c_struct *contact = new c_struct();
- if (opts.group_append)
+ if (opts.group_append)
+ {
+ DBVARIANT dbv;
+ if (db_get_ts(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
- DBVARIANT dbv;
- if (db_get_ts(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
- {
- if (dbv.ptszVal != NULL)
- lstrcpyn(contact->szgroup, dbv.ptszVal, SIZEOF(contact->szgroup));
+ if (dbv.ptszVal != NULL)
+ lstrcpyn(contact->szgroup, dbv.ptszVal, SIZEOF(contact->szgroup));
- db_free(&dbv);
- }
+ db_free(&dbv);
}
+ }
- // Make contact name
- TCHAR *tmp = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR);
- lstrcpyn(contact->szname, tmp, SIZEOF(contact->szname));
+ // Make contact name
+ TCHAR *tmp = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR);
+ lstrcpyn(contact->szname, tmp, SIZEOF(contact->szname));
- PROTOACCOUNT *acc = ProtoGetAccount(pszProto);
- if (acc != NULL)
- lstrcpyn(contact->proto, acc->tszAccountName, SIZEOF(contact->proto));
+ PROTOACCOUNT *acc = ProtoGetAccount(pszProto);
+ if (acc != NULL)
+ lstrcpyn(contact->proto, acc->tszAccountName, SIZEOF(contact->proto));
- contact->hcontact = hContact;
- contacts.insert(contact);
- }
+ contact->hcontact = hContact;
+ contacts.insert(contact);
}
SortArray();
|