diff options
Diffstat (limited to 'plugins/GmailNotifier')
-rw-r--r-- | plugins/GmailNotifier/src/gmail.h | 2 | ||||
-rw-r--r-- | plugins/GmailNotifier/src/main.cpp | 50 | ||||
-rw-r--r-- | plugins/GmailNotifier/src/notify.cpp | 16 | ||||
-rw-r--r-- | plugins/GmailNotifier/src/options.cpp | 36 | ||||
-rw-r--r-- | plugins/GmailNotifier/src/utility.cpp | 8 |
5 files changed, 57 insertions, 55 deletions
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 "<body onload=document.gmail.submit();><form name=gmail action=https://www.google.com/a/"
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 77480035dc..ca9ce6a3b5 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -51,7 +51,7 @@ INT_PTR GetStatus(WPARAM wParam, LPARAM lParam) INT_PTR GetName(WPARAM wParam, LPARAM lParam)
{
- mir_strncpy((char*)lParam, pluginName, wParam);
+ mir_strncpy((char*)lParam, MODULE_NAME, wParam);
return 0;
}
@@ -93,26 +93,26 @@ extern "C" int __declspec(dllexport) Load() HookEvent(ME_CLIST_DOUBLECLICKED, OpenBrowser);
PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
- pd.szName = pluginName;
+ pd.szName = MODULE_NAME;
pd.type = PROTOTYPE_VIRTUAL;
Proto_RegisterModule(&pd);
- CreateProtoServiceFunction(pluginName, PS_GETCAPS, GetCaps);
- CreateProtoServiceFunction(pluginName, PS_GETSTATUS, GetStatus);
- CreateProtoServiceFunction(pluginName, PS_GETNAME, GetName);
+ CreateProtoServiceFunction(MODULE_NAME, PS_GETCAPS, GetCaps);
+ CreateProtoServiceFunction(MODULE_NAME, PS_GETSTATUS, GetStatus);
+ CreateProtoServiceFunction(MODULE_NAME, PS_GETNAME, GetName);
CreateServiceFunction("GmailMNotifier/Notifying", Notifying);
- opt.circleTime = db_get_dw(NULL, pluginName, "circleTime", 30);
- opt.notifierOnTray = db_get_dw(NULL, pluginName, "notifierOnTray", TRUE);
- opt.notifierOnPop = db_get_dw(NULL, pluginName, "notifierOnPop", TRUE);
- opt.popupDuration = db_get_dw(NULL, pluginName, "popupDuration", -1);
- opt.popupBgColor = db_get_dw(NULL, pluginName, "popupBgColor", RGB(173, 206, 247));
- opt.popupTxtColor = db_get_dw(NULL, pluginName, "popupTxtColor", RGB(0, 0, 0));
- opt.OpenUsePrg = db_get_dw(NULL, pluginName, "OpenUsePrg", 0);
- opt.ShowCustomIcon = db_get_dw(NULL, pluginName, "ShowCustomIcon", FALSE);
- opt.UseOnline = db_get_dw(NULL, pluginName, "UseOnline", FALSE);
- opt.AutoLogin = db_get_dw(NULL, pluginName, "AutoLogin", TRUE);
- opt.LogThreads = db_get_dw(NULL, pluginName, "LogThreads", FALSE);
+ opt.circleTime = db_get_dw(NULL, MODULE_NAME, "circleTime", 30);
+ opt.notifierOnTray = db_get_dw(NULL, MODULE_NAME, "notifierOnTray", TRUE);
+ opt.notifierOnPop = db_get_dw(NULL, MODULE_NAME, "notifierOnPop", TRUE);
+ opt.popupDuration = db_get_dw(NULL, MODULE_NAME, "popupDuration", -1);
+ opt.popupBgColor = db_get_dw(NULL, MODULE_NAME, "popupBgColor", RGB(173, 206, 247));
+ opt.popupTxtColor = db_get_dw(NULL, MODULE_NAME, "popupTxtColor", RGB(0, 0, 0));
+ opt.OpenUsePrg = db_get_dw(NULL, MODULE_NAME, "OpenUsePrg", 0);
+ opt.ShowCustomIcon = db_get_dw(NULL, MODULE_NAME, "ShowCustomIcon", FALSE);
+ opt.UseOnline = db_get_dw(NULL, MODULE_NAME, "UseOnline", FALSE);
+ opt.AutoLogin = db_get_dw(NULL, MODULE_NAME, "AutoLogin", TRUE);
+ opt.LogThreads = db_get_dw(NULL, MODULE_NAME, "LogThreads", FALSE);
DBVARIANT dbv;
if (db_get_s(NULL, "Icons", "GmailMNotifier40076", &dbv)) {
@@ -126,23 +126,25 @@ extern "C" int __declspec(dllexport) Load() BuildList();
ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
for (int i = 0; i < acc_num; i++)
- db_set_dw(acc[i].hContact, pluginName, "Status", ID_STATUS_NONEW);
+ db_set_dw(acc[i].hContact, MODULE_NAME, "Status", ID_STATUS_NONEW);
hTimer = SetTimer(NULL, 0, opt.circleTime * 60000, TimerProc);
hMirandaStarted = HookEvent(ME_SYSTEM_MODULESLOADED, OnMirandaStart);
hOptionsInitial = HookEvent(ME_OPT_INITIALISE, OptInit);
- CreateServiceFunction("GmailMNotifier/MenuCommand", PluginMenuCommand);
+
+ CreateServiceFunction(MODULE_NAME "/MenuCommand", PluginMenuCommand);
CLISTMENUITEM mi = { 0 };
mi.position = -0x7FFFFFFF;
mi.flags = 0;
- mi.hIcon = Skin_LoadProtoIcon(pluginName, ID_STATUS_ONLINE);
- mi.pszName = LPGEN("&Check all Gmail inboxes");
- mi.pszContactOwner = pluginName;
- mi.pszService = "GmailMNotifier/MenuCommand";
+ mi.icolibItem = Skin_LoadProtoIcon(MODULE_NAME, ID_STATUS_ONLINE);
+ mi.name.a = LPGEN("&Check all Gmail inboxes");
+ mi.pszService = MODULE_NAME "/MenuCommand";
Menu_AddMainMenuItem(&mi);
- mi.pszName = LPGEN("&Check Gmail inbox");
- Menu_AddContactMenuItem(&mi);
+
+ mi.name.a = LPGEN("&Check Gmail inbox");
+ mi.pszService = "/MenuCommand";
+ Menu_AddContactMenuItem(&mi, MODULE_NAME);
return 0;
}
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index e1aff5e67e..9ec7111750 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -3,7 +3,7 @@ int OpenBrowser(WPARAM hContact, LPARAM lParam)
{
char *proto = GetContactProto(hContact);
- if (proto && !mir_strcmp(proto, pluginName)) {
+ if (proto && !mir_strcmp(proto, MODULE_NAME)) {
Account *curAcc = GetAccountByContact(hContact);
PUDeletePopup(curAcc->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;
|