Skip to content

Commit

Permalink
WIP: Fix changing device label once connected
Browse files Browse the repository at this point in the history
  • Loading branch information
melvo committed Jun 8, 2024
1 parent 1393b8f commit 8fa8ddf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/omemo/QXmppOmemoManager_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2951,15 +2951,21 @@ QXmppTask<bool> ManagerPrivate::changeDeviceLabel(const QString &deviceLabel)

ownDevice.label = deviceLabel;

if (isStarted) {
auto updateDeviceLabel = [this, interface]() mutable {
auto future = omemoStorage->setOwnDevice(ownDevice);
future.then(q, [=, this]() mutable {
publishDeviceListItem(true, [=](bool isPublished) mutable {
interface.finish(std::move(isPublished));
});
});
};

if (isStarted) {
updateDeviceLabel();
} else {
interface.finish(true);
q->connect(q->client(), &QXmppClient::connected, q, [updateDeviceLabel]() mutable {
updateDeviceLabel();
});
}

return interface.task();
Expand Down

0 comments on commit 8fa8ddf

Please sign in to comment.