From ab4abbb7a60f941acab8f0566c6b619f68f1b489 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 27 Jun 2015 11:09:19 +0000 Subject: - CLISTMENUITEM::pszContactOwner removed, because it's supported only by contact's menu; - Menu_AddContactMenuItem now receives parameter szProto; - Menu_Add* helpers are converted into real functions; git-svn-id: http://svn.miranda-ng.org/main/trunk@14409 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/GmailNotifier/src/gmail.h | 2 +- plugins/GmailNotifier/src/main.cpp | 50 ++++++++++++++++++----------------- plugins/GmailNotifier/src/notify.cpp | 16 +++++------ plugins/GmailNotifier/src/options.cpp | 36 ++++++++++++------------- plugins/GmailNotifier/src/utility.cpp | 8 +++--- 5 files changed, 57 insertions(+), 55 deletions(-) (limited to 'plugins/GmailNotifier/src') diff --git a/plugins/GmailNotifier/src/gmail.h b/plugins/GmailNotifier/src/gmail.h index 1c56a13e80..d6293e4436 100644 --- a/plugins/GmailNotifier/src/gmail.h +++ b/plugins/GmailNotifier/src/gmail.h @@ -25,7 +25,7 @@ #define WM_SHELLNOTIFY WM_USER+5 #define IDI_TRAY WM_USER+6 -#define pluginName "GmailMNotifier" +#define MODULE_NAME "GmailMNotifier" #define _MAX_DOWN_BUFFER 65536 #define LINK "https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fmail.google.com%2Fmail&service=mail&passive=true&Email=" #define FORMDATA1 "
popUpHwnd); CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)curAcc->hContact, (LPARAM)1); @@ -11,7 +11,7 @@ int OpenBrowser(WPARAM hContact, LPARAM lParam) return FALSE; if (curAcc->oldResults_num != 0) { - db_set_w(curAcc->hContact, pluginName, "Status", ID_STATUS_NONEW); + db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_NONEW); curAcc->oldResults_num = 0; DeleteResults(curAcc->results.next); curAcc->results.next = NULL; @@ -61,21 +61,21 @@ void NotifyUser(Account *curAcc) PUDeletePopup(curAcc->popUpHwnd); CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)curAcc->hContact, (LPARAM)1); if (curAcc->oldResults_num != 0) - db_set_w(curAcc->hContact, pluginName, "Status", ID_STATUS_NONEW); + db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_NONEW); break; case -1: - db_set_w(curAcc->hContact, pluginName, "Status", ID_STATUS_AWAY); + db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_AWAY); break; default: - db_set_w(curAcc->hContact, pluginName, "Status", ID_STATUS_OCCUPIED); + db_set_w(curAcc->hContact, MODULE_NAME, "Status", ID_STATUS_OCCUPIED); int newMails = (curAcc->oldResults_num == -1) ? (curAcc->results_num) : (curAcc->results_num - curAcc->oldResults_num); if (opt.LogThreads&&newMails > 0) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_READ; - dbei.szModule = pluginName; + dbei.szModule = MODULE_NAME; dbei.timestamp = time(NULL); resultLink *prst = curAcc->results.next; @@ -91,7 +91,7 @@ void NotifyUser(Account *curAcc) cle.hContact = curAcc->hContact; cle.hDbEvent = 1; cle.flags = CLEF_URGENT; - cle.hIcon = Skin_LoadProtoIcon(pluginName, ID_STATUS_OCCUPIED); + cle.hIcon = Skin_LoadProtoIcon(MODULE_NAME, ID_STATUS_OCCUPIED); cle.pszService = "GmailMNotifier/Notifying"; cle.pszTooltip = curAcc->results.next->content; CallServiceSync(MS_CLIST_REMOVEEVENT, (WPARAM)curAcc->hContact, (LPARAM)1); @@ -102,7 +102,7 @@ void NotifyUser(Account *curAcc) POPUPDATA ppd = { 0 }; ppd.lchContact = curAcc->hContact; - ppd.lchIcon = Skin_LoadProtoIcon(pluginName, ID_STATUS_OCCUPIED); + ppd.lchIcon = Skin_LoadProtoIcon(MODULE_NAME, ID_STATUS_OCCUPIED); mir_strcpy(ppd.lpzContactName, curAcc->results.content); resultLink *prst = curAcc->results.next; for (int i = 0; i < 5 && i < newMails; i++) { diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index f329cbf2e0..652a674981 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -8,10 +8,10 @@ static void SaveButton(HWND hwndDlg,HWND hwndCombo, int curIndex) { SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0); SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LPARAM)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); + db_set_s(acc[curIndex].hContact, MODULE_NAME, "name", acc[curIndex].name); + db_set_s(acc[curIndex].hContact, MODULE_NAME, "Nick", acc[curIndex].name); GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, _countof(acc[curIndex].pass)); - db_set_s(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass); + db_set_s(acc[curIndex].hContact, MODULE_NAME, "Password", acc[curIndex].pass); } } static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -77,7 +77,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } { DBVARIANT dbv; - if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) { + if (!db_get_s(NULL, MODULE_NAME, "OpenUsePrgPath", &dbv)) { mir_strcpy(str, dbv.pszVal); db_free(&dbv); } @@ -150,7 +150,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetDlgItemTextA(hwndDlg, IDC_PASS, ""); SetFocus(hwndCombo); acc[curIndex].hContact = CallService(MS_DB_CONTACT_ADD, 0, 0); - Proto_AddToContact(acc[curIndex].hContact, pluginName); + Proto_AddToContact(acc[curIndex].hContact, MODULE_NAME); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -202,20 +202,20 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (opt.circleTime > 0) { KillTimer(NULL, hTimer); hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc); - db_set_dw(NULL, pluginName, "circleTime", opt.circleTime); + db_set_dw(NULL, MODULE_NAME, "circleTime", opt.circleTime); } opt.notifierOnTray = IsDlgButtonChecked(hwndDlg, IDC_OPTTRAY); opt.notifierOnPop = IsDlgButtonChecked(hwndDlg, IDC_OPTPOP); - db_set_dw(NULL, pluginName, "notifierOnTray", opt.notifierOnTray); - db_set_dw(NULL, pluginName, "notifierOnPop", opt.notifierOnPop); + db_set_dw(NULL, MODULE_NAME, "notifierOnTray", opt.notifierOnTray); + db_set_dw(NULL, MODULE_NAME, "notifierOnPop", opt.notifierOnPop); opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, NULL, TRUE); - db_set_dw(NULL, pluginName, "popupDuration", opt.popupDuration); + db_set_dw(NULL, MODULE_NAME, "popupDuration", opt.popupDuration); opt.popupBgColor = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor); opt.popupTxtColor = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor); - db_set_dw(NULL, pluginName, "popupBgColor", opt.popupBgColor); - db_set_dw(NULL, pluginName, "popupTxtColor", opt.popupTxtColor); + db_set_dw(NULL, MODULE_NAME, "popupBgColor", opt.popupBgColor); + db_set_dw(NULL, MODULE_NAME, "popupTxtColor", opt.popupTxtColor); if (IsDlgButtonChecked(hwndDlg, IDC_SYSDEF) == BST_CHECKED) opt.OpenUsePrg = 0; @@ -226,8 +226,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } GetDlgItemTextA(hwndDlg, IDC_PRG, str, _countof(str)); - db_set_dw(NULL, pluginName, "OpenUsePrg", opt.OpenUsePrg); - db_set_s(NULL, pluginName, "OpenUsePrgPath", str); + db_set_dw(NULL, MODULE_NAME, "OpenUsePrg", opt.OpenUsePrg); + db_set_s(NULL, MODULE_NAME, "OpenUsePrgPath", str); opt.ShowCustomIcon = IsDlgButtonChecked(hwndDlg, IDC_SHOWICON); opt.UseOnline = IsDlgButtonChecked(hwndDlg, IDC_ONLINE); @@ -238,14 +238,14 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else if (IsDlgButtonChecked(hwndDlg, IDC_AUTOLOGIN) == BST_INDETERMINATE) opt.AutoLogin = 2; opt.LogThreads = IsDlgButtonChecked(hwndDlg, IDC_LOGTHREADS); - db_set_dw(NULL, pluginName, "ShowCustomIcon", opt.ShowCustomIcon); - db_set_dw(NULL, pluginName, "UseOnline", opt.UseOnline); - db_set_dw(NULL, pluginName, "AutoLogin", opt.AutoLogin); - db_set_dw(NULL, pluginName, "LogThreads", opt.LogThreads); + db_set_dw(NULL, MODULE_NAME, "ShowCustomIcon", opt.ShowCustomIcon); + db_set_dw(NULL, MODULE_NAME, "UseOnline", opt.UseOnline); + db_set_dw(NULL, MODULE_NAME, "AutoLogin", opt.AutoLogin); + db_set_dw(NULL, MODULE_NAME, "LogThreads", opt.LogThreads); ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; for (int i = 0; i < acc_num; i++) - db_set_w(acc[i].hContact, pluginName, "Status", ID_STATUS_NONEW); + db_set_w(acc[i].hContact, MODULE_NAME, "Status", ID_STATUS_NONEW); } return TRUE; diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 0cd72e28a6..8e91d5d8ed 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -5,8 +5,8 @@ void BuildList(void) DBVARIANT dbv; acc_num = 0; - for (MCONTACT hContact = db_find_first(pluginName); hContact; hContact = db_find_next(hContact, pluginName)) { - if (!db_get_s(hContact, pluginName, "name", &dbv)) { + for (MCONTACT hContact = db_find_first(MODULE_NAME); hContact; hContact = db_find_next(hContact, MODULE_NAME)) { + if (!db_get_s(hContact, MODULE_NAME, "name", &dbv)) { acc_num++; acc = (Account *)realloc(acc, acc_num * sizeof(Account)); memset(&acc[acc_num-1], 0, sizeof(Account)); @@ -15,7 +15,7 @@ void BuildList(void) CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE); db_free(&dbv); - if (!db_get_s(hContact, pluginName, "Password", &dbv)) { + if (!db_get_s(hContact, MODULE_NAME, "Password", &dbv)) { mir_strcpy(acc[acc_num-1].pass, dbv.pszVal); db_free(&dbv); } @@ -42,7 +42,7 @@ BOOL GetBrowser(char *str) strKey = strIE; else if (opt.OpenUsePrg == 0) strKey = strDefault; - else if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) { + else if (!db_get_s(NULL, MODULE_NAME, "OpenUsePrgPath", &dbv)) { mir_strcpy(str, dbv.pszVal); db_free(&dbv); return FALSE; -- cgit v1.2.3