From 7287b25120a081f769656c775e90b15baf88f53a Mon Sep 17 00:00:00 2001 From: George Hazan <ghazan@miranda.im> Date: Thu, 18 Oct 2018 12:50:31 +0300 Subject: Db_autobackups: code cleaning & reordering --- plugins/Db_autobackups/src/backup.cpp | 140 ++++++++++++++------------------- plugins/Db_autobackups/src/main.cpp | 34 +++++--- plugins/Db_autobackups/src/options.cpp | 66 ++++++---------- plugins/Db_autobackups/src/options.h | 17 ---- plugins/Db_autobackups/src/stdafx.h | 19 +++-- 5 files changed, 118 insertions(+), 158 deletions(-) (limited to 'plugins') diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index cd87c676a1..3961618d31 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -1,14 +1,14 @@ #include "stdafx.h" -static UINT_PTR timer_id = 0; -volatile long m_state = 0; +static UINT_PTR timer_id = 0; +static volatile long g_iState = 0; -LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_COMMAND: { - wchar_t* ptszPath = (wchar_t*)PUGetPluginData(hWnd); + wchar_t *ptszPath = (wchar_t*)PUGetPluginData(hWnd); if (ptszPath != nullptr) ShellExecute(nullptr, L"open", ptszPath, nullptr, nullptr, SW_SHOW); @@ -18,6 +18,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_CONTEXTMENU: PUDeletePopup(hWnd); break; + case UM_FREEPLUGINDATA: mir_free(PUGetPluginData(hWnd)); break; @@ -25,7 +26,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) return DefWindowProc(hWnd, msg, wParam, lParam); } -void ShowPopup(wchar_t* ptszText, wchar_t* ptszHeader, wchar_t* ptszPath) +static void ShowPopup(const wchar_t *ptszText, wchar_t *ptszHeader, wchar_t *ptszPath) { POPUPDATAT ppd = { 0 }; @@ -39,7 +40,7 @@ void ShowPopup(wchar_t* ptszText, wchar_t* ptszHeader, wchar_t* ptszPath) PUAddPopupT(&ppd); } -INT_PTR CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) +static INT_PTR CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { case WM_INITDIALOG: @@ -57,27 +58,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) return FALSE; } -wchar_t* DoubleSlash(wchar_t *sorce) -{ - wchar_t *ret, *r, *s; - - ret = (wchar_t*)mir_alloc((MAX_PATH * sizeof(wchar_t))); - if (ret == nullptr) - return nullptr; - for (s = sorce, r = ret; *s && (r - ret) < (MAX_PATH - 1); s++, r++) { - if (*s != '\\') - *r = *s; - else { - *r = '\\'; - r++; - *r = '\\'; - } - } - r[0] = 0; - return ret; -} - -bool MakeZip_Dir(LPCWSTR szDir, LPCWSTR pwszProfile, LPCWSTR szDest, LPCWSTR pwszBackupFolder, HWND progress_dialog) +static bool MakeZip_Dir(LPCWSTR szDir, LPCWSTR pwszProfile, LPCWSTR szDest, LPCWSTR pwszBackupFolder, HWND progress_dialog) { HWND hProgBar = GetDlgItem(progress_dialog, IDC_PROGRESS); size_t count = 0, folderNameLen = mir_wstrlen(pwszBackupFolder); @@ -127,7 +108,7 @@ bool MakeZip_Dir(LPCWSTR szDir, LPCWSTR pwszProfile, LPCWSTR szDest, LPCWSTR pws return 1; } -bool MakeZip(wchar_t *tszDest, wchar_t *dbname, HWND progress_dialog) +static bool MakeZip(wchar_t *tszDest, wchar_t *dbname, HWND progress_dialog) { HWND hProgBar = GetDlgItem(progress_dialog, IDC_PROGRESS); @@ -149,6 +130,7 @@ bool MakeZip(wchar_t *tszDest, wchar_t *dbname, HWND progress_dialog) return true; } +///////////////////////////////////////////////////////////////////////////////////////// struct backupFile { @@ -156,7 +138,7 @@ struct backupFile FILETIME CreationTime; }; -int Comp(const void *i, const void *j) +static int Comp(const void *i, const void *j) { backupFile *pi = (backupFile*)i; backupFile *pj = (backupFile*)j; @@ -164,19 +146,18 @@ int Comp(const void *i, const void *j) if (pi->CreationTime.dwHighDateTime > pj->CreationTime.dwHighDateTime || (pi->CreationTime.dwHighDateTime == pj->CreationTime.dwHighDateTime && pi->CreationTime.dwLowDateTime > pj->CreationTime.dwLowDateTime)) return -1; - else - return 1; + return 1; } -int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) +static int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) { - if (options.num_backups == 0) // Rotation disabled? + if (g_plugin.num_backups == 0) // Rotation disabled? return 0; backupFile *bf = nullptr, *bftmp; wchar_t backupfolderTmp[MAX_PATH]; - mir_snwprintf(backupfolderTmp, L"%s\\%s*.%s", backupfolder, dbname, options.use_zip ? L"zip" : L"dat"); + mir_snwprintf(backupfolderTmp, L"%s\\%s*.%s", backupfolder, dbname, g_plugin.use_zip ? L"zip" : L"dat"); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(backupfolderTmp, &FindFileData); @@ -194,20 +175,25 @@ int RotateBackups(wchar_t *backupfolder, wchar_t *dbname) wcsncpy_s(bf[i].Name, FindFileData.cFileName, _TRUNCATE); bf[i].CreationTime = FindFileData.ftCreationTime; i++; - } while (FindNextFile(hFind, &FindFileData)); + } + while (FindNextFile(hFind, &FindFileData)); + + // Sort the list of found files by date in descending order. if (i > 0) - qsort(bf, i, sizeof(backupFile), Comp); /* Sort the list of found files by date in descending order. */ - for (; i >= options.num_backups; i--) { + qsort(bf, i, sizeof(backupFile), Comp); + + for (; i >= g_plugin.num_backups; i--) { mir_snwprintf(backupfolderTmp, L"%s\\%s", backupfolder, bf[(i - 1)].Name); DeleteFile(backupfolderTmp); } + err_out: FindClose(hFind); mir_free(bf); return 0; } -int Backup(wchar_t *backup_filename) +static int Backup(wchar_t *backup_filename) { bool bZip = false; wchar_t dbname[MAX_PATH], dest_file[MAX_PATH]; @@ -216,7 +202,7 @@ int Backup(wchar_t *backup_filename) Profile_GetNameW(_countof(dbname), dbname); wchar_t backupfolder[MAX_PATH]; - PathToAbsoluteW(VARSW(options.folder), backupfolder); + PathToAbsoluteW(VARSW(g_plugin.folder), backupfolder); // ensure the backup folder exists (either create it or return non-zero signifying error) int err = CreateDirectoryTreeW(backupfolder); @@ -226,7 +212,7 @@ int Backup(wchar_t *backup_filename) } if (backup_filename == nullptr) { - bZip = options.use_zip != 0; + bZip = g_plugin.use_zip != 0; RotateBackups(backupfolder, dbname); SYSTEMTIME st; @@ -242,24 +228,25 @@ int Backup(wchar_t *backup_filename) if (!mir_wstrcmp(wcsrchr(backup_filename, '.'), L".zip")) bZip = true; } - if (!options.disable_popups) + + if (!g_plugin.disable_popups) ShowPopup(dbname, TranslateT("Backup in progress"), nullptr); - if (!options.disable_progress) + if (!g_plugin.disable_progress) progress_dialog = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress); SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file...")); BOOL res; if (bZip) { - res = options.backup_profile + res = g_plugin.backup_profile ? MakeZip_Dir(VARSW(L"%miranda_userdata%"), dbname, dest_file, backupfolder, progress_dialog) : MakeZip(dest_file, dbname, progress_dialog); } else res = db_get_current()->Backup(dest_file) == ERROR_SUCCESS; if (res) { - if (!bZip) { // Set the backup file to the current time for rotator's correct work + if (!bZip) { // Set the backup file to the current time for rotator's correct work SYSTEMTIME st; GetSystemTime(&st); @@ -269,69 +256,58 @@ int Backup(wchar_t *backup_filename) SetFileTime(hFile, nullptr, nullptr, &ft); CloseHandle(hFile); } + SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0); UpdateWindow(progress_dialog); - db_set_dw(0, MODULENAME, "LastBackupTimestamp", (DWORD)time(0)); + g_plugin.setDword("LastBackupTimestamp", (DWORD)time(0)); - if (options.use_cloudfile) { - CFUPLOADDATA ui = { options.cloudfile_service, dest_file, L"Backups" }; + if (g_plugin.use_cloudfile) { + CFUPLOADDATA ui = { g_plugin.cloudfile_service, dest_file, L"Backups" }; if (CallService(MS_CLOUDFILE_UPLOAD, (LPARAM)&ui)) ShowPopup(TranslateT("Uploading to cloud failed"), TranslateT("Error"), nullptr); } - if (!options.disable_popups) { - size_t dest_file_len = mir_wstrlen(dest_file); - wchar_t *puText; - - if (dest_file_len > 50) { - size_t i; - puText = (wchar_t*)mir_alloc(sizeof(wchar_t) * (dest_file_len + 2)); - for (i = (dest_file_len - 1); dest_file[i] != '\\'; i--) - ; - //wcsncpy_s(dest_file, backup_filename, _TRUNCATE); - mir_wstrncpy(puText, dest_file, (i + 2)); - mir_wstrcat(puText, L"\n"); - mir_wstrcat(puText, (dest_file + i + 1)); + wchar_t *pd = wcsrchr(dest_file, '\\'); + + if (!g_plugin.disable_popups) { + CMStringW puText; + + if (pd && mir_wstrlen(dest_file) > 50) { + puText.Append(dest_file, pd - dest_file); + puText.AppendChar('\n'); + puText.Append(pd + 1); } - else - puText = mir_wstrdup(dest_file); + else puText = dest_file; // Now we need to know, which folder we made a backup. Let's break unnecessary variables :) - while (dest_file[--dest_file_len] != L'\\') - ; - dest_file[dest_file_len] = 0; + if (pd) *pd = 0; ShowPopup(puText, TranslateT("Database backed up"), dest_file); - mir_free(puText); } } - else - DeleteFile(dest_file); + else DeleteFileW(dest_file); DestroyWindow(progress_dialog); return 0; } -void BackupThread(void *backup_filename) +static void BackupThread(void *backup_filename) { Backup((wchar_t*)backup_filename); - InterlockedExchange(&m_state, 0); /* Backup done. */ + InterlockedExchange(&g_iState, 0); // Backup done. mir_free(backup_filename); } void BackupStart(wchar_t *backup_filename) { - wchar_t *tm = nullptr; - LONG cur_state; - - cur_state = InterlockedCompareExchange(&m_state, 1, 0); - if (cur_state != 0) { /* Backup allready in process. */ - ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), nullptr); /* Show error message :) */ + LONG cur_state = InterlockedCompareExchange(&g_iState, 1, 0); + if (cur_state != 0) { // Backup allready in process. + ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), nullptr); return; } - if (backup_filename != nullptr) - tm = mir_wstrdup(backup_filename); + + wchar_t *tm = mir_wstrdup(backup_filename); if (mir_forkthread(BackupThread, tm) == INVALID_HANDLE_VALUE) { - InterlockedExchange(&m_state, 0); /* Backup done. */ + InterlockedExchange(&g_iState, 0); // Backup done. mir_free(tm); } } @@ -339,8 +315,8 @@ void BackupStart(wchar_t *backup_filename) VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { time_t t = time(0); - time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", 0); - if (diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24))))) + time_t diff = t - (time_t)g_plugin.getDword("LastBackupTimestamp"); + if (diff > (time_t)(g_plugin.period * (g_plugin.period_type == PT_MINUTES ? 60 : (g_plugin.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24))))) BackupStart(nullptr); } @@ -350,7 +326,7 @@ int SetBackupTimer(void) KillTimer(nullptr, timer_id); timer_id = 0; } - if (options.backup_types & BT_PERIODIC) + if (g_plugin.backup_types & BT_PERIODIC) timer_id = SetTimer(nullptr, 0, (1000 * 60), TimerProc); return 0; } diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index fd8adfb792..240e21adff 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -21,8 +21,19 @@ PLUGININFOEX pluginInfoEx = { }; CMPlugin::CMPlugin() : - PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx) -{} + PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx), + backup_types(MODULENAME, "BackupType", BT_PERIODIC), + period(MODULENAME, "Period", 1), + period_type(MODULENAME, "PeriodType", PT_DAYS), + num_backups(MODULENAME, "NumBackups", 3), + disable_progress(MODULENAME, "NoProgress", 0), + disable_popups(MODULENAME, "NoPopups", 0), + use_zip(MODULENAME, "UseZip", 0), + backup_profile(MODULENAME, "BackupProfile", 0), + use_cloudfile(MODULENAME, "UseCloudFile", 0), + cloudfile_service(MODULENAME, "CloudFileService", nullptr) +{ +} ///////////////////////////////////////////////////////////////////////////////////////// @@ -58,7 +69,7 @@ static INT_PTR DBSaveAs(WPARAM, LPARAM) static int FoldersGetBackupPath(WPARAM, LPARAM) { - FoldersGetCustomPathT(hFolder, options.folder, _countof(options.folder), DIR SUB_DIR); + FoldersGetCustomPathT(hFolder, g_plugin.folder, _countof(g_plugin.folder), DIR SUB_DIR); return 0; } @@ -86,15 +97,14 @@ static int ModulesLoad(WPARAM, LPARAM) FoldersGetBackupPath(0, 0); } else { - DBVARIANT dbv; - if (!db_get_ws(0, MODULENAME, "Folder", &dbv)) { - wcsncpy_s(options.folder, dbv.pwszVal, _TRUNCATE); - db_free(&dbv); - } - else mir_snwprintf(options.folder, L"%s%s", DIR, SUB_DIR); + ptrW wszFolder(g_plugin.getWStringA("Folder")); + if (wszFolder) + wcsncpy_s(g_plugin.folder, wszFolder, _TRUNCATE); + else + mir_snwprintf(g_plugin.folder, L"%s%s", DIR, SUB_DIR); } - if (options.backup_types & BT_START) + if (g_plugin.backup_types & BT_START) BackupStart(nullptr); return 0; } @@ -103,8 +113,8 @@ static int ModulesLoad(WPARAM, LPARAM) // for setting changed event not cleared. the backup on exit function will write to the db, calling those hooks. static int PreShutdown(WPARAM, LPARAM) { - if (options.backup_types & BT_EXIT) { - options.disable_popups = 1; // Don't try to show popups on exit + if (g_plugin.backup_types & BT_EXIT) { + g_plugin.disable_popups = 1; // Don't try to show popups on exit BackupStart(nullptr); } return 0; diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 2545308e3d..c3091ab006 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -1,21 +1,5 @@ #include "stdafx.h" -Options::Options() : - backup_types(MODULENAME, "BackupType", BT_PERIODIC), - period(MODULENAME, "Period", 1), - period_type(MODULENAME, "PeriodType", PT_DAYS), - num_backups(MODULENAME, "NumBackups", 3), - disable_progress(MODULENAME, "NoProgress", 0), - disable_popups(MODULENAME, "NoPopups", 0), - use_zip(MODULENAME, "UseZip", 0), - backup_profile(MODULENAME, "BackupProfile", 0), - use_cloudfile(MODULENAME, "UseCloudFile", 0), - cloudfile_service(MODULENAME, "CloudFileService", nullptr) -{ -} - -Options options; - ///////////////////////////////////////////////////////////////////////////////////////// class COptionsDlg : public CDlgBase @@ -55,9 +39,9 @@ class COptionsDlg : public CDlgBase m_cloudFileService.Enable(m_useCloudFile.IsChecked()); UseZip_OnChange(0); - BYTE backupTypes = options.backup_types; + BYTE backupTypes = g_plugin.backup_types; if (backupTypes == BT_DISABLED) - backupTypes = options.backup_types.Default(); + backupTypes = g_plugin.backup_types.Default(); m_backupOnStart.SetState(backupTypes & BT_START ? TRUE : FALSE); m_backupOnExit.SetState(backupTypes & BT_EXIT ? TRUE : FALSE); m_backupPeriodic.SetState(backupTypes & BT_PERIODIC ? TRUE : FALSE); @@ -102,7 +86,7 @@ class COptionsDlg : public CDlgBase switch (uMsg) { case BFFM_INITIALIZED: wchar_t backupfolder[MAX_PATH]; - PathToAbsoluteW(VARSW(options.folder), backupfolder); + PathToAbsoluteW(VARSW(g_plugin.folder), backupfolder); SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)backupfolder); break; } @@ -114,7 +98,7 @@ class COptionsDlg : public CDlgBase CCtrlCombo &combo = *(CCtrlCombo*)param; int pos = combo.GetCount(); combo.InsertString(serviceInfo->userName, pos, (LPARAM)serviceInfo->accountName); - if (mir_strcmp(serviceInfo->accountName, options.cloudfile_service) == 0) + if (mir_strcmp(serviceInfo->accountName, g_plugin.cloudfile_service) == 0) combo.SetCurSel(pos); return 0; } @@ -152,13 +136,13 @@ public: m_useZip(this, IDC_CHK_USEZIP), m_useCloudFile(this, IDC_CLOUDFILE), m_cloudFileService(this, IDC_CLOUDFILESEVICE) { - CreateLink(m_period, options.period); - CreateLink(m_numBackups, options.num_backups); - CreateLink(m_disableProgress, options.disable_progress); - CreateLink(m_disablePopups, options.disable_popups); - CreateLink(m_useZip, options.use_zip); - CreateLink(m_backupProfile, options.backup_profile); - CreateLink(m_useCloudFile, options.use_cloudfile); + CreateLink(m_period, g_plugin.period); + CreateLink(m_numBackups, g_plugin.num_backups); + CreateLink(m_disableProgress, g_plugin.disable_progress); + CreateLink(m_disablePopups, g_plugin.disable_popups); + CreateLink(m_useZip, g_plugin.use_zip); + CreateLink(m_backupProfile, g_plugin.backup_profile); + CreateLink(m_useCloudFile, g_plugin.use_cloudfile); m_disable.OnChange = Callback(this, &COptionsDlg::Disable_OnChange); m_backupOnStart.OnChange = Callback(this, &COptionsDlg::BackupType_OnChange); @@ -174,20 +158,20 @@ public: bool OnInitDialog() override { - m_disable.SetState(options.backup_types == BT_DISABLED); - m_backupOnStart.SetState(options.backup_types & BT_START ? TRUE : FALSE); - m_backupOnExit.SetState(options.backup_types & BT_EXIT ? TRUE : FALSE); - m_backupPeriodic.SetState(options.backup_types & BT_PERIODIC ? TRUE : FALSE); + m_disable.SetState(g_plugin.backup_types == BT_DISABLED); + m_backupOnStart.SetState(g_plugin.backup_types & BT_START ? TRUE : FALSE); + m_backupOnExit.SetState(g_plugin.backup_types & BT_EXIT ? TRUE : FALSE); + m_backupPeriodic.SetState(g_plugin.backup_types & BT_PERIODIC ? TRUE : FALSE); m_period.SetRange(60, 1); m_numBackups.SetRange(9999, 1); - m_numBackups.SetPosition(options.num_backups); + m_numBackups.SetPosition(g_plugin.num_backups); m_periodType.AddString(TranslateT("days")); m_periodType.AddString(TranslateT("hours")); m_periodType.AddString(TranslateT("minutes")); - m_periodType.SetCurSel(options.period_type); + m_periodType.SetCurSel(g_plugin.period_type); if (ServiceExists(MS_FOLDERS_GET_PATH)) { m_folder.Hide(); @@ -195,7 +179,7 @@ public: m_foldersPageLink.Show(); } else { - m_folder.SetText(options.folder); + m_folder.SetText(g_plugin.folder); wchar_t tszTooltipText[4096]; mir_snwprintf(tszTooltipText, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s", @@ -242,11 +226,11 @@ public: else backupTypes &= ~BT_PERIODIC; - options.backup_types = backupTypes; + g_plugin.backup_types = backupTypes; SetBackupTimer(); - options.period_type = m_periodType.GetCurSel(); + g_plugin.period_type = m_periodType.GetCurSel(); ptrW folder(m_folder.GetText()); @@ -260,11 +244,11 @@ public: return false; } - wcsncpy_s(options.folder, folder, _TRUNCATE); - db_set_ws(0, MODULENAME, "Folder", folder); + wcsncpy_s(g_plugin.folder, folder, _TRUNCATE); + g_plugin.setWString("Folder", folder); int currentService = m_cloudFileService.GetCurSel(); - options.cloudfile_service = currentService >= 0 + g_plugin.cloudfile_service = currentService >= 0 ? (char*)m_cloudFileService.GetItemData(currentService) : nullptr; return true; @@ -292,9 +276,7 @@ public: void BackupType_OnChange(CCtrlBase*) { - if (!m_backupOnStart.IsChecked() && - !m_backupOnExit.IsChecked() && - !m_backupPeriodic.IsChecked()) { + if (!m_backupOnStart.IsChecked() && !m_backupOnExit.IsChecked() && !m_backupPeriodic.IsChecked()) { m_disable.SetState(TRUE); SetDialogState(); } diff --git a/plugins/Db_autobackups/src/options.h b/plugins/Db_autobackups/src/options.h index 69a61e57b1..10185b8cc9 100644 --- a/plugins/Db_autobackups/src/options.h +++ b/plugins/Db_autobackups/src/options.h @@ -38,20 +38,3 @@ enum PeriodType PT_HOURS, PT_MINUTES }; - -struct Options -{ - CMOption<BYTE> backup_types; - CMOption<WORD> period; - CMOption<BYTE> period_type; - wchar_t folder[MAX_PATH]; - CMOption<WORD> num_backups; - CMOption<BYTE> disable_progress; - CMOption<BYTE> disable_popups; - CMOption<BYTE> use_zip; - CMOption<BYTE> backup_profile; - CMOption<BYTE> use_cloudfile; - CMOption<char*> cloudfile_service; - - Options(); -}; diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h index 1c2036e736..6a9336b47b 100644 --- a/plugins/Db_autobackups/src/stdafx.h +++ b/plugins/Db_autobackups/src/stdafx.h @@ -32,6 +32,18 @@ struct CMPlugin : public PLUGIN<CMPlugin> { CMPlugin(); + CMOption<BYTE> backup_types; + CMOption<WORD> period; + CMOption<BYTE> period_type; + wchar_t folder[MAX_PATH]; + CMOption<WORD> num_backups; + CMOption<BYTE> disable_progress; + CMOption<BYTE> disable_popups; + CMOption<BYTE> use_zip; + CMOption<BYTE> backup_profile; + CMOption<BYTE> use_cloudfile; + CMOption<char*> cloudfile_service; + int Load() override; }; @@ -42,11 +54,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> #define SUB_DIR L"\\AutoBackups" #define DIR L"%miranda_userdata%" -struct Options; -extern Options options; - -int SetBackupTimer(void); -int OptionsInit(WPARAM wParam, LPARAM lParam); +int SetBackupTimer(void); +int OptionsInit(WPARAM wParam, LPARAM lParam); void BackupStart(wchar_t *backup_filename); struct ZipFile -- cgit v1.2.3