From ee60f2425259f30fbd1aac9e87252083a35fc173 Mon Sep 17 00:00:00 2001 From: Sergei Ilinykh Date: Fri, 21 Jun 2024 11:55:35 +0300 Subject: [PATCH] publish both vcard4 and vcard-temp when avatar conversion is unavaialble on the server --- iris | 2 +- src/infodlg.cpp | 9 +++++++++ src/vcardfactory.cpp | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/iris b/iris index 0534923b5..eef87be61 160000 --- a/iris +++ b/iris @@ -1 +1 @@ -Subproject commit 0534923b5a81e11d80867bb7e7f5dd5e70f48091 +Subproject commit eef87be6171a7851775c8924f7b7d871d6126af3 diff --git a/src/infodlg.cpp b/src/infodlg.cpp index 57ba1529c..0809730ca 100644 --- a/src/infodlg.cpp +++ b/src/infodlg.cpp @@ -731,6 +731,15 @@ void InfoWidget::publish() } }); + bool hasAvaConv = account()->client()->serverInfoManager()->accountFeatures().hasAvatarConversion(); + if (!hasAvaConv) { + v.detach(); + if (d->photo.size()) { + v.setPhoto(VCard4::UriValue { d->photo, d->photoMime }); + } + VCardFactory::instance()->setVCard(d->pa, v, target, flags | VCardFactory::ForceVCardTemp); + } + if (d->type == Self) { // publish or retract avatar depending on d->photo contents d->pa->avatarFactory()->setSelfAvatar(QImage::fromData(d->photo)); diff --git a/src/vcardfactory.cpp b/src/vcardfactory.cpp index 192c21465..d3e19765d 100644 --- a/src/vcardfactory.cpp +++ b/src/vcardfactory.cpp @@ -231,7 +231,8 @@ VCard4::VCard VCardFactory::vcard(const Jid &j, Flags flags) */ Task *VCardFactory::setVCard(PsiAccount *account, const VCard4::VCard &v, const Jid &targetJid, Flags flags) { - if ((flags & MucRoom)) { // || !account->client()->serverInfoManager()->hasPersistentStorage()) { + if ((flags & MucRoom) || (flags & ForceVCardTemp)) { + // || !account->client()->serverInfoManager()->hasPersistentStorage()) { JT_VCard *jtVCard_ = new JT_VCard(account->client()->rootTask()); connect(jtVCard_, &JT_VCard::finished, this, [this, v, jtVCard_, flags]() { if (jtVCard_->success()) {