From 8fceb2db2ea58d7d105194b4e03a80ddd566ad6e Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 22 May 2014 18:28:59 +0000 Subject: GMailNotifier: -Fixed hangup in options (fixes #675) -Fixed Apply button -ressource fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@9280 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/GmailNotifier/src/check.cpp | 2 +- plugins/GmailNotifier/src/gmail.h | 4 +-- plugins/GmailNotifier/src/main.cpp | 8 ++--- plugins/GmailNotifier/src/notify.cpp | 6 ++-- plugins/GmailNotifier/src/options.cpp | 62 +++++++++++++++++++++-------------- plugins/GmailNotifier/src/resource.h | 15 ++++----- 6 files changed, 55 insertions(+), 42 deletions(-) (limited to 'plugins/GmailNotifier/src') diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp index 06f73d6326..b3821cb7cf 100644 --- a/plugins/GmailNotifier/src/check.cpp +++ b/plugins/GmailNotifier/src/check.cpp @@ -128,7 +128,7 @@ error_handle: curAcc->IsChecking = FALSE; } -void __cdecl Check_ThreadFunc(LPVOID lpParam) +void __cdecl Check_ThreadFunc(void *lpParam) { InternetSetCookieA("https://mail.google.com/mail/", "GX", ""); if (lpParam) { diff --git a/plugins/GmailNotifier/src/gmail.h b/plugins/GmailNotifier/src/gmail.h index 4f95173141..67e5eeda85 100644 --- a/plugins/GmailNotifier/src/gmail.h +++ b/plugins/GmailNotifier/src/gmail.h @@ -85,8 +85,8 @@ BOOL GetBrowser(char *); void CheckMailInbox(Account *); void NotifyUser(Account *); int OptInit(WPARAM, LPARAM); -void Check_ThreadFunc(LPVOID); -void Login_ThreadFunc(LPVOID); +void Check_ThreadFunc(void *); +void Login_ThreadFunc(void *); int OpenBrowser(WPARAM , LPARAM); int ParsePage(char *, resultLink *); void DeleteResults(resultLink *); diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 6428e1f151..06760df072 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -61,12 +61,12 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { PluginMenuCommand(0, 0); } -INT_PTR PluginMenuCommand(WPARAM hContact, LPARAM lParam) +INT_PTR PluginMenuCommand(WPARAM hContact, LPARAM) { if (!optionWindowIsOpen) mir_forkthread(Check_ThreadFunc, GetAccountByContact(hContact)); @@ -74,7 +74,7 @@ INT_PTR PluginMenuCommand(WPARAM hContact, LPARAM lParam) return 0; } -static int OnMirandaStart(WPARAM wParam, LPARAM lParam) +static int OnMirandaStart(WPARAM, LPARAM) { PluginMenuCommand(0, 0); return 0; @@ -87,7 +87,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" int __declspec(dllexport) Load() { - SkinAddNewSoundEx("Gmail", "Other", "Gmail: New Thread(s)"); + SkinAddNewSoundEx("Gmail", LPGEN("Other"), LPGEN("Gmail: New Thread(s)")); HookEvent(ME_CLIST_DOUBLECLICKED, OpenBrowser); PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index cce1dccc07..a684e5ff0c 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -21,7 +21,7 @@ int OpenBrowser(WPARAM hContact, LPARAM lParam) return FALSE; } -INT_PTR Notifying(WPARAM wParam, LPARAM lParam) +INT_PTR Notifying(WPARAM, LPARAM lParam) { OpenBrowser(((CLISTEVENT*)lParam)->hContact, 0); return 0; @@ -116,7 +116,7 @@ void NotifyUser(Account *curAcc) ppd.PluginData = NULL; ppd.iSeconds = opt.popupDuration; PUDeletePopup(curAcc->popUpHwnd); - CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0); + PUAddPopup(&ppd); } if (newMails > 0) SkinPlaySound("Gmail"); @@ -135,7 +135,7 @@ void DeleteResults(resultLink *prst) } } -void __cdecl Login_ThreadFunc(LPVOID lpParam) +void __cdecl Login_ThreadFunc(void *lpParam) { if (lpParam == NULL) return; diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 7700c140ca..9d23d99357 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -22,7 +22,6 @@ LRESULT WINAPI FlatComboProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - int i; int ShowControl; char str[MAX_PATH] = { 0 }; char *tail; @@ -52,8 +51,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA // Perform the subclass SetWindowLongPtr(hwndCombo, GWLP_WNDPROC, (LONG_PTR)FlatComboProc); - for (i = 0; i < acc_num; i++) - SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LONG)(LPSTR)acc[i].name); + for (int i = 0; i < acc_num; i++) + SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LONG)acc[i].name); SendMessage(hwndCombo, CB_SETCURSEL, curIndex, 0); if (curIndex < acc_num) SetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass); @@ -110,13 +109,16 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return TRUE; case WM_COMMAND: - if (LOWORD(wParam) == IDC_SYSDEF || LOWORD(wParam) == IDC_USEIE || LOWORD(wParam) == IDC_STARTPRG) { + switch (LOWORD(wParam)) { + case IDC_SYSDEF: + case IDC_USEIE: + case IDC_STARTPRG: ShowControl = IsDlgButtonChecked(hwndDlg, IDC_STARTPRG) ? SW_SHOW : SW_HIDE; ShowWindow(GetDlgItem(hwndDlg, IDC_PRG), ShowControl); ShowWindow(GetDlgItem(hwndDlg, IDC_PRGBROWSE), ShowControl); - } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; - switch (LOWORD(wParam)) { case IDC_OPTPOP: ShowControl = IsDlgButtonChecked(hwndDlg, IDC_OPTPOP) ? SW_SHOW : SW_HIDE; ShowWindow(GetDlgItem(hwndDlg, IDC_DURATION), ShowControl); @@ -126,6 +128,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC_COLOR), ShowControl); ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC_LESS), ShowControl); ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC_SEC), ShowControl); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_PRGBROWSE: @@ -140,35 +143,39 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA OpenFileName.lpstrFile = szName; OpenFileName.nMaxFile = _MAX_PATH; OpenFileName.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; - if (!GetOpenFileName((LPOPENFILENAME)&OpenFileName)) + if (!GetOpenFileName(&OpenFileName)) return 0; SetDlgItemText(hwndDlg, IDC_PRG, szName); } + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_BTNADD: acc_num++; acc = (Account *)realloc(acc, acc_num * sizeof(Account)); - curIndex = SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LONG)(LPSTR)""); + curIndex = SendMessageA(hwndCombo, CB_ADDSTRING, 0, (LONG)""); memset(&acc[curIndex], 0, sizeof(Account)); SendMessage(hwndCombo, CB_SETCURSEL, curIndex, 0); SetDlgItemTextA(hwndDlg, IDC_PASS, ""); SetFocus(hwndCombo); acc[curIndex].hContact = CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)acc[curIndex].hContact, (LPARAM)pluginName); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_BTNSAV: - GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, 64); - tail = strstr(acc[curIndex].name, "@"); - if (tail && lstrcmpA(tail + 1, "gmail.com") != 0) - lstrcpyA(acc[curIndex].hosted, tail + 1); - SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0); - SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LONG)(LPSTR)acc[curIndex].name); - SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0); - db_set_s(acc[curIndex].hContact, pluginName, "name", acc[curIndex].name); - db_set_s(acc[curIndex].hContact, pluginName, "Nick", acc[curIndex].name); - GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, 64); - db_set_s(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass); + if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, 64)) { + tail = strstr(acc[curIndex].name, "@"); + if (tail && lstrcmpA(tail + 1, "gmail.com") != 0) + lstrcpyA(acc[curIndex].hosted, tail + 1); + SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0); + SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LONG_PTR)acc[curIndex].name); + SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0); + db_set_s(acc[curIndex].hContact, pluginName, "name", acc[curIndex].name); + db_set_s(acc[curIndex].hContact, pluginName, "Nick", acc[curIndex].name); + GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, 64); + db_set_s(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } break; case IDC_BTNDEL: @@ -176,22 +183,29 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage(hwndCombo, CB_DELETESTRING, curIndex, 0); DeleteResults(acc[curIndex].results.next); acc[curIndex].results.next = NULL; - CallService(MS_DB_CONTACT_DELETE, (WPARAM)(HANDLE)acc[curIndex].hContact, 0); - for (i = curIndex; i < acc_num; i++) + CallService(MS_DB_CONTACT_DELETE, (WPARAM)acc[curIndex].hContact, 0); + for (int i = curIndex; i < acc_num; i++) acc[i] = acc[i + 1]; curIndex = 0; SendMessage(hwndCombo, CB_SETCURSEL, 0, 0); SetDlgItemTextA(hwndDlg, IDC_PASS, acc[0].pass); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_NAME: if (HIWORD(wParam) == CBN_SELCHANGE) { curIndex = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0); SetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } + break; + case IDC_ONLINE: + case IDC_SHOWICON: + case IDC_AUTOLOGIN: + case IDC_LOGTHREADS: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return TRUE; case WM_NOTIFY: @@ -244,7 +258,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA db_set_dw(NULL, pluginName, "LogThreads", opt.LogThreads); ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; - for (i = 0; i < acc_num; i++) + for (int i = 0; i < acc_num; i++) db_set_w(acc[i].hContact, pluginName, "Status", ID_STATUS_NONEW); } return TRUE; @@ -256,7 +270,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return FALSE; } -int OptInit(WPARAM wParam, LPARAM lParam) +int OptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp; diff --git a/plugins/GmailNotifier/src/resource.h b/plugins/GmailNotifier/src/resource.h index 7fdf98e866..8a66a02e96 100644 --- a/plugins/GmailNotifier/src/resource.h +++ b/plugins/GmailNotifier/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by options.rc +// Microsoft Visual C++ generated include file. +// Used by C:\Users\xx\Documents\Visual Studio 2010\Projects\miranda-ng\plugins\GmailNotifier\res\options.rc // #define IDD_OPT 101 #define IDI_ICONNEW 106 @@ -12,6 +12,7 @@ #define IDC_OPTTRAY 1002 #define IDC_OPTPOP 1003 #define IDC_USEIE 1004 +#define IDC_STATIC_DURATION 1006 #define IDC_BGCOLOR 1007 #define IDC_TEXTCOLOR 1008 #define IDC_PRG 1009 @@ -19,22 +20,20 @@ #define IDC_STARTPRG 1011 #define IDC_PRGBROWSE 1012 #define IDC_STATIC_COLOR 1014 -#define IDC_STATIC_DURATION 1006 #define IDC_STATIC_LESS 1016 #define IDC_STATIC_SEC 1017 #define IDC_STATIC_CUSTOM 1018 +#define IDC_BTNADD 1019 #define IDC_PASS 1020 +#define IDC_BTNSAV 1021 #define IDC_NAME 1022 #define IDC_CIRCLE 1023 #define IDC_DURATION 1024 #define IDC_SHOWICON 1025 +#define IDC_BTNDEL 1026 #define IDC_AUTOLOGIN 1028 #define IDC_LOGTHREADS 1029 -#define IDC_BTNADD 1019 -#define IDC_BTNSAV 1021 -#define IDC_BTNDEL 1026 -#define IDC_ONLINE 1036 - +#define IDC_ONLINE 1036 // Next default values for new objects // -- cgit v1.2.3