diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-05 22:27:16 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-05 22:27:16 +0000 |
commit | 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch) | |
tree | b1ee30b70c6e36d1a06aed6885cb80dc560a68ca /src/core/stdfile | |
parent | f4a1bbc6ba4b8137cb868639ac146aa97e97e9df (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 'src/core/stdfile')
-rw-r--r-- | src/core/stdfile/file.cpp | 91 | ||||
-rw-r--r-- | src/core/stdfile/fileopts.cpp | 36 | ||||
-rw-r--r-- | src/core/stdfile/filerecvdlg.cpp | 30 | ||||
-rw-r--r-- | src/core/stdfile/filexferdlg.cpp | 14 | ||||
-rw-r--r-- | src/core/stdfile/ftmanager.cpp | 8 |
5 files changed, 89 insertions, 90 deletions
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 048125abac..8e67d7f802 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -27,22 +27,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s);
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR *r);
-static HANDLE hSRFileMenuItem;
+static HGENMENU hSRFileMenuItem;
TCHAR *GetContactID(HANDLE hContact)
{
TCHAR *theValue = {0};
char *szProto = GetContactProto(hContact);
- if (DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0) == 1) {
+ if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1) {
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, szProto, "ChatRoomID", &dbv)) {
+ if ( !db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) {
theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return theValue;
- } }
+ }
+ }
else {
- CONTACTINFO ci = {0};
- ci.cbSize = sizeof(ci);
+ CONTACTINFO ci = { sizeof(ci) };
ci.hContact = hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
@@ -50,11 +50,11 @@ TCHAR *GetContactID(HANDLE hContact) switch (ci.type) {
case CNFT_ASCIIZ:
return (TCHAR *)ci.pszVal;
- break;
case CNFT_DWORD:
return _itot(ci.dVal, (TCHAR *)mir_alloc(sizeof(TCHAR)*32), 10);
- break;
- } } }
+ }
+ }
+ }
return NULL;
}
@@ -71,20 +71,20 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) {
FileSendData fsd;
fsd.hContact = (HANDLE)wParam;
-
- char** ppFiles = (char**)lParam;
- int count = 0;
- while (ppFiles[count] != NULL)
- count++;
-
- fsd.ppFiles = (const TCHAR**)alloca((count+1) * sizeof(void*));
- for (int i=0; i < count; i++)
- fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
- fsd.ppFiles[ count ] = NULL;
-
+
+ char** ppFiles = (char**)lParam;
+ int count = 0;
+ while (ppFiles[count] != NULL)
+ count++;
+
+ fsd.ppFiles = (const TCHAR**)alloca((count+1) * sizeof(void*));
+ for (int i=0; i < count; i++)
+ fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
+ fsd.ppFiles[ count ] = NULL;
+
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
for (int j = 0; j < count; j++)
- mir_free((void*)fsd.ppFiles[j]);
+ mir_free((void*)fsd.ppFiles[j]);
return 0;
}
@@ -99,11 +99,11 @@ static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
{
- TCHAR buf[MAX_PATH];
+ TCHAR buf[MAX_PATH];
GetContactReceivedFilesDir((HANDLE)wParam, buf, MAX_PATH, TRUE);
- char* dir = mir_t2a(buf);
- lstrcpynA((char*)lParam, dir, MAX_PATH);
- mir_free(dir);
+ char* dir = mir_t2a(buf);
+ lstrcpynA((char*)lParam, dir, MAX_PATH);
+ mir_free(dir);
return 0;
}
@@ -120,7 +120,7 @@ void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam) cle.hContact = hContact;
cle.hDbEvent = hdbe;
cle.lParam = lParam;
- if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
+ if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
@@ -134,7 +134,7 @@ void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam) cle.hIcon = LoadSkinIcon(SKINICON_EVENT_FILE);
cle.pszService = "SRFile/RecvFile";
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
-} }
+ } }
static int FileEventAdded(WPARAM wParam, LPARAM lParam)
{
@@ -158,7 +158,7 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu if (RegOpenKeyEx(hKeyBase, szSubKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
return 0;
-
+
if (RegQueryValueEx(hKey, szValue, NULL, NULL, (PBYTE)szOutput, &cbOut) != ERROR_SUCCESS) {
RegCloseKey(hKey);
return 0;
@@ -175,15 +175,15 @@ void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsO else if (size<100*1024) unitsOverride = UNITS_KBPOINT1;
else if (size<1024*1024) unitsOverride = UNITS_KBPOINT0;
else if (size<1024*1024*1024) unitsOverride = UNITS_MBPOINT2;
- else unitsOverride = UNITS_GBPOINT3;
+ else unitsOverride = UNITS_GBPOINT3;
}
if (unitsUsed) *unitsUsed = unitsOverride;
switch(unitsOverride) {
- case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits?_T(" "):_T(""), appendUnits?TranslateT("bytes"):_T("")); break;
- case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size/1024.0, appendUnits?_T(" KB"):_T("")); break;
- case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size/1024), appendUnits?_T(" KB"):_T("")); break;
- case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20)/1024.0, appendUnits?_T(" GB"):_T("")); break;
- default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size/1048576.0, appendUnits?_T(" MB"):_T("")); break;
+ case UNITS_BYTES: mir_sntprintf(szOut, cchOut, _T("%u%s%s"), (int)size, appendUnits?_T(" "):_T(""), appendUnits?TranslateT("bytes"):_T("")); break;
+ case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, _T("%.1lf%s"), size/1024.0, appendUnits?_T(" KB"):_T("")); break;
+ case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, _T("%u%s"), (int)(size/1024), appendUnits?_T(" KB"):_T("")); break;
+ case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, _T("%.3f%s"), (size >> 20)/1024.0, appendUnits?_T(" GB"):_T("")); break;
+ default: mir_sntprintf(szOut, cchOut, _T("%.2lf%s"), size/1048576.0, appendUnits?_T(" MB"):_T("")); break;
}
}
@@ -281,8 +281,8 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS dest->currentFileSize = src->currentFileSize;
dest->currentFileProgress = src->currentFileProgress;
dest->currentFileTime = src->currentFileTime;
- dest->flags &= ~PFTS_UTF;
- dest->flags |= PFTS_TCHAR;
+ dest->flags &= ~PFTS_UTF;
+ dest->flags |= PFTS_TCHAR;
}
static void RemoveUnreadFileEvents(void)
@@ -303,19 +303,18 @@ static void RemoveUnreadFileEvents(void) static int SRFilePreBuildMenu(WPARAM wParam, LPARAM)
{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
-
+ bool bEnabled = false;
char *szProto = GetContactProto((HANDLE)wParam);
if (szProto != NULL) {
if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND) {
if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
- mi.flags = CMIM_FLAGS;
- else if (DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- mi.flags = CMIM_FLAGS;
- } }
+ bEnabled = true;
+ else if (db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ bEnabled = true;
+ }
+ }
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSRFileMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hSRFileMenuItem, bEnabled);
return 0;
}
@@ -365,7 +364,7 @@ static void sttRecvCreateBlob(DBEVENTINFO& dbei, int fileCount, char** pszFiles, for (int i=0; i < fileCount; i++)
dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
}
-
+
dbei.cbBlob += lstrlenA(szDescr) + 1;
if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == 0)
diff --git a/src/core/stdfile/fileopts.cpp b/src/core/stdfile/fileopts.cpp index 5e9a465d63..c018c18a5f 100644 --- a/src/core/stdfile/fileopts.cpp +++ b/src/core/stdfile/fileopts.cpp @@ -71,16 +71,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
}
- CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, DBGetContactSettingByte(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, DBGetContactSettingByte(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED);
- switch(DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) {
+ CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, db_get_b(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED);
+ switch(db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) {
case VIRUSSCAN_AFTERDL: CheckDlgButton(hwndDlg, IDC_SCANAFTERDL, BST_CHECKED); break;
case VIRUSSCAN_DURINGDL: CheckDlgButton(hwndDlg, IDC_SCANDURINGDL, BST_CHECKED); break;
default: CheckDlgButton(hwndDlg, IDC_NOSCANNER, BST_CHECKED); break;
}
- CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, DBGetContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
{ TCHAR szScanExe[MAX_PATH];
int i, iItem;
@@ -98,9 +98,9 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) {
+ if (db_get_ts(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) {
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
if (SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCOUNT, 0, 0)) {
@@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L PostMessage(hwndDlg, M_SCANCMDLINESELCHANGE, 0, 0);
}
}
- switch(DBGetContactSettingByte(NULL, "SRFile", "IfExists", FILERESUME_ASK)) {
+ switch(db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK)) {
case FILERESUME_RESUMEALL: CheckDlgButton(hwndDlg, IDC_RESUME, BST_CHECKED); break;
case FILERESUME_OVERWRITEALL: CheckDlgButton(hwndDlg, IDC_OVERWRITE, BST_CHECKED); break;
case FILERESUME_RENAMEALL: CheckDlgButton(hwndDlg, IDC_RENAME, BST_CHECKED); break;
@@ -211,16 +211,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR str[512];
GetDlgItemText(hwndDlg, IDC_FILEDIR, str, SIZEOF(str));
RemoveInvalidPathChars(str);
- DBWriteContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", str);
- DBWriteContactSettingByte(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
- DBWriteContactSettingByte(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- DBWriteContactSettingByte(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
- DBWriteContactSettingByte(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
- DBWriteContactSettingByte(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL)?VIRUSSCAN_AFTERDL:(IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL)?VIRUSSCAN_DURINGDL:VIRUSSCAN_DISABLE)));
+ db_set_ts(NULL, "SRFile", "RecvFilesDirAdv", str);
+ db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
+ db_set_b(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ db_set_b(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
+ db_set_b(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
+ db_set_b(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL)?VIRUSSCAN_AFTERDL:(IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL)?VIRUSSCAN_DURINGDL:VIRUSSCAN_DISABLE)));
GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, SIZEOF(str));
- DBWriteContactSettingTString(NULL, "SRFile", "ScanCmdLine", str);
- DBWriteContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
- DBWriteContactSettingByte(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK)?FILERESUME_ASK:(IsDlgButtonChecked(hwndDlg, IDC_RESUME)?FILERESUME_RESUMEALL:(IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE)?FILERESUME_OVERWRITEALL:FILERESUME_RENAMEALL))));
+ db_set_ts(NULL, "SRFile", "ScanCmdLine", str);
+ db_set_b(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
+ db_set_b(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK)?FILERESUME_ASK:(IsDlgButtonChecked(hwndDlg, IDC_RESUME)?FILERESUME_RESUMEALL:(IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE)?FILERESUME_OVERWRITEALL:FILERESUME_RENAMEALL))));
return TRUE;
}
}
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index f9e2c3ddce..5633073ac4 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -136,10 +136,10 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL TCHAR szTemp[MAX_PATH];
szTemp[0] = 0;
- if ( !DBGetContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
+ if ( !db_get_ts(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
if (lstrlen(dbv.ptszVal) > 0)
lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !szTemp[0])
@@ -185,10 +185,10 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) TCHAR szTemp[MAX_PATH];
szTemp[0] = 0;
- if ( !DBGetContactSettingTString(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
+ if ( !db_get_ts(NULL, "SRFile", "RecvFilesDirAdv", &dbv)) {
if (lstrlen(dbv.ptszVal) > 0)
lstrcpyn(szTemp, dbv.ptszVal, SIZEOF(szTemp));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !szTemp[0])
@@ -241,10 +241,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i);
DBVARIANT dbv;
- if (DBGetContactSettingTString(NULL, "SRFile", idstr, &dbv))
+ if (db_get_ts(NULL, "SRFile", idstr, &dbv))
break;
SendDlgItemMessage(hwndDlg, IDC_FILEDIR, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
db_event_markRead(dat->hContact, dat->hDbEvent);
@@ -302,18 +302,18 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_NAME, contactName);
}
- if (DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
RECT rcBtn1, rcBtn2, rcDateCtrl;
GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rcBtn1);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rcBtn2);
GetWindowRect(GetDlgItem(hwndDlg, IDC_DATE), &rcDateCtrl);
SetWindowPos(GetDlgItem(hwndDlg, IDC_DATE), 0, 0, 0, rcDateCtrl.right-rcDateCtrl.left-(rcBtn2.left-rcBtn1.left), rcDateCtrl.bottom-rcDateCtrl.top, SWP_NOZORDER|SWP_NOMOVE);
}
- else if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0)) {
+ else if (db_get_b(NULL, "SRFile", "AutoAccept", 0)) {
//don't check auto-min here to fix BUG#647620
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK));
}
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
return TRUE;
@@ -362,12 +362,12 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBVARIANT dbv;
for (i = MAX_MRU_DIRS-2;i>=0;i--) {
mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i);
- if (DBGetContactSettingTString(NULL, "SRFile", idstr, &dbv)) continue;
+ if (db_get_ts(NULL, "SRFile", idstr, &dbv)) continue;
mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i+1);
- DBWriteContactSettingTString(NULL, "SRFile", idstr, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_set_ts(NULL, "SRFile", idstr, dbv.ptszVal);
+ db_free(&dbv);
}
- DBWriteContactSettingTString(NULL, "SRFile", idstr, szRecvDir);
+ db_set_ts(NULL, "SRFile", idstr, szRecvDir);
}
}
EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAMES), FALSE);
@@ -381,7 +381,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->hwndTransfer = FtMgr_AddTransfer(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
//check for auto-minimize here to fix BUG#647620
- if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0)) {
+ if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && db_get_b(NULL, "SRFile", "AutoMin", 0)) {
ShowWindow(hwndDlg, SW_HIDE);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
}
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l acs.handleType = HANDLE_CONTACT;
acs.szProto = "";
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
break;
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index 93354d07d4..593008551e 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -32,7 +32,7 @@ static int CheckVirusScanned(HWND hwnd, struct FileDlgData *dat, int i) if (dat->send) return 1;
if (dat->fileVirusScanned == NULL) return 0;
if (dat->fileVirusScanned[i]) return 1;
- if (DBGetContactSettingByte(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1;
+ if (db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1;
return IDYES == MessageBox(hwnd, TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"), TranslateT("File Received"), MB_YESNO|MB_DEFBUTTON2);
}
@@ -103,7 +103,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) DBVARIANT dbv;
TCHAR szCmdLine[768];
- if ( !DBGetContactSettingTString(NULL, "SRFile", "ScanCmdLine", &dbv))
+ if ( !db_get_ts(NULL, "SRFile", "ScanCmdLine", &dbv))
{
if (dbv.ptszVal[0])
{
@@ -125,7 +125,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) CloseHandle(pi.hThread);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_free(info->szFile);
mir_free(info);
@@ -255,8 +255,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CreateDirectoryTreeT(dat->szSavePath);
dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILEALLOWT, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
- if (DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
- else dat->resumeBehaviour = DBGetContactSettingByte(NULL, "SRFile", "IfExists", FILERESUME_ASK);
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
+ else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK);
SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT);
}
{
@@ -530,7 +530,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemTextA(hwndDlg, IDC_FILENAME, "");
if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles>1 && !dat->send)
SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1);
- if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
+ if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
PostMessage(hwndDlg, M_VIRUSSCANDONE, dat->transferStatus.currentFileNumber, 0);
else {
@@ -666,7 +666,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR LPGENT("Transfer completed, open folder."),
FTS_OPEN);
- int useScanner = DBGetContactSettingByte(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE);
+ int useScanner = db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE);
if (useScanner != VIRUSSCAN_DISABLE) {
struct virusscanthreadstartinfo *vstsi;
vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
diff --git a/src/core/stdfile/ftmanager.cpp b/src/core/stdfile/ftmanager.cpp index deb1bd3ef7..65b74a75fc 100644 --- a/src/core/stdfile/ftmanager.cpp +++ b/src/core/stdfile/ftmanager.cpp @@ -162,7 +162,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (i == dat->wnds->realCount)
PostMessage(GetParent(hwnd), WM_TIMER, 1, NULL);
- if(dat->runningCount == 0 && (int)wParam == ACKRESULT_SUCCESS && DBGetContactSettingByte(NULL, "SRFile", "AutoClose", 0))
+ if(dat->runningCount == 0 && (int)wParam == ACKRESULT_SUCCESS && db_get_b(NULL, "SRFile", "AutoClose", 0))
ShowWindow(hwndFtMgr, SW_HIDE);
break;
@@ -414,7 +414,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_CLOSE:
ShowWindow(hwnd, SW_HIDE);
- if (DBGetContactSettingByte(NULL, "SRFile", "AutoClear", 1)) {
+ if (db_get_b(NULL, "SRFile", "AutoClear", 1)) {
PostMessage(dat->hwndIncoming, WM_FT_CLEANUP, 0, 0);
PostMessage(dat->hwndOutgoing, WM_FT_CLEANUP, 0, 0);
}
@@ -476,7 +476,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND FtMgr_Show(bool bForceActivate, bool bFromMenu)
{
- bool bAutoMin = DBGetContactSettingByte(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */
+ bool bAutoMin = db_get_b(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */
bool bJustCreated = (hwndFtMgr == NULL);
if (bJustCreated)
@@ -520,7 +520,7 @@ void FtMgr_ShowPage(int page) HWND FtMgr_AddTransfer(FileDlgData *fdd)
{
- bool bForceActivate = fdd->send || !DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0);
+ bool bForceActivate = fdd->send || !db_get_b(NULL, "SRFile", "AutoAccept", 0);
TFtMgrData *dat = (TFtMgrData*)GetWindowLongPtr(FtMgr_Show(bForceActivate, false), GWLP_USERDATA);
if (dat == NULL)
return NULL;
|