summaryrefslogtreecommitdiff
path: root/plugins/PackUpdater
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-12 21:44:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-12 21:44:56 +0300
commit53fe3e46177d17b4941610de19f5cc6210700cb4 (patch)
treeb67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/PackUpdater
parent488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff)
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/PackUpdater')
-rw-r--r--plugins/PackUpdater/Src/Notifications.cpp20
-rw-r--r--plugins/PackUpdater/Src/Options.cpp40
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp76
3 files changed, 68 insertions, 68 deletions
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp
index a9d691e588..64cdc6da08 100644
--- a/plugins/PackUpdater/Src/Notifications.cpp
+++ b/plugins/PackUpdater/Src/Notifications.cpp
@@ -176,9 +176,9 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM)
static void __stdcall CreateDownloadDialog(void*)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups3", DEFAULT_POPUP_ENABLED))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop);
- else if (db_get_b(NULL, MODULENAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
+ else if (g_plugin.getByte("Popups3M", DEFAULT_MESSAGE_ENABLED)) {
mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DOWNLOAD), nullptr, DlgDownload);
}
@@ -195,11 +195,11 @@ void DlgDownloadProc()
if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occurred while downloading the update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONSTOP);
}
CallFunctionAsync(DestroyDownloadDialog, nullptr);
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
}
mir_wstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
mir_snprintf(szKey, "File_%d_CurrentVersion", todo[i].FileNum);
- db_set_ws(NULL, MODULENAME, szKey, todo[i].tszCurVer);
+ g_plugin.setWString(szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
arFilePath.push_back(todo[i].File.tszDiskPath);
arFileName.push_back(tszFileName);
@@ -420,7 +420,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(0, "Popup", "Actions", 0) & 1))
rc = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop);
else
rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
@@ -436,7 +436,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
break;
case 1:
if (Reminder == 2)
- db_set_b(NULL, MODULENAME, "Reminder", 1);
+ g_plugin.setByte("Reminder", 1);
memset(&si, 0, sizeof(STARTUPINFO));
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
@@ -504,15 +504,15 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
}
else { //reminder for not installed pack update
if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
- db_set_b(NULL, MODULENAME, "Reminder", 2);
+ g_plugin.setByte("Reminder", 2);
mir_snwprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
}
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp
index 0e5b293e3a..281415d69a 100644
--- a/plugins/PackUpdater/Src/Options.cpp
+++ b/plugins/PackUpdater/Src/Options.cpp
@@ -65,7 +65,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
else {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i + 1029), (db_get_b(NULL, MODULENAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 1029), (g_plugin.getByte(str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
}
}
return TRUE;
@@ -134,17 +134,17 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
InitTimer();
- db_set_b(NULL, MODULENAME, "UpdateOnStartup", UpdateOnStartup);
- db_set_b(NULL, MODULENAME, "OnlyOnceADay", OnlyOnceADay);
- db_set_b(NULL, MODULENAME, "UpdateOnPeriod", UpdateOnPeriod);
- db_set_dw(NULL, MODULENAME, "Period", Period);
- db_set_b(NULL, MODULENAME, "PeriodMeasure", PeriodMeasure);
+ g_plugin.setByte("UpdateOnStartup", UpdateOnStartup);
+ g_plugin.setByte("OnlyOnceADay", OnlyOnceADay);
+ g_plugin.setByte("UpdateOnPeriod", UpdateOnPeriod);
+ g_plugin.setDword("Period", Period);
+ g_plugin.setByte("PeriodMeasure", PeriodMeasure);
Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
- db_set_b(NULL, MODULENAME, "Reminder", Reminder);
+ g_plugin.setByte("Reminder", Reminder);
if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, "Popups%dM", i);
- db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
+ g_plugin.setByte(str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
}
}
}
@@ -200,14 +200,14 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
mir_snprintf(str2, "Popups%dM", i);
- CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODULENAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODULENAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 40071), (g_plugin.getByte(str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 1024), (g_plugin.getByte(str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, (i + 40071)))
EnableWindow(GetDlgItem(hdlg, (i + 1024)), FALSE);
else if (i > 0)
EnableWindow(GetDlgItem(hdlg, (i + 1024)), TRUE);
}
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(0, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -215,7 +215,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case WM_SHOWWINDOW:
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(0, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -349,27 +349,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, "Popups%iBg", i);
- db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
+ g_plugin.setDword(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, MODULENAME, szSetting, ctlColor);
+ g_plugin.setDword(szSetting, ctlColor);
}
//Colors
- db_set_b(NULL, MODULENAME, "DefColors", MyOptions.DefColors);
+ g_plugin.setByte("DefColors", MyOptions.DefColors);
//Timeout
MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
- db_set_dw(NULL, MODULENAME, "Timeout", MyOptions.Timeout);
+ g_plugin.setDword("Timeout", MyOptions.Timeout);
//Left mouse click
- db_set_b(NULL, MODULENAME, "LeftClickAction", MyOptions.LeftClickAction);
+ g_plugin.setByte("LeftClickAction", MyOptions.LeftClickAction);
//Right mouse click
- db_set_b(NULL, MODULENAME, "RightClickAction", MyOptions.RightClickAction);
+ g_plugin.setByte("RightClickAction", MyOptions.RightClickAction);
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
- db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
+ g_plugin.setByte(str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
mir_snprintf(str2, "Popups%dM", i);
- db_set_b(NULL, MODULENAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
+ g_plugin.setByte(str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
}
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index b6cb5c24ae..1f15dd40be 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -68,41 +68,41 @@ void InitPopupList()
int index = 0;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups2Tx", COLOR_TX_DEFAULT);
index = 3;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups3Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups3Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups3Tx", COLOR_TX_DEFAULT);
}
void LoadOptions()
{
- MyOptions.DefColors = db_get_b(NULL, MODULENAME, "DefColors", DEFAULT_COLORS);
- MyOptions.LeftClickAction = db_get_b(NULL, MODULENAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- MyOptions.RightClickAction = db_get_b(NULL, MODULENAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- MyOptions.Timeout = db_get_dw(NULL, MODULENAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
- UpdateOnStartup = db_get_b(NULL, MODULENAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- OnlyOnceADay = db_get_b(NULL, MODULENAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- UpdateOnPeriod = db_get_b(NULL, MODULENAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- Period = db_get_dw(NULL, MODULENAME, "Period", DEFAULT_PERIOD);
- PeriodMeasure = db_get_b(NULL, MODULENAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- Reminder = db_get_b(NULL, MODULENAME, "Reminder", DEFAULT_REMINDER);
- FileCount = db_get_dw(NULL, MODULENAME, "FileCount", DEFAULT_FILECOUNT);
+ MyOptions.DefColors = g_plugin.getByte("DefColors", DEFAULT_COLORS);
+ MyOptions.LeftClickAction = g_plugin.getByte("LeftClickAction", DEFAULT_POPUP_LCLICK);
+ MyOptions.RightClickAction = g_plugin.getByte("RightClickAction", DEFAULT_POPUP_RCLICK);
+ MyOptions.Timeout = g_plugin.getDword("Timeout", DEFAULT_TIMEOUT_VALUE);
+ UpdateOnStartup = g_plugin.getByte("UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ OnlyOnceADay = g_plugin.getByte("OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ UpdateOnPeriod = g_plugin.getByte("UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ Period = g_plugin.getDword("Period", DEFAULT_PERIOD);
+ PeriodMeasure = g_plugin.getByte("PeriodMeasure", DEFAULT_PERIODMEASURE);
+ Reminder = g_plugin.getByte("Reminder", DEFAULT_REMINDER);
+ FileCount = g_plugin.getDword("FileCount", DEFAULT_FILECOUNT);
}
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
@@ -164,7 +164,7 @@ BOOL Exists(LPCTSTR strName)
BOOL IsPluginDisabled(wchar_t* filename)
{
char* fname = mir_u2a(filename);
- int res = db_get_b(NULL, "PluginDisable", fname, 0);
+ int res = db_get_b(0, "PluginDisable", fname, 0);
mir_free(fname);
return res;
}
@@ -185,19 +185,19 @@ static void CheckUpdates(void *)
if (!Exists(tszRoot))
CreateDirectory(tszRoot, nullptr);
Files.clear();
- Reminder = db_get_b(NULL, MODULENAME, "Reminder", DEFAULT_REMINDER);
- FileCount = db_get_dw(NULL, MODULENAME, "FileCount", DEFAULT_FILECOUNT);
+ Reminder = g_plugin.getByte("Reminder", DEFAULT_REMINDER);
+ FileCount = g_plugin.getDword("FileCount", DEFAULT_FILECOUNT);
// Load files info
- ptrW tszDownloadURL(db_get_wsa(NULL, MODULENAME, "File_VersionURL"));
+ ptrW tszDownloadURL(g_plugin.getWStringA("File_VersionURL"));
if (!tszDownloadURL) { // URL is not set
Title = TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONSTOP);
hCheckThread = nullptr;
return;
@@ -221,14 +221,14 @@ static void CheckUpdates(void *)
FILEINFO FileInfo = { L"", L"", L"", L"", L"", L"", L"", { L"", L"" } };
mir_snprintf(szKey, "File_%d_CurrentVersion", CurrentFile + 1);
- ptrW tszCurVer(db_get_wsa(NULL, MODULENAME, szKey));
+ ptrW tszCurVer(g_plugin.getWStringA(szKey));
if (tszCurVer)
mir_wstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
else
mir_wstrncpy(FileInfo.tszCurVer, L"", _countof(FileInfo.tszCurVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- ptrW tszLastVer(db_get_wsa(NULL, MODULENAME, szKey));
+ ptrW tszLastVer(g_plugin.getWStringA(szKey));
if (tszLastVer)
mir_wstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
else
@@ -248,11 +248,11 @@ static void CheckUpdates(void *)
if (wcsstr(tszBuff, L"\\")) { //check update name
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
@@ -322,7 +322,7 @@ static void CheckUpdates(void *)
// Save last version
mir_wstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- db_set_ws(NULL, MODULENAME, szKey, Files[CurrentFile].tszLastVer);
+ g_plugin.setWString(szKey, Files[CurrentFile].tszLastVer);
} // end compare versions
} //end checking all files in for ()
@@ -339,22 +339,22 @@ static void CheckUpdates(void *)
if (!UpdatesCount && !Silent) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
if (!FileCount) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
hCheckThread = nullptr;
@@ -365,16 +365,16 @@ void DoCheck(int iFlag)
if (hCheckThread != nullptr) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
else if (iFlag) {
hCheckThread = mir_forkthread(CheckUpdates);
- db_set_dw(NULL, MODULENAME, "LastUpdate", time(0));
+ g_plugin.setDword("LastUpdate", time(0));
}
}
@@ -382,7 +382,7 @@ BOOL AllowUpdateOnStartup()
{
if (OnlyOnceADay) {
time_t now = time(0);
- time_t was = db_get_dw(NULL, MODULENAME, "LastUpdate", 0);
+ time_t was = g_plugin.getDword("LastUpdate", 0);
if ((now - was) < 86400)
return FALSE;