From 53fe3e46177d17b4941610de19f5cc6210700cb4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 21:44:56 +0300 Subject: db_* functions replaced with g_plugin calls --- plugins/FTPFileYM/src/dbentry.cpp | 4 ++-- plugins/FTPFileYM/src/ftpfile.cpp | 2 +- plugins/FTPFileYM/src/options.cpp | 44 ++++++++++++++++++------------------ plugins/FTPFileYM/src/serverlist.cpp | 18 +++++++-------- plugins/FTPFileYM/src/utils.cpp | 2 +- 5 files changed, 35 insertions(+), 35 deletions(-) (limited to 'plugins/FTPFileYM') diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index f9c39ae5b4..beb4d59c88 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -48,7 +48,7 @@ DBEntry *DBEntry::getNext(DBEntry *entry) for (; entryID < count; entryID++) { int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", entryID, -1); if (ftpNum != -1) { - ptrA Value(db_get_sa(NULL, MODULENAME, frmt.Format("Filename%d", entryID))); + ptrA Value(g_plugin.getStringA(frmt.Format("Filename%d", entryID))); if (Value) { strncpy_s(szValue, Value, _TRUNCATE); entry->m_fileID = entryID; @@ -90,7 +90,7 @@ DBEntry* DBEntry::get(int fileID) int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", fileID, -1); if (ftpNum != -1) { - ptrA Value(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Filename%d", fileID))); + ptrA Value(g_plugin.getStringA(CMStringA(FORMAT, "Filename%d", fileID))); if (Value) { strncpy_s(szValue, Value, _TRUNCATE); entry->m_fileID = fileID; diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 01dd4374a7..18230a7b24 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -101,7 +101,7 @@ void InitMenuItems() CMStringA frmt; for (int i = 0; i < ServerList::FTP_COUNT; i++) { - ptrA Name(db_get_sa(NULL, MODULENAME, frmt.Format("Name%d", i))); + ptrA Name(g_plugin.getStringA(frmt.Format("Name%d", i))); if (Name) mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1); diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index cb32cc66c4..b71aaaa0a1 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -33,32 +33,32 @@ void Options::deinit() void Options::loadOptions() { - selected = db_get_b(0, MODULENAME, "Selected", 0); - defaultFTP = db_get_b(0, MODULENAME, "Default", 0); - bAutosend = db_get_b(0, MODULENAME, "Autosend", 0) ? true : false; - bCloseDlg = db_get_b(0, MODULENAME, "CloseDlg", 0) ? true : false; - bCopyLink = db_get_b(0, MODULENAME, "CopyLink", 1) ? true : false; - bUseSubmenu = db_get_b(0, MODULENAME, "UseSubmenu", 1) ? true : false; - bHideInactive = db_get_b(0, MODULENAME, "HideInactive", 1) ? true : false; - bAutoDelete = db_get_b(0, MODULENAME, "DeleteTimer", 0) ? true : false; - iDeleteTime = db_get_dw(0, MODULENAME, "AutoDeleteTime", 60); - timeRange = (ETimeRange)db_get_b(0, MODULENAME, "TimeRange", TR_MINUTES); - iCompressionLevel = db_get_b(0, MODULENAME, "CompressionLevel", 6); - bSetZipName = db_get_b(0, MODULENAME, "SetZipName", 0) ? true : false; + selected = g_plugin.getByte("Selected", 0); + defaultFTP = g_plugin.getByte("Default", 0); + bAutosend = g_plugin.getByte("Autosend", 0) ? true : false; + bCloseDlg = g_plugin.getByte("CloseDlg", 0) ? true : false; + bCopyLink = g_plugin.getByte("CopyLink", 1) ? true : false; + bUseSubmenu = g_plugin.getByte("UseSubmenu", 1) ? true : false; + bHideInactive = g_plugin.getByte("HideInactive", 1) ? true : false; + bAutoDelete = g_plugin.getByte("DeleteTimer", 0) ? true : false; + iDeleteTime = g_plugin.getDword("AutoDeleteTime", 60); + timeRange = (ETimeRange)g_plugin.getByte("TimeRange", TR_MINUTES); + iCompressionLevel = g_plugin.getByte("CompressionLevel", 6); + bSetZipName = g_plugin.getByte("SetZipName", 0) ? true : false; } void Options::saveOptions() const { - db_set_b(0, MODULENAME, "Autosend", bAutosend ? 1 : 0); - db_set_b(0, MODULENAME, "CopyLink", bCopyLink ? 1 : 0); - db_set_b(0, MODULENAME, "UseSubmenu", bUseSubmenu ? 1 : 0); - db_set_b(0, MODULENAME, "HideInactive", bHideInactive ? 1 : 0); - db_set_b(0, MODULENAME, "CloseDlg", bCloseDlg ? 1 : 0); - db_set_b(0, MODULENAME, "DeleteTimer", bAutoDelete ? 1 : 0); - db_set_dw(0, MODULENAME, "AutoDeleteTime", iDeleteTime); - db_set_b(0, MODULENAME, "TimeRange", (int)timeRange); - db_set_b(0, MODULENAME, "CompressionLevel", iCompressionLevel); - db_set_b(0, MODULENAME, "SetZipName", bSetZipName ? 1 : 0); + g_plugin.setByte("Autosend", bAutosend ? 1 : 0); + g_plugin.setByte("CopyLink", bCopyLink ? 1 : 0); + g_plugin.setByte("UseSubmenu", bUseSubmenu ? 1 : 0); + g_plugin.setByte("HideInactive", bHideInactive ? 1 : 0); + g_plugin.setByte("CloseDlg", bCloseDlg ? 1 : 0); + g_plugin.setByte("DeleteTimer", bAutoDelete ? 1 : 0); + g_plugin.setDword("AutoDeleteTime", iDeleteTime); + g_plugin.setByte("TimeRange", (int)timeRange); + g_plugin.setByte("CompressionLevel", iCompressionLevel); + g_plugin.setByte("SetZipName", bSetZipName ? 1 : 0); } void Options::enableItems(HWND hwndDlg, bool state) diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index b29c263aef..33cce223ec 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -57,31 +57,31 @@ void ServerList::saveToDb() const DB::setWordF(0, MODULENAME, "Port%d", opt.selected, ftp->m_iPort); DB::setByteF(0, MODULENAME, "Passive%d", opt.selected, ftp->m_bPassive); DB::setByteF(0, MODULENAME, "Enabled%d", opt.selected, ftp->m_bEnabled); - db_set_b(0, MODULENAME, "Selected", opt.selected); - db_set_b(0, MODULENAME, "Default", opt.defaultFTP); + g_plugin.setByte("Selected", opt.selected); + g_plugin.setByte("Default", opt.defaultFTP); } ServerList::FTP::FTP(int index) { - ptrA Name(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Name%d", index))); + ptrA Name(g_plugin.getStringA(CMStringA(FORMAT, "Name%d", index))); if (Name) mir_snwprintf(m_stzName, TranslateT("FTP Server %d"), index + 1); - ptrA Pass(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Password%d", index))); + ptrA Pass(g_plugin.getStringA(CMStringA(FORMAT, "Password%d", index))); if (Pass) strncpy_s(m_szPass, Pass, _TRUNCATE); - ptrA Server(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Server%d", index))); + ptrA Server(g_plugin.getStringA(CMStringA(FORMAT, "Server%d", index))); if (Server) strncpy_s(m_szServer, Server, _TRUNCATE); - ptrA User(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "User%d", index))); + ptrA User(g_plugin.getStringA(CMStringA(FORMAT, "User%d", index))); if (User) strncpy_s(m_szUser, User, _TRUNCATE); - ptrA Url(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Url%d", index))); + ptrA Url(g_plugin.getStringA(CMStringA(FORMAT, "Url%d", index))); if (Url) strncpy_s(m_szUrl, Url, _TRUNCATE); - ptrA Dir(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Dir%d", index))); + ptrA Dir(g_plugin.getStringA(CMStringA(FORMAT, "Dir%d", index))); if (Dir) strncpy_s(m_szDir, Dir, _TRUNCATE); - ptrA Chmod(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Chmod%d", index))); + ptrA Chmod(g_plugin.getStringA(CMStringA(FORMAT, "Chmod%d", index))); if (Chmod) strncpy_s(m_szChmod, Chmod, _TRUNCATE); m_ftpProto = (FTP::EProtoType)DB::getWordF(0, MODULENAME, "FtpProto%d", index, FTP::FT_STANDARD); diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index e866115cd6..6b17c59f52 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -111,7 +111,7 @@ void Utils::curlSetOpt(CURL *hCurl, ServerList::FTP *ftp, char *url, struct curl if (ftp->m_bPassive) curl_easy_setopt(hCurl, CURLOPT_FTPPORT, 0); else { - ptrA localip(db_get_sa(NULL, MODULENAME, "LocalIP")); + ptrA localip(g_plugin.getStringA("LocalIP")); if (localip) curl_easy_setopt(hCurl, CURLOPT_FTPPORT, localip); else -- cgit v1.2.3