summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
commit8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch)
tree03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/PluginUpdater/src
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp6
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp36
-rw-r--r--plugins/PluginUpdater/src/Events.cpp6
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp16
-rw-r--r--plugins/PluginUpdater/src/Options.cpp76
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp24
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp38
-rw-r--r--plugins/PluginUpdater/src/stdafx.h10
8 files changed, 107 insertions, 105 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 1db3a7b496..e7a289764a 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
// do this after filling list - enables 'ITEMCHANGED' below
SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
- Utils_RestoreWindowPosition(hDlg, 0, MODNAME, "ListWindow");
+ Utils_RestoreWindowPosition(hDlg, 0, MODULENAME, "ListWindow");
return TRUE;
case WM_NOTIFY:
@@ -327,7 +327,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_DESTROY:
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ListWindow");
+ Utils_SaveWindowPosition(hDlg, NULL, MODULENAME, "ListWindow");
Window_FreeIcon_IcoLib(hDlg);
hwndDialog = nullptr;
delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
@@ -490,6 +490,6 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam)
void InitListNew()
{
- CreateServiceFunction(MODNAME "/ParseUri", ParseUriService);
+ CreateServiceFunction(MODULENAME "/ParseUri", ParseUriService);
CreateServiceFunction(MS_PU_SHOWLIST, ShowListCommand);
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 58d293b43f..950944d8b7 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -122,7 +122,7 @@ static void ApplyUpdates(void *param)
}
Skin_PlaySound("updatecompleted");
- db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5);
+ db_set_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, 5);
if (opts.bBackup)
CallService(MS_AB_BACKUP, 0, 0);
@@ -130,28 +130,28 @@ static void ApplyUpdates(void *param)
if (opts.bChangePlatform) {
wchar_t mirandaPath[MAX_PATH];
GetModuleFileName(nullptr, mirandaPath, _countof(mirandaPath));
- db_set_ws(NULL, MODNAME, "OldBin2", mirandaPath);
+ db_set_ws(NULL, MODULENAME, "OldBin2", mirandaPath);
- db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
+ db_unset(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM);
}
else {
- ptrW oldbin(db_get_wsa(NULL, MODNAME, "OldBin2"));
+ ptrW oldbin(db_get_wsa(NULL, MODULENAME, "OldBin2"));
if (oldbin) {
SafeDeleteFile(oldbin);
- db_unset(NULL, MODNAME, "OldBin2");
+ db_unset(NULL, MODULENAME, "OldBin2");
}
}
if (opts.bForceRedownload) {
opts.bForceRedownload = 0;
- db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
+ db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
}
// 5) Prepare Restart
int rc = MessageBox(hDlg, TranslateT("Update complete. Press Yes to restart Miranda now or No to postpone a restart until the exit."), TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION);
PostMessage(hDlg, WM_CLOSE, 0, 0);
if (rc == IDYES) {
- BOOL bRestartCurrentProfile = db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0;
+ BOOL bRestartCurrentProfile = db_get_b(NULL, MODULENAME, "RestartCurrentProfile", 1) ? 1 : 0;
if (opts.bChangePlatform) {
wchar_t mirstartpath[MAX_PATH];
@@ -275,7 +275,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
// 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;
case WM_NOTIFY:
@@ -361,12 +361,12 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
case WM_DESTROY:
Window_FreeIcon_IcoLib(hDlg);
- Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow");
+ Utils_SaveWindowPosition(hDlg, NULL, MODULENAME, "ConfirmWindow");
hwndDialog = nullptr;
delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(0));
+ db_set_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, time(0));
mir_forkthread(InitTimer);
break;
@@ -457,13 +457,13 @@ static void DlgUpdateSilent(void *param)
Skin_PlaySound("updatecompleted");
opts.bForceRedownload = false;
- db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
+ db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
opts.bChangePlatform = false;
- db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
+ db_unset(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM);
- db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5);
- db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 1);
+ db_set_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, 5);
+ db_set_b(NULL, MODULENAME, DB_SETTING_NEED_RESTART, 1);
// 5) Prepare Restart
wchar_t tszTitle[100];
@@ -478,7 +478,7 @@ static void DlgUpdateSilent(void *param)
mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(nullptr, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
- CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
+ CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODULENAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
}
}
}
@@ -803,7 +803,7 @@ static void DoCheck(bool bSilent = true)
else {
opts.bSilent = bSilent;
- db_set_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, time(0));
+ db_set_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, time(0));
hCheckThread = mir_forkthread(CheckUpdates);
}
@@ -841,7 +841,7 @@ void CheckUpdateOnStartup()
if (opts.bUpdateOnStartup) {
if (opts.bOnlyOnceADay) {
time_t now = time(0),
- was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
+ was = db_get_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, 0);
if ((now - was) < 86400)
return;
@@ -888,7 +888,7 @@ void InitTimer(void *type)
case 0: // default, plan next check relative to last check
{
time_t now = time(0);
- time_t was = db_get_dw(NULL, MODNAME, DB_SETTING_LAST_UPDATE, 0);
+ time_t was = db_get_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, 0);
interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
interval -= (now - was) * 1000;
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp
index 1d5e3176f0..3fe786d3e1 100644
--- a/plugins/PluginUpdater/src/Events.cpp
+++ b/plugins/PluginUpdater/src/Events.cpp
@@ -53,11 +53,11 @@ int ModulesLoaded(WPARAM, LPARAM)
else lstrcpyn(g_tszRoot, VARSW(L"%miranda_path%\\" DEFAULT_UPDATES_FOLDER), _countof(g_tszRoot));
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- AssocMgr_AddNewUrlTypeW("mirpu:", TranslateT("Plugin updater URI scheme"), g_plugin.getInst(), IDI_PLGLIST, MODNAME "/ParseUri", 0);
+ AssocMgr_AddNewUrlTypeW("mirpu:", TranslateT("Plugin updater URI scheme"), g_plugin.getInst(), IDI_PLGLIST, MODULENAME "/ParseUri", 0);
- int iRestartCount = db_get_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 2);
+ int iRestartCount = db_get_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, 2);
if (iRestartCount > 0)
- db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, iRestartCount - 1);
+ db_set_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, iRestartCount - 1);
else
EmptyFolder(); // silently
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index e5a948f01d..7a215758d6 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -25,18 +25,18 @@ void InitPopupList()
{
int index = 0;
PopupsList[index].ID = index;
- 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].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].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);
}
void PopupAction(HWND hPopup, BYTE action)
@@ -74,7 +74,7 @@ static void _stdcall RestartPrompt(void *)
mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(nullptr, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
- CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
+ CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODULENAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
}
static LRESULT CALLBACK PopupDlgProcRestart(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -99,7 +99,7 @@ void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
char setting[100];
mir_snprintf(setting, "Popups%d", Number);
- if (db_get_b(NULL, MODNAME, setting, DEFAULT_POPUP_ENABLED)) {
+ if (db_get_b(NULL, MODULENAME, setting, DEFAULT_POPUP_ENABLED)) {
POPUPDATAT pd = { 0 };
pd.lchContact = NULL;
pd.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 57f50bd06f..e81c536ea2 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -29,14 +29,14 @@ static int GetBits(HWND hwndDlg)
static int GetUpdateMode()
{
- int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, -1);
+ int UpdateMode = db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, -1);
// Check if there is url for custom mode
if (UpdateMode == UPDATE_MODE_CUSTOM) {
- ptrW url(db_get_wsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL));
if (url == NULL || !wcslen(url)) {
// No url for custom mode, reset that setting so it will be determined automatically
- db_unset(NULL, MODNAME, DB_SETTING_UPDATE_MODE);
+ db_unset(NULL, MODULENAME, DB_SETTING_UPDATE_MODE);
UpdateMode = -1;
}
}
@@ -65,7 +65,7 @@ wchar_t* GetDefaultUrl()
mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
return mir_wstrdup(url);
default:
- return db_get_wsa(NULL, MODNAME, DB_SETTING_UPDATE_URL);
+ return db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL);
}
}
@@ -90,7 +90,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), TRUE);
}
CheckDlgButton(hwndDlg, IDC_SILENTMODE, opts.bSilentMode ? BST_CHECKED : BST_UNCHECKED);
- if (db_get_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0))
+ if (db_get_b(NULL, MODULENAME, DB_SETTING_NEED_RESTART, 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_NEEDRESTARTLABEL), SW_SHOW);
SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
@@ -105,12 +105,12 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
- if (db_get_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0)) {
+ if (db_get_b(NULL, MODULENAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STABLE), FALSE);
// Reset setting if needed
- int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ int UpdateMode = db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
SetDlgItemText(hwndDlg,IDC_STABLE,LPGENW("Stable version (incompatible with current development version)"));
}
TranslateDialogDefault(hwndDlg);
@@ -140,7 +140,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
- ptrW url(db_get_wsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -207,7 +207,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
{
- ptrW url(db_get_wsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -255,52 +255,52 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (hdr && hdr->code == PSN_APPLY) {
- db_set_b(NULL, MODNAME, "UpdateOnStartup", opts.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
- db_set_b(NULL, MODNAME, "OnlyOnceADay", opts.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
- db_set_b(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
- db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
- db_set_b(NULL, MODNAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
- db_set_b(NULL, MODNAME, "Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
+ db_set_b(NULL, MODULENAME, "UpdateOnStartup", opts.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
+ db_set_b(NULL, MODULENAME, "OnlyOnceADay", opts.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
+ db_set_b(NULL, MODULENAME, "UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
+ db_set_b(NULL, MODULENAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
+ db_set_b(NULL, MODULENAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
+ db_set_b(NULL, MODULENAME, "Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
wchar_t buffer[3] = {0};
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
- db_set_dw(NULL, MODNAME, "Period", opts.Period = _wtoi(buffer));
+ db_set_dw(NULL, MODULENAME, "Period", opts.Period = _wtoi(buffer));
mir_forkthread(InitTimer, (void*)1);
if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (!opts.bChangePlatform)
opts.bForceRedownload = 0;
- db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
+ db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
}
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
if (!opts.bChangePlatform)
opts.bForceRedownload = 0;
- db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
+ db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
}
else if ( IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
// Only set ForceRedownload if the previous UpdateMode was different
// to redownload all plugin with pdb files
- if (db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
- db_set_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
+ if (db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
+ db_set_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
}
}
else {
wchar_t tszUrl[100];
GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
- db_set_ws(NULL, MODNAME, DB_SETTING_UPDATE_URL, tszUrl);
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
+ db_set_ws(NULL, MODULENAME, DB_SETTING_UPDATE_URL, tszUrl);
+ db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
opts.bForceRedownload = 0;
- db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD);
+ db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
}
if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) {
- db_set_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- db_set_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
+ db_set_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ db_set_b(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
}
- else db_set_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 0);
+ else db_set_b(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 0);
}
}
}
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
for (int i = 0; i < POPUPS; i++) {
char str[20] = {0};
mir_snprintf(str, "Popups%d", i);
- CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i+40071), (db_get_b(NULL, MODULENAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
}
return TRUE;
@@ -472,26 +472,26 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, 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", PopupOptions.DefColors);
+ db_set_b(NULL, MODULENAME, "DefColors", PopupOptions.DefColors);
//Timeout
PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
- db_set_dw(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
+ db_set_dw(NULL, MODULENAME, "Timeout", PopupOptions.Timeout);
//Left mouse click
- db_set_b(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
+ db_set_b(NULL, MODULENAME, "LeftClickAction", PopupOptions.LeftClickAction);
//Right mouse click
- db_set_b(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
+ db_set_b(NULL, MODULENAME, "RightClickAction", PopupOptions.RightClickAction);
//Notified popups
for (int i = 0; i < POPUPS; i++) {
char str[20] = {0};
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))));
}
return TRUE;
} //case PSN_APPLY
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index 00e23eb0c8..bafb59f0ef 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -39,6 +39,10 @@ PLUGININFOEX pluginInfoEx = {
{0x968def4a, 0xbc60, 0x4266, {0xac, 0x8, 0x75, 0x4c, 0xe7, 0x21, 0xdb, 0x5f}}
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
@@ -52,7 +56,7 @@ extern "C" __declspec(dllexport) int Load(void)
InitServices();
- db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0);
+ db_set_b(NULL, MODULENAME, DB_SETTING_NEED_RESTART, 0);
DWORD dwLen = GetTempPath(_countof(g_tszTempPath), g_tszTempPath);
if (g_tszTempPath[dwLen-1] == '\\')
@@ -103,22 +107,22 @@ extern "C" __declspec(dllexport) int Load(void)
g_plugin.addSound("updatefailed", LPGENW("Plugin Updater"), LPGENW("Update failed"));
// Upgrade old settings
- if (-1 == db_get_b(0, MODNAME, DB_SETTING_UPDATE_MODE, -1)) {
- ptrW dbvUpdateURL(db_get_wsa(0, MODNAME, DB_SETTING_UPDATE_URL));
+ if (-1 == db_get_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, -1)) {
+ ptrW dbvUpdateURL(db_get_wsa(0, MODULENAME, DB_SETTING_UPDATE_URL));
if (dbvUpdateURL) {
if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_OLD))) {
- db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
- db_unset(0, MODNAME, DB_SETTING_UPDATE_URL);
+ db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ db_unset(0, MODULENAME, DB_SETTING_UPDATE_URL);
}
else if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_TRUNK_OLD))) {
- db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- db_unset(0, MODNAME, DB_SETTING_UPDATE_URL);
+ db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ db_unset(0, MODULENAME, DB_SETTING_UPDATE_URL);
}
else if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS_OLD) L"/")) {
- db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
- db_unset(0, MODNAME, DB_SETTING_UPDATE_URL);
+ db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
+ db_unset(0, MODULENAME, DB_SETTING_UPDATE_URL);
}
- else db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
+ else db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index cb1fd9d618..ca1c94d5e9 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -25,20 +25,20 @@ HANDLE hPipe = nullptr;
/////////////////////////////////////////////////////////////////////////////////////
void LoadOptions()
{
- PopupOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
-
- opts.bUpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bForceRedownload = db_get_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, 0);
- opts.bSilentMode = db_get_b(NULL, MODNAME, "SilentMode", 0);
- opts.bBackup = db_get_b(NULL, MODNAME, "Backup", 0);
- opts.bChangePlatform = db_get_b(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM, 0);
+ PopupOptions.DefColors = db_get_b(NULL, MODULENAME, "DefColors", DEFAULT_COLORS);
+ PopupOptions.LeftClickAction= db_get_b(NULL, MODULENAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
+ PopupOptions.RightClickAction = db_get_b(NULL, MODULENAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
+ PopupOptions.Timeout = db_get_dw(NULL, MODULENAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
+
+ opts.bUpdateOnStartup = db_get_b(NULL, MODULENAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ opts.bOnlyOnceADay = db_get_b(NULL, MODULENAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ opts.bUpdateOnPeriod = db_get_b(NULL, MODULENAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ opts.Period = db_get_dw(NULL, MODULENAME, "Period", DEFAULT_PERIOD);
+ opts.bPeriodMeasure = db_get_b(NULL, MODULENAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
+ opts.bForceRedownload = db_get_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, 0);
+ opts.bSilentMode = db_get_b(NULL, MODULENAME, "SilentMode", 0);
+ opts.bBackup = db_get_b(NULL, MODULENAME, "Backup", 0);
+ opts.bChangePlatform = db_get_b(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM, 0);
}
IconItem iconList[] =
@@ -58,7 +58,7 @@ void InitNetlib()
NETLIBUSER nlu = {};
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szDescriptiveName.w = TranslateT("Plugin Updater HTTP connections");
- nlu.szSettingsModule = MODNAME;
+ nlu.szSettingsModule = MODULENAME;
hNetlibUser = Netlib_RegisterUser(&nlu);
}
@@ -205,14 +205,14 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes)
DeleteFile(tszTmpIni);
if (bDoNotSwitchToStable) {
- db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1);
+ db_set_b(NULL, MODULENAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1);
// Reset setting if needed
- int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ int UpdateMode = db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
}
else
- db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0);
+ db_set_b(NULL, MODULENAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0);
return true;
}
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index 0f66b8cfb1..e90119bcd6 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -62,7 +62,7 @@ Boston, MA 02111-1307, USA.
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
-#define MODNAME "PluginUpdater"
+#define MODULENAME "PluginUpdater"
#define MODULEA "Plugin Updater"
#define MODULE L"Plugin Updater"
#define DEFAULT_UPDATES_FOLDER L"Plugin Updates"
@@ -138,8 +138,8 @@ extern struct PlugOptions
#define DB_SETTING_LAST_UPDATE "LastUpdate"
#define DB_SETTING_DONT_SWITCH_TO_STABLE "DontSwitchToStable"
#define DB_SETTING_CHANGEPLATFORM "ChangePlatform"
-#define DB_MODULE_FILES MODNAME "Files"
-#define DB_MODULE_NEW_FILES MODNAME "NewFiles"
+#define DB_MODULE_FILES MODULENAME "Files"
+#define DB_MODULE_NEW_FILES MODULENAME "NewFiles"
#define MAX_RETRIES 3
@@ -159,9 +159,7 @@ extern IconItem iconList[];
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODNAME)
- {}
+ CMPlugin();
};
void UninitCheck(void);