summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater
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/PluginUpdater
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/PluginUpdater')
-rw-r--r--plugins/PluginUpdater/src/Common.h6
-rw-r--r--plugins/PluginUpdater/src/Events.cpp4
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp6
-rw-r--r--plugins/PluginUpdater/src/Options.cpp34
-rw-r--r--plugins/PluginUpdater/src/Scanner.cpp12
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp38
6 files changed, 50 insertions, 50 deletions
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h
index f0ffa25310..0ec714323c 100644
--- a/plugins/PluginUpdater/src/Common.h
+++ b/plugins/PluginUpdater/src/Common.h
@@ -163,9 +163,9 @@ int SafeCreateFilePath(TCHAR *pFolder);
#if MIRANDA_VER < 0x0A00
-#define db_free(A) DBFreeVariant(A)
-#define db_get_b(A,B,C,D) DBGetContactSettingByte(A,B,C,D)
-#define db_set_s(A,B,C,D) DBWriteContactSettingString(A,B,C,D)
+#define db_free(A) db_free(A)
+#define db_get_b(A,B,C,D) db_get_b(A,B,C,D)
+#define db_set_s(A,B,C,D) db_set_s(A,B,C,D)
template<class T> class mir_ptr
{
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp
index 4e2eb89ca1..a82e0261b8 100644
--- a/plugins/PluginUpdater/src/Events.cpp
+++ b/plugins/PluginUpdater/src/Events.cpp
@@ -36,9 +36,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
opts.bSilent = true;
- int iRestartCount = DBGetContactSettingByte(NULL, MODNAME, "RestartCount", 2);
+ int iRestartCount = db_get_b(NULL, MODNAME, "RestartCount", 2);
if (iRestartCount > 0)
- DBWriteContactSettingByte(NULL, MODNAME, "RestartCount", iRestartCount-1);
+ db_set_b(NULL, MODNAME, "RestartCount", iRestartCount-1);
else
EmptyFolder(0, TRUE); // silently
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index 1170b44f1e..0816172bf8 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -116,10 +116,10 @@ static void MakePopupAction(POPUPACTION &pa, int id)
void ShowPopup(HWND hDlg, LPCTSTR ptszTitle, LPCTSTR ptszText, int Number, int ActType)
{
- if ( !ServiceExists(MS_POPUP_ADDPOPUP) || !DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) ) {
+ if ( !ServiceExists(MS_POPUP_ADDPOPUP) || !db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) ) {
char setting[100];
mir_snprintf(setting, SIZEOF(setting), "Popups%dM", Number);
- if (DBGetContactSettingByte(NULL, MODNAME, setting, DEFAULT_MESSAGE_ENABLED)) {
+ if (db_get_b(NULL, MODNAME, setting, DEFAULT_MESSAGE_ENABLED)) {
int iMsgType;
switch( Number ) {
case 1: iMsgType = MB_ICONSTOP; break;
@@ -372,7 +372,7 @@ LBL_Exit:
SafeDeleteFile(p.File.tszDiskPath); // remove .zip after successful update
}
- DBWriteContactSettingByte(NULL, MODNAME, "RestartCount", 2);
+ db_set_b(NULL, MODNAME, "RestartCount", 2);
CallFunctionAsync(RestartMe, 0);
goto LBL_Exit;
}
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 32ef2068ab..35970f383c 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -60,7 +60,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
CheckDlgButton(hwndDlg, IDC_UPDATEICONS, opts.bUpdateIcons);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- if ( DBGetContactSettingString(NULL, MODNAME, "UpdateURL", &dbv)) {
+ if ( db_get_s(NULL, MODNAME, "UpdateURL", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
CheckDlgButton(hwndDlg, IDC_STABLE, TRUE);
}
@@ -147,13 +147,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
InitTimer();
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnStartup", opts.bUpdateOnStartup);
- DBWriteContactSettingByte(NULL, MODNAME, "OnlyOnceADay", opts.bOnlyOnceADay);
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod);
- DBWriteContactSettingByte(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure);
- DBWriteContactSettingDword(NULL, MODNAME, "Period", opts.Period);
+ db_set_b(NULL, MODNAME, "UpdateOnStartup", opts.bUpdateOnStartup);
+ db_set_b(NULL, MODNAME, "OnlyOnceADay", opts.bOnlyOnceADay);
+ db_set_b(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod);
+ db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure);
+ db_set_dw(NULL, MODNAME, "Period", opts.Period);
opts.bUpdateIcons = IsDlgButtonChecked(hwndDlg, IDC_UPDATEICONS);
- DBWriteContactSettingByte(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons);
+ db_set_b(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons);
if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE))
db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
@@ -218,8 +218,8 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- CheckDlgButton(hdlg, (i+40071), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
- CheckDlgButton(hdlg, (i+1024), (DBGetContactSettingByte(NULL, MODNAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
+ 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);
if (IsDlgButtonChecked(hdlg, (i+40071)))
EnableWindow(GetDlgItem(hdlg, (i+1024)), FALSE);
else if (i > 0)
@@ -359,27 +359,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, SIZEOF(szSetting), "Popups%iBg", i);
- DBWriteContactSettingDword(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODNAME, szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i+41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, SIZEOF(szSetting), "Popups%iTx", i);
- DBWriteContactSettingDword(NULL, MODNAME, szSetting, ctlColor);
+ db_set_dw(NULL, MODNAME, szSetting, ctlColor);
}
//Colors
- DBWriteContactSettingByte(NULL, MODNAME, "DefColors", PopupOptions.DefColors);
+ db_set_b(NULL, MODNAME, "DefColors", PopupOptions.DefColors);
//Timeout
PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE);
- DBWriteContactSettingDword(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
+ db_set_dw(NULL, MODNAME, "Timeout", PopupOptions.Timeout);
//Left mouse click
- DBWriteContactSettingByte(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
+ db_set_b(NULL, MODNAME, "LeftClickAction", PopupOptions.LeftClickAction);
//Right mouse click
- DBWriteContactSettingByte(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
+ db_set_b(NULL, MODNAME, "RightClickAction", PopupOptions.RightClickAction);
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, SIZEOF(str), "Popups%d", i);
- DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
+ db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i+40071))));
mir_snprintf(str2, SIZEOF(str2), "Popups%dM", i);
- DBWriteContactSettingByte(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
+ db_set_b(NULL, MODNAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i+1024))));
}
return TRUE;
} //case PSN_APPLY
diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp
index bb9f7e339b..7855a12b7a 100644
--- a/plugins/PluginUpdater/src/Scanner.cpp
+++ b/plugins/PluginUpdater/src/Scanner.cpp
@@ -23,7 +23,7 @@ int CalculateModuleHash(const TCHAR *tszFileName, char *dest);
static BYTE IsPluginDisabled(const char *filename)
{
- return DBGetContactSettingByte(NULL, "PluginDisable", filename, 0);
+ return db_get_b(NULL, "PluginDisable", filename, 0);
}
static bool Exists(LPCTSTR strName)
@@ -269,9 +269,9 @@ static void CheckUpdates(void *)
tszTempPath[dwLen-1] = 0;
// Load files info
- if (DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar)) { // URL is not set
- DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL));
- DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar);
+ if (db_get_ts(NULL, MODNAME, "UpdateURL", &dbVar)) { // URL is not set
+ db_set_ts(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL));
+ db_get_ts(NULL, MODNAME, "UpdateURL", &dbVar);
}
REPLACEVARSARRAY vars[2];
@@ -287,7 +287,7 @@ static void CheckUpdates(void *)
dat.dwFlags = RVF_TCHAR;
dat.variables = vars;
mir_ptr<TCHAR> tszBaseUrl((TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)dbVar.ptszVal, (LPARAM)&dat));
- DBFreeVariant(&dbVar);
+ db_free(&dbVar);
// Download version info
ShowPopup(NULL, TranslateT("Plugin Updater"), TranslateT("Downloading version info..."), 4, 0);
@@ -365,6 +365,6 @@ void DoCheck(int iFlag)
}
else if (iFlag) {
hCheckThread = mir_forkthread(CheckUpdates, 0);
- DBWriteContactSettingDword(NULL, MODNAME, "LastUpdate", time(NULL));
+ db_set_dw(NULL, MODNAME, "LastUpdate", time(NULL));
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index bb2ee1380a..87f7cbedb7 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -85,41 +85,41 @@ void InitPopupList()
int index = 0;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups2Tx", COLOR_TX_DEFAULT);
index = 3;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = DBGetContactSettingDword(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = DBGetContactSettingDword(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = db_get_dw(NULL, MODNAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = db_get_dw(NULL, MODNAME, "Popups3Tx", COLOR_TX_DEFAULT);
}
void LoadOptions()
{
- PopupOptions.DefColors = DBGetContactSettingByte(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= DBGetContactSettingByte(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = DBGetContactSettingByte(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = DBGetContactSettingDword(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
+ 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 = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = DBGetContactSettingByte(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = DBGetContactSettingDword(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = DBGetContactSettingByte(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bUpdateIcons = DBGetContactSettingByte(NULL, MODNAME, "UpdateIcons", DEFAULT_UPDATEICONS);
+ 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.bUpdateIcons = db_get_b(NULL, MODNAME, "UpdateIcons", DEFAULT_UPDATEICONS);
}
ULONG crc32_table[256];
@@ -252,7 +252,7 @@ BOOL AllowUpdateOnStartup()
{
if (opts.bOnlyOnceADay) {
time_t now = time(NULL);
- time_t was = DBGetContactSettingDword(NULL, MODNAME, "LastUpdate", 0);
+ time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
if ((now - was) < 86400)
return FALSE;