diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/HTTPServer/src/GuiElements.cpp | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/HTTPServer/src/GuiElements.cpp')
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index de1a8553af..2d0bb6771b 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -194,7 +194,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) string sCreateLink(const char * pszSrvPath)
{
char szTemp[30];
- string sLink = DBGetString(NULL, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
+ string sLink = DBGetString(0, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
mir_snprintf(szTemp, "%d.%d.%d.%d", SplitIpAddress(dwLocalIpAddress));
ReplaceAll(sLink, "%LocalIP%", szTemp);
@@ -706,40 +706,40 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara LVCOLUMN cCol = { 0 };
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx1", 126);
+ cCol.cx = g_plugin.getWord("StatWnd_cx1", 126);
cCol.pszText = Translate("Share name");
ListView_InsertColumn(hShareList, 0, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx2", 48);
+ cCol.cx = g_plugin.getWord("StatWnd_cx2", 48);
cCol.pszText = Translate("Max Downloads");
ListView_InsertColumn(hShareList, 1, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx3", 96);
+ cCol.cx = g_plugin.getWord("StatWnd_cx3", 96);
cCol.pszText = Translate("Allowed IP");
ListView_InsertColumn(hShareList, 2, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx4", 104);
+ cCol.cx = g_plugin.getWord("StatWnd_cx4", 104);
cCol.pszText = Translate("Allowed Mask");
ListView_InsertColumn(hShareList, 3, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx5", 252);
+ cCol.cx = g_plugin.getWord("StatWnd_cx5", 252);
cCol.pszText = Translate("Real path");
ListView_InsertColumn(hShareList, 4, &cCol);
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx6", 142);
+ cCol.cx = g_plugin.getWord("StatWnd_cx6", 142);
cCol.pszText = Translate("Share name");
ListView_InsertColumn(hUserList, 0, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx7", 111);
+ cCol.cx = g_plugin.getWord("StatWnd_cx7", 111);
cCol.pszText = Translate("User");
ListView_InsertColumn(hUserList, 1, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx8", 100);
+ cCol.cx = g_plugin.getWord("StatWnd_cx8", 100);
cCol.pszText = Translate("Agent");
ListView_InsertColumn(hUserList, 2, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx9", 100);
+ cCol.cx = g_plugin.getWord("StatWnd_cx9", 100);
cCol.pszText = Translate("Completed");
ListView_InsertColumn(hUserList, 3, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx10", 100);
+ cCol.cx = g_plugin.getWord("StatWnd_cx10", 100);
cCol.pszText = Translate("Speed");
ListView_InsertColumn(hUserList, 4, &cCol);
- bool b = db_get_b(NULL, MODULENAME, "StatWnd_ShowHidden", 0) != 0;
+ bool b = g_plugin.getByte("StatWnd_ShowHidden", 0) != 0;
CheckDlgButton(hwndDlg, IDC_SHOWHIDDENSHARES, b ? BST_CHECKED : BST_UNCHECKED);
bLastAutoRefress = false;
@@ -932,19 +932,19 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
HWND hUserList = GetDlgItem(hwndDlg, IDC_CURRENT_USERS);
- db_set_w(NULL, MODULENAME, "StatWnd_cx1", (WORD)ListView_GetColumnWidth(hShareList, 0));
- db_set_w(NULL, MODULENAME, "StatWnd_cx2", (WORD)ListView_GetColumnWidth(hShareList, 1));
- db_set_w(NULL, MODULENAME, "StatWnd_cx3", (WORD)ListView_GetColumnWidth(hShareList, 2));
- db_set_w(NULL, MODULENAME, "StatWnd_cx4", (WORD)ListView_GetColumnWidth(hShareList, 3));
- db_set_w(NULL, MODULENAME, "StatWnd_cx5", (WORD)ListView_GetColumnWidth(hShareList, 4));
- db_set_w(NULL, MODULENAME, "StatWnd_cx6", (WORD)ListView_GetColumnWidth(hUserList, 0));
- db_set_w(NULL, MODULENAME, "StatWnd_cx7", (WORD)ListView_GetColumnWidth(hUserList, 1));
- db_set_w(NULL, MODULENAME, "StatWnd_cx8", (WORD)ListView_GetColumnWidth(hUserList, 2));
- db_set_w(NULL, MODULENAME, "StatWnd_cx9", (WORD)ListView_GetColumnWidth(hUserList, 3));
- db_set_w(NULL, MODULENAME, "StatWnd_cx10", (WORD)ListView_GetColumnWidth(hUserList, 4));
+ g_plugin.setWord("StatWnd_cx1", (WORD)ListView_GetColumnWidth(hShareList, 0));
+ g_plugin.setWord("StatWnd_cx2", (WORD)ListView_GetColumnWidth(hShareList, 1));
+ g_plugin.setWord("StatWnd_cx3", (WORD)ListView_GetColumnWidth(hShareList, 2));
+ g_plugin.setWord("StatWnd_cx4", (WORD)ListView_GetColumnWidth(hShareList, 3));
+ g_plugin.setWord("StatWnd_cx5", (WORD)ListView_GetColumnWidth(hShareList, 4));
+ g_plugin.setWord("StatWnd_cx6", (WORD)ListView_GetColumnWidth(hUserList, 0));
+ g_plugin.setWord("StatWnd_cx7", (WORD)ListView_GetColumnWidth(hUserList, 1));
+ g_plugin.setWord("StatWnd_cx8", (WORD)ListView_GetColumnWidth(hUserList, 2));
+ g_plugin.setWord("StatWnd_cx9", (WORD)ListView_GetColumnWidth(hUserList, 3));
+ g_plugin.setWord("StatWnd_cx10", (WORD)ListView_GetColumnWidth(hUserList, 4));
bool b = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDDENSHARES) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "StatWnd_ShowHidden", b);
+ g_plugin.setByte("StatWnd_ShowHidden", b);
Utils_SaveWindowPosition(hwndDlg, 0, MODULENAME, "StatWnd_");
DestroyWindow(hwndDlg);
@@ -1074,16 +1074,16 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_INITDIALOG:
{
- string sDefExt = DBGetString(NULL, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
+ string sDefExt = DBGetString(0, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
SetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, sDefExt.c_str());
- bool b = db_get_b(NULL, MODULENAME, "AddStatisticsMenuItem", 1) != 0;
+ bool b = g_plugin.getByte("AddStatisticsMenuItem", 1) != 0;
CheckDlgButton(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
- b = db_get_b(NULL, MODULENAME, "AddAcceptConMenuItem", 1) != 0;
+ b = g_plugin.getByte("AddAcceptConMenuItem", 1) != 0;
CheckDlgButton(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
- b = db_get_b(NULL, MODULENAME, "WriteLogFile", 0) != 0;
+ b = g_plugin.getByte("WriteLogFile", 0) != 0;
CheckDlgButton(hwndDlg, IDC_WRITE_LOG_FILE, b ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOW_POPUPS, bShowPopups ? BST_CHECKED : BST_UNCHECKED);
@@ -1119,7 +1119,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, nDefaultDownloadLimit, true);
indexCreationMode =
- (eIndexCreationMode)db_get_b(NULL, MODULENAME, "IndexCreationMode", 3);
+ (eIndexCreationMode)g_plugin.getByte("IndexCreationMode", 3);
switch (indexCreationMode) {
case INDEX_CREATION_HTML:
@@ -1203,64 +1203,64 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
char szTemp[500];
if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, _countof(szTemp)))
- db_set_s(NULL, MODULENAME, "ExternalSrvName", szTemp);
+ g_plugin.setString("ExternalSrvName", szTemp);
- bool b = db_get_b(NULL, MODULENAME, "AddStatisticsMenuItem", 1) != 0;
+ bool b = g_plugin.getByte("AddStatisticsMenuItem", 1) != 0;
bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
- db_set_b(NULL, MODULENAME, "AddStatisticsMenuItem", bNew);
+ g_plugin.setByte("AddStatisticsMenuItem", bNew);
MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
}
- b = db_get_b(NULL, MODULENAME, "AddAcceptConMenuItem", 1) != 0;
+ b = g_plugin.getByte("AddAcceptConMenuItem", 1) != 0;
bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
- db_set_b(NULL, MODULENAME, "AddAcceptConMenuItem", bNew);
+ g_plugin.setByte("AddAcceptConMenuItem", bNew);
MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
}
bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "WriteLogFile", bNew);
+ g_plugin.setByte("WriteLogFile", bNew);
bShowPopups = IsDlgButtonChecked(hwndDlg, IDC_SHOW_POPUPS) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "ShowPopups", bShowPopups);
+ g_plugin.setByte("ShowPopups", bShowPopups);
GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, _countof(szTemp));
sUrlAddress = szTemp;
- db_set_s(NULL, MODULENAME, "UrlAddress", sUrlAddress.c_str());
+ g_plugin.setString("UrlAddress", sUrlAddress.c_str());
GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, _countof(szTemp));
sPageKeyword = szTemp;
- db_set_s(NULL, MODULENAME, "PageKeyword", sPageKeyword.c_str());
+ g_plugin.setString("PageKeyword", sPageKeyword.c_str());
dwExternalIpAddress = 0;
BOOL bTranslated = false;
int nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_SPEED, &bTranslated, true);
if (bTranslated) {
nMaxUploadSpeed = nTemp << 10;
- db_set_dw(NULL, MODULENAME, "MaxUploadSpeed", nMaxUploadSpeed);
+ g_plugin.setDword("MaxUploadSpeed", nMaxUploadSpeed);
}
nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_TOTAL, &bTranslated, true);
if (bTranslated) {
nMaxConnectionsTotal = nTemp;
- db_set_dw(NULL, MODULENAME, "MaxConnectionsTotal", nMaxConnectionsTotal);
+ g_plugin.setDword("MaxConnectionsTotal", nMaxConnectionsTotal);
}
nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_PER_USER, &bTranslated, true);
if (bTranslated) {
nMaxConnectionsPerUser = nTemp;
- db_set_dw(NULL, MODULENAME, "MaxConnectionsPerUser", nMaxConnectionsPerUser);
+ g_plugin.setDword("MaxConnectionsPerUser", nMaxConnectionsPerUser);
}
nTemp = GetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, &bTranslated, true);
if (bTranslated) {
nDefaultDownloadLimit = nTemp;
- db_set_dw(NULL, MODULENAME, "DefaultDownloadLimit", nDefaultDownloadLimit);
+ g_plugin.setDword("DefaultDownloadLimit", nDefaultDownloadLimit);
}
bLimitOnlyWhenOnline = IsDlgButtonChecked(hwndDlg, IDC_LIMIT_ONLY_WHEN_ONLINE) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline);
+ g_plugin.setByte("LimitOnlyWhenOnline", bLimitOnlyWhenOnline);
if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_HTML) == BST_CHECKED ||
IsDlgButtonChecked(hwndDlg, IDC_INDEX_DETECT) == BST_CHECKED) {
@@ -1283,7 +1283,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP indexCreationMode = INDEX_CREATION_DISABLE;
}
- db_set_b(NULL, MODULENAME, "IndexCreationMode", (BYTE)indexCreationMode);
+ g_plugin.setByte("IndexCreationMode", (BYTE)indexCreationMode);
return TRUE;
}
@@ -1337,7 +1337,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) void CALLBACK MainThreadCallback(void *param)
{
POPUPDATAT *pclData = (POPUPDATAT*)param;
- if (db_get_b(NULL, MODULENAME, "WriteLogFile", 0) != 0)
+ if (g_plugin.getByte("WriteLogFile", 0) != 0)
LogEvent(pclData->lpzContactName, pclData->lpzText);
PUAddPopupT(pclData);
@@ -1430,8 +1430,8 @@ void InitGuiElements() stInitCom.dwICC = ICC_INTERNET_CLASSES;
InitCommonControlsEx(&stInitCom);
- sUrlAddress = DBGetString(NULL, MODULENAME, "UrlAddress", szDefaultUrlAddress);
- sPageKeyword = DBGetString(NULL, MODULENAME, "PageKeyword", szDefaultPageKeyword);
+ sUrlAddress = DBGetString(0, MODULENAME, "UrlAddress", szDefaultUrlAddress);
+ sPageKeyword = DBGetString(0, MODULENAME, "PageKeyword", szDefaultPageKeyword);
hShareNewFileService = CreateServiceFunction(MS_SHARE_NEW_FILE, nShareNewFile);
hShowStatisticsViewService = CreateServiceFunction(MS_SHOW_STATISTICS_VIEW, nShowStatisticsView);
@@ -1445,7 +1445,7 @@ void InitGuiElements() mi.pszService = MS_SHARE_NEW_FILE;
hShareNewFileMenuItem = Menu_AddContactMenuItem(&mi);
- if (db_get_b(NULL, MODULENAME, "AddStatisticsMenuItem", 1) != 0) {
+ if (g_plugin.getByte("AddStatisticsMenuItem", 1) != 0) {
SET_UID(mi, 0x68db84c9, 0xe6b4, 0x4b4f, 0x93, 0x4b, 0xfd, 0x34, 0x2d, 0x83, 0x11, 0xe7);
mi.position = 1000085005;
mi.name.w = LPGENW("Show HTTP server statistics");
@@ -1453,5 +1453,5 @@ void InitGuiElements() hShowStatisticsViewMenuItem = Menu_AddMainMenuItem(&mi);
}
- bShowPopups = db_get_b(NULL, MODULENAME, "ShowPopups", bShowPopups) != 0;
+ bShowPopups = g_plugin.getByte("ShowPopups", bShowPopups) != 0;
}
|