From e846e91f80bb1a304ebeb9f30eff7da00fb455ef Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Wed, 5 Jun 2024 17:20:08 +0300 Subject: [PATCH] Current version of Psi+ is 1.5.1945 It is based on: * psi: fb021b10 * plugins: 7a65467 * psimedia: 478567e * resources: e32ef4b --- iris/src/xmpp/xmpp-im/xmpp_task.cpp | 2 +- src/avatars.cpp | 29 ++++++++++++++++++++--------- version | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/iris/src/xmpp/xmpp-im/xmpp_task.cpp b/iris/src/xmpp/xmpp-im/xmpp_task.cpp index bdd7c2db3..7c4c2a02b 100644 --- a/iris/src/xmpp/xmpp-im/xmpp_task.cpp +++ b/iris/src/xmpp/xmpp-im/xmpp_task.cpp @@ -268,7 +268,7 @@ bool Task::iqVerify(const QDomElement &x, const Jid &to, const QString &id, cons // empty 'from' ? if (from.isEmpty()) { // allowed if we are querying the server - if (!to.isEmpty() && !to.compare(server)) + if (!to.isEmpty() && !to.compare(local, false) && !to.compare(server)) return false; } // from ourself? diff --git a/src/avatars.cpp b/src/avatars.cpp index 17d3c89c1..9b79570f4 100644 --- a/src/avatars.cpp +++ b/src/avatars.cpp @@ -179,9 +179,9 @@ class AvatarCache : public FileCache { } else { qWarning("avatars.cpp: Unexpected item payload"); } - } else if (n == PEP_AVATAR_METADATA_NS) { - if (item.payload().tagName() == QLatin1String(PEP_AVATAR_METADATA_TN) - && item.payload().firstChildElement().isNull()) { + } else if (n == PEP_AVATAR_METADATA_NS && item.payload().tagName() == QLatin1String(PEP_AVATAR_METADATA_TN)) { + auto info = item.payload().firstChildElement(QLatin1String("info")); + if (info.isNull()) { result = AvatarCache::instance()->removeIcon(AvatarCache::AvatarType, jidFull); } else { auto id = item.id().toLatin1(); @@ -198,15 +198,14 @@ class AvatarCache : public FileCache { VCardFactory::instance()->ensureVCardUpdated(pa, jid, VCardFactory::InterestPhoto, hash); - for (QDomElement e = item.payload().firstChildElement(QLatin1String("info")); !e.isNull(); - e = e.nextSiblingElement(QLatin1String("info"))) { - if (e.attribute(QLatin1String("type")).toLower() != QLatin1String("image/png")) { + for (; !info.isNull(); info = info.nextSiblingElement(QLatin1String("info"))) { + if (info.attribute(QLatin1String("type")).toLower() != QLatin1String("image/png")) { continue; // TODO add support for QImageReader::supportedMimeTypes() (requires usage of qnam) } - if (!e.attribute(QLatin1String("url")).isEmpty()) { + if (!info.attribute(QLatin1String("url")).isEmpty()) { continue; // web avatars are not currently supported. TODO but their support is highly expected } - if (e.attribute(QLatin1String("id")) != item.id()) { + if (info.attribute(QLatin1String("id")) != item.id()) { continue; // that's something totally unexpected } // found in-band png (by xep84 hash is for png) avatar. So we can make request @@ -222,7 +221,7 @@ class AvatarCache : public FileCache { if (result == UserUpdateRequired) { #ifdef AVATAR_EDBUG - qDebug() << "remove from iconset" << jidFull; + qDebug() << "remove from iconset and emit avatarChanged on itemPublished" << jidFull; #endif iconset_->removeIcon(QString(QLatin1String("avatars/%1")).arg(jidFull)); emit avatarChanged(jidFull); @@ -236,12 +235,18 @@ class AvatarCache : public FileCache { if (hash.isEmpty()) { // photo removal if (AvatarCache::instance()->removeIcon(AvatarCache::VCardType, fullJid) == AvatarCache::UserUpdateRequired) { +#ifdef AVATAR_EDBUG + qDebug() << "remove from iconset and emit avatarChanged. ensureVCardUpdated/removeIcon" << fullJid; +#endif iconset_->removeIcon(QString(QLatin1String("avatars/%1")).arg(fullJid)); emit avatarChanged(fullJid); } } else { auto result = appendUser(hash, AvatarCache::VCardType, fullJid); if (result == AvatarCache::UserUpdateRequired) { +#ifdef AVATAR_EDBUG + qDebug() << "remove from iconset and emit avatarChanged. ensureVCardUpdated/appendUser" << fullJid; +#endif iconset_->removeIcon(QString(QLatin1String("avatars/%1")).arg(fullJid)); emit avatarChanged(fullJid); } else if (result == AvatarCache::NoData) { @@ -258,6 +263,9 @@ class AvatarCache : public FileCache { && AvatarCache::instance()->setIcon(AvatarCache::CustomType, j.bare(), f.readAll()))) { qWarning("Failed to set manual avatar"); } +#ifdef AVATAR_EDBUG + qDebug() << "remove from iconset and emit avatarChanged. importManualAvatar" << j.bare(); +#endif iconset_->removeIcon(QString(QLatin1String("avatars/%1")).arg(j.bare())); emit avatarChanged(j); } @@ -265,6 +273,9 @@ class AvatarCache : public FileCache { void removeManualAvatar(const Jid &j) { if (AvatarCache::instance()->removeIcon(AvatarCache::CustomType, j.bare()) == AvatarCache::UserUpdateRequired) { +#ifdef AVATAR_EDBUG + qDebug() << "remove from iconset and emit avatarChanged. removeManualAvatar" << j.bare(); +#endif iconset_->removeIcon(QString(QLatin1String("avatars/%1")).arg(j.bare())); emit avatarChanged(j); } diff --git a/version b/version index a9c07c684..5a4f25e12 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.5.1944 (2024-06-05, 55d57f64) +1.5.1945 (2024-06-05, fb021b10)