Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.1945
Browse files Browse the repository at this point in the history
It is based on:
* psi: fb021b10
* plugins: 7a65467
* psimedia: 478567e
* resources: e32ef4b
  • Loading branch information
tehnick committed Jun 5, 2024
1 parent dfcac2e commit e846e91
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion iris/src/xmpp/xmpp-im/xmpp_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
29 changes: 20 additions & 9 deletions src/avatars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -258,13 +263,19 @@ 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);
}

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);
}
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1944 (2024-06-05, 55d57f64)
1.5.1945 (2024-06-05, fb021b10)

0 comments on commit e846e91

Please sign in to comment.