diff options
-rw-r--r-- | protocols/JabberG/src/jabber_vcard.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 4e510462cd..41cb908e0b 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -90,11 +90,15 @@ public: bool OnInitDialog() override
{
- ppro->m_vCardUpdates |= (1UL << iPageId);
ppro->WindowSubscribe(m_hwnd);
return true;
}
+ void OnChange() override
+ {
+ ppro->m_vCardUpdates |= (1UL << iPageId);
+ }
+
bool OnApply() override
{
ppro->m_vCardUpdates &= ~(1UL << iPageId);
@@ -857,7 +861,8 @@ void CJabberProto::AppendVcardFromDB(TiXmlElement *n, char *tag, char *key) return;
ptrA tszValue(getUStringA(key));
- n << XCHILD(tag, tszValue);
+ if (mir_strlen(tszValue))
+ n << XCHILD(tag, tszValue);
}
void CJabberProto::SetServerVcard(bool bPhotoChanged, wchar_t *szPhotoFileName)
@@ -875,6 +880,8 @@ void CJabberProto::SetServerVcard(bool bPhotoChanged, wchar_t *szPhotoFileName) AppendVcardFromDB(n, "GIVEN", "FirstName");
AppendVcardFromDB(n, "MIDDLE", "MiddleName");
AppendVcardFromDB(n, "FAMILY", "LastName");
+ if (XmlGetChildCount(n) == 0)
+ v->DeleteChild(n);
AppendVcardFromDB(v, "NICKNAME", "Nick");
AppendVcardFromDB(v, "BDAY", "BirthDate");
@@ -907,6 +914,8 @@ void CJabberProto::SetServerVcard(bool bPhotoChanged, wchar_t *szPhotoFileName) AppendVcardFromDB(n, "PCODE", "ZIP");
AppendVcardFromDB(n, "CTRY", "Country");
AppendVcardFromDB(n, "COUNTRY", "Country"); // for compatibility with client using old vcard format
+ if (XmlGetChildCount(n) == 1)
+ v->DeleteChild(n);
n = v << XCHILD("ADR");
n << XCHILD("WORK");
@@ -918,10 +927,14 @@ void CJabberProto::SetServerVcard(bool bPhotoChanged, wchar_t *szPhotoFileName) AppendVcardFromDB(n, "PCODE", "CompanyZIP");
AppendVcardFromDB(n, "CTRY", "CompanyCountry");
AppendVcardFromDB(n, "COUNTRY", "CompanyCountry"); // for compatibility with client using old vcard format
+ if (XmlGetChildCount(n) == 1)
+ v->DeleteChild(n);
n = v << XCHILD("ORG");
AppendVcardFromDB(n, "ORGNAME", "Company");
AppendVcardFromDB(n, "ORGUNIT", "CompanyDepartment");
+ if (XmlGetChildCount(n) == 0)
+ v->DeleteChild(n);
AppendVcardFromDB(v, "TITLE", "CompanyPosition");
AppendVcardFromDB(v, "ROLE", "Role");
|