summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/icq_db.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-06-29 12:24:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-06-29 12:24:18 +0000
commit4530fb627722a4c2018184dcdaea7fa9f44c10d7 (patch)
tree3ae98b2130d2f77bbb7fc3840a67b8bae6a6fb39 /protocols/IcqOscarJ/src/icq_db.cpp
parent9a1218da04b7887c4d7f6e88e0a33aea76b12f57 (diff)
- fixes #646 (Database Encryption mode, ICQ and email contacts);
- code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@9614 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src/icq_db.cpp')
-rw-r--r--protocols/IcqOscarJ/src/icq_db.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp
index e99ffa649f..25250c66fb 100644
--- a/protocols/IcqOscarJ/src/icq_db.cpp
+++ b/protocols/IcqOscarJ/src/icq_db.cpp
@@ -36,7 +36,7 @@ int CIcqProto::getSetting(MCONTACT hContact, const char *szSetting, DBVARIANT *d
double CIcqProto::getSettingDouble(MCONTACT hContact, const char *szSetting, double dDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
+ DBVARIANT dbv = { DBVT_DELETED };
double dRes;
if (getSetting(hContact, szSetting, &dbv))
@@ -58,24 +58,35 @@ DWORD CIcqProto::getContactUin(MCONTACT hContact)
int CIcqProto::getContactUid(MCONTACT 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) {
+ switch (dbv.type) {
+ case DBVT_DWORD:
*pdwUin = dbv.dVal;
iRes = 0;
- }
- else if (dbv.type == DBVT_ASCIIZ) {
+ break;
+
+ case DBVT_ASCIIZ:
+ if (ppszUid && m_bAimEnabled) {
+ strcpy(*ppszUid, dbv.pszVal);
+ iRes = 0;
+ }
+ else debugLogA("AOL screennames not accepted");
+ break;
+
+ case DBVT_UTF8:
if (ppszUid && m_bAimEnabled) {
strcpy(*ppszUid, dbv.pszVal);
+ mir_utf8decode(*ppszUid, NULL);
iRes = 0;
}
- else
- debugLogA("AOL screennames not accepted");
+ else debugLogA("AOL screennames not accepted");
+ break;
}
db_free(&dbv);
}
@@ -84,8 +95,8 @@ int CIcqProto::getContactUid(MCONTACT hContact, DWORD *pdwUin, uid_str *ppszUid)
char* CIcqProto::getSettingStringUtf(MCONTACT hContact, const char *szModule, const char *szSetting, char *szDef)
{
- DBVARIANT dbv = {DBVT_DELETED};
- if ( db_get_utf(hContact, szModule, szSetting, &dbv)) {
+ DBVARIANT dbv = { DBVT_DELETED };
+ if (db_get_utf(hContact, szModule, szSetting, &dbv)) {
db_free(&dbv); // for a setting with invalid contents/type
return null_strdup(szDef);
}
@@ -158,7 +169,7 @@ void CIcqProto::setStatusMsgVar(MCONTACT hContact, char* szStatusMsg, bool isAns
char *oldStatusMsg = NULL;
DBVARIANT dbv;
- if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
+ if (!db_get_ts(hContact, "CList", "StatusMsg", &dbv)) {
oldStatusMsg = make_utf8_string(dbv.ptszVal);
db_free(&dbv);
}