summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-02-12 19:08:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-02-12 19:08:44 +0000
commit37d75985201293402712edfecb611fc14aaa1c3a (patch)
treefe3e353ce99b6462cefe1738c694ad25574b1c70 /protocols
parenta6a07109358ccf64f4bd43f62ddfa421eccefec3 (diff)
good bye, ansi
git-svn-id: http://svn.miranda-ng.org/main/trunk@3580 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/IcqOscarJ/src/changeinfo/constants.cpp7
-rw-r--r--protocols/IcqOscarJ/src/fam_15icqserver.cpp38
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.h1
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp12
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp17
5 files changed, 22 insertions, 53 deletions
diff --git a/protocols/IcqOscarJ/src/changeinfo/constants.cpp b/protocols/IcqOscarJ/src/changeinfo/constants.cpp
index 92403a74f0..766a69c49a 100644
--- a/protocols/IcqOscarJ/src/changeinfo/constants.cpp
+++ b/protocols/IcqOscarJ/src/changeinfo/constants.cpp
@@ -110,7 +110,6 @@ const SettingItem setting[]={
{LPGEN("Nickname"), LI_STRING, DBVT_UTF8, "Nick"},
{LPGEN("First name"), LI_STRING, DBVT_UTF8, "FirstName"},
{LPGEN("Last name"), LI_STRING, DBVT_UTF8, "LastName"},
-// {LPGEN("Age"), LI_NUMBER, DBVT_WORD, "Age", ageRange},
{LPGEN("Gender"), LI_LIST, DBVT_BYTE, "Gender", genderField},
{LPGEN("About"), LI_LONGSTRING, DBVT_UTF8, "About"},
//password
@@ -127,9 +126,9 @@ const SettingItem setting[]={
{LPGEN("State"), LI_STRING, DBVT_UTF8, "State"},
{LPGEN("ZIP/postcode"), LI_STRING, DBVT_UTF8, "ZIP"},
{LPGEN("Country"), LI_LIST, DBVT_WORD, "Country", countryField},
- {LPGEN("Phone number"), LI_STRING, DBVT_ASCIIZ, "Phone"},
- {LPGEN("Fax number"), LI_STRING, DBVT_ASCIIZ, "Fax"},
- {LPGEN("Cellular number"),LI_STRING, DBVT_ASCIIZ, "Cellular"},
+ {LPGEN("Phone number"), LI_STRING, DBVT_UTF8, "Phone"},
+ {LPGEN("Fax number"), LI_STRING, DBVT_UTF8, "Fax"},
+ {LPGEN("Cellular number"),LI_STRING, DBVT_UTF8, "Cellular"},
//more
{LPGEN("Personal Detail"),LI_DIVIDER},
{LPGEN("Timezone"), LI_LIST|LIF_ZEROISVALID|LIF_SIGNED,DBVT_BYTE, "Timezone", timezones},
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
index 60163c0e64..a1ff5b7645 100644
--- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp
+++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp
@@ -582,29 +582,21 @@ int CIcqProto::parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRe
{
int nRecords = 0;
- if (pData && pData->wLen >= 2)
- {
+ if (pData && pData->wLen >= 2) {
BYTE *pRecords = pData->pData;
WORD wRecordCount;
unpackWord(&pRecords, &wRecordCount);
oscar_tlv_record_list *cData = readIntoTLVRecordList(&pRecords, pData->wLen - 2, nMaxRecords > wRecordCount ? wRecordCount : nMaxRecords);
oscar_tlv_record_list *cDataItem = cData;
- while (cDataItem)
- {
+ while (cDataItem) {
oscar_tlv_chain *cItem = cDataItem->item;
- for (int i = 0; i < nRecordDef; i++)
- {
+ for (int i = 0; i < nRecordDef; i++) {
char szItemKey[MAX_PATH];
null_snprintf(szItemKey, MAX_PATH, pRecordDef[i].szDbSetting, nRecords);
- switch (pRecordDef[i].dbType)
- {
- case DBVT_ASCIIZ:
- writeDbInfoSettingTLVString(hContact, szItemKey, cItem, pRecordDef[i].wTLV);
- break;
-
+ switch (pRecordDef[i].dbType) {
case DBVT_UTF8:
writeDbInfoSettingTLVStringUtf(hContact, szItemKey, cItem, pRecordDef[i].wTLV);
break;
@@ -621,15 +613,13 @@ int CIcqProto::parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRe
// release memory
disposeRecordList(&cData);
}
+
// remove old data from database
if (!nRecords || nMaxRecords > 1)
for (int i = nRecords; i <= nMaxRecords; i++)
- for (int j = 0; j < nRecordDef; j++)
- {
+ for (int j = 0; j < nRecordDef; j++) {
char szItemKey[MAX_PATH];
-
null_snprintf(szItemKey, MAX_PATH, pRecordDef[j].szDbSetting, i);
-
deleteSetting(hContact, szItemKey);
}
@@ -899,9 +889,9 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain *
pTLV = cDetails->getTLV(0x50, 1);
if (pTLV && pTLV->wLen > 0)
- writeDbInfoSettingTLVString(hContact, "e-mail", cDetails, 0x50); // Verified e-mail
+ writeDbInfoSettingTLVStringUtf(hContact, "e-mail", cDetails, 0x50); // Verified e-mail
else
- writeDbInfoSettingTLVString(hContact, "e-mail", cDetails, 0x55); // Pending e-mail
+ writeDbInfoSettingTLVStringUtf(hContact, "e-mail", cDetails, 0x55); // Pending e-mail
writeDbInfoSettingTLVStringUtf(hContact, "FirstName", cDetails, 0x64);
writeDbInfoSettingTLVStringUtf(hContact, "LastName", cDetails, 0x6E);
@@ -921,15 +911,15 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain *
{
oscar_tlv_chain *cPhone;
cPhone = cPhones->getRecordByTLV(0x6E, 1);
- writeDbInfoSettingTLVString(hContact, "Phone", cPhone, 0x64);
+ writeDbInfoSettingTLVStringUtf(hContact, "Phone", cPhone, 0x64);
cPhone = cPhones->getRecordByTLV(0x6E, 2);
- writeDbInfoSettingTLVString(hContact, "CompanyPhone", cPhone, 0x64);
+ writeDbInfoSettingTLVStringUtf(hContact, "CompanyPhone", cPhone, 0x64);
cPhone = cPhones->getRecordByTLV(0x6E, 3);
- writeDbInfoSettingTLVString(hContact, "Cellular", cPhone, 0x64);
+ writeDbInfoSettingTLVStringUtf(hContact, "Cellular", cPhone, 0x64);
cPhone = cPhones->getRecordByTLV(0x6E, 4);
- writeDbInfoSettingTLVString(hContact, "Fax", cPhone, 0x64);
+ writeDbInfoSettingTLVStringUtf(hContact, "Fax", cPhone, 0x64);
cPhone = cPhones->getRecordByTLV(0x6E, 5);
- writeDbInfoSettingTLVString(hContact, "CompanyFax", cPhone, 0x64);
+ writeDbInfoSettingTLVStringUtf(hContact, "CompanyFax", cPhone, 0x64);
disposeRecordList(&cPhones);
}
@@ -971,7 +961,7 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain *
deleteSetting(hContact, "Gender");
}
- writeDbInfoSettingTLVString(hContact, "Homepage", cDetails, 0xFA);
+ writeDbInfoSettingTLVStringUtf(hContact, "Homepage", cDetails, 0xFA);
writeDbInfoSettingTLVDate(hContact, "BirthYear", "BirthMonth", "BirthDay", cDetails, 0x1A4);
writeDbInfoSettingTLVByte(hContact, "Language1", cDetails, 0xAA);
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h
index 4d25bdb95b..5fdf411387 100644
--- a/protocols/IcqOscarJ/src/icq_proto.h
+++ b/protocols/IcqOscarJ/src/icq_proto.h
@@ -956,7 +956,6 @@ struct CIcqProto : public PROTO_INTERFACE, public MZeroedObject
BOOL writeDbInfoSettingByteWithTable(HANDLE hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength);
void writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv);
- void writeDbInfoSettingTLVString(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv);
void writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv);
void writeDbInfoSettingTLVByte(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv);
void writeDbInfoSettingTLVDouble(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index d62a5f1f5b..c434321763 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -1016,14 +1016,12 @@ INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam)
SAFE_FREE(&wstr);
}
else {
- DBVARIANT dbv = {0};
-
- if (!getSettingString(hContact, DBSETTING_XSTATUS_NAME, &dbv) && dbv.pszVal)
+ DBVARIANT dbv;
+ if ( !getSettingString(hContact, DBSETTING_XSTATUS_NAME, &dbv) && dbv.pszVal) {
strcpy(pData->pszName, dbv.pszVal);
- else
- strcpy(pData->pszName, "");
-
- db_free(&dbv);
+ db_free(&dbv);
+ }
+ else strcpy(pData->pszName, "");
}
}
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index a67d63d6c1..53cf92c3f8 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -1373,23 +1373,6 @@ void CIcqProto::writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSe
}
-void CIcqProto::writeDbInfoSettingTLVString(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv)
-{
- oscar_tlv *pTLV = chain->getTLV(wTlv, 1);
-
- if (pTLV && pTLV->wLen > 0)
- {
- char *str = (char*)_alloca(pTLV->wLen + 1);
-
- memcpy(str, pTLV->pData, pTLV->wLen);
- str[pTLV->wLen] = '\0';
- setSettingString(hContact, szSetting, str);
- }
- else
- deleteSetting(hContact, szSetting);
-}
-
-
void CIcqProto::writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv)
{
int num = chain->getNumber(wTlv, 1);