From 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 22:27:16 +0000 Subject: - 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 --- plugins/PackUpdater/Src/Notifications.cpp | 20 ++++---- plugins/PackUpdater/Src/Options.cpp | 40 +++++++-------- plugins/PackUpdater/Src/Utils.cpp | 82 +++++++++++++++---------------- 3 files changed, 71 insertions(+), 71 deletions(-) (limited to 'plugins/PackUpdater') diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 20ba80c0d7..facaec4b49 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 wParam, LPARAM lPar static void __stdcall CreateDownloadDialog(void*) { - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED)) hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop); - else if (DBGetContactSettingByte(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) { + else if (db_get_b(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) { lstrcpyn(tszDialogMsg, Text, SIZEOF(tszDialogMsg)); hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload); } @@ -195,11 +195,11 @@ void DlgDownloadProc() if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) { Title = TranslateT("Pack Updater"); Text = TranslateT("An error occured while downloading the update."); - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) { + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) { Number = 1; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONSTOP); } CallFunctionAsync(DestroyDownloadDialog, 0); @@ -402,7 +402,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam } lstrcpyn(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer)); mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum); - DBWriteContactSettingTString(NULL, MODNAME, szKey, todo[i].tszCurVer); + db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer); arFileType.push_back(todo[i].FileType); arFilePath.push_back(todo[i].File.tszDiskPath); arFileName.push_back(tszFileName); @@ -421,7 +421,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_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "PopUp", "Actions", 0) & 1)) rc = DialogBox(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgMsgPop); else rc = MessageBox(NULL, 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) - DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 1); + db_set_b(NULL, MODNAME, "Reminder", 1); memset(&si, 0, sizeof(STARTUPINFO)); memset(&pi, 0, sizeof(PROCESS_INFORMATION)); si.cb = sizeof(STARTUPINFO); @@ -499,16 +499,16 @@ 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)) - DBWriteContactSettingByte(NULL, MODNAME, "Reminder", 2); + db_set_b(NULL, MODNAME, "Reminder", 2); mir_sntprintf(tszBuff, SIZEOF(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_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) { Number = 2; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONINFORMATION); } } diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index 3460ef1dcb..3b16bb0565 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, SIZEOF(str), "Popups%dM", i); - CheckDlgButton(hwndDlg, (i+1029), (DBGetContactSettingByte(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED); + CheckDlgButton(hwndDlg, (i+1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED); } } return TRUE; @@ -139,17 +139,17 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA InitTimer(); - DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup); - DBWriteContactSettingByte(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay); - DBWriteContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod); - DBWriteContactSettingDword(NULL, MODNAME, "Period", Period); - DBWriteContactSettingByte(NULL, MODNAME, "PeriodMeasure", PeriodMeasure); + db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup); + db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay); + db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod); + db_set_dw(NULL, MODNAME, "Period", Period); + db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure); Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER); - DBWriteContactSettingByte(NULL, MODNAME, "Reminder", Reminder); + db_set_b(NULL, MODNAME, "Reminder", Reminder); if ( !ServiceExists(MS_POPUP_ADDPOPUP)) { for (int i = 1; i < POPUPS; i++) { mir_snprintf(str, SIZEOF(str), "Popups%dM", i); - DBWriteContactSettingByte(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029)))); + db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029)))); } } } @@ -212,14 +212,14 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) { 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) EnableWindow(GetDlgItem(hdlg, (i+1024)), TRUE); } - if (!(DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS)) + if (!(db_get_dw(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS)) EnableWindow(GetDlgItem(hdlg, (40071)), FALSE); else EnableWindow(GetDlgItem(hdlg, (40071)), TRUE); @@ -227,7 +227,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; } case WM_SHOWWINDOW: - if (!(DBGetContactSettingDword(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS)) + if (!(db_get_dw(NULL, "PopUp", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS)) EnableWindow(GetDlgItem(hdlg, (40071)), FALSE); else EnableWindow(GetDlgItem(hdlg, (40071)), TRUE); @@ -387,28 +387,28 @@ 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", MyOptions.DefColors); + db_set_b(NULL, MODNAME, "DefColors", MyOptions.DefColors); //Timeout MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, 0, TRUE); - DBWriteContactSettingDword(NULL, MODNAME, "Timeout", MyOptions.Timeout); + db_set_dw(NULL, MODNAME, "Timeout", MyOptions.Timeout); //Left mouse click - DBWriteContactSettingByte(NULL, MODNAME, "LeftClickAction", MyOptions.LeftClickAction); + db_set_b(NULL, MODNAME, "LeftClickAction", MyOptions.LeftClickAction); //Right mouse click - DBWriteContactSettingByte(NULL, MODNAME, "RightClickAction", MyOptions.RightClickAction); + db_set_b(NULL, MODNAME, "RightClickAction", MyOptions.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/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 3b322ab4be..5717178a6c 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -69,41 +69,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() { - MyOptions.DefColors = DBGetContactSettingByte(NULL, MODNAME, "DefColors", DEFAULT_COLORS); - MyOptions.LeftClickAction= DBGetContactSettingByte(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK); - MyOptions.RightClickAction = DBGetContactSettingByte(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK); - MyOptions.Timeout = DBGetContactSettingDword(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE); - UpdateOnStartup = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP); - OnlyOnceADay = DBGetContactSettingByte(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY); - UpdateOnPeriod = DBGetContactSettingByte(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD); - Period = DBGetContactSettingDword(NULL, MODNAME, "Period", DEFAULT_PERIOD); - PeriodMeasure = DBGetContactSettingByte(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE); - Reminder = DBGetContactSettingByte(NULL, MODNAME, "Reminder", DEFAULT_REMINDER); - FileCount = DBGetContactSettingDword(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT); + MyOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS); + MyOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK); + MyOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK); + MyOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE); + UpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP); + OnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY); + UpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD); + Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD); + PeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE); + Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER); + FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT); } BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) @@ -170,7 +170,7 @@ BOOL Exists(LPCTSTR strName) BOOL IsPluginDisabled(TCHAR* filename) { char* fname = mir_t2a(filename); - int res = DBGetContactSettingByte(NULL, "PluginDisable", fname, 0); + int res = db_get_b(NULL, "PluginDisable", fname, 0); mir_free(fname); return res; } @@ -193,23 +193,23 @@ static void CheckUpdates(void *) if (!Exists(tszRoot)) CreateDirectory(tszRoot, NULL); Files.clear(); - Reminder = DBGetContactSettingByte(NULL, MODNAME, "Reminder", DEFAULT_REMINDER); - FileCount = DBGetContactSettingDword(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT); + Reminder = db_get_b(NULL, MODNAME, "Reminder", DEFAULT_REMINDER); + FileCount = db_get_dw(NULL, MODNAME, "FileCount", DEFAULT_FILECOUNT); // Load files info - DBGetContactSettingTString(NULL, MODNAME, "File_VersionURL", &dbVar); + db_get_ts(NULL, MODNAME, "File_VersionURL", &dbVar); if (lstrcmp(dbVar.ptszVal, NULL) == 0)// URL is not set { Title=TranslateT("Pack Updater"); Text = TranslateT("URL for checking updates not found."); - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) { Number = 1; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONSTOP); - DBFreeVariant(&dbVar); + db_free(&dbVar); hCheckThread = NULL; return; } @@ -235,20 +235,20 @@ static void CheckUpdates(void *) dbVar.ptszVal = NULL; mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", CurrentFile + 1); - DBGetContactSettingTString(NULL, MODNAME, szKey, &dbVar); + db_get_ts(NULL, MODNAME, szKey, &dbVar); if (lstrcmp(dbVar.ptszVal, NULL) == 0) { - DBFreeVariant(&dbVar); + db_free(&dbVar); lstrcpyn(FileInfo.tszCurVer, _T(""), SIZEOF(FileInfo.tszCurVer)); } else lstrcpyn(FileInfo.tszCurVer, dbVar.ptszVal, SIZEOF(FileInfo.tszCurVer)); dbVar.ptszVal = NULL; mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1); - DBGetContactSettingTString(NULL, MODNAME, szKey, &dbVar); + db_get_ts(NULL, MODNAME, szKey, &dbVar); if (lstrcmp(dbVar.ptszVal, NULL) == 0) { - DBFreeVariant(&dbVar); + db_free(&dbVar); lstrcpyn(FileInfo.tszLastVer, _T(""), SIZEOF(FileInfo.tszLastVer)); } else @@ -268,12 +268,12 @@ static void CheckUpdates(void *) { Title = TranslateT("Pack Updater"); Text = TranslateT("Name of Update's file is not supported."); - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) { Number = 1; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONINFORMATION); continue; } // end check update name @@ -352,7 +352,7 @@ static void CheckUpdates(void *) // Save last version lstrcpyn(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszLastVer)); mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1); - DBWriteContactSettingTString(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer); + db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer); } // user have admin's rights mir_free(tszSysRoot); mir_free(tszProgFiles); @@ -372,24 +372,24 @@ static void CheckUpdates(void *) { Title = TranslateT("Pack Updater"); Text = TranslateT("No updates found."); - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) { Number = 2; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONINFORMATION); } if (!FileCount) { Title = TranslateT("Pack Updater"); Text = TranslateT("No files for update."); - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) { Number = 2; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONINFORMATION); } hCheckThread = NULL; @@ -401,18 +401,18 @@ void DoCheck(int iFlag) { Title = TranslateT("Pack Updater"); Text = TranslateT("Update checking already started!"); - if ( ServiceExists(MS_POPUP_ADDPOPUP) && DBGetContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 1) && DBGetContactSettingByte(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) + if ( ServiceExists(MS_POPUP_ADDPOPUP) && db_get_b(NULL, "PopUp", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups2", DEFAULT_POPUP_ENABLED)) { Number = 2; show_popup(0, Title, Text, Number, 0); } - else if (DBGetContactSettingByte(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) + else if (db_get_b(NULL, MODNAME, "Popups2M", DEFAULT_MESSAGE_ENABLED)) MessageBox(NULL, Text, Title, MB_ICONINFORMATION); } else if (iFlag) { hCheckThread = mir_forkthread(CheckUpdates, 0); - DBWriteContactSettingDword(NULL, MODNAME, "LastUpdate", time(NULL)); + db_set_dw(NULL, MODNAME, "LastUpdate", time(NULL)); } } @@ -421,7 +421,7 @@ BOOL AllowUpdateOnStartup() if(OnlyOnceADay) { 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; -- cgit v1.2.3