forked from blue/squawk
keeping up with qxmpp
This commit is contained in:
parent
73d83f55af
commit
3c6b611a41
10 changed files with 146 additions and 153 deletions
|
@ -108,23 +108,19 @@ Account::Account(const QString& p_login, const QString& p_server, const QString&
|
|||
client.addExtension(om);
|
||||
|
||||
if (oh->hasOwnDevice()) {
|
||||
QFuture<bool> future = om->load();
|
||||
QXmppTask<bool> future = om->load();
|
||||
loadingOmemo = true;
|
||||
|
||||
QFutureWatcher<bool> *watcher = new QFutureWatcher<bool>(this);
|
||||
QObject::connect(watcher, &QFutureWatcherBase::finished, [watcher, this] () {
|
||||
future.then(this, [this] (bool result) {
|
||||
loadingOmemo = false;
|
||||
if (state == Shared::ConnectionState::scheduled) {
|
||||
client.connectToServer(config, presence);
|
||||
}
|
||||
if (watcher->result()) {
|
||||
if (result) {
|
||||
qDebug() << "successfully loaded OMEMO data for account" << getName();
|
||||
} else {
|
||||
qDebug() << "couldn't load OMEMO data for account" << getName();
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
watcher->setFuture(future);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -235,20 +231,17 @@ void Core::Account::onClientStateChange(QXmppClient::State st)
|
|||
#ifdef WITH_OMEMO
|
||||
if (!oh->hasOwnDevice()) {
|
||||
qDebug() << "setting up OMEMO data for account" << getName();
|
||||
QFuture<bool> future = om->setUp();
|
||||
QFutureWatcher<bool> *watcher = new QFutureWatcher<bool>(this);
|
||||
QObject::connect(watcher, &QFutureWatcherBase::finished, [watcher, this] () {
|
||||
if (watcher->result()) {
|
||||
QXmppTask<bool> future = om->setUp();
|
||||
future.then(this, [this] (bool result) {
|
||||
if (result)
|
||||
qDebug() << "successfully set up OMEMO data for account" << getName();
|
||||
} else {
|
||||
else
|
||||
qDebug() << "couldn't set up OMEMO data for account" << getName();
|
||||
}
|
||||
watcher->deleteLater();
|
||||
if (state == Shared::ConnectionState::connected) {
|
||||
|
||||
if (state == Shared::ConnectionState::connected)
|
||||
runDiscoveryService();
|
||||
}
|
||||
|
||||
});
|
||||
watcher->setFuture(future);
|
||||
} else {
|
||||
runDiscoveryService();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue