summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
commit007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch)
treeb1ee30b70c6e36d1a06aed6885cb80dc560a68ca /plugins/Db_autobackups
parentf4a1bbc6ba4b8137cb868639ac146aa97e97e9df (diff)
- rest of menus cleared;
- old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db_autobackups')
-rw-r--r--plugins/Db_autobackups/src/backup.cpp4
-rw-r--r--plugins/Db_autobackups/src/options.cpp32
2 files changed, 18 insertions, 18 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index 1922212386..2a2495b62b 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -171,7 +171,7 @@ int Backup(TCHAR* backup_filename)
{
SendMessage(progress_dialog, PBM_SETPOS, (WPARAM)(int)(100), 0);
UpdateWindow(progress_dialog);
- DBWriteContactSettingDword(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
+ db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
if (!options.disable_popups)
{
size_t dest_file_len = lstrlen(dest_file);
@@ -204,7 +204,7 @@ int Backup(TCHAR* backup_filename)
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
time_t t = time(NULL);
- time_t diff = t - (time_t)DBGetContactSettingDword(0, "AutoBackups", "LastBackupTimestamp", (DWORD)t);
+ time_t diff = t - (time_t)db_get_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)t);
if(diff > (time_t)(options.period * (options.period_type == PT_MINUTES ? 60 : (options.period_type == PT_HOURS ? 60 * 60 : 60 * 60 * 24 ))))
mir_forkthread(BackupThread, NULL);
}
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index da944bc205..839aacc582 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -4,14 +4,14 @@ Options options;
int LoadOptions(void)
{
- options.backup_types = (BackupType)DBGetContactSettingByte(0, "AutoBackups", "BackupType", (BYTE)(BT_PERIODIC));
- options.period = (unsigned int)DBGetContactSettingWord(0, "AutoBackups", "Period", 1);
- options.period_type = (PeriodType)DBGetContactSettingByte(0, "AutoBackups", "PeriodType", (BYTE)PT_DAYS);
+ options.backup_types = (BackupType)db_get_b(0, "AutoBackups", "BackupType", (BYTE)(BT_PERIODIC));
+ options.period = (unsigned int)db_get_w(0, "AutoBackups", "Period", 1);
+ options.period_type = (PeriodType)db_get_b(0, "AutoBackups", "PeriodType", (BYTE)PT_DAYS);
if (!ServiceExists(MS_FOLDERS_GET_PATH)) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(0, "AutoBackups", "Folder", &dbv)) {
+ if (!db_get_ts(0, "AutoBackups", "Folder", &dbv)) {
TCHAR *tmp = Utils_ReplaceVarsT(dbv.ptszVal);
if(_tcslen(tmp) >= 2 && tmp[1] == ':')
@@ -19,15 +19,15 @@ int LoadOptions(void)
else
mir_sntprintf(options.folder, MAX_PATH, _T("%s\\%s"), profilePath, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mir_free(tmp);
} else
mir_sntprintf(options.folder, MAX_PATH, _T("%s%s"), DIR, SUB_DIR);
}
- options.num_backups = (unsigned int)DBGetContactSettingWord(0, "AutoBackups", "NumBackups", 3);
+ options.num_backups = (unsigned int)db_get_w(0, "AutoBackups", "NumBackups", 3);
- options.disable_progress = (BOOL)DBGetContactSettingByte(0, "AutoBackups", "NoProgress", 0);
- options.disable_popups = (BOOL)DBGetContactSettingByte(0, "AutoBackups", "NoPopups", 0);
+ options.disable_progress = (BOOL)db_get_b(0, "AutoBackups", "NoProgress", 0);
+ options.disable_popups = (BOOL)db_get_b(0, "AutoBackups", "NoPopups", 0);
SetBackupTimer();
return 0;
@@ -37,19 +37,19 @@ int SaveOptions(void)
{
TCHAR prof_dir[MAX_PATH];
- DBWriteContactSettingByte(0, "AutoBackups", "BackupType", (BYTE)options.backup_types);
+ db_set_b(0, "AutoBackups", "BackupType", (BYTE)options.backup_types);
if (options.period < 1) options.period = 1;
- DBWriteContactSettingWord(0, "AutoBackups", "Period", (WORD)options.period);
- DBWriteContactSettingByte(0, "AutoBackups", "PeriodType", (BYTE)options.period_type);
+ db_set_w(0, "AutoBackups", "Period", (WORD)options.period);
+ db_set_b(0, "AutoBackups", "PeriodType", (BYTE)options.period_type);
mir_sntprintf(prof_dir, MAX_PATH, _T("%s\\"), profilePath);
size_t prof_len = _tcslen(prof_dir);
size_t opt_len = _tcslen(options.folder);
if(opt_len > prof_len && _tcsncmp(options.folder, prof_dir, prof_len) == 0) {
- DBWriteContactSettingTString(0, "AutoBackups", "Folder", (options.folder + prof_len));
+ db_set_ts(0, "AutoBackups", "Folder", (options.folder + prof_len));
} else
- DBWriteContactSettingTString(0, "AutoBackups", "Folder", options.folder);
+ db_set_ts(0, "AutoBackups", "Folder", options.folder);
TCHAR *tmp = Utils_ReplaceVarsT(options.folder);
if(_tcslen(tmp) < 2 || tmp[1] != ':')
@@ -59,9 +59,9 @@ int SaveOptions(void)
mir_free(buf);
}
mir_free(tmp);
- DBWriteContactSettingWord(0, "AutoBackups", "NumBackups", (WORD)options.num_backups);
- DBWriteContactSettingByte(0, "AutoBackups", "NoProgress", (BYTE)options.disable_progress);
- DBWriteContactSettingByte(0, "AutoBackups", "NoPopups", (BYTE)options.disable_popups);
+ db_set_w(0, "AutoBackups", "NumBackups", (WORD)options.num_backups);
+ db_set_b(0, "AutoBackups", "NoProgress", (BYTE)options.disable_progress);
+ db_set_b(0, "AutoBackups", "NoPopups", (BYTE)options.disable_popups);
SetBackupTimer();
return 0;