summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/GTalkExt/src/tipper_items.cpp18
-rw-r--r--protocols/IcqOscarJ/src/fam_02location.cpp15
-rw-r--r--protocols/MRA/src/MraProto.h3
-rw-r--r--protocols/MRA/src/Mra_functions.cpp34
-rw-r--r--protocols/Twitter/src/connection.cpp9
5 files changed, 20 insertions, 59 deletions
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp
index 6dc8a3d6ae..36d0cbb0b1 100644
--- a/protocols/GTalkExt/src/tipper_items.cpp
+++ b/protocols/GTalkExt/src/tipper_items.cpp
@@ -47,29 +47,27 @@ static const LPTSTR UNREAD_THREADS_LABEL = LPGENT("Unread threads:");
void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
{
for (int i = count; i > 0; i--) {
- DBCONTACTWRITESETTING cws;
+ DBVARIANT dbv;
sprintf(buff, format, i - 1);
- if (db_get(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ if (db_get(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
__try {
- if (DBVT_ASCIIZ == cws.value.type) {
- db_free(&cws.value);
- if (db_get_ws(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ if (DBVT_ASCIIZ == dbv.type) {
+ db_free(&dbv);
+ if (db_get_ws(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
}
- if (db_get_s(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ if (db_get_s(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
- cws.szModule = TIPPER_ITEMS_MOD_NAME;
sprintf(buff, format, i);
- cws.szSetting = buff;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ db_set(NULL, TIPPER_ITEMS_MOD_NAME, buff, &dbv);
}
__finally {
- db_free(&cws.value);
+ db_free(&dbv);
}
}
}
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp
index 8aa2a56aa7..7687c18444 100644
--- a/protocols/IcqOscarJ/src/fam_02location.cpp
+++ b/protocols/IcqOscarJ/src/fam_02location.cpp
@@ -185,19 +185,8 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
// Get Profile encoding TLV
pTLV = pChain->getTLV(0x05, 1);
- if (pTLV && (pTLV->wLen > 0))
- {
- // store client capabilities
- BYTE* capBuf = pTLV->pData;
- WORD capLen = pTLV->wLen;
- DBCONTACTWRITESETTING dbcws;
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.cpbVal = capLen;
- dbcws.value.pbVal = capBuf;
- dbcws.szModule = m_szModuleName;
- dbcws.szSetting = "CapBuf";
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&dbcws);
- }
+ if (pTLV && pTLV->wLen > 0) // store client capabilities
+ db_set_blob(hContact, m_szModuleName, "CapBuf", pTLV->pData, pTLV->wLen);
else
deleteSetting(hContact, "CapBuf");
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;
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 5dac1643bf..77ed802696 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -43,14 +43,7 @@ inline static T db_pod_get(HANDLE hContact,const char *module,const char *settin
template<typename T>
inline static INT_PTR db_pod_set(HANDLE hContact,const char *module,const char *setting,T val)
{
- DBCONTACTWRITESETTING cws;
-
- cws.szModule = module;
- cws.szSetting = setting;
- cws.value.type = DBVT_BLOB;
- cws.value.cpbVal = sizeof(T);
- cws.value.pbVal = reinterpret_cast<BYTE*>(&val);
- return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+ return db_set_blob(hContact, module, setting, &val, sizeof(T));
}
void TwitterProto::SignOn(void*)