forked from blue/squawk
Refactoring, account destruction fix, some thoughts about where to store contact settings (omemo enable status for instance)
This commit is contained in:
parent
283e9ebc4d
commit
fffef9876a
15 changed files with 352 additions and 380 deletions
|
@ -44,6 +44,7 @@ Account::Account(const QString& p_login, const QString& p_server, const QString&
|
|||
#endif
|
||||
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0)
|
||||
cm(new QXmppCarbonManagerV2()),
|
||||
psm(new QXmppPubSubManager()),
|
||||
#else
|
||||
cm(new QXmppCarbonManager()),
|
||||
#endif
|
||||
|
@ -55,7 +56,6 @@ Account::Account(const QString& p_login, const QString& p_server, const QString&
|
|||
um(new QXmppUploadRequestManager()),
|
||||
dm(client.findExtension<QXmppDiscoveryManager>()),
|
||||
rcpm(new QXmppMessageReceiptManager()),
|
||||
psm(new QXmppPubSubManager()),
|
||||
reconnectScheduled(false),
|
||||
reconnectTimer(new QTimer),
|
||||
network(p_net),
|
||||
|
@ -167,22 +167,34 @@ Account::~Account() {
|
|||
QObject::disconnect(network, &NetworkAccess::downloadFileComplete, mh, &MessageHandler::onDownloadFileComplete);
|
||||
QObject::disconnect(network, &NetworkAccess::loadFileError, mh, &MessageHandler::onLoadFileError);
|
||||
|
||||
delete vh;
|
||||
delete mh;
|
||||
delete rh;
|
||||
|
||||
rh->clear(); //conferenses inside of roster handler hold QXmppMuc objects.
|
||||
//If we destroy QXmppMucManager, then when we will be destroying RosterHandler
|
||||
//it will try to destory Core::Conference objects
|
||||
//and inside of those QXmppMuc objects will already be destroyed.
|
||||
//So, clear will start the destruction from Core::Conference and this way it's not gonna crash
|
||||
|
||||
delete delay;
|
||||
delete reconnectTimer;
|
||||
#ifdef WITH_OMEMO
|
||||
delete om;
|
||||
#endif
|
||||
delete rcpm;
|
||||
delete dm;
|
||||
delete um;
|
||||
delete bm;
|
||||
delete mm;
|
||||
delete am;
|
||||
delete cm;
|
||||
delete delay;
|
||||
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0)
|
||||
delete psm;
|
||||
#endif
|
||||
#ifdef WITH_OMEMO
|
||||
delete om;
|
||||
delete tm;
|
||||
delete oh;
|
||||
delete th;
|
||||
#endif
|
||||
|
||||
delete dh;
|
||||
delete vh;
|
||||
delete rh;
|
||||
delete mh;
|
||||
}
|
||||
|
||||
Shared::ConnectionState Core::Account::getState() const {
|
||||
|
@ -345,7 +357,7 @@ void Core::Account::onPresenceReceived(const QXmppPresence& p_presence) {
|
|||
vh->handlePresenceOfMyAccountChange(p_presence);
|
||||
} else {
|
||||
RosterItem* item = rh->getRosterItem(jid);
|
||||
if (item != 0)
|
||||
if (item != nullptr)
|
||||
item->handlePresence(p_presence);
|
||||
}
|
||||
|
||||
|
@ -417,7 +429,7 @@ void Core::Account::requestArchive(const QString& jid, int count, const QString&
|
|||
qDebug() << "An archive request for " << jid << ", before " << before;
|
||||
RosterItem* contact = rh->getRosterItem(jid);
|
||||
|
||||
if (contact == 0) {
|
||||
if (contact == nullptr) {
|
||||
qDebug() << "An attempt to request archive for" << jid << "in account" << name << ", but the contact with such id wasn't found, skipping";
|
||||
emit responseArchive(jid, std::list<Shared::Message>(), true);
|
||||
return;
|
||||
|
@ -483,7 +495,7 @@ void Core::Account::onMamResultsReceived(const QString& queryId, const QXmppResu
|
|||
|
||||
RosterItem* ri = rh->getRosterItem(jid);
|
||||
|
||||
if (ri != 0) {
|
||||
if (ri != nullptr) {
|
||||
qDebug() << "Flushing messages for" << jid << ", complete:" << complete;
|
||||
ri->flushMessagesToArchive(complete, resultSetReply.first(), resultSetReply.last());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue