summaryrefslogtreecommitdiff
path: root/plugins/TipperYM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TipperYM')
-rw-r--r--plugins/TipperYM/src/options.cpp92
-rw-r--r--plugins/TipperYM/src/popwin.cpp62
2 files changed, 71 insertions, 83 deletions
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index 84ad4272c8..f422396f33 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -2072,71 +2072,61 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0);
- else
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) TRUE, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
+ if (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0);
+ else
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
+ {
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem && db_get_b(hContact, MODULE, "FavouriteContact", 0))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
}
-
- CheckDlgButton(hwndDlg, IDC_CHK_HIDEOFFLINE, opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE);
- CheckDlgButton(hwndDlg, IDC_CHK_APPENDPROTO, opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO);
-
- return TRUE;
}
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDC_BTN_OK:
- {
- BYTE isChecked;
- int count = 0;
+ CheckDlgButton(hwndDlg, IDC_CHK_HIDEOFFLINE, opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE);
+ CheckDlgButton(hwndDlg, IDC_CHK_APPENDPROTO, opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO);
+ return TRUE;
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hItem)
- {
- isChecked = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
- db_set_b(hContact, MODULE, "FavouriteContact", isChecked);
- if (isChecked) count++;
- }
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_BTN_OK:
+ {
+ BYTE isChecked;
+ int count = 0;
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ if (hItem) {
+ isChecked = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0);
+ db_set_b(hContact, MODULE, "FavouriteContact", isChecked);
+ if (isChecked) count++;
}
- db_set_dw(0, MODULE, "FavouriteContactsCount", count);
+ }
+ db_set_dw(0, MODULE, "FavouriteContactsCount", count);
- opt.iFavoriteContFlags = 0;
- opt.iFavoriteContFlags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? FAVCONT_HIDE_OFFLINE : 0 |
- IsDlgButtonChecked(hwndDlg, IDC_CHK_APPENDPROTO) ? FAVCONT_APPEND_PROTO : 0;
+ opt.iFavoriteContFlags = 0;
+ opt.iFavoriteContFlags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? FAVCONT_HIDE_OFFLINE : 0 |
+ IsDlgButtonChecked(hwndDlg, IDC_CHK_APPENDPROTO) ? FAVCONT_APPEND_PROTO : 0;
- db_set_dw(0, MODULE, "FavContFlags", opt.iFavoriteContFlags);
- } // fall through
- case IDC_BTN_CANCEL:
- {
- DestroyWindow(hwndDlg);
- break;
- }
- }
- return TRUE;
- }
- case WM_CLOSE:
- {
+ db_set_dw(0, MODULE, "FavContFlags", opt.iFavoriteContFlags);
+ } // fall through
+ case IDC_BTN_CANCEL:
DestroyWindow(hwndDlg);
- return TRUE;
+ break;
}
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ return TRUE;
}
return FALSE;
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);
}
}
}