diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/GTalkExt/src/tipper_items.cpp | 15 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icqosc_svcs.cpp | 21 | ||||
-rw-r--r-- | protocols/MRA/src/MraAntiSpam.cpp | 13 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 23 | ||||
-rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 2 | ||||
-rw-r--r-- | protocols/Twitter/src/connection.cpp | 7 |
6 files changed, 19 insertions, 62 deletions
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 77c5e60e95..6dc8a3d6ae 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -48,21 +48,20 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) {
for (int i = count; i > 0; i--) {
DBCONTACTWRITESETTING cws;
- DBCONTACTGETSETTING cgs;
- cgs.szModule = TIPPER_ITEMS_MOD_NAME;
sprintf(buff, format, i - 1);
- cgs.szSetting = buff;
- cgs.pValue = &cws.value;
- if (CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&cgs)) break;
+ if (db_get(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ break;
+
__try {
if (DBVT_ASCIIZ == cws.value.type) {
db_free(&cws.value);
- cws.value.type = DBVT_WCHAR;
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break;
+ if (db_get_ws(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ break;
}
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break;
+ if (db_get_s(0, TIPPER_ITEMS_MOD_NAME, buff, &cws.value))
+ break;
cws.szModule = TIPPER_ITEMS_MOD_NAME;
sprintf(buff, format, i);
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 2d140d8094..9442d860d6 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -89,15 +89,10 @@ INT_PTR CIcqProto::GetInfoSetting(WPARAM wParam, LPARAM lParam) DBCONTACTGETSETTING *cgs = (DBCONTACTGETSETTING*)lParam;
BYTE type = cgs->pValue->type;
- cgs->pValue->type = 0; // original type without conversion
- INT_PTR rc = CallService(MS_DB_CONTACT_GETSETTING_STR, wParam, lParam);
-
+ DBVARIANT dbv = { 0 };
+ INT_PTR rc = db_get_s((HANDLE)wParam, cgs->szModule, cgs->szSetting, &dbv, 0);
if (!rc)
{ // Success
- DBVARIANT dbv;
-
- memcpy(&dbv, cgs->pValue, sizeof(DBVARIANT));
-
if (dbv.type == DBVT_BLOB)
{
cgs->pValue->pbVal = (BYTE*)mir_alloc(dbv.cpbVal);
@@ -742,23 +737,15 @@ INT_PTR __cdecl CIcqProto::IcqAddCapability(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl CIcqProto::IcqCheckCapability(WPARAM wParam, LPARAM lParam)
{
int res = 0;
- DBCONTACTGETSETTING dbcgs;
DBVARIANT dbvariant;
HANDLE hContact = (HANDLE)wParam;
ICQ_CUSTOMCAP *icqCustomCap = (ICQ_CUSTOMCAP *)lParam;
- dbcgs.pValue = &dbvariant;
- dbcgs.szModule = m_szModuleName;
- dbcgs.szSetting = "CapBuf";
-
- CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs);
+ db_get(hContact, m_szModuleName, "CapBuf", &dbvariant);
if (dbvariant.type == DBVT_BLOB)
- {
res = MatchCapability(dbvariant.pbVal, dbvariant.cpbVal, (const capstr*)&icqCustomCap->caps, 0x10)?1:0; // FIXME: Why icqCustomCap->caps is not capstr?
- }
-
- CallService(MS_DB_CONTACT_FREEVARIANT,0,(LPARAM)(DBVARIANT*)&dbvariant);
+ db_free(&dbvariant);
return res;
}
diff --git a/protocols/MRA/src/MraAntiSpam.cpp b/protocols/MRA/src/MraAntiSpam.cpp index 2eaa64348e..e3bc5edd82 100644 --- a/protocols/MRA/src/MraAntiSpam.cpp +++ b/protocols/MRA/src/MraAntiSpam.cpp @@ -17,15 +17,8 @@ static size_t dwBadWordsCount = 0; size_t MraAntiSpamLoadBadWordsW()
{
- char szSettingName[MAX_PATH];
- size_t i = 0, dwValueSize, dwAllocatedItemsCount = MRA_ANTISPAM_PREALLOC_COUNT;
DBVARIANT dbv = {0};
- DBCONTACTGETSETTING sVal = {0};
-
- dbv.type = DBVT_WCHAR;
- sVal.pValue = &dbv;
- sVal.szModule = "MRA";
- sVal.szSetting = szSettingName;
+ size_t i = 0, dwValueSize, dwAllocatedItemsCount = MRA_ANTISPAM_PREALLOC_COUNT;
if (pmabwBadWords || dwBadWordsCount)
MraAntiSpamFreeBadWords();
@@ -33,9 +26,9 @@ size_t MraAntiSpamLoadBadWordsW() pmabwBadWords = (MRA_ANTISPAM_BAD_WORD*)mir_calloc((sizeof(MRA_ANTISPAM_BAD_WORD)*dwAllocatedItemsCount));
for (i = 0;TRUE;i++) {
+ char szSettingName[MAX_PATH];
mir_snprintf(szSettingName, SIZEOF(szSettingName), "AntiSpamBadWord %lu", i);
- dbv.type = DBVT_WCHAR;
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, NULL, (LPARAM)&sVal))
+ if (db_get_ws(NULL, "MRA", szSettingName, &dbv))
break;
if (dwAllocatedItemsCount == i) {
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index d4a5f657ac..65ed85f6c1 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -207,13 +207,7 @@ BOOL DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam BOOL bRet = FALSE;
size_t dwReadedStringLen, dwRetBuffSizeLocal;
DBVARIANT dbv = {0};
- DBCONTACTGETSETTING sVal = {0};
-
- dbv.type = DBVT_WCHAR;
- sVal.pValue = &dbv;
- sVal.szModule = lpszModule;
- sVal.szSetting = lpszValueName;
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, (WPARAM)hContact, (LPARAM)&sVal) == 0)
+ if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0)
{
dwReadedStringLen = lstrlenW(dbv.pwszVal);
if (lpszRetBuff && (dwRetBuffSize>dwReadedStringLen))
@@ -241,13 +235,7 @@ BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam BOOL bRet = FALSE;
size_t dwReadedStringLen;
DBVARIANT dbv = {0};
- DBCONTACTGETSETTING sVal = {0};
-
- dbv.type = DBVT_WCHAR;
- sVal.pValue = &dbv;
- sVal.szModule = lpszModule;
- sVal.szSetting = lpszValueName;
- if (CallService(MS_DB_CONTACT_GETSETTING_STR, (WPARAM)hContact, (LPARAM)&sVal) == 0)
+ if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0)
{
dwReadedStringLen = lstrlenW(dbv.pwszVal);
if (lpwszRetBuff && (dwRetBuffSize>dwReadedStringLen))
@@ -344,12 +332,7 @@ BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszVal {
BOOL bRet = FALSE;
DBVARIANT dbv;
- DBCONTACTGETSETTING sVal = {0};
-
- sVal.pValue = &dbv;
- sVal.szModule = lpszModule;
- sVal.szSetting = lpszValueName;
- if (CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&sVal) == 0)
+ if (db_get(hContact, lpszModule, lpszValueName, &dbv) == 0)
{
if (dbv.type == DBVT_BLOB)
{
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 932cc30c5f..176fe529f2 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -182,7 +182,7 @@ HANDLE CSkypeProto::GetContactFromAuthEvent(HANDLE hEvent) dbei.cbBlob = sizeof(DWORD) * 2;
dbei.pBlob = (PBYTE)&body;
- if (::CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei))
+ if (::db_event_get(hEvent, &dbei))
return INVALID_HANDLE_VALUE;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 031d21fc36..5dac1643bf 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -28,12 +28,7 @@ template<typename T> inline static T db_pod_get(HANDLE hContact,const char *module,const char *setting,T errorValue)
{
DBVARIANT dbv;
- DBCONTACTGETSETTING cgs;
-
- cgs.szModule = module;
- cgs.szSetting = setting;
- cgs.pValue = &dbv;
- if(CallService(MS_DB_CONTACT_GETSETTING,(WPARAM)hContact,(LPARAM)&cgs))
+ if(db_get(hContact, module, setting, &dbv))
return errorValue;
// TODO: remove this, it's just a temporary workaround
|