From 9e791b8e15d0d5d8686436ed9eee010e670b858b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 9 Feb 2015 14:03:33 +0000 Subject: - fix for 'change subject' notifications; - merge from branch git-svn-id: http://svn.miranda-ng.org/main/trunk@12062 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/dialogs.cpp | 62 ++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'protocols/WhatsApp/src/dialogs.cpp') diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index e482cdfa9d..67c12c7475 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -15,9 +15,7 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, 3, 0); SendDlgItemMessage(hwndDlg, IDC_PW2, EM_LIMITTEXT, 3, 0); - - CheckDlgButton(hwndDlg, IDC_SSL, proto->getBool(WHATSAPP_KEY_SSL, false) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTORUN, proto->getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SSL, db_get_b(NULL, proto->m_szModuleName, WHATSAPP_KEY_SSL, 0) ? BST_CHECKED : BST_UNCHECKED); { ptrA szStr(proto->getStringA(WHATSAPP_KEY_CC)); if (szStr != NULL) @@ -83,23 +81,15 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA } } - if (HWND(lParam) == GetFocus()) { - if (HIWORD(wParam) == EN_CHANGE) { - switch (LOWORD(wParam)) { - case IDC_CC: - case IDC_LOGIN: - case IDC_NICK: - case IDC_PW: - case IDC_PW2: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - else if (HIWORD(wParam) == BN_CLICKED) { - switch (LOWORD(wParam)) { - case IDC_AUTORUN: - case IDC_SSL: - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } + if (HIWORD(wParam) == EN_CHANGE && reinterpret_cast(lParam) == GetFocus()) { + switch (LOWORD(wParam)) { + case IDC_CC: + case IDC_LOGIN: + case IDC_NICK: + case IDC_SSL: + case IDC_PW: + case IDC_PW2: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } break; @@ -118,7 +108,6 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA proto->setString(WHATSAPP_KEY_NICK, str); proto->setByte(WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwndDlg, IDC_SSL)); - proto->setByte(WHATSAPP_KEY_AUTORUNCHATS, IsDlgButtonChecked(hwndDlg, IDC_AUTORUN)); return TRUE; } break; @@ -130,6 +119,16 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA ///////////////////////////////////////////////////////////////////////////////////////// // Invite dialog +static void FilterList(HWND hwndClist, WhatsAppProto *ppro) +{ + for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + char *proto = GetContactProto(hContact); + if (mir_strcmp(proto, ppro->m_szModuleName) || ppro->isChatRoom(hContact)) + if (MCONTACT hItem = SendMessage(hwndClist, CLM_FINDCONTACT, hContact, 0)) + SendMessage(hwndClist, CLM_DELETEITEM, hItem, 0); + } +} + static void InitList(HWND hwndClist, WhatsAppProto *ppro) { SetWindowLongPtr(hwndClist, GWL_STYLE, @@ -146,13 +145,8 @@ static void InitList(HWND hwndClist, WhatsAppProto *ppro) for (int i = 0; i <= FONTID_MAX; i++) SendMessage(hwndClist, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT)); - - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - char *proto = GetContactProto(hContact); - if (mir_strcmp(proto, ppro->m_szModuleName) || ppro->isChatRoom(hContact)) - if (MCONTACT hItem = SendMessage(hwndClist, CLM_FINDCONTACT, hContact, 0)) - SendMessage(hwndClist, CLM_DELETEITEM, hItem, 0); - } + + FilterList(hwndClist, ppro); } INT_PTR CALLBACK InviteDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -168,7 +162,17 @@ INT_PTR CALLBACK InviteDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM InitList(GetDlgItem(hwndDlg, IDC_CLIST), proto); return 1; - + + case WM_NOTIFY: + if (((LPNMHDR)lParam)->idFrom == IDC_CLIST) { + switch (((LPNMHDR)lParam)->code) { + case CLN_LISTREBUILT: + case CLN_NEWCONTACT: + FilterList(((LPNMHDR)lParam)->hwndFrom, proto); + } + } + break; + case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: -- cgit v1.2.3