forked from blue/squawk
some debug, fix a crash removing a currently selected contact
This commit is contained in:
parent
e31ef78e71
commit
19835af3cf
9 changed files with 40 additions and 14 deletions
|
@ -61,7 +61,7 @@
|
|||
#include "handlers/discoveryhandler.h"
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
#include <Omemo/QXmppOmemoManager.h>
|
||||
#include <QXmppOmemoManager.h>
|
||||
#include <QXmppTrustManager.h>
|
||||
#include "handlers/trusthandler.h"
|
||||
#include "handlers/omemohandler.h"
|
||||
|
|
|
@ -368,9 +368,9 @@ void Core::DelayManager::Manager::receivedBundles(const QString& jid, const std:
|
|||
Job::Id jobId = itr->second;
|
||||
requestedBundles.erase(itr);
|
||||
std::map<Job::Id, Job*>::const_iterator jitr = runningJobs.find(jobId);
|
||||
if (jitr == runningJobs.end()) {
|
||||
if (jitr == runningJobs.end())
|
||||
throw JobNotFound(jobId, "receivedBundles");
|
||||
}
|
||||
|
||||
Job* jb = jitr->second;
|
||||
InfoForUser* job = dynamic_cast<InfoForUser*>(jb);
|
||||
|
||||
|
|
|
@ -357,28 +357,36 @@ std::pair<Shared::Message::State, QString> Core::MessageHandler::scheduleSending
|
|||
if (task.isFinished()) {
|
||||
const QXmppE2eeExtension::MessageEncryptResult& res = task.result();
|
||||
if (std::holds_alternative<std::unique_ptr<QXmppMessage>>(res)) {
|
||||
qDebug() << "Successfully encrypted a message";
|
||||
const std::unique_ptr<QXmppMessage>& encrypted = std::get<std::unique_ptr<QXmppMessage>>(res);
|
||||
encrypted->setBody(QString());
|
||||
encrypted->setOutOfBandUrl(QString());
|
||||
bool success = acc->client.sendPacket(*encrypted.get());
|
||||
if (success)
|
||||
if (success) {
|
||||
qDebug() << "Successfully sent an encrypted message";
|
||||
return {Shared::Message::State::sent, ""};
|
||||
else
|
||||
} else {
|
||||
qDebug() << "Couldn't sent an encrypted message";
|
||||
return {Shared::Message::State::error, "Error sending successfully encrypted message"};
|
||||
}
|
||||
} else if (std::holds_alternative<QXmppError>(res)) {
|
||||
qDebug() << "Couldn't encrypt a message";
|
||||
const QXmppError& err = std::get<QXmppError>(res);
|
||||
return {Shared::Message::State::error, err.description};
|
||||
} else {
|
||||
qDebug() << "Couldn't encrypt a message";
|
||||
return {Shared::Message::State::error, "Unexpected error ecryptng the message"};
|
||||
}
|
||||
} else {
|
||||
task.then(this, [this, id] (QXmppE2eeExtension::MessageEncryptResult&& result) {
|
||||
if (std::holds_alternative<std::unique_ptr<QXmppMessage>>(result)) {
|
||||
qDebug() << "Successfully encrypted a message";
|
||||
const std::unique_ptr<QXmppMessage>& encrypted = std::get<std::unique_ptr<QXmppMessage>>(result);
|
||||
encrypted->setBody(QString());
|
||||
encrypted->setOutOfBandUrl(QString());
|
||||
bool success = acc->client.sendPacket(*encrypted.get());
|
||||
if (success) {
|
||||
qDebug() << "Successfully sent an encrypted message";
|
||||
std::tuple<bool, QString, QString> ids = getOriginalPendingMessageId(id, false);
|
||||
if (std::get<0>(ids)) {
|
||||
QString id = std::get<1>(ids);
|
||||
|
@ -393,12 +401,15 @@ std::pair<Shared::Message::State, QString> Core::MessageHandler::scheduleSending
|
|||
qDebug() << "Encrypted message has been successfully sent, but it couldn't be found to update the sate";
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Couldn't sent an encrypted message";
|
||||
handlePendingMessageError(id, "Error sending successfully encrypted message");
|
||||
}
|
||||
} else if (std::holds_alternative<QXmppError>(result)) {
|
||||
qDebug() << "Couldn't encrypt a message";
|
||||
const QXmppError& err = std::get<QXmppError>(result);
|
||||
handlePendingMessageError(id, err.description);
|
||||
} else {
|
||||
qDebug() << "Couldn't encrypt a message";
|
||||
handlePendingMessageError(id, "Unexpected error ecryptng the message");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -169,7 +169,15 @@ void Core::OmemoHandler::getDevices(const QString& jid, std::list<Shared::KeyInf
|
|||
|
||||
for (QHash<uint32_t, Device>::const_iterator itr = devs.begin(), end = devs.end(); itr != end; ++itr) {
|
||||
const Device& dev = itr.value();
|
||||
out.emplace_back(itr.key(), dev.keyId, dev.label, QDateTime(), Shared::TrustLevel::undecided, Shared::EncryptionProtocol::omemo2, false);
|
||||
out.emplace_back(
|
||||
itr.key(),
|
||||
dev.keyId,
|
||||
dev.label,
|
||||
dev.removalFromDeviceListDate,
|
||||
Shared::TrustLevel::undecided,
|
||||
Shared::EncryptionProtocol::omemo2,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <list>
|
||||
#include <functional>
|
||||
|
||||
#include <Omemo/QXmppOmemoStorage.h>
|
||||
#include <QXmppOmemoStorage.h>
|
||||
#include <cache.h>
|
||||
|
||||
#include <shared/keyinfo.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue