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/TipperYM/src/popwin.cpp | |
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/TipperYM/src/popwin.cpp')
-rw-r--r-- | plugins/TipperYM/src/popwin.cpp | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 290c1fcdd6..03682178bb 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -1551,13 +1551,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_NUMCONTACTS) {
int iCount = 0, iCountOnline = 0;
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- char *proto = GetContactProto(hContact);
- if (proto && !strcmp(proto, pa->szModuleName)) {
- if (db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- iCountOnline++;
- iCount++;
- }
+ for (HANDLE hContact = db_find_first(pa->szModuleName); hContact; hContact = db_find_next(hContact, pa->szModuleName)) {
+ if (db_get_w(hContact, pa->szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ iCountOnline++;
+ iCount++;
}
mir_sntprintf(buff, 64, _T("(%d/%d)"), iCountOnline, iCount);
}
@@ -1679,32 +1676,33 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (db_get_b(hContact, MODULE, "FavouriteContact", 0)) {
char *proto = GetContactProto(hContact);
- if (proto) {
- WORD wStatus = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
- WordToStatusDesc(hContact, proto, "Status", swzStatus, 256);
-
- if (wStatus != ID_STATUS_OFFLINE)
- iCountOnline++;
-
- iCount++;
-
- if ( !(opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE && wStatus == ID_STATUS_OFFLINE)) {
- if (!bTitlePainted) {
- AddRow(pwd, TranslateT("Fav. contacts"), NULL, NULL, false, false, !bFirstItem, true, NULL);
- bFirstItem = false;
- bTitlePainted = true;
- }
-
- TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
- if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) {
- TCHAR *swzProto = a2t(proto);
- mir_sntprintf(swzName, 256, _T("%s (%s)"), swzNick, swzProto);
- mir_free(swzProto);
- }
- else _tcscpy(swzName, swzNick);
-
- AddRow(pwd, swzName, swzStatus, NULL, false, false, false);
+ if (proto == NULL)
+ continue;
+
+ WORD wStatus = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ WordToStatusDesc(hContact, proto, "Status", swzStatus, 256);
+
+ if (wStatus != ID_STATUS_OFFLINE)
+ iCountOnline++;
+
+ iCount++;
+
+ if ( !(opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE && wStatus == ID_STATUS_OFFLINE)) {
+ if (!bTitlePainted) {
+ AddRow(pwd, TranslateT("Fav. contacts"), NULL, NULL, false, false, !bFirstItem, true, NULL);
+ bFirstItem = false;
+ bTitlePainted = true;
}
+
+ TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
+ if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) {
+ TCHAR *swzProto = a2t(proto);
+ mir_sntprintf(swzName, 256, _T("%s (%s)"), swzNick, swzProto);
+ mir_free(swzProto);
+ }
+ else _tcscpy(swzName, swzNick);
+
+ AddRow(pwd, swzName, swzStatus, NULL, false, false, false);
}
}
}
|