diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
commit | 8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch) | |
tree | 03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/PackUpdater/Src | |
parent | c5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff) |
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/PackUpdater/Src')
-rw-r--r-- | plugins/PackUpdater/Src/Events.cpp | 2 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Notifications.cpp | 30 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Options.cpp | 36 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/PackUpdater.cpp | 12 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/Utils.cpp | 76 | ||||
-rw-r--r-- | plugins/PackUpdater/Src/stdafx.h | 10 |
6 files changed, 84 insertions, 82 deletions
diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp index c0a4830ac0..9ad9d4918b 100644 --- a/plugins/PackUpdater/Src/Events.cpp +++ b/plugins/PackUpdater/Src/Events.cpp @@ -31,7 +31,7 @@ int ModulesLoaded(WPARAM, LPARAM) hkd.pszName = "Check for pack updates";
hkd.szDescription.w = LPGENW("Check for pack updates");
hkd.szSection.w = LPGENW("Pack Updater");
- hkd.pszService = MODNAME"/CheckUpdates";
+ hkd.pszService = MODULENAME"/CheckUpdates";
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
Hotkey_Register(&hkd);
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index e2e3d9793c..a9d691e588 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -96,11 +96,11 @@ static void MakePopupAction(POPUPACTION &pa, INT id) switch (id) {
case IDYES:
pa.lchIcon = IcoLib_GetIcon("btn_ok");
- strncpy_s(pa.lpzTitle, MODNAME"/Yes", _countof(pa.lpzTitle));
+ strncpy_s(pa.lpzTitle, MODULENAME"/Yes", _countof(pa.lpzTitle));
break;
case IDNO:
pa.lchIcon = IcoLib_GetIcon("btn_cancel");
- strncpy_s(pa.lpzTitle, MODNAME"/No", _countof(pa.lpzTitle));
+ strncpy_s(pa.lpzTitle, MODULENAME"/No", _countof(pa.lpzTitle));
break;
}
}
@@ -176,9 +176,9 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM) static void __stdcall CreateDownloadDialog(void*)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop);
- else if (db_get_b(NULL, MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
+ else if (db_get_b(NULL, MODULENAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DOWNLOAD), nullptr, DlgDownload);
}
@@ -195,11 +195,11 @@ void DlgDownloadProc() if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occurred while downloading the update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONSTOP);
}
CallFunctionAsync(DestroyDownloadDialog, nullptr);
@@ -274,7 +274,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam EnableWindow(hwOk, true/*one_enabled ? TRUE : FALSE*/);
// do this after filling list - enables 'ITEMCHANGED' below
SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
- Utils_RestoreWindowPositionNoSize(hDlg, 0, MODNAME, "ConfirmWindow");
+ Utils_RestoreWindowPositionNoSize(hDlg, 0, MODULENAME, "ConfirmWindow");
}
return TRUE;
@@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam PROCESS_INFORMATION pi;
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
+ Utils_SaveWindowPosition(hDlg, NULL, MODULENAME, "ConfirmWindow");
arFileType.clear();
arFilePath.clear();
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
mir_wstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
mir_snprintf(szKey, "File_%d_CurrentVersion", todo[i].FileNum);
- db_set_ws(NULL, MODNAME, szKey, todo[i].tszCurVer);
+ db_set_ws(NULL, MODULENAME, szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
arFilePath.push_back(todo[i].File.tszDiskPath);
arFileName.push_back(tszFileName);
@@ -420,7 +420,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
rc = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop);
else
rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
@@ -436,7 +436,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 1:
if (Reminder == 2)
- db_set_b(NULL, MODNAME, "Reminder", 1);
+ db_set_b(NULL, MODULENAME, "Reminder", 1);
memset(&si, 0, sizeof(STARTUPINFO));
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
@@ -504,15 +504,15 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
else { //reminder for not installed pack update
if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
- db_set_b(NULL, MODNAME, "Reminder", 2);
+ db_set_b(NULL, MODULENAME, "Reminder", 2);
mir_snwprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
}
@@ -522,7 +522,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam case IDCANCEL:
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
+ Utils_SaveWindowPosition(hDlg, NULL, MODULENAME, "ConfirmWindow");
EndDialog(hDlg, IDCANCEL);
return TRUE;
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index f7701cb158..49649a9f66 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -65,7 +65,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA else {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i + 1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 1029), (db_get_b(NULL, MODULENAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
}
}
return TRUE;
@@ -134,17 +134,17 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA InitTimer();
- db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
- db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
- db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
- db_set_dw(NULL, MODNAME, "Period", Period);
- db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
+ db_set_b(NULL, MODULENAME, "UpdateOnStartup", UpdateOnStartup);
+ db_set_b(NULL, MODULENAME, "OnlyOnceADay", OnlyOnceADay);
+ db_set_b(NULL, MODULENAME, "UpdateOnPeriod", UpdateOnPeriod);
+ db_set_dw(NULL, MODULENAME, "Period", Period);
+ db_set_b(NULL, MODULENAME, "PeriodMeasure", PeriodMeasure);
Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
- db_set_b(NULL, MODNAME, "Reminder", Reminder);
+ db_set_b(NULL, MODULENAME, "Reminder", Reminder);
if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, "Popups%dM", i);
- db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
+ db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
}
}
}
@@ -200,8 +200,8 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
mir_snprintf(str2, "Popups%dM", i);
- CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODULENAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODULENAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, (i + 40071)))
EnableWindow(GetDlgItem(hdlg, (i + 1024)), FALSE);
else if (i > 0)
@@ -349,27 +349,27 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) ctlColor = SendDlgItemMessage(hdlg, (i + 42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, "Popups%iBg", i);
- db_set_dw(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i + 41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, "Popups%iTx", i);
- db_set_dw(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
}
//Colors
- db_set_b(NULL, MODNAME, "DefColors", MyOptions.DefColors);
+ db_set_b(NULL, MODULENAME, "DefColors", MyOptions.DefColors);
//Timeout
MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
- db_set_dw(NULL, MODNAME, "Timeout", MyOptions.Timeout);
+ db_set_dw(NULL, MODULENAME, "Timeout", MyOptions.Timeout);
//Left mouse click
- db_set_b(NULL, MODNAME, "LeftClickAction", MyOptions.LeftClickAction);
+ db_set_b(NULL, MODULENAME, "LeftClickAction", MyOptions.LeftClickAction);
//Right mouse click
- db_set_b(NULL, MODNAME, "RightClickAction", MyOptions.RightClickAction);
+ db_set_b(NULL, MODULENAME, "RightClickAction", MyOptions.RightClickAction);
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
- db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
+ db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
mir_snprintf(str2, "Popups%dM", i);
- db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
+ db_set_b(NULL, MODULENAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
}
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 2199c515ab..784bef719a 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -41,6 +41,10 @@ PLUGININFOEX pluginInfoEx = { 0x29517be5, 0x779a, 0x48e5, { 0x89, 0x50, 0xcb, 0x4d, 0xe1, 0xd4, 0x31, 0x72 } }
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
@@ -66,7 +70,7 @@ extern "C" __declspec(dllexport) int Load(void) IcoLibInit();
// Add cheking update menu item
- CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand);
+ CreateServiceFunction(MODULENAME"/CheckUpdates", MenuCommand);
CMenuItem mi;
SET_UID(mi, 0x326495e8, 0xab0a, 0x47d2, 0xb2, 0x22, 0x2a, 0x8e, 0xa8, 0xae, 0x53, 0x1a);
@@ -74,18 +78,18 @@ extern "C" __declspec(dllexport) int Load(void) mi.flags = CMIF_UNICODE;
mi.hIcolibItem = IcoLib_GetIcon("check_update");
mi.name.w = LPGENW("Check for pack updates");
- mi.pszService = MODNAME"/CheckUpdates";
+ mi.pszService = MODULENAME"/CheckUpdates";
Menu_AddMainMenuItem(&mi);
// Add empty updates folder menu item
- CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder);
+ CreateServiceFunction(MODULENAME"/EmptyFolder", EmptyFolder);
memset(&mi, 0, sizeof(mi));
SET_UID(mi, 0xc3eea590, 0xaba3, 0x454f, 0x93, 0x93, 0xbc, 0x97, 0x15, 0x2c, 0x3b, 0x3d);
mi.position = -0x7FFFFFFF;
mi.flags = CMIF_UNICODE;
mi.hIcolibItem = IcoLib_GetIcon("empty_folder");
mi.name.w = LPGENW("Clear pack updates folder");
- mi.pszService = MODNAME"/EmptyFolder";
+ mi.pszService = MODULENAME"/EmptyFolder";
Menu_AddMainMenuItem(&mi);
// Add options hook
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 14bd0ad350..c3c456d411 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -52,7 +52,7 @@ BOOL NetlibInit() NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szDescriptiveName.w = TranslateT("Pack Updater HTTP connection");
- nlu.szSettingsModule = MODNAME;
+ nlu.szSettingsModule = MODULENAME;
hNetlibUser = Netlib_RegisterUser(&nlu);
return hNetlibUser != nullptr;
@@ -69,41 +69,41 @@ void InitPopupList() int index = 0;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups2Tx", COLOR_TX_DEFAULT);
index = 3;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups3Tx", COLOR_TX_DEFAULT);
}
void LoadOptions()
{
- MyOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- MyOptions.LeftClickAction = db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- MyOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- MyOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
- UpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- OnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- UpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- PeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
- FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
+ MyOptions.DefColors = db_get_b(NULL, MODULENAME, "DefColors", DEFAULT_COLORS);
+ MyOptions.LeftClickAction = db_get_b(NULL, MODULENAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
+ MyOptions.RightClickAction = db_get_b(NULL, MODULENAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
+ MyOptions.Timeout = db_get_dw(NULL, MODULENAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
+ UpdateOnStartup = db_get_b(NULL, MODULENAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ OnlyOnceADay = db_get_b(NULL, MODULENAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ UpdateOnPeriod = db_get_b(NULL, MODULENAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ Period = db_get_dw(NULL, MODULENAME, "Period", DEFAULT_PERIOD);
+ PeriodMeasure = db_get_b(NULL, MODULENAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
+ Reminder = db_get_b(NULL, MODULENAME, "Reminder", DEFAULT_REMINDER);
+ FileCount = db_get_dw(NULL, MODULENAME, "FileCount", DEFAULT_FILECOUNT);
}
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
@@ -186,19 +186,19 @@ static void CheckUpdates(void *) if (!Exists(tszRoot))
CreateDirectory(tszRoot, nullptr);
Files.clear();
- Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER);
- FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT);
+ Reminder = db_get_b(NULL, MODULENAME, "Reminder", DEFAULT_REMINDER);
+ FileCount = db_get_dw(NULL, MODULENAME, "FileCount", DEFAULT_FILECOUNT);
// Load files info
- ptrW tszDownloadURL(db_get_wsa(NULL, MODNAME, "File_VersionURL"));
+ ptrW tszDownloadURL(db_get_wsa(NULL, MODULENAME, "File_VersionURL"));
if (!tszDownloadURL) { // URL is not set
Title = TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONSTOP);
hCheckThread = nullptr;
return;
@@ -222,14 +222,14 @@ static void CheckUpdates(void *) FILEINFO FileInfo = { L"", L"", L"", L"", L"", L"", L"", { L"", L"" } };
mir_snprintf(szKey, "File_%d_CurrentVersion", CurrentFile + 1);
- ptrW tszCurVer(db_get_wsa(NULL, MODNAME, szKey));
+ ptrW tszCurVer(db_get_wsa(NULL, MODULENAME, szKey));
if (tszCurVer)
mir_wstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
else
mir_wstrncpy(FileInfo.tszCurVer, L"", _countof(FileInfo.tszCurVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- ptrW tszLastVer(db_get_wsa(NULL, MODNAME, szKey));
+ ptrW tszLastVer(db_get_wsa(NULL, MODULENAME, szKey));
if (tszLastVer)
mir_wstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
else
@@ -249,11 +249,11 @@ static void CheckUpdates(void *) if (wcsstr(tszBuff, L"\\")) { //check update name
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
@@ -323,7 +323,7 @@ static void CheckUpdates(void *) // Save last version
mir_wstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- db_set_ws(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
+ db_set_ws(NULL, MODULENAME, szKey, Files[CurrentFile].tszLastVer);
} // end compare versions
} //end checking all files in for ()
@@ -340,22 +340,22 @@ static void CheckUpdates(void *) if (!UpdatesCount && !Silent) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
if (!FileCount) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
hCheckThread = nullptr;
@@ -366,16 +366,16 @@ void DoCheck(int iFlag) if (hCheckThread != nullptr) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
else if (iFlag) {
hCheckThread = mir_forkthread(CheckUpdates);
- db_set_dw(NULL, MODNAME, "LastUpdate", time(0));
+ db_set_dw(NULL, MODULENAME, "LastUpdate", time(0));
}
}
@@ -383,7 +383,7 @@ BOOL AllowUpdateOnStartup() {
if (OnlyOnceADay) {
time_t now = time(0);
- time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
+ time_t was = db_get_dw(NULL, MODULENAME, "LastUpdate", 0);
if ((now - was) < 86400)
return FALSE;
diff --git a/plugins/PackUpdater/Src/stdafx.h b/plugins/PackUpdater/Src/stdafx.h index 5df3de5503..be444fdfc8 100644 --- a/plugins/PackUpdater/Src/stdafx.h +++ b/plugins/PackUpdater/Src/stdafx.h @@ -45,17 +45,15 @@ Boston, MA 02111-1307, USA. #include "resource.h"
#include "Notifications.h"
-#define MODNAME "PackUpdater"
-#define MODULEA "Pack Updater"
-#define MODULE L"Pack Updater"
+#define MODULENAME "PackUpdater"
+#define MODULEA "Pack Updater"
+#define MODULE L"Pack Updater"
#define DEFAULT_UPDATES_FOLDER L"Pack Updates"
typedef std::wstring tString;
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODNAME)
- {}
+ CMPlugin();
};
struct FILEURL
|