summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp34
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp64
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp8
-rw-r--r--plugins/PluginUpdater/src/Notifications.h54
-rw-r--r--plugins/PluginUpdater/src/Options.cpp110
-rw-r--r--plugins/PluginUpdater/src/Services.cpp8
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp30
-rw-r--r--plugins/PluginUpdater/src/stdafx.h72
8 files changed, 186 insertions, 194 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 52321a1dad..5de9e7de72 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -76,11 +76,9 @@ static void ApplyDownloads(void *param)
SafeDeleteFile(p.File.tszDiskPath); // remove .zip after successful update
db_unset(0, DB_MODULE_NEW_FILES, _T2A(p.tszOldName));
}
- else
- ListView_SetItemText(hwndList, i, 1, TranslateT("Failed!"));
+ else ListView_SetItemText(hwndList, i, 1, TranslateT("Failed!"));
}
- else
- ListView_SetItemText(hwndList, i, 1, TranslateT("Skipped."));
+ else ListView_SetItemText(hwndList, i, 1, TranslateT("Skipped."));
}
Netlib_CloseHandle(nlc);
@@ -162,14 +160,14 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);
OSVERSIONINFO osver = { sizeof(osver) };
- if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6) {
+ if (IsWindows7OrGreater()) {
wchar_t szPath[MAX_PATH];
- GetModuleFileName(nullptr, szPath, _countof(szPath));
+ GetModuleFileNameW(nullptr, szPath, _countof(szPath));
wchar_t *ext = wcsrchr(szPath, '.');
if (ext != nullptr)
*ext = '\0';
wcscat(szPath, L".test");
- HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ HANDLE hFile = CreateFileW(szPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
// Running Windows Vista or later (major version >= 6).
Button_SetElevationRequiredState(GetDlgItem(hDlg, IDOK), !IsProcessElevated());
@@ -184,7 +182,6 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
///
LVCOLUMN lvc = { 0 };
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
- //lvc.fmt = LVCFMT_LEFT;
lvc.pszText = TranslateT("Component Name");
lvc.cx = 220; // width of column in pixels
@@ -348,24 +345,27 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t*
FILEINFO *FileInfo = new FILEINFO;
FileInfo->bDeleteOnly = FALSE;
// copy the relative old name
- wcsncpy(FileInfo->tszOldName, hash.m_name, _countof(FileInfo->tszOldName));
- wcsncpy(FileInfo->tszNewName, hash.m_name, _countof(FileInfo->tszNewName));
+ wcsncpy_s(FileInfo->tszOldName, hash.m_name, _TRUNCATE);
+ wcsncpy_s(FileInfo->tszNewName, hash.m_name, _TRUNCATE);
wchar_t tszFileName[MAX_PATH];
- wcsncpy(tszFileName, wcsrchr(tszPath, L'\\') + 1, _countof(tszFileName));
- wchar_t *tp = wcschr(tszFileName, L'.'); if (tp) *tp = 0;
+ wcsncpy_s(tszFileName, wcsrchr(tszPath, L'\\') + 1, _TRUNCATE);
+ if (auto *tp = wcschr(tszFileName, L'.'))
+ *tp = 0;
wchar_t tszRelFileName[MAX_PATH];
- wcsncpy(tszRelFileName, hash.m_name, MAX_PATH);
- tp = wcsrchr(tszRelFileName, L'.'); if (tp) *tp = 0;
- tp = wcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
- wcslwr(tp);
+ wcsncpy_s(tszRelFileName, hash.m_name, _TRUNCATE);
+ if (auto *tp = wcsrchr(tszRelFileName, L'.'))
+ *tp = 0;
+ if (auto *tp = wcschr(tszRelFileName, L'\\'))
+ wcslwr((tp) ? tp+1 : tszRelFileName);
mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
- for (tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != nullptr; tp = wcschr(tp, '\\'))
+ for (auto *tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != nullptr; tp = wcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
+
// Load list of checked Plugins from database
Netlib_LogfW(hNetlibUser, L"File %s found", FileInfo->tszOldName);
FileInfo->bEnabled = db_get_b(0, DB_MODULE_NEW_FILES, _T2A(FileInfo->tszOldName)) != 0;
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index e75ee0f7ba..0cb5db79aa 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -124,10 +124,10 @@ static void ApplyUpdates(void *param)
g_plugin.setByte(DB_SETTING_RESTART_COUNT, 5);
- if (opts.bBackup)
+ if (g_plugin.bBackup)
CallService(MS_AB_BACKUP, 0, 0);
- if (opts.bChangePlatform) {
+ if (g_plugin.bChangePlatform) {
wchar_t mirandaPath[MAX_PATH];
GetModuleFileName(nullptr, mirandaPath, _countof(mirandaPath));
g_plugin.setWString("OldBin2", mirandaPath);
@@ -142,8 +142,8 @@ static void ApplyUpdates(void *param)
}
}
- if (opts.bForceRedownload) {
- opts.bForceRedownload = 0;
+ if (g_plugin.bForceRedownload) {
+ g_plugin.bForceRedownload = 0;
g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
}
@@ -152,7 +152,7 @@ static void ApplyUpdates(void *param)
PostMessage(hDlg, WM_CLOSE, 0, 0);
if (rc == IDYES) {
BOOL bRestartCurrentProfile = g_plugin.getByte("RestartCurrentProfile", 1) ? 1 : 0;
- if (opts.bChangePlatform) {
+ if (g_plugin.bChangePlatform) {
wchar_t mirstartpath[MAX_PATH];
#ifdef _WIN64
@@ -456,10 +456,10 @@ static void DlgUpdateSilent(void *param)
delete &UpdateFiles;
Skin_PlaySound("updatecompleted");
- opts.bForceRedownload = false;
+ g_plugin.bForceRedownload = false;
g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
- opts.bChangePlatform = false;
+ g_plugin.bChangePlatform = false;
g_plugin.delSetting(DB_SETTING_CHANGEPLATFORM);
g_plugin.setByte(DB_SETTING_RESTART_COUNT, 5);
@@ -485,7 +485,7 @@ static void DlgUpdateSilent(void *param)
static void __stdcall LaunchDialog(void *param)
{
- if (opts.bSilentMode && opts.bSilent)
+ if (g_plugin.bSilentMode && g_plugin.bSilent)
mir_forkthread(DlgUpdateSilent, param);
else
hwndDialog = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_UPDATE), GetDesktopWindow(), DlgUpdate, (LPARAM)param);
@@ -657,7 +657,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
else {
if (level == 0) {
// Rename Miranda*.exe
- wcsncpy_s(tszNewName, opts.bChangePlatform && !mir_wstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
+ wcsncpy_s(tszNewName, g_plugin.bChangePlatform && !mir_wstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, tszNewName);
}
else {
@@ -694,7 +694,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
}
// No need to hash a file if we are forcing a redownload anyway
- if (!opts.bForceRedownload) {
+ if (!g_plugin.bForceRedownload) {
// try to hash the file
char szMyHash[33];
__try {
@@ -704,8 +704,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
Netlib_LogfW(hNetlibUser, L"File %s: Already up-to-date, skipping", ffd.cFileName);
continue;
}
- else
- Netlib_LogfW(hNetlibUser, L"File %s: Update available", ffd.cFileName);
+ else Netlib_LogfW(hNetlibUser, L"File %s: Update available", ffd.cFileName);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
@@ -724,20 +723,21 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
MyCRC = 0;
}
+ int bEnabled = db_get_b(0, DB_MODULE_FILES, StrToLower(_T2A(tszBuf + cbBaseLen)), 1);
+ if (bEnabled == 2) // hidden database setting to exclude a plugin from list
+ continue;
+
// Yeah, we've got new version.
FILEINFO *FileInfo = new FILEINFO;
// copy the relative old name
- wcsncpy(FileInfo->tszOldName, tszBuf + cbBaseLen, _countof(FileInfo->tszOldName));
+ wcsncpy_s(FileInfo->tszOldName, tszBuf + cbBaseLen, _TRUNCATE);
FileInfo->bDeleteOnly = bDeleteOnly;
- if (FileInfo->bDeleteOnly) {
- // save the full old name for deletion
- wcsncpy(FileInfo->tszNewName, tszBuf, _countof(FileInfo->tszNewName));
- }
- else {
- wcsncpy(FileInfo->tszNewName, ptszUrl, _countof(FileInfo->tszNewName));
- }
+ if (FileInfo->bDeleteOnly) // save the full old name for deletion
+ wcsncpy_s(FileInfo->tszNewName, tszBuf, _TRUNCATE);
+ else
+ wcsncpy_s(FileInfo->tszNewName, ptszUrl, _TRUNCATE);
- wcsncpy(tszBuf, ptszUrl, _countof(tszBuf));
+ wcsncpy_s(tszBuf, ptszUrl, _TRUNCATE);
wchar_t *p = wcsrchr(tszBuf, '.');
if (p) *p = 0;
p = wcsrchr(tszBuf, '\\');
@@ -750,13 +750,13 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
*p++ = '/';
// remember whether the user has decided not to update this component with this particular new version
- FileInfo->bEnabled = db_get_b(0, DB_MODULE_FILES, StrToLower(_T2A(FileInfo->tszOldName)), 1);
+ FileInfo->bEnabled = bEnabled;
FileInfo->File.CRCsum = MyCRC;
UpdateFiles->insert(FileInfo);
// If we are in the silent mode, only count enabled plugins, otherwise count all
- if (!opts.bSilent || FileInfo->bEnabled)
+ if (!g_plugin.bSilent || FileInfo->bEnabled)
count++;
}
}
@@ -777,7 +777,7 @@ static void CheckUpdates(void *)
if (tszTempPath[dwLen - 1] == '\\')
tszTempPath[dwLen - 1] = 0;
- if (!opts.bSilent)
+ if (!g_plugin.bSilent)
ShowPopup(TranslateT("Plugin Updater"), TranslateT("Checking for new updates..."), POPUP_TYPE_INFO);
ptrW updateUrl(GetDefaultUrl()), baseUrl;
@@ -790,7 +790,7 @@ static void CheckUpdates(void *)
// Show dialog
if (count == 0) {
- if (!opts.bSilent)
+ if (!g_plugin.bSilent)
ShowPopup(TranslateT("Plugin Updater"), TranslateT("No updates found."), POPUP_TYPE_INFO);
delete UpdateFiles;
}
@@ -813,7 +813,7 @@ static void DoCheck(bool bSilent = true)
SetFocus(hwndDialog);
}
else {
- opts.bSilent = bSilent;
+ g_plugin.bSilent = bSilent;
g_plugin.setDword(DB_SETTING_LAST_UPDATE, time(0));
@@ -850,8 +850,8 @@ void UnloadCheck()
void CheckUpdateOnStartup()
{
- if (opts.bUpdateOnStartup) {
- if (opts.bOnlyOnceADay) {
+ if (g_plugin.bUpdateOnStartup) {
+ if (g_plugin.bOnlyOnceADay) {
time_t now = time(0),
was = g_plugin.getDword(DB_SETTING_LAST_UPDATE, 0);
@@ -870,7 +870,7 @@ static void CALLBACK TimerAPCProc(void *, DWORD, DWORD)
DoCheck();
}
-static LONGLONG PeriodToMilliseconds(const int period, BYTE &periodMeasure)
+static LONGLONG PeriodToMilliseconds(const int period, int &periodMeasure)
{
LONGLONG result = period * 1000LL;
switch(periodMeasure) {
@@ -890,7 +890,7 @@ static LONGLONG PeriodToMilliseconds(const int period, BYTE &periodMeasure)
void __stdcall InitTimer(void *type)
{
- if (!opts.bUpdateOnPeriod)
+ if (!g_plugin.bUpdateOnPeriod)
return;
LONGLONG interval;
@@ -901,7 +901,7 @@ void __stdcall InitTimer(void *type)
time_t now = time(0);
time_t was = g_plugin.getDword(DB_SETTING_LAST_UPDATE, 0);
- interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
+ interval = PeriodToMilliseconds(g_plugin.iPeriod, g_plugin.iPeriodMeasure);
interval -= (now - was) * 1000;
if (interval <= 0)
interval = 1000; // no last update or too far in the past -> do it now
@@ -913,7 +913,7 @@ void __stdcall InitTimer(void *type)
break;
default: // options changed, use set interval from now
- interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
+ interval = PeriodToMilliseconds(g_plugin.iPeriod, g_plugin.iPeriodMeasure);
}
FILETIME ft;
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index acf22fd26e..72285052fd 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -54,11 +54,11 @@ static LRESULT CALLBACK PopupDlgProc(HWND hPopup, UINT uMsg, WPARAM wParam, LPAR
{
switch (uMsg) {
case WM_COMMAND:
- PopupAction(hPopup, PopupOptions.LeftClickAction);
+ PopupAction(hPopup, g_plugin.PopupLeftClickAction);
break;
case WM_CONTEXTMENU:
- PopupAction(hPopup, PopupOptions.RightClickAction);
+ PopupAction(hPopup, g_plugin.PopupRightClickAction);
break;
case UM_FREEPLUGINDATA:
@@ -110,13 +110,13 @@ void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
}
else {
ppd.PluginWindowProc = PopupDlgProc;
- ppd.iSeconds = PopupOptions.Timeout;
+ ppd.iSeconds = g_plugin.PopupTimeout;
}
lstrcpyn(ppd.lpwzText, ptszText, MAX_SECONDLINE);
lstrcpyn(ppd.lpwzContactName, ptszTitle, MAX_CONTACTNAME);
- switch (PopupOptions.DefColors) {
+ switch (g_plugin.PopupDefColors) {
case byCOLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
diff --git a/plugins/PluginUpdater/src/Notifications.h b/plugins/PluginUpdater/src/Notifications.h
index 3624989b18..3c3026f42e 100644
--- a/plugins/PluginUpdater/src/Notifications.h
+++ b/plugins/PluginUpdater/src/Notifications.h
@@ -21,8 +21,6 @@ Boston, MA 02111-1307, USA.
#define POPUPS 3
-//=== Objects =====
-//This one is used to easily tie status id, icon, text...
struct aPopups
{
int ID;
@@ -30,41 +28,29 @@ struct aPopups
COLORREF colorText;
};
-#define DEFAULT_POPUP_LCLICK 1
-#define DEFAULT_POPUP_RCLICK 0
-#define DEFAULT_POPUP_ENABLED 1
-#define DEFAULT_MESSAGE_ENABLED 0
-#define DEFAULT_TIMEOUT_VALUE 0
+extern aPopups PopupsList[POPUPS];
-#define COLOR_BG_FIRSTDEFAULT RGB(173,206,247)
-#define COLOR_BG_SECONDDEFAULT RGB(255,189,189)
-#define COLOR_TX_DEFAULT RGB(0,0,0)
+/////////////////////////////////////////////////////////////////////////////////////////
-#define byCOLOR_OWN 0x1
-#define byCOLOR_WINDOWS 0x2
-#define byCOLOR_POPUP 0x3
-#define DEFAULT_COLORS byCOLOR_POPUP
+#define DEFAULT_POPUP_LCLICK 1
+#define DEFAULT_POPUP_RCLICK 0
+#define DEFAULT_POPUP_ENABLED 1
+#define DEFAULT_MESSAGE_ENABLED 0
+#define DEFAULT_TIMEOUT_VALUE 0
-#define POPUP_TYPE_MSG 0
-#define POPUP_TYPE_ERROR 1
-#define POPUP_TYPE_INFO 2
+#define COLOR_BG_FIRSTDEFAULT RGB(173,206,247)
+#define COLOR_BG_SECONDDEFAULT RGB(255,189,189)
+#define COLOR_TX_DEFAULT RGB(0,0,0)
-// Actions on popup click
-#define PCA_CLOSEPOPUP 0 // close popup
-#define PCA_DONOTHING 1 // do nothing
+#define byCOLOR_OWN 0x1
+#define byCOLOR_WINDOWS 0x2
+#define byCOLOR_POPUP 0x3
+#define DEFAULT_COLORS byCOLOR_POPUP
-//===== Options flags
-extern struct POPUP_OPTIONS {
- BYTE DefColors;
- BYTE LeftClickAction;
- BYTE RightClickAction;
- int Timeout;
-} PopupOptions;
+#define POPUP_TYPE_MSG 0
+#define POPUP_TYPE_ERROR 1
+#define POPUP_TYPE_INFO 2
-static struct {
- wchar_t *Text;
- int Action;
-} PopupActions[] = {
- LPGENW("Close popup"), PCA_CLOSEPOPUP,
- LPGENW("Do nothing"), PCA_DONOTHING
-};
+// Actions on popup click
+#define PCA_CLOSEPOPUP 0 // close popup
+#define PCA_DONOTHING 1 // do nothing
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 31205b9a4d..cbcc8f5890 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -19,9 +19,6 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
-PlugOptions opts;
-POPUP_OPTIONS PopupOptions = { 0 };
-
static int GetBits(HWND hwndDlg)
{
return IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM) ? DEFAULT_OPP_BITS : DEFAULT_BITS;
@@ -41,7 +38,7 @@ static int GetUpdateMode()
}
}
- if (UpdateMode < 0 || UpdateMode > UPDATE_MODE_MAX_VALUE) {
+ if (UpdateMode < 0 || UpdateMode >= UPDATE_MODE_MAX_VALUE) {
// Missing or unknown mode, determine correct from version of running core
char coreVersion[512];
Miranda_GetVersionText(coreVersion, _countof(coreVersion));
@@ -56,16 +53,16 @@ wchar_t* GetDefaultUrl()
wchar_t url[MAX_PATH];
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
- mir_snwprintf(url, DEFAULT_UPDATE_URL, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL, g_plugin.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
return mir_wstrdup(url);
case UPDATE_MODE_STABLE_SYMBOLS:
- mir_snwprintf(url, DEFAULT_UPDATE_URL_STABLE_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_STABLE_SYMBOLS, g_plugin.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
return mir_wstrdup(url);
case UPDATE_MODE_TRUNK:
- mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK, g_plugin.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
return mir_wstrdup(url);
case UPDATE_MODE_TRUNK_SYMBOLS:
- mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, g_plugin.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
return mir_wstrdup(url);
default:
return g_plugin.getWStringA(DB_SETTING_UPDATE_URL);
@@ -80,31 +77,31 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
switch (msg) {
case WM_INITDIALOG:
- if (opts.bUpdateOnStartup) {
+ if (g_plugin.bUpdateOnStartup) {
CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), TRUE);
}
- CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, opts.bOnlyOnceADay ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHANGE_PLATFORM, opts.bChangePlatform ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, g_plugin.bOnlyOnceADay ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHANGE_PLATFORM, g_plugin.bChangePlatform ? BST_CHECKED : BST_UNCHECKED);
- if (opts.bUpdateOnPeriod) {
+ if (g_plugin.bUpdateOnPeriod) {
CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), TRUE);
}
- CheckDlgButton(hwndDlg, IDC_SILENTMODE, opts.bSilentMode ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SILENTMODE, g_plugin.bSilentMode ? BST_CHECKED : BST_UNCHECKED);
if (g_plugin.getByte(DB_SETTING_NEED_RESTART, 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_NEEDRESTARTLABEL), SW_SHOW);
SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
- SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)opts.Period);
+ SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)g_plugin.iPeriod);
if (ServiceExists(MS_AB_BACKUP)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_BACKUP), TRUE);
SetDlgItemText(hwndDlg, IDC_BACKUP, LPGENW("Backup database before update"));
- if (opts.bBackup)
+ if (g_plugin.bBackup)
CheckDlgButton(hwndDlg, IDC_BACKUP, BST_CHECKED);
}
@@ -122,7 +119,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
- ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
+ ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), g_plugin.iPeriodMeasure);
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
@@ -277,23 +274,23 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (hdr && hdr->code == PSN_APPLY) {
- g_plugin.setByte("UpdateOnStartup", opts.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
- g_plugin.setByte("OnlyOnceADay", opts.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
- g_plugin.setByte("UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
- g_plugin.setByte("PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
- g_plugin.setByte("SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
- g_plugin.setByte("Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
+ g_plugin.setByte("UpdateOnStartup", g_plugin.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
+ g_plugin.setByte("OnlyOnceADay", g_plugin.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
+ g_plugin.setByte("UpdateOnPeriod", g_plugin.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
+ g_plugin.setByte("PeriodMeasure", g_plugin.iPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
+ g_plugin.setByte("SilentMode", g_plugin.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
+ g_plugin.setByte("Backup", g_plugin.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
wchar_t buffer[3] = { 0 };
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
- g_plugin.setDword("Period", opts.Period = _wtoi(buffer));
+ g_plugin.setDword("Period", g_plugin.iPeriod = _wtoi(buffer));
InitTimer((void*)1);
bool bNoSymbols = false;
if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
- if (!opts.bChangePlatform)
- opts.bForceRedownload = 0;
+ if (!g_plugin.bChangePlatform)
+ g_plugin.bForceRedownload = 0;
g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
bNoSymbols = true;
}
@@ -301,14 +298,14 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
// Only set ForceRedownload if the previous UpdateMode was different
// to redownload all plugin with pdb files
if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_STABLE_SYMBOLS) {
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE_SYMBOLS);
}
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- if (!opts.bChangePlatform)
- opts.bForceRedownload = 0;
+ if (!g_plugin.bChangePlatform)
+ g_plugin.bForceRedownload = 0;
g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
bNoSymbols = true;
}
@@ -316,7 +313,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
// Only set ForceRedownload if the previous UpdateMode was different
// to redownload all plugin with pdb files
if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
}
}
@@ -325,15 +322,15 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
g_plugin.setWString(DB_SETTING_UPDATE_URL, tszUrl);
g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
- opts.bForceRedownload = 0;
+ g_plugin.bForceRedownload = 0;
g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
}
if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) {
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
+ g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
+ g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, g_plugin.bChangePlatform = 1);
}
- else g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 0);
+ else g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, g_plugin.bChangePlatform = 0);
// if user selected update channel without symbols, remove PDBs
if (bNoSymbols) {
@@ -360,6 +357,17 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar
return FALSE;
}
+struct
+{
+ wchar_t *Text;
+ int Action;
+}
+static PopupActions[] =
+{
+ LPGENW("Close popup"), PCA_CLOSEPOPUP,
+ LPGENW("Do nothing"), PCA_DONOTHING
+};
+
static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -367,33 +375,33 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
TranslateDialogDefault(hdlg);
//Colors
- if (PopupOptions.DefColors == byCOLOR_OWN) {
+ if (g_plugin.PopupDefColors == byCOLOR_OWN) {
CheckDlgButton(hdlg, IDC_USEOWNCOLORS, BST_CHECKED);
}
- else if (PopupOptions.DefColors == byCOLOR_WINDOWS) {
+ else if (g_plugin.PopupDefColors == byCOLOR_WINDOWS) {
CheckDlgButton(hdlg, IDC_USEWINCOLORS, BST_CHECKED);
}
- else if (PopupOptions.DefColors == byCOLOR_POPUP) {
+ else if (g_plugin.PopupDefColors == byCOLOR_POPUP) {
CheckDlgButton(hdlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
}
for (int i = 0; i < POPUPS; i++) {
SendDlgItemMessage(hdlg, (i + 42071), CPM_SETCOLOUR, 0, PopupsList[i].colorBack);
SendDlgItemMessage(hdlg, (i + 41071), CPM_SETCOLOUR, 0, PopupsList[i].colorText);
- EnableWindow(GetDlgItem(hdlg, (i + 42071)), (PopupOptions.DefColors == byCOLOR_OWN));
- EnableWindow(GetDlgItem(hdlg, (i + 41071)), (PopupOptions.DefColors == byCOLOR_OWN));
+ EnableWindow(GetDlgItem(hdlg, (i + 42071)), (g_plugin.PopupDefColors == byCOLOR_OWN));
+ EnableWindow(GetDlgItem(hdlg, (i + 41071)), (g_plugin.PopupDefColors == byCOLOR_OWN));
}
// Timeout
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE, EM_LIMITTEXT, 4, 0);
SendDlgItemMessage(hdlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, -1, 9999);
- SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, PopupOptions.Timeout, TRUE);
+ SetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, g_plugin.PopupTimeout, TRUE);
// Mouse actions
for (auto &it : PopupActions) {
SendDlgItemMessage(hdlg, IDC_LC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_LC, CB_ADDSTRING, 0, (LPARAM)TranslateW(it.Text)), it.Action);
SendDlgItemMessage(hdlg, IDC_RC, CB_SETITEMDATA, SendDlgItemMessage(hdlg, IDC_RC, CB_ADDSTRING, 0, (LPARAM)TranslateW(it.Text)), it.Action);
}
- SendDlgItemMessage(hdlg, IDC_LC, CB_SETCURSEL, PopupOptions.LeftClickAction, 0);
- SendDlgItemMessage(hdlg, IDC_RC, CB_SETCURSEL, PopupOptions.RightClickAction, 0);
+ SendDlgItemMessage(hdlg, IDC_LC, CB_SETCURSEL, g_plugin.PopupLeftClickAction, 0);
+ SendDlgItemMessage(hdlg, IDC_RC, CB_SETCURSEL, g_plugin.PopupRightClickAction, 0);
//Popups notified
for (int i = 0; i < POPUPS; i++) {
@@ -419,9 +427,9 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
return TRUE;
}
if (idCtrl == IDC_LC)
- PopupOptions.LeftClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_LC, CB_GETCURSEL, 0, 0);
+ g_plugin.PopupLeftClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_LC, CB_GETCURSEL, 0, 0);
else if (idCtrl == IDC_RC)
- PopupOptions.RightClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_RC, CB_GETCURSEL, 0, 0);
+ g_plugin.PopupRightClickAction = (BYTE)SendDlgItemMessage(hdlg, IDC_RC, CB_GETCURSEL, 0, 0);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
return TRUE;
@@ -431,7 +439,7 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
if (wNotifyCode != BN_CLICKED)
break;
- PopupOptions.DefColors = byCOLOR_OWN;
+ g_plugin.PopupDefColors = byCOLOR_OWN;
for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i + 42071)), TRUE); //Background
@@ -445,7 +453,7 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
break;
//Use Windows colors
- PopupOptions.DefColors = byCOLOR_WINDOWS;
+ g_plugin.PopupDefColors = byCOLOR_WINDOWS;
for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i + 42071)), FALSE); //Background
EnableWindow(GetDlgItem(hdlg, (i + 41071)), FALSE); //Text
@@ -458,7 +466,7 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
break;
//Use Popup colors
- PopupOptions.DefColors = byCOLOR_POPUP;
+ g_plugin.PopupDefColors = byCOLOR_POPUP;
for (int i = 0; i < POPUPS; i++) {
EnableWindow(GetDlgItem(hdlg, (i + 42071)), FALSE); //Background
EnableWindow(GetDlgItem(hdlg, (i + 41071)), FALSE); //Text
@@ -532,14 +540,14 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM
g_plugin.setDword(szSetting, ctlColor);
}
//Colors
- g_plugin.setByte("DefColors", PopupOptions.DefColors);
+ g_plugin.setByte("DefColors", g_plugin.PopupDefColors);
//Timeout
- PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
- g_plugin.setDword("Timeout", PopupOptions.Timeout);
+ g_plugin.PopupTimeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
+ g_plugin.setDword("Timeout", g_plugin.PopupTimeout);
//Left mouse click
- g_plugin.setByte("LeftClickAction", PopupOptions.LeftClickAction);
+ g_plugin.setByte("LeftClickAction", g_plugin.PopupLeftClickAction);
//Right mouse click
- g_plugin.setByte("RightClickAction", PopupOptions.RightClickAction);
+ g_plugin.setByte("RightClickAction", g_plugin.PopupRightClickAction);
//Notified popups
for (int i = 0; i < POPUPS; i++) {
char str[20] = { 0 };
diff --git a/plugins/PluginUpdater/src/Services.cpp b/plugins/PluginUpdater/src/Services.cpp
index ab8c744c9f..2182c08817 100644
--- a/plugins/PluginUpdater/src/Services.cpp
+++ b/plugins/PluginUpdater/src/Services.cpp
@@ -28,7 +28,7 @@ static INT_PTR srvParseHashes(WPARAM wParam, LPARAM lParam)
SERVLIST *pList = new SERVLIST(50, CompareHashes);
ptrW baseUrl;
- if ( ParseHashes(ptszUrl, baseUrl, *pList)) {
+ if (ParseHashes(ptszUrl, baseUrl, *pList)) {
wcsncpy(ptszBaseUrl, baseUrl, MAX_PATH);
return (INT_PTR)pList;
}
@@ -59,8 +59,8 @@ static INT_PTR srvGetNthHash(WPARAM wParam, LPARAM lParam)
void InitServices()
{
- CreateServiceFunction(MS_PU_PARSEHASHES, srvParseHashes);
- CreateServiceFunction(MS_PU_FREEHASHES, srvFreeHashes);
+ CreateServiceFunction(MS_PU_PARSEHASHES, srvParseHashes);
+ CreateServiceFunction(MS_PU_FREEHASHES, srvFreeHashes);
CreateServiceFunction(MS_PU_GETHASHCOUNT, srvGetHashCount);
- CreateServiceFunction(MS_PU_GETNTHHASH, srvGetNthHash);
+ CreateServiceFunction(MS_PU_GETNTHHASH, srvGetNthHash);
} \ No newline at end of file
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 253bc2151c..f6d23f1899 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -23,22 +23,24 @@ HNETLIBUSER hNetlibUser = nullptr;
HANDLE hPipe = nullptr;
/////////////////////////////////////////////////////////////////////////////////////
+
void LoadOptions()
{
- PopupOptions.DefColors = g_plugin.getByte("DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= g_plugin.getByte("LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = g_plugin.getByte("RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = g_plugin.getDword("Timeout", DEFAULT_TIMEOUT_VALUE);
-
- opts.bUpdateOnStartup = g_plugin.getByte("UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = g_plugin.getByte("OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = g_plugin.getByte("UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = g_plugin.getDword("Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = g_plugin.getByte("PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bForceRedownload = g_plugin.getByte(DB_SETTING_REDOWNLOAD, 0);
- opts.bSilentMode = g_plugin.getByte("SilentMode", 0);
- opts.bBackup = g_plugin.getByte("Backup", 0);
- opts.bChangePlatform = g_plugin.getByte(DB_SETTING_CHANGEPLATFORM, 0);
+ g_plugin.PopupDefColors = g_plugin.getByte("DefColors", DEFAULT_COLORS);
+ g_plugin.PopupLeftClickAction= g_plugin.getByte("LeftClickAction", DEFAULT_POPUP_LCLICK);
+ g_plugin.PopupRightClickAction = g_plugin.getByte("RightClickAction", DEFAULT_POPUP_RCLICK);
+ g_plugin.PopupTimeout = g_plugin.getDword("Timeout", DEFAULT_TIMEOUT_VALUE);
+
+ g_plugin.bUpdateOnStartup = g_plugin.getBool("UpdateOnStartup", true);
+ g_plugin.bOnlyOnceADay = g_plugin.getBool("OnlyOnceADay", true);
+ g_plugin.bUpdateOnPeriod = g_plugin.getBool("UpdateOnPeriod", false);
+ g_plugin.bForceRedownload = g_plugin.getBool(DB_SETTING_REDOWNLOAD, false);
+ g_plugin.bSilentMode = g_plugin.getBool("SilentMode", false);
+ g_plugin.bBackup = g_plugin.getBool("Backup", false);
+ g_plugin.bChangePlatform = g_plugin.getBool(DB_SETTING_CHANGEPLATFORM, false);
+
+ g_plugin.iPeriod = g_plugin.getDword("Period", 1);
+ g_plugin.iPeriodMeasure = g_plugin.getByte("PeriodMeasure", 1);
}
IconItem iconList[] =
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index 2a74f8f77c..dac85f823d 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.
#include <Windowsx.h>
#include <Shlobj.h>
#include <string.h>
+#include <VersionHelpers.h>
// Miranda header files
#include <newpluginapi.h>
@@ -83,38 +84,22 @@ struct FILEINFO
typedef OBJLIST<FILEINFO> FILELIST;
-extern struct PlugOptions
-{
- BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bForceRedownload, bSilentMode, bBackup, bChangePlatform;
- BOOL bSilent;
-
- BYTE bPeriodMeasure;
- int Period;
-} opts;
-
-#define DEFAULT_UPDATEONSTARTUP 1
-#define DEFAULT_UPDATEONPERIOD 0
-#define DEFAULT_PERIOD 1
-#define DEFAULT_PERIODMEASURE 1
-#define DEFAULT_ONLYONCEADAY 1
-
#define DEFAULT_UPDATE_URL L"https://miranda-ng.org/distr/stable/x%d"
#define DEFAULT_UPDATE_URL_TRUNK L"https://miranda-ng.org/distr/x%d"
#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS L"https://miranda-ng.org/distr/pdb_x%d"
#define DEFAULT_UPDATE_URL_STABLE_SYMBOLS L"https://miranda-ng.org/distr/stable/pdb_x%d"
-
#define FILENAME_X64 L"miranda64.exe"
#define FILENAME_X32 L"miranda32.exe"
#ifdef _WIN64
- #define DEFAULT_BITS 64
- #define DEFAULT_OPP_BITS 32
+ #define DEFAULT_BITS 64
+ #define DEFAULT_OPP_BITS 32
#define OLD_FILENAME FILENAME_X64
#define NEW_FILENAME FILENAME_X32
#else
- #define DEFAULT_BITS 32
- #define DEFAULT_OPP_BITS 64
+ #define DEFAULT_BITS 32
+ #define DEFAULT_OPP_BITS 64
#define OLD_FILENAME FILENAME_X32
#define NEW_FILENAME FILENAME_X64
#endif
@@ -125,23 +110,27 @@ extern struct PlugOptions
#define DEFAULT_UPDATE_URL_TRUNK_OLD "https://miranda-ng.org/distr/x%platform%"
#define DEFAULT_UPDATE_URL_TRUNK_SYMBOLS_OLD "https://miranda-ng.org/distr/pdb_x%platform%"
-#define UPDATE_MODE_CUSTOM 0
-#define UPDATE_MODE_STABLE 1
-#define UPDATE_MODE_TRUNK 2
-#define UPDATE_MODE_TRUNK_SYMBOLS 3
-#define UPDATE_MODE_STABLE_SYMBOLS 4
-#define UPDATE_MODE_MAX_VALUE 4 // when adding new mode, increment this number
-
-#define DB_SETTING_UPDATE_MODE "UpdateMode"
-#define DB_SETTING_UPDATE_URL "UpdateURL"
-#define DB_SETTING_REDOWNLOAD "ForceRedownload"
-#define DB_SETTING_NEED_RESTART "NeedRestart"
-#define DB_SETTING_RESTART_COUNT "RestartCount"
-#define DB_SETTING_LAST_UPDATE "LastUpdate"
-#define DB_SETTING_DONT_SWITCH_TO_STABLE "DontSwitchToStable"
-#define DB_SETTING_CHANGEPLATFORM "ChangePlatform"
-#define DB_MODULE_FILES MODULENAME "Files"
-#define DB_MODULE_NEW_FILES MODULENAME "NewFiles"
+enum
+{
+ UPDATE_MODE_CUSTOM,
+ UPDATE_MODE_STABLE,
+ UPDATE_MODE_TRUNK,
+ UPDATE_MODE_TRUNK_SYMBOLS,
+ UPDATE_MODE_STABLE_SYMBOLS,
+ UPDATE_MODE_MAX_VALUE // leave this variable last in the list
+};
+
+#define DB_SETTING_UPDATE_MODE "UpdateMode"
+#define DB_SETTING_UPDATE_URL "UpdateURL"
+#define DB_SETTING_REDOWNLOAD "ForceRedownload"
+#define DB_SETTING_NEED_RESTART "NeedRestart"
+#define DB_SETTING_RESTART_COUNT "RestartCount"
+#define DB_SETTING_LAST_UPDATE "LastUpdate"
+#define DB_SETTING_DONT_SWITCH_TO_STABLE "DontSwitchToStable"
+#define DB_SETTING_CHANGEPLATFORM "ChangePlatform"
+
+#define DB_MODULE_FILES MODULENAME "Files"
+#define DB_MODULE_NEW_FILES MODULENAME "NewFiles"
#define MAX_RETRIES 3
@@ -153,7 +142,6 @@ using namespace std;
extern DWORD g_mirandaVersion;
extern wchar_t g_tszRoot[MAX_PATH], g_tszTempPath[MAX_PATH];
-extern aPopups PopupsList[POPUPS];
extern HANDLE hPipe;
extern HNETLIBUSER hNetlibUser;
@@ -165,6 +153,14 @@ struct CMPlugin : public PLUGIN<CMPlugin>
int Load() override;
int Unload() override;
+
+ // common options
+ bool bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bForceRedownload, bSilentMode, bBackup, bChangePlatform, bSilent;
+ int iPeriod, iPeriodMeasure;
+
+ // popup options
+ BYTE PopupDefColors, PopupLeftClickAction, PopupRightClickAction;
+ int PopupTimeout;
};
void UninitCheck(void);