From afde2a2f02d488a2764394ae658569326cf81bdf Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Thu, 13 Jun 2024 22:50:08 +0300 Subject: [PATCH] Current version of Psi+ is 1.5.1969 It is based on: * psi: 260a7cb8 * plugins: 7a65467 * psimedia: 478567e * resources: e32ef4b --- psi.doap | 9 +++++++++ src/avatars.cpp | 4 ++-- src/psiaccount.cpp | 27 ++++++++++++++++++++++++++- src/psicon.cpp | 3 ++- src/vcardfactory.cpp | 10 +++++++--- src/vcardfactory.h | 2 +- version | 2 +- 7 files changed, 48 insertions(+), 9 deletions(-) diff --git a/psi.doap b/psi.doap index e133a9ecc..30b6d6623 100644 --- a/psi.doap +++ b/psi.doap @@ -626,6 +626,15 @@ + + + + + complete + 0.12.0 + + + diff --git a/src/avatars.cpp b/src/avatars.cpp index 7e90ab9ee..cbff035d1 100644 --- a/src/avatars.cpp +++ b/src/avatars.cpp @@ -1086,13 +1086,13 @@ void AvatarFactory::publish_success(const QString &n, const PubSubItem &item) meta_el.appendChild(info_el); account()->pepManager()->publish(PEP_AVATAR_METADATA_NS, PubSubItem(d->selfAvatarHash_, meta_el)); if (account()->client()->serverInfoManager()->accountFeatures().hasAvatarConversion()) { - VCardFactory::instance()->setPhoto(account()->jid(), d->selfAvatarData_, {}); + VCardFactory::instance()->setPhoto(account()->jid(), d->selfAvatarData_, VCardFactory::Silent); } d->selfAvatarData_.clear(); // we don't need it anymore } else if (n == PEP_AVATAR_METADATA_NS) { bool removed = item.payload().firstChildElement("metadata").firstChildElement("info").isNull(); if (account()->client()->serverInfoManager()->accountFeatures().hasAvatarConversion() && removed) { - VCardFactory::instance()->deletePhoto(account()->jid(), {}); + VCardFactory::instance()->deletePhoto(account()->jid(), VCardFactory::Silent); } } } diff --git a/src/psiaccount.cpp b/src/psiaccount.cpp index b9af97e66..ac0ffb8d8 100644 --- a/src/psiaccount.cpp +++ b/src/psiaccount.cpp @@ -2390,6 +2390,7 @@ void PsiAccount::serverFeaturesChanged() if (d->client->serverInfoManager()->serverFeatures().hasVCard() && !d->vcardChecked) { // Get the vcard const auto vcard = VCardFactory::instance()->vcard(d->jid); +#if 0 // feels not needed with pubsub vcards. commented out on 2024-06-13. TODO remove options? if (PsiOptions::instance()->getOption("options.vcard.query-own-vcard-on-login").toBool() || vcard.isEmpty() || (vcard.nickName().isEmpty() && vcard.fullName().isEmpty())) { auto req = VCardFactory::instance()->getVCard(this, d->jid); @@ -2423,7 +2424,9 @@ void PsiAccount::serverFeaturesChanged() changeVCard(); } }); - } else { + } else +#endif + { d->nickFromVCard = true; // if we get here, one of these fields is non-empty if (!vcard.nickName().isEmpty()) { @@ -3866,6 +3869,28 @@ void PsiAccount::itemPublished(const Jid &j, const QString &n, const PubSubItem u->setGeoLocation(geoloc); cpUpdate(*u); } + } else if (n == QLatin1String("urn:ietf:params:xml:ns:vcard-4.0")) { + // we are interested only in our own at the moment + if (j.compare(d->jid, false)) { + VCard4::VCard vcard(item.payload()); + QString nick = d->jid.node(); + bool changeOwn; + if (vcard) { + if (!vcard.nickName().isEmpty()) { + d->nickFromVCard = true; + nick = vcard.nickName(); + } else if (!vcard.fullName().isEmpty()) { + d->nickFromVCard = true; + nick = vcard.fullName(); + } + if (!vcard.photo().isEmpty()) { + d->vcardPhotoUpdate(vcard.photo()); + } + setNick(nick); + + changeOwn = vcard.isEmpty(); + } + } } } diff --git a/src/psicon.cpp b/src/psicon.cpp index 80caa2b54..2551d6ca2 100644 --- a/src/psicon.cpp +++ b/src/psicon.cpp @@ -871,7 +871,8 @@ QStringList PsiCon::xmppFatures() const << "http://jabber.org/protocol/activity+notify" << "http://jabber.org/protocol/tune+notify" << "http://jabber.org/protocol/geoloc+notify" - << "urn:xmpp:avatar:metadata+notify") + << "urn:xmpp:avatar:metadata+notify" + << "urn:xmpp:contacts+notify") << OptFeatureMap("options.messages.send-composing-events", QStringList() << "http://jabber.org/protocol/chatstates") << OptFeatureMap("options.ui.notifications.send-receipts", QStringList() << "urn:xmpp:receipts"); diff --git a/src/vcardfactory.cpp b/src/vcardfactory.cpp index 250568d65..08c18c5b8 100644 --- a/src/vcardfactory.cpp +++ b/src/vcardfactory.cpp @@ -140,7 +140,9 @@ void VCardFactory::saveVCard(const Jid &j, const VCard4::VCard &vcard, Flags fla *nickIt = vcard; } - emit vcardChanged(j, flags); + if (!(flags & Silent)) { + emit vcardChanged(j, flags); + } return; } @@ -170,8 +172,10 @@ void VCardFactory::saveVCard(const Jid &j, const VCard4::VCard &vcard, Flags fla file.remove(); } - Jid jid = j; - emit vcardChanged(jid, flags); + Jid jid = j; + if (!(flags & Silent)) { + emit vcardChanged(jid, flags); + } } /** diff --git a/src/vcardfactory.h b/src/vcardfactory.h index 7a999ca9f..d8a1ecca0 100644 --- a/src/vcardfactory.h +++ b/src/vcardfactory.h @@ -46,7 +46,7 @@ class VCardFactory : public QObject { Q_OBJECT public: - enum Flag { MucRoom = 0x1, MucUser = 0x2, Cache = 0x4, ForceVCardTemp = 0x8 }; + enum Flag { MucRoom = 0x1, MucUser = 0x2, Cache = 0x4, ForceVCardTemp = 0x8, Silent = 0x10 }; Q_DECLARE_FLAGS(Flags, Flag); static VCardFactory *instance(); diff --git a/version b/version index fd579bbd6..be3d1bfd7 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.5.1968 (2024-06-13, 5d129299) +1.5.1969 (2024-06-13, 260a7cb8)