Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.1933
Browse files Browse the repository at this point in the history
It is based on:
* psi: ad9d69af
* plugins: 7a65467
* psimedia: 478567e
* resources: e32ef4b
  • Loading branch information
tehnick committed May 27, 2024
1 parent 6b2fa64 commit 24f7fb5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 37 deletions.
80 changes: 44 additions & 36 deletions src/infodlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,23 @@ void InfoWidget::setReadOnly(bool x)
m_ui.te_desc->setReadOnly(x);
}

void InfoWidget::release()
{
d->busy = false;
emit released();
fieldsEnable(true);
}

void InfoWidget::updateNick()
{
if (d->jid.compare(d->pa->jid(), false)) {
if (!d->vcard.nickName().isEmpty())
d->pa->setNick(d->vcard.nickName());
else
d->pa->setNick(d->pa->jid().node());
}
}

void InfoWidget::doRefresh()
{
if (!d->pa->checkConnected(this))
Expand All @@ -620,7 +637,6 @@ void InfoWidget::doRefresh()

fieldsEnable(false);

d->actionType = 0;
emit busy();

VCardFactory::Flags flags;
Expand All @@ -629,47 +645,27 @@ void InfoWidget::doRefresh()
}
auto request = VCardFactory::instance()->getVCard(d->pa, d->jid, flags);
connect(request, &VCardRequest::finished, this, [this, request]() {
d->busy = false;
emit released();
fieldsEnable(true);

release();
if (request->success()) {
auto vcard = request->vcard();
if (vcard) {
d->vcard = vcard;
setData(d->vcard);
}

if (d->jid.compare(d->pa->jid(), false)) {
if (vcard && !vcard.nickName().isEmpty())
d->pa->setNick(d->vcard.nickName());
else
d->pa->setNick(d->pa->jid().node());
}

if (d->actionType == 1)
QMessageBox::information(this, tr("Success"),
d->type == MucAdm ? tr("Your conference information has been published.")
: tr("Your account information has been published."));
updateNick();
} else {
if (d->actionType == 0) {
if (d->type == Self)
QMessageBox::critical(
this, tr("Error"),
tr("Unable to retrieve your account information. Perhaps you haven't entered any yet."));
else if (d->type == MucAdm)
QMessageBox::critical(this, tr("Error"),
tr("Unable to retrieve information about this conference.\nReason: %1")
.arg(request->errorString()));
else
QMessageBox::critical(this, tr("Error"),
tr("Unable to retrieve information about this contact.\nReason: %1")
.arg(request->errorString()));
} else {
if (d->type == Self)
QMessageBox::critical(
this, tr("Error"),
tr("Unable to publish your account information.\nReason: %1").arg(request->errorString()));
}
tr("Unable to retrieve your account information. Perhaps you haven't entered any yet."));
else if (d->type == MucAdm)
QMessageBox::critical(this, tr("Error"),
tr("Unable to retrieve information about this conference.\nReason: %1")
.arg(request->errorString()));
else
QMessageBox::critical(
this, tr("Error"),
tr("Unable to retrieve information about this contact.\nReason: %1").arg(request->errorString()));
}
});
}
Expand All @@ -686,17 +682,29 @@ void InfoWidget::publish()
return;
}

VCard submit_vcard = makeVCard();
d->vcard = makeVCard();

fieldsEnable(false);

d->actionType = 1;
emit busy();

VCardFactory::Flags flags;
if (d->type == MucAdm)
flags |= VCardFactory::MucRoom;
VCardFactory::instance()->setVCard(d->pa, submit_vcard, jid(), flags);
auto task = VCardFactory::instance()->setVCard(d->pa, d->vcard, {}, flags);
connect(task, &JT_VCard::finished, this, [this, task]() {
release();
if (task->success()) {
updateNick();
QMessageBox::information(this, tr("Success"),
d->type == MucAdm ? tr("Your conference information has been published.")
: tr("Your account information has been published."));
} else {
QMessageBox::critical(
this, tr("Error"),
tr("Unable to publish your account information.\nReason: %1").arg(task->statusString()));
}
});
}

PsiAccount *InfoWidget::account() const { return d->pa; }
Expand Down
2 changes: 2 additions & 0 deletions src/infodlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ private slots:
void setPreviewPhoto(const QString &str);
void requestResourceInfo(const XMPP::Jid &j);
void requestLastActivity();
void release();
void updateNick();

signals:
void busy();
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1932 (2024-05-27, 42e621df)
1.5.1933 (2024-05-27, ad9d69af)

0 comments on commit 24f7fb5

Please sign in to comment.