diff options
Diffstat (limited to 'protocols/IcqOscarJ/src')
-rw-r--r-- | protocols/IcqOscarJ/src/icq_db.cpp | 23 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_servlist.cpp | 24 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_uploadui.cpp | 21 |
3 files changed, 10 insertions, 58 deletions
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index ecf76ebfc4..8841ce24fc 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -107,27 +107,10 @@ WORD CIcqProto::getContactStatus(HANDLE hContact) int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len)
{
- DBVARIANT dbv = {DBVT_DELETED};
- DBCONTACTGETSETTING sVal = {0};
-
- dbv.pszVal = dest;
- dbv.cchVal = dest_len;
- dbv.type = DBVT_ASCIIZ;
-
- sVal.pValue = &dbv;
- sVal.szModule = m_szModuleName;
- sVal.szSetting = szSetting;
-
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0) {
- dbv.pszVal = dest;
- dbv.cchVal = dest_len;
- dbv.type = DBVT_UTF8;
-
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0)
- return 1; // nothing found
- }
+ if (!db_get_static(hContact, m_szModuleName, szSetting, dest, dest_len))
+ return 0;
- return (dbv.type != DBVT_ASCIIZ);
+ return db_get_static_utf(hContact, m_szModuleName, szSetting, dest, dest_len);
}
int CIcqProto::setSettingDouble(HANDLE hContact, const char *szSetting, double dValue)
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 44e6ef480e..5eac04a78b 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -930,28 +930,10 @@ static int GroupReserveIdsEnumProc(const char *szSetting,LPARAM lParam) // it is probably server group
GroupReserveIdsEnumParam *param = (GroupReserveIdsEnumParam*)lParam;
char val[MAX_PATH+2]; // dummy
-
- DBVARIANT dbv = {DBVT_DELETED};
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = val;
- dbv.cchVal = MAX_PATH;
-
- DBCONTACTGETSETTING cgs;
- cgs.szModule = param->szModule;
- cgs.szSetting = szSetting;
- cgs.pValue = &dbv;
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC,0,(LPARAM)&cgs))
- { // we failed to read setting, try also utf8 - DB bug
- dbv.type = DBVT_UTF8;
- dbv.pszVal = val;
- dbv.cchVal = MAX_PATH;
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC,0,(LPARAM)&cgs))
+ if (db_get_static(0, param->szModule, szSetting, val, MAX_PATH))
+ if (db_get_static_utf(0, param->szModule, szSetting, val, MAX_PATH))
return 0; // we failed also, invalid setting
- }
- if (dbv.type != DBVT_ASCIIZ)
- { // it is not a cached server-group name
- return 0;
- }
+
param->ppro->ReserveServerID((WORD)strtoul(szSetting, NULL, 0x10), SSIT_GROUP, 0);
#ifdef _DEBUG
param->ppro->debugLogA("Loaded group %u:'%s'", strtoul(szSetting, NULL, 0x10), val);
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 01e7b14f6b..7b4aa7d4ba 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -148,25 +148,12 @@ static void GetLastUploadLogLine(HWND hwndDlg, char *szBuf, size_t cbBuf) static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam)
{
- if (szSetting && strlennull(szSetting)<5)
- { // it is probably server group
+ // it is probably server group
+ if (szSetting && strlennull(szSetting) < 5) {
char val[MAX_PATH+2]; // dummy
- DBVARIANT dbv;
- DBCONTACTGETSETTING cgs;
-
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = val;
- dbv.cchVal = MAX_PATH;
-
- cgs.szModule=(char*)lParam;
- cgs.szSetting=szSetting;
- cgs.pValue=&dbv;
- if(CallService(MS_DB_CONTACT_GETSETTINGSTATIC,0,(LPARAM)&cgs))
+ if (db_get_static(NULL, (char*)lParam, szSetting, val, MAX_PATH))
return 0; // this converts all string types to DBVT_ASCIIZ
- if(dbv.type!=DBVT_ASCIIZ)
- { // it is not a cached server-group name
- return 0;
- }
+
pwGroupIds = (WORD*)SAFE_REALLOC(pwGroupIds, (cbGroupIds+1)*sizeof(WORD));
pwGroupIds[cbGroupIds] = (WORD)strtoul(szSetting, NULL, 0x10);
cbGroupIds++;
|