diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-30 12:16:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-30 12:16:44 +0000 |
commit | 25ec54ea27a7099f33573b260a620ed7273176fe (patch) | |
tree | 1810a0cb35d23deeed9ccdaf0ab276a4022f9a41 /protocols/MRA | |
parent | a546606709e6bb72e01eb38b2c8c8756608fd5d6 (diff) |
- db_set_blob used everywhere for writing blobs
- DBCONTACTWRITESETTING left only in the event handlers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5191 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/src/MraProto.h | 3 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 34 |
2 files changed, 9 insertions, 28 deletions
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 2ba636de92..019401c90d 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -30,7 +30,6 @@ BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPCSTR lpszValue, size_t dwValueSize);
BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPCWSTR lpwszValue, size_t dwValueSize);
-int DB_WriteContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpValue, size_t dwValueSize);
BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
struct CMraProto : public PROTO_INTERFACE
@@ -140,7 +139,7 @@ struct CMraProto : public PROTO_INTERFACE return DB_SetStringExW(Contact, m_szModuleName, valueName, parValue, parValueSize); }
__forceinline BOOL mraWriteContactSettingBlob(HANDLE hContact, const char *lpszValueName, LPVOID lpbValue, size_t dwValueSize) {
- return DB_WriteContactSettingBlob(hContact, m_szModuleName, lpszValueName, lpbValue, dwValueSize); }
+ return db_set_blob(hContact, m_szModuleName, lpszValueName, lpbValue, dwValueSize); }
__forceinline BOOL mraGetContactSettingBlob(HANDLE hContact, const char *lpszValueName, LPVOID lpbRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize) {
return DB_GetContactSettingBlob(hContact, m_szModuleName, lpszValueName, lpbRet, dwRetBuffSize, pdwRetBuffSize); }
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 65ed85f6c1..3d5b14bc64 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -268,16 +268,13 @@ BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L lpwszValueLocal = (LPWSTR)mir_calloc((dwValueSizeLocal*sizeof(WCHAR)));
if (lpwszValueLocal) {
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = lpszModule;
- cws.szSetting = lpszValueName;
- cws.value.type = DBVT_WCHAR;
- cws.value.pwszVal = (WCHAR*)lpwszValueLocal;
+ DBVARIANT dbv = {0};
+ dbv.type = DBVT_WCHAR;
+ dbv.pwszVal = (WCHAR*)lpwszValueLocal;
dwValueSizeLocal = MultiByteToWideChar(MRA_CODE_PAGE, 0, lpszValue, dwValueSize, lpwszValueLocal, dwValueSizeLocal);
lpwszValueLocal[dwValueSizeLocal] = 0;
- bRet = (CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws) == 0);
+ bRet = (db_set(hContact, lpszModule, lpszValueName, &dbv) == 0);
mir_free(lpwszValueLocal);
}
@@ -297,14 +294,11 @@ BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L LPWSTR lpwszValueLocal = (LPWSTR)mir_calloc(((dwValueSize+MAX_PATH)*sizeof(WCHAR)));
if (lpwszValueLocal) {
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = lpszModule;
- cws.szSetting = lpszValueName;
- cws.value.type = DBVT_WCHAR;
- cws.value.pwszVal = (WCHAR*)lpwszValueLocal;
+ DBVARIANT dbv = {0};
+ dbv.type = DBVT_WCHAR;
+ dbv.pwszVal = (WCHAR*)lpwszValueLocal;
memmove(lpwszValueLocal, lpwszValue, (dwValueSize*sizeof(WCHAR)));
- bRet = (CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws) == 0);
+ bRet = (db_set(hContact, lpszModule, lpszValueName, &dbv) == 0);
mir_free(lpwszValueLocal);
}
@@ -316,18 +310,6 @@ BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L return bRet;
}
-int DB_WriteContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpValue, size_t dwValueSize)
-{
- DBCONTACTWRITESETTING cws = {0};
-
- cws.szModule = lpszModule;
- cws.szSetting = lpszValueName;
- cws.value.type = DBVT_BLOB;
- cws.value.pbVal = (LPBYTE)lpValue;
- cws.value.cpbVal = (WORD)dwValueSize;
- return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
-}
-
BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize)
{
BOOL bRet = FALSE;
|