summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-08-21 15:09:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-08-21 15:09:28 +0300
commita8fc78b9fe3f244eb01499969f6fd28229df3019 (patch)
tree7d5ecd9164c8d7274ecbe0df5b5bb03e2b86aff0 /protocols/JabberG
parentfce7a2fc973422c0ba7444617423e91f5b3784b6 (diff)
Jabber: more portable version of a crutch with full vcard hash
Diffstat (limited to 'protocols/JabberG')
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp8
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp10
2 files changed, 11 insertions, 7 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 57e18df43f..b3446760ff 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1638,7 +1638,8 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info)
debugLogA("Avatar enabled");
for (auto *xNode : TiXmlFilter(node, "x")) {
- if (!mir_strcmp(XmlGetAttr(xNode, "xmlns"), "vcard-temp:x:update")) {
+ auto *pszNamespace = XmlGetAttr(xNode, "xmlns");
+ if (!mir_strcmp(pszNamespace, "vcard-temp:x:update")) {
auto *szPhoto = XmlGetChildText(xNode, "photo");
if (szPhoto && !bHasAvatar) {
if (mir_strlen(szPhoto)) {
@@ -1653,8 +1654,9 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info)
}
else bRemovedAvatar = true;
}
-
- const char *txt = XmlGetAttr(xNode, "vcard");
+ }
+ else if (!mir_strcmp(pszNamespace, "miranda:x:vcard")) {
+ auto *txt = xNode->GetText();
if (mir_strlen(txt)) {
ptrA saved(getStringA(hContact, "VCardHash"));
if (saved == nullptr || mir_strcmp(saved, txt)) {
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 82f27729bb..a0a281f0f9 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -446,15 +446,17 @@ void CJabberProto::SendPresenceTo(int status, const char *to, const TiXmlElement
if (m_bEnableAvatars) {
TiXmlElement *x = p << XCHILDNS("x", "vcard-temp:x:update");
- ptrA vcardHash(getUStringA("VCardHash"));
- if (vcardHash != nullptr)
- x << XATTR("vcard", vcardHash);
-
ptrA hashValue(getUStringA("AvatarHash"));
if (hashValue != nullptr) // XEP-0153: vCard-Based Avatars
x << XCHILD("photo", hashValue);
else
x << XCHILD("photo");
+
+ ptrA vcardHash(getUStringA("VCardHash"));
+ if (vcardHash != nullptr) {
+ x = p << XCHILDNS("x", "miranda:x:vcard");
+ x->SetText(vcardHash.get());
+ }
}
{
mir_cslock lck(m_csModeMsgMutex);