summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/IcqOscarJ/src')
-rw-r--r--protocols/IcqOscarJ/src/UI/userinfotab.cpp10
-rw-r--r--protocols/IcqOscarJ/src/changeinfo/db.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp6
-rw-r--r--protocols/IcqOscarJ/src/fam_03buddy.cpp4
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp14
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp14
-rw-r--r--protocols/IcqOscarJ/src/icq_db.cpp188
-rw-r--r--protocols/IcqOscarJ/src/icq_db.h10
-rw-r--r--protocols/IcqOscarJ/src/icq_direct.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_filetransfer.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_infoupdate.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_menu.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp26
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icqosc_svcs.cpp88
-rw-r--r--protocols/IcqOscarJ/src/stdpackets.cpp4
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp16
18 files changed, 165 insertions, 235 deletions
diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp
index 47c47d755f..50ee92ce24 100644
--- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp
+++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp
@@ -76,13 +76,11 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, HANDLE hContact,
dbv.type = DBVT_DELETED;
}
}
- else
- {
+ else {
if (szModule == NULL)
unspecified = 1;
- else
- {
- unspecified = DBGetContactSetting(hContact, szModule, szSetting, &dbv);
+ else {
+ unspecified = db_get(hContact, szModule, szSetting, &dbv);
bDbv = 1;
}
}
@@ -196,7 +194,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, HANDLE hContact,
SetDlgItemTextA(hwndDlg, idCtrl, pstr);
if (bDbv)
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
if (bAlloc)
SAFE_FREE(&pstr);
diff --git a/protocols/IcqOscarJ/src/changeinfo/db.cpp b/protocols/IcqOscarJ/src/changeinfo/db.cpp
index 643dcaa034..ba231acebe 100644
--- a/protocols/IcqOscarJ/src/changeinfo/db.cpp
+++ b/protocols/IcqOscarJ/src/changeinfo/db.cpp
@@ -75,7 +75,7 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged)
break;
#endif
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
char buf[MAX_PATH];
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index 9bc06f19ab..228754e7ec 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -585,7 +585,7 @@ char* CIcqProto::buildUinList(int subtype, WORD wMaxLen, HANDLE* hContactResume)
add = 0;
// Never add hidden contacts to CS list
- if (DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if (db_get_b(hContact, "CList", "Hidden", 0))
add = 0;
break;
@@ -689,7 +689,7 @@ void CIcqProto::setUserInfo()
//MIM/PackName
bool bHasPackName = false;
DBVARIANT dbv;
- if ( !DBGetContactSettingString(NULL, "ICQCaps", "PackName", &dbv )) {
+ if ( !db_get_s(NULL, "ICQCaps", "PackName", &dbv )) {
//MIM/PackName
bHasPackName = true;
wAdditionalData += 16;
@@ -771,7 +771,7 @@ void CIcqProto::setUserInfo()
//MIM/PackName
if ( bHasPackName ) {
packBuffer(&packet, (BYTE*)dbv.pszVal, 0x10);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
if(!CustomCapList.empty())
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp
index caa41d966c..813a223306 100644
--- a/protocols/IcqOscarJ/src/fam_03buddy.cpp
+++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp
@@ -566,7 +566,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info)
if (szClient == cliSpamBot)
{
- if (getSettingByte(NULL, "KillSpambots", DEFAULT_KILLSPAM_ENABLED) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (getSettingByte(NULL, "KillSpambots", DEFAULT_KILLSPAM_ENABLED) && db_get_b(hContact, "CList", "NotOnList", 0))
{ // kill spammer
icq_DequeueUser(dwUIN);
icq_sendRemoveContact(dwUIN, NULL);
@@ -746,7 +746,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar
if (strlennull(szStatusNote) || (!getSettingString(hContact, DBSETTING_STATUS_NOTE, &dbv) && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && strlennull(dbv.pszVal)))
NetLog_Server("%s changed status note to \"%s\"", strUID(dwUin, szUid), szStatusNote ? szStatusNote : "");
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
if (szStatusNote)
setSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, szStatusNote);
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 8afbe40c13..c41a68c3f1 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -930,7 +930,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server
else
NetLog_Server("SSI ignoring existing contact '%s'", szRecordName);
// Contact on server is always on list
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 0);
+ db_set_b(hContact, "CList", "NotOnList", 0);
}
// Save group and item ID
@@ -1015,7 +1015,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server
{
// Yes, we really do need to delete it first. Otherwise the CLUI nick
// cache isn't updated (I'll look into it)
- DBDeleteContactSetting(hContact,"CList","MyHandle");
+ db_unset(hContact,"CList","MyHandle");
setSettingStringUtf(hContact, "CList", "MyHandle", pszNick);
}
}
@@ -1023,7 +1023,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server
}
else if (strlennull(pszNick) > 0)
{
- DBDeleteContactSetting(hContact,"CList","MyHandle");
+ db_unset(hContact,"CList","MyHandle");
setSettingStringUtf(hContact, "CList", "MyHandle", pszNick);
}
}
@@ -1522,7 +1522,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou
icq_QueueUser(hContact);
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
else if (pToken)
{
@@ -1568,7 +1568,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou
NetLog_Server("Owner meta info token changed");
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
if (pToken)
@@ -1661,7 +1661,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
else if (!getSettingString(hContact, "Nick", &dbv))
{
szNick = null_strdup(dbv.pszVal);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
@@ -1918,7 +1918,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size)
/** add code to remove old hash from server */
bResetHash = 1;
}
- ICQFreeVariant(&dbvHash);
+ db_free(&dbvHash);
}
if (bResetHash) // start update session
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index c7027a54ee..65b69db92a 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -108,7 +108,7 @@ TCHAR* CIcqProto::GetOwnAvatarFileName()
{
TCHAR tmp[MAX_PATH * 2];
CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)dbvFile.ptszVal, (LPARAM)tmp);
- ICQFreeVariant(&dbvFile);
+ db_free(&dbvFile);
return null_strdup(tmp);
}
@@ -286,11 +286,11 @@ int CIcqProto::IsAvatarChanged(HANDLE hContact, const BYTE *pHash, int nHashLen)
{
if ((dbvSaved.cpbVal != nHashLen) || memcmp(dbvSaved.pbVal, pHash, nHashLen))
{ // the hashes are different
- ICQFreeVariant(&dbvSaved);
+ db_free(&dbvSaved);
return 2;
}
- ICQFreeVariant(&dbvSaved);
+ db_free(&dbvSaved);
return 0; // hash is there and is the same - Success
}
@@ -604,7 +604,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac
#ifdef _DEBUG
NetLog_Hash(this, "old", dbv.pbVal, dbv.cpbVal);
#endif
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
NetLog_Server("%s has removed Avatar.", strUID(dwUIN, szUID));
deleteSetting(hContact, "AvatarHash");
@@ -713,7 +713,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac
bJob = 2;
}
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
if (bJob)
@@ -755,7 +755,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac
#ifdef _DEBUG
NetLog_Hash(this, "old", dbv.pbVal, dbv.cpbVal);
#endif
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
NetLog_Server("%s has removed Avatar.", strUID(dwUIN, szUID));
deleteSetting(hContact, "AvatarHash");
@@ -1687,7 +1687,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt
if (ppro->setSettingBlob(pCookieData->hContact, "AvatarSaved", dbv.pbVal, dbv.cpbVal))
NetLog_Server("Failed to set file hash.");
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp
index 9e9ca34fb2..ebb0f08ac1 100644
--- a/protocols/IcqOscarJ/src/icq_db.cpp
+++ b/protocols/IcqOscarJ/src/icq_db.cpp
@@ -29,7 +29,6 @@
// -----------------------------------------------------------------------------
#include "icqoscar.h"
-
void CIcqProto::CreateResidentSetting(const char *szSetting)
{
char pszSetting[2*MAX_PATH];
@@ -40,152 +39,131 @@ void CIcqProto::CreateResidentSetting(const char *szSetting)
CallService(MS_DB_SETSETTINGRESIDENT, 1, (WPARAM)pszSetting);
}
-
int CIcqProto::getSetting(HANDLE hContact, const char *szSetting, DBVARIANT *dbv)
{
- return DBGetContactSettingW(hContact, m_szModuleName, szSetting, dbv);
+ return db_get_s(hContact, m_szModuleName, szSetting, dbv, 0);
}
-
BYTE CIcqProto::getSettingByte(HANDLE hContact, const char *szSetting, BYTE byDef)
{
- return DBGetContactSettingByte(hContact, m_szModuleName, szSetting, byDef);
+ return db_get_b(hContact, m_szModuleName, szSetting, byDef);
}
-
WORD CIcqProto::getSettingWord(HANDLE hContact, const char *szSetting, WORD wDef)
{
- return DBGetContactSettingWord(hContact, m_szModuleName, szSetting, wDef);
+ return db_get_w(hContact, m_szModuleName, szSetting, wDef);
}
-
DWORD CIcqProto::getSettingDword(HANDLE hContact, const char *szSetting, DWORD dwDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
+ DBVARIANT dbv = {DBVT_DELETED};
DWORD dwRes;
- if (getSetting(hContact, szSetting, &dbv))
- return dwDef; // not found, give default
+ if (getSetting(hContact, szSetting, &dbv))
+ return dwDef; // not found, give default
if (dbv.type != DBVT_DWORD)
dwRes = dwDef; // invalid type, give default
else // found and valid, give result
dwRes = dbv.dVal;
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return dwRes;
}
-
double CIcqProto::getSettingDouble(HANDLE hContact, const char *szSetting, double dDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
- double dRes;
+ DBVARIANT dbv = {DBVT_DELETED};
+ double dRes;
- if (getSetting(hContact, szSetting, &dbv))
- return dDef; // not found, give default
+ if (getSetting(hContact, szSetting, &dbv))
+ return dDef; // not found, give default
- if (dbv.type != DBVT_BLOB || dbv.cpbVal != sizeof(double))
- dRes = dDef;
- else
- dRes = *(double*)dbv.pbVal;
+ if (dbv.type != DBVT_BLOB || dbv.cpbVal != sizeof(double))
+ dRes = dDef;
+ else
+ dRes = *(double*)dbv.pbVal;
- ICQFreeVariant(&dbv);
- return dRes;
+ db_free(&dbv);
+ return dRes;
}
-
DWORD CIcqProto::getContactUin(HANDLE hContact)
{
return getSettingDword(hContact, UNIQUEIDSETTING, 0);
}
-
int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid)
{
- DBVARIANT dbv = {DBVT_DELETED};
+ DBVARIANT dbv = {DBVT_DELETED};
int iRes = 1;
*pdwUin = 0;
if (ppszUid) *ppszUid[0] = '\0';
- if (!getSetting(hContact, UNIQUEIDSETTING, &dbv))
- {
- if (dbv.type == DBVT_DWORD)
- {
+ if (!getSetting(hContact, UNIQUEIDSETTING, &dbv)) {
+ if (dbv.type == DBVT_DWORD) {
*pdwUin = dbv.dVal;
iRes = 0;
}
- else if (dbv.type == DBVT_ASCIIZ)
- {
- if (ppszUid && m_bAimEnabled)
- {
+ else if (dbv.type == DBVT_ASCIIZ) {
+ if (ppszUid && m_bAimEnabled) {
strcpy(*ppszUid, dbv.pszVal);
iRes = 0;
}
else
NetLog_Server("AOL screennames not accepted");
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
return iRes;
}
-
int CIcqProto::getSettingString(HANDLE hContact, const char *szSetting, DBVARIANT *dbv)
{
- int res = DBGetContactSettingString(hContact, m_szModuleName, szSetting, dbv);
-
- if (res)
- ICQFreeVariant(dbv);
+ int res = db_get_s(hContact, m_szModuleName, szSetting, dbv);
+ if (res)
+ db_free(dbv);
return res;
}
-
int CIcqProto::getSettingStringW(HANDLE hContact, const char *szSetting, DBVARIANT *dbv)
{
- int res = DBGetContactSettingWString(hContact, m_szModuleName, szSetting, dbv);
-
- if (res)
- ICQFreeVariant(dbv);
+ int res = db_get_ws(hContact, m_szModuleName, szSetting, dbv);
+ if (res)
+ db_free(dbv);
return res;
}
-
char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, char *szDef)
{
DBVARIANT dbv = {DBVT_DELETED};
-
- if (DBGetContactSettingUTF8String(hContact, szModule, szSetting, &dbv))
- {
- ICQFreeVariant(&dbv); // for a setting with invalid contents/type
+ if ( db_get_utf(hContact, szModule, szSetting, &dbv)) {
+ db_free(&dbv); // for a setting with invalid contents/type
return null_strdup(szDef);
- }
+ }
char *szRes = null_strdup(dbv.pszVal);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return szRes;
}
-
char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szSetting, char *szDef)
{
return getSettingStringUtf(hContact, m_szModuleName, szSetting, szDef);
}
-
WORD CIcqProto::getContactStatus(HANDLE hContact)
{
- return getSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
+ return getSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
}
-
int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len)
{
- DBVARIANT dbv = {DBVT_DELETED};
- DBCONTACTGETSETTING sVal = {0};
+ DBVARIANT dbv = {DBVT_DELETED};
+ DBCONTACTGETSETTING sVal = {0};
dbv.pszVal = dest;
dbv.cchVal = dest_len;
@@ -195,8 +173,7 @@ int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, ch
sVal.szModule = m_szModuleName;
sVal.szSetting = szSetting;
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0)
- { // due to MS_DB_CONTACT_GETSETTINGSTATIC setting type check, we need to request UTF8 as well
+ if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0) {
dbv.pszVal = dest;
dbv.cchVal = dest_len;
dbv.type = DBVT_UTF8;
@@ -208,93 +185,77 @@ int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, ch
return (dbv.type != DBVT_ASCIIZ);
}
-
int CIcqProto::deleteSetting(HANDLE hContact, const char *szSetting)
{
- return DBDeleteContactSetting(hContact, m_szModuleName, szSetting);
+ return db_unset(hContact, m_szModuleName, szSetting);
}
-
int CIcqProto::setSettingByte(HANDLE hContact, const char *szSetting, BYTE byValue)
{
- return DBWriteContactSettingByte(hContact, m_szModuleName, szSetting, byValue);
+ return db_set_b(hContact, m_szModuleName, szSetting, byValue);
}
-
int CIcqProto::setSettingWord(HANDLE hContact, const char *szSetting, WORD wValue)
{
- return DBWriteContactSettingWord(hContact, m_szModuleName, szSetting, wValue);
+ return db_set_w(hContact, m_szModuleName, szSetting, wValue);
}
-
int CIcqProto::setSettingDword(HANDLE hContact, const char *szSetting, DWORD dwValue)
{
- return DBWriteContactSettingDword(hContact, m_szModuleName, szSetting, dwValue);
+ return db_set_dw(hContact, m_szModuleName, szSetting, dwValue);
}
-
int CIcqProto::setSettingDouble(HANDLE hContact, const char *szSetting, double dValue)
{
- return setSettingBlob(hContact, szSetting, (BYTE*)&dValue, sizeof(double));
+ return setSettingBlob(hContact, szSetting, (BYTE*)&dValue, sizeof(double));
}
-
int CIcqProto::setSettingString(HANDLE hContact, const char *szSetting, const char *szValue)
{
- return DBWriteContactSettingString(hContact, m_szModuleName, szSetting, szValue);
+ return db_set_s(hContact, m_szModuleName, szSetting, szValue);
}
-
int CIcqProto::setSettingStringW(HANDLE hContact, const char *szSetting, const WCHAR *wszValue)
{
- return DBWriteContactSettingWString(hContact, m_szModuleName, szSetting, wszValue);
+ return db_set_ws(hContact, m_szModuleName, szSetting, wszValue);
}
-
int CIcqProto::setSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, const char *szValue)
{
- return DBWriteContactSettingUTF8String(hContact, szModule, szSetting, (char*)szValue);
+ return db_set_utf(hContact, szModule, szSetting, szValue);
}
-
int CIcqProto::setSettingStringUtf(HANDLE hContact, const char *szSetting, const char *szValue)
{
- return setSettingStringUtf(hContact, m_szModuleName, szSetting, szValue);
+ return db_set_utf(hContact, m_szModuleName, szSetting, szValue);
}
-
int CIcqProto::setSettingBlob(HANDLE hContact, const char *szSetting, const BYTE *pValue, const int cbValue)
{
- return DBWriteContactSettingBlob(hContact, m_szModuleName, szSetting, (void*)pValue, cbValue);
+ return db_set_blob(hContact, m_szModuleName, szSetting, (void*)pValue, cbValue);
}
-
int CIcqProto::setContactHidden(HANDLE hContact, BYTE bHidden)
{
- int nResult = DBWriteContactSettingByte(hContact, "CList", "Hidden", bHidden);
-
+ int nResult = db_set_b(hContact, "CList", "Hidden", bHidden);
if (!bHidden) // clear zero setting
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
- return nResult;
+ return nResult;
}
void CIcqProto::setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi)
{
- if (szStatusMsg && szStatusMsg[0])
- {
- if (isAnsi)
- {
+ if (szStatusMsg && szStatusMsg[0]) {
+ if (isAnsi) {
char* szStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, "");
wchar_t* szStatusNoteW = make_unicode_string(szStatusNote);
int len = (int)wcslen(szStatusNoteW) * 3 + 1;
char* szStatusNoteAnsi = (char*)alloca(len);
WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, szStatusNoteW, -1, szStatusNoteAnsi, len, NULL, NULL);
bool notmatch = false;
- for (int i=0; ;++i)
- {
- if (szStatusNoteAnsi[i] != szStatusMsg[i] && szStatusNoteAnsi[i] != '?' && szStatusMsg[i] != '?')
- {
+ for (int i=0; ;++i) {
+ if (szStatusNoteAnsi[i] != szStatusMsg[i] && szStatusNoteAnsi[i] != '?' && szStatusMsg[i] != '?') {
notmatch = true;
break;
}
@@ -303,41 +264,25 @@ void CIcqProto::setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi)
}
szStatusMsg = notmatch ? ansi_to_utf8(szStatusMsg) : szStatusNote;
SAFE_FREE(&szStatusNoteW);
- if (notmatch) SAFE_FREE(&szStatusNote);
+ if (notmatch)
+ SAFE_FREE(&szStatusNote);
}
char* oldStatusMsg = NULL;
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, "CList", "StatusMsg", &dbv))
- {
- switch (dbv.type)
- {
- case DBVT_UTF8:
- oldStatusMsg = null_strdup(dbv.pszVal);
- break;
-
- case DBVT_WCHAR:
- oldStatusMsg = make_utf8_string(dbv.pwszVal);
- break;
- }
- ICQFreeVariant(&dbv);
+ if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
+ oldStatusMsg = make_utf8_string(dbv.ptszVal);
+ db_free(&dbv);
}
-
+
if (!oldStatusMsg || strcmp(oldStatusMsg, szStatusMsg))
setSettingStringUtf(hContact, "CList", "StatusMsg", szStatusMsg);
SAFE_FREE(&oldStatusMsg);
if (isAnsi) SAFE_FREE(&szStatusMsg);
}
- else
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
-}
-
-int __fastcall ICQFreeVariant(DBVARIANT *dbv)
-{
- return DBFreeVariant(dbv);
+ else db_unset(hContact, "CList", "StatusMsg");
}
-
int CIcqProto::IsICQContact(HANDLE hContact)
{
char* szProto = GetContactProto(hContact);
@@ -345,7 +290,6 @@ int CIcqProto::IsICQContact(HANDLE hContact)
return !strcmpnull(szProto, m_szModuleName);
}
-
HANDLE CIcqProto::AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob)
{
DBEVENTINFO dbei = {0};
@@ -361,7 +305,6 @@ HANDLE CIcqProto::AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flag
return (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
}
-
HANDLE CIcqProto::FindFirstContact()
{
HANDLE hContact = db_find_first(m_szModuleName);
@@ -372,7 +315,6 @@ HANDLE CIcqProto::FindFirstContact()
return FindNextContact(hContact);
}
-
HANDLE CIcqProto::FindNextContact(HANDLE hContact)
{
hContact = db_find_next(hContact, m_szModuleName);
@@ -385,15 +327,7 @@ HANDLE CIcqProto::FindNextContact(HANDLE hContact)
return hContact;
}
-
char* CIcqProto::getContactCListGroup(HANDLE hContact)
{
return getSettingStringUtf(hContact, "CList", "Group", NULL);
}
-
-
-int __stdcall ICQSetContactCListGroup(HANDLE hContact, const char *szGroup)
-{
- /// TODO
- return 0;
-}
diff --git a/protocols/IcqOscarJ/src/icq_db.h b/protocols/IcqOscarJ/src/icq_db.h
index 5bfc22d58b..180dcfc5fd 100644
--- a/protocols/IcqOscarJ/src/icq_db.h
+++ b/protocols/IcqOscarJ/src/icq_db.h
@@ -1,22 +1,22 @@
// ---------------------------------------------------------------------------80
// ICQ plugin for Miranda Instant Messenger
// ________________________________________
-//
+//
// Copyright © 2000-2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede
// Copyright © 2001-2002 Jon Keating, Richard Hughes
// Copyright © 2002-2004 Martin Öberg, Sam Kothari, Robert Rainwater
// Copyright © 2004-2010 Joe Kucera
-//
+//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@@ -39,6 +39,4 @@
#define setSettingStringT setSettingString
#endif
-int __fastcall ICQFreeVariant(DBVARIANT* dbv);
-
#endif /* __ICQ_DB_H */
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp
index 7779f1bad7..db8a2dca33 100644
--- a/protocols/IcqOscarJ/src/icq_direct.cpp
+++ b/protocols/IcqOscarJ/src/icq_direct.cpp
@@ -1167,5 +1167,5 @@ void CIcqProto::sendPeerFileInit(directconnect* dc)
#ifdef _DEBUG
NetLog_Direct("Sent PEER_FILE_INIT to %u on %s DC", dc->dwRemoteUin, dc->incoming?"incoming":"outgoing");
#endif
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp
index 61484c3987..0c08e15f22 100644
--- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp
@@ -83,7 +83,7 @@ static void file_sendNick(CIcqProto* ppro, directconnect* dc)
packLEWord(&packet, (WORD)(wNickLen + 1));
packBuffer(&packet, (LPBYTE)szNick, (WORD)(wNickLen + 1));
ppro->sendDirectPacket(dc, &packet);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp
index 014df20e01..257256fd1f 100644
--- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp
+++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp
@@ -323,7 +323,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* )
if (!getSetting(m_infoUpdateList[i].hContact, DBSETTING_METAINFO_TOKEN, &dbv))
{ // retrieve user details using privacy token
ppackTLV(&pItem, &nItemSize, 0x96, dbv.cpbVal, dbv.pbVal);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
// last updated time
ppackTLVDouble(&pItem, &nItemSize, 0x64, getSettingDouble(m_infoUpdateList[i].hContact, DBSETTING_METAINFO_TIME, 0));
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp
index a5d3d684e5..ae012d26a5 100644
--- a/protocols/IcqOscarJ/src/icq_menu.cpp
+++ b/protocols/IcqOscarJ/src/icq_menu.cpp
@@ -228,7 +228,7 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM)
sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
m_bSsiEnabled && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) &&
!getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) &&
- !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0));
+ !db_get_b(hContact, "CList", "NotOnList", 0));
}
sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0);
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 652ecc6b57..50771cb011 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -497,7 +497,7 @@ int CIcqProto::AuthDeny( HANDLE hDbEvent, const TCHAR* szReason )
icq_sendAuthResponseServ(uin, uid, 0, szReason);
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (db_get_b(hContact, "CList", "NotOnList", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
return 0; // Success
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index ee0355443a..ac9667618e 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -1042,7 +1042,7 @@ void CIcqProto::LoadServerIDs()
nUnhandled++;
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
NetLog_Server("Loaded SSI: %d contacts, %d groups, %d permit, %d deny, %d ignore, %d unknown items.", nContacts, nGroups, nPermits, nDenys, nIgnores, nUnhandled);
@@ -1196,7 +1196,7 @@ DWORD CIcqProto::icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAc
pMetaToken = (BYTE*)_alloca(dbv.cpbVal);
memcpy(pMetaToken, dbv.pbVal, dbv.cpbVal);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!getSetting(hContact, DBSETTING_METAINFO_TIME, &dbv))
{
@@ -1205,7 +1205,7 @@ DWORD CIcqProto::icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAc
for (int i = 0; i < dbv.cpbVal; i++)
pMetaTime[i] = dbv.pbVal[dbv.cpbVal - i - 1];
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!getSetting(hContact, DBSETTING_SERVLIST_DATA, &dbv))
@@ -1214,7 +1214,7 @@ DWORD CIcqProto::icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAc
pData = (BYTE*)_alloca(nDataLen);
memcpy(pData, dbv.pbVal, nDataLen);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
nNickLen = strlennull(szNick);
@@ -1446,7 +1446,7 @@ void* CIcqProto::collectGroups(int *count)
static int GroupLinksEnumProc(const char *szSetting,LPARAM lParam)
{
// check link target, add if match
- if (DBGetContactSettingWord(NULL, ((char**)lParam)[2], szSetting, 0) == (WORD)((char**)lParam)[1])
+ if (db_get_w(NULL, ((char**)lParam)[2], szSetting, 0) == (WORD)((char**)lParam)[1])
{
char** block = (char**)SAFE_MALLOC(2*sizeof(char*));
block[1] = null_strdup(szSetting);
@@ -1479,7 +1479,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID)
{
void* bet;
- DBDeleteContactSetting(NULL, szModule, list[1]);
+ db_unset(NULL, szModule, list[1]);
SAFE_FREE((void**)&list[1]);
bet = list;
list = (char**)list[0];
@@ -1506,7 +1506,7 @@ char *CIcqProto::getServListGroupName(WORD wGroupID)
if (!CheckServerID(wGroupID, 0))
{ // check if valid id, if not give empty and remove
NetLog_Server("Removing group %u from cache...", wGroupID);
- DBDeleteContactSetting(NULL, szModule, szGroup);
+ db_unset(NULL, szModule, szGroup);
return NULL;
}
@@ -1532,7 +1532,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName)
setSettingStringUtf(NULL, szModule, szGroup, szGroupName);
else
{
- DBDeleteContactSetting(NULL, szModule, szGroup);
+ db_unset(NULL, szModule, szGroup);
removeGroupPathLinks(wGroupID);
}
return;
@@ -1546,12 +1546,12 @@ WORD CIcqProto::getServListGroupLinkID(const char *szPath)
null_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
- wGroupId = DBGetContactSettingWord(NULL, szModule, szPath, 0);
+ wGroupId = db_get_w(NULL, szModule, szPath, 0);
if (wGroupId && !CheckServerID(wGroupId, 0))
{ // known, check if still valid, if not remove
NetLog_Server("Removing group \"%s\" from cache...", szPath);
- DBDeleteContactSetting(NULL, szModule, szPath);
+ db_unset(NULL, szModule, szPath);
wGroupId = 0;
}
@@ -1566,9 +1566,9 @@ void CIcqProto::setServListGroupLinkID(const char *szPath, WORD wGroupID)
null_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
if (wGroupID)
- DBWriteContactSettingWord(NULL, szModule, szPath, wGroupID);
+ db_set_w(NULL, szModule, szPath, wGroupID);
else
- DBDeleteContactSetting(NULL, szModule, szPath);
+ db_unset(NULL, szModule, szPath);
}
@@ -2312,7 +2312,7 @@ void CIcqProto::servlistMoveContact(HANDLE hContact, const char *pszNewGroup)
if (!getSettingWord(hContact, DBSETTING_SERVLIST_ID, 0)) /// FIXME:::: this should be in _ready
{ // the contact is not stored on the server, check if we should try to add
if (!getSettingByte(NULL, "ServerAddRemove", DEFAULT_SS_ADDSERVER) ||
- DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ db_get_b(hContact, "CList", "Hidden", 0))
return;
}
cookie_servlist_action *ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index 89b530e607..4d52aa6ab4 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -1036,7 +1036,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam)
else
strcpy(pData->pszName, "");
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1058,7 +1058,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam)
else
strcpy(pData->pszMessage, "");
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -1082,7 +1082,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam)
*pData->wParam = strlennull(dbv.pszVal);
else
*pData->wParam = 0;
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
if (pData->lParam) {
@@ -1090,7 +1090,7 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam)
*pData->lParam = strlennull(dbv.pszVal);
else
*pData->lParam = 0;
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
index ee6dd1731c..11fc36f385 100644
--- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp
+++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp
@@ -173,7 +173,7 @@ INT_PTR CIcqProto::GetInfoSetting(WPARAM wParam, LPARAM lParam)
rc = LookupDatabaseSetting(interestsField, code, cgs->pValue, type);
}
// Release database memory
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
return rc;
@@ -408,13 +408,13 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (getSetting(pai->hContact, "AvatarHash", &dbv) || dbv.type != DBVT_BLOB || (dbv.cpbVal != 0x14 && dbv.cpbVal != 0x09))
{
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_NOAVATAR; // we did not found avatar hash or hash invalid - no avatar available
}
if (getContactUid(pai->hContact, &dwUIN, &szUID))
{
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_NOAVATAR; // we do not support avatars for invalid contacts
}
@@ -433,7 +433,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{ // hashes are the same
if (_taccess(tszFile, 0) == 0)
{
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_SUCCESS; // we have found the avatar file, whoala
}
@@ -450,12 +450,12 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile);
lstrcpyn(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_WAITFOR;
}
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_NOAVATAR;
}
@@ -667,10 +667,10 @@ HANDLE CIcqProto::AddToListByUIN(DWORD dwUin, DWORD dwFlags)
HANDLE hContact = HContactFromUIN(dwUin, &bAdded);
if (hContact)
{
- if (!(dwFlags & PALF_TEMPORARY) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (!(dwFlags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 0))
{
setContactHidden(hContact, 0);
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
}
return hContact; // Success
@@ -686,10 +686,10 @@ HANDLE CIcqProto::AddToListByUID(const char *szUID, DWORD dwFlags)
HANDLE hContact = HContactFromUID(0, szUID, &bAdded);
if (hContact)
{
- if (!(dwFlags & PALF_TEMPORARY) && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (!(dwFlags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 0))
{
setContactHidden(hContact, 0);
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
}
return hContact; // Success
@@ -709,7 +709,7 @@ void CIcqProto::ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre
if (pre->flags & PREF_UTF)
flags |= DBEF_UTF;
- if (hContact && DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if (hContact && db_get_b(hContact, "CList", "Hidden", 0))
{
DWORD dwUin;
uid_str szUid;
@@ -727,39 +727,39 @@ void CIcqProto::ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre
AddEvent(hContact, wType, pre->timestamp, flags, cbBlob, pBlob);
}
-INT_PTR __cdecl CIcqProto::IcqAddCapability(WPARAM wParam, LPARAM lParam)
-{
- ICQ_CUSTOMCAP *icqCustomCapIn = (ICQ_CUSTOMCAP *)lParam;
- ICQ_CUSTOMCAP *icqCustomCap = (ICQ_CUSTOMCAP *)malloc(sizeof(ICQ_CUSTOMCAP));
- memcpy(icqCustomCap, icqCustomCapIn, sizeof(ICQ_CUSTOMCAP));
- CustomCapList.push_back(icqCustomCap);
-// MessageBoxA(NULL, ((ICQ_CUSTOMCAP *)(lstCustomCaps->items[lstCustomCaps->realCount-1]))->name, "custom cap", MB_OK);
- return 0;
-}
-
-
-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);
-
- 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);
-
- return res;
-}
+INT_PTR __cdecl CIcqProto::IcqAddCapability(WPARAM wParam, LPARAM lParam)
+{
+ ICQ_CUSTOMCAP *icqCustomCapIn = (ICQ_CUSTOMCAP *)lParam;
+ ICQ_CUSTOMCAP *icqCustomCap = (ICQ_CUSTOMCAP *)malloc(sizeof(ICQ_CUSTOMCAP));
+ memcpy(icqCustomCap, icqCustomCapIn, sizeof(ICQ_CUSTOMCAP));
+ CustomCapList.push_back(icqCustomCap);
+// MessageBoxA(NULL, ((ICQ_CUSTOMCAP *)(lstCustomCaps->items[lstCustomCaps->realCount-1]))->name, "custom cap", MB_OK);
+ return 0;
+}
+
+
+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);
+
+ 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);
+
+ return res;
+}
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp
index 3bc9502560..b08c152cb5 100644
--- a/protocols/IcqOscarJ/src/stdpackets.cpp
+++ b/protocols/IcqOscarJ/src/stdpackets.cpp
@@ -268,7 +268,7 @@ void CIcqProto::icq_setstatus(WORD wStatus, const char *szStatusNote)
if (m_bMoodsEnabled && !getSettingString(NULL, DBSETTING_STATUS_MOOD, &dbv))
szMoodData = null_strdup(dbv.pszVal);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
wStatusNoteLen = strlennull(szStatusNote);
wStatusMoodLen = strlennull(szMoodData);
@@ -566,7 +566,7 @@ DWORD CIcqProto::icq_sendGetInfoServ(HANDLE hContact, DWORD dwUin, int bManual)
pToken = (BYTE*)_alloca(cbToken);
memcpy(pToken, infoToken.pbVal, cbToken);
- ICQFreeVariant(&infoToken);
+ db_free(&infoToken);
}
cookie_directory_data *pCookieData = (cookie_directory_data*)SAFE_MALLOC(sizeof(cookie_directory_data));
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index 70f7547108..a67d63d6c1 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -507,7 +507,7 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added)
if (!bIsSyncingCL)
{
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
setContactHidden(hContact, 1);
setSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
@@ -573,7 +573,7 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added)
if (!bIsSyncingCL)
{
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
setContactHidden(hContact, 1);
setSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
@@ -1115,7 +1115,7 @@ int CIcqProto::IsMetaInfoChanged(HANDLE hContact)
res = 1; // directory info not saved at all
}
- ICQFreeVariant(&infoToken);
+ db_free(&infoToken);
}
else
{ // it cannot be detected if user info was not changed, so use a generic threshold
@@ -1133,7 +1133,7 @@ int CIcqProto::IsMetaInfoChanged(HANDLE hContact)
else if (infoSaved.type == DBVT_DWORD)
dwInfoTime = infoSaved.dVal;
- ICQFreeVariant(&infoSaved);
+ db_free(&infoSaved);
if ((time(NULL) - dwInfoTime) > 14*3600*24)
{
@@ -1263,7 +1263,7 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay)
sendServPacket(&packet);
}
SAFE_FREE(&szCurrentStatusNote);
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
}
SAFE_FREE(&setStatusNoteText);
@@ -1342,7 +1342,7 @@ int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay)
bChanged = TRUE;
}
- ICQFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{ // only alter status mood object with new status mood, keep the thread waiting for execution
@@ -1607,8 +1607,8 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType
return FALSE;
// Don't send statusmessage to temporary contacts or hidden contacts
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) ||
- DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if (db_get_b(hContact, "CList", "NotOnList", 0) ||
+ db_get_b(hContact, "CList", "Hidden", 0))
return FALSE;
// Don't send statusmessage to invisible contacts