Skip to content

Commit

Permalink
publish both vcard4 and vcard-temp when avatar conversion is unavaial…
Browse files Browse the repository at this point in the history
…ble on the server
  • Loading branch information
Ri0n committed Jun 21, 2024
1 parent 1f37adf commit ee60f24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion iris
9 changes: 9 additions & 0 deletions src/infodlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion src/vcardfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit ee60f24

Please sign in to comment.