forked from blue/squawk
support of the new managers in account code, new states, new lambdas, even launches now, even receives some bundles
This commit is contained in:
parent
db3bc358a7
commit
dfe72ca36c
12 changed files with 113 additions and 25 deletions
|
@ -21,7 +21,8 @@
|
|||
|
||||
Core::DiscoveryHandler::DiscoveryHandler(Core::Account* account):
|
||||
QObject(),
|
||||
acc(account) {}
|
||||
acc(account),
|
||||
omemoToCarbonsConnected (false) {}
|
||||
|
||||
Core::DiscoveryHandler::~DiscoveryHandler() {}
|
||||
|
||||
|
@ -79,6 +80,19 @@ void Core::DiscoveryHandler::onInfoReceived(const QXmppDiscoveryIq& info)
|
|||
if (enableCC) {
|
||||
qDebug() << "Enabling carbon copies for account" << accName;
|
||||
acc->cm->setCarbonsEnabled(true);
|
||||
#ifdef WITH_OMEMO
|
||||
if (!omemoToCarbonsConnected && acc->oh->hasOwnDevice()) {
|
||||
// connect(this, &QXmppCarbonManager::messageSent, acc->om, &QXmppOmemoManager::handleMessage);
|
||||
// connect(this, &QXmppCarbonManager::messageReceived, acc->om, &QXmppOmemoManager::handleMessage);
|
||||
omemoToCarbonsConnected = true;
|
||||
}
|
||||
} else {
|
||||
if (omemoToCarbonsConnected) {
|
||||
// disconnect(this, &QXmppCarbonManager::messageSent, acc->om, &QXmppOmemoManager::handleMessage);
|
||||
// disconnect(this, &QXmppCarbonManager::messageReceived, acc->om, &QXmppOmemoManager::handleMessage);
|
||||
omemoToCarbonsConnected = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
qDebug() << "Requesting account" << accName << "capabilities";
|
||||
|
|
|
@ -40,6 +40,7 @@ private slots:
|
|||
|
||||
private:
|
||||
Account* acc;
|
||||
bool omemoToCarbonsConnected;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ Core::OmemoHandler::OmemoHandler(Account* account) :
|
|||
db.open();
|
||||
try {
|
||||
QVariant own = meta->getRecord("ownDevice");
|
||||
ownDevice.value() = own.value<OwnDevice>();
|
||||
ownDevice = own.value<OwnDevice>();
|
||||
qDebug() << "Successfully found own device omemo data for account" << acc->getName();
|
||||
} catch (const DataBase::NotFound& e) {
|
||||
qDebug() << "No device omemo data was found for account" << acc->getName();
|
||||
|
@ -42,6 +42,10 @@ Core::OmemoHandler::~OmemoHandler() {
|
|||
db.close();
|
||||
}
|
||||
|
||||
bool Core::OmemoHandler::hasOwnDevice() {
|
||||
return ownDevice.has_value();
|
||||
}
|
||||
|
||||
QFuture<void> Core::OmemoHandler::emptyVoidFuture() {
|
||||
QFutureInterface<QXmppOmemoStorage::OmemoData> result(QFutureInterfaceBase::Started);
|
||||
result.reportFinished();
|
||||
|
@ -101,7 +105,7 @@ QFuture<void> Core::OmemoHandler::addPreKeyPairs(const QHash<uint32_t, QByteArra
|
|||
}
|
||||
|
||||
QFuture<void> Core::OmemoHandler::addSignedPreKeyPair(uint32_t keyId, const QXmppOmemoStorage::SignedPreKeyPair& keyPair) {
|
||||
signedPreKeyPairs->addRecord(keyId, keyPair);
|
||||
signedPreKeyPairs->forceRecord(keyId, keyPair);
|
||||
return emptyVoidFuture();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
|
||||
QFuture<void> resetAll() override;
|
||||
|
||||
bool hasOwnDevice();
|
||||
|
||||
private:
|
||||
static QFuture<void> emptyVoidFuture();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue