1
0
Fork 0
forked from blue/squawk

some better cleanup and restore state on connect disconnect, workaround for that wired undefined condition error on every other reconnection

This commit is contained in:
Blue 2020-06-21 01:26:30 +03:00
parent 87426ee20f
commit 0dcfc5eedc
6 changed files with 61 additions and 16 deletions

View file

@ -421,7 +421,11 @@ void Core::RosterHandler::bookmarksReceived(const QXmppBookmarkSet& bookmarks)
if (cItr == conferences.end()) {
addNewRoom(jid, c.nickName(), c.name(), c.autoJoin());
} else {
qDebug() << "Received a bookmark to a MUC " << jid << " which is already booked by another bookmark, skipping";
if (c.autoJoin()) {
cItr->second->setJoined(true);
} else {
cItr->second->setAutoJoin(false);
}
}
}
}
@ -572,12 +576,14 @@ void Core::RosterHandler::onContactAvatarChanged(Shared::Avatar type, const QStr
emit acc->changeContact(item->jid, cData);
}
void Core::RosterHandler::cancelHistoryRequests()
void Core::RosterHandler::handleOffline()
{
for (const std::pair<const QString, Conference*>& pair : conferences) {
pair.second->clearArchiveRequests();
pair.second->downgradeDatabaseState();
}
for (const std::pair<const QString, Contact*>& pair : contacts) {
pair.second->clearArchiveRequests();
pair.second->downgradeDatabaseState();
}
}

View file

@ -55,7 +55,7 @@ public:
void removeRoomRequest(const QString& jid);
void addRoomRequest(const QString& jid, const QString& nick, const QString& password, bool autoJoin);
void cancelHistoryRequests();
void handleOffline();
Core::Contact* getContact(const QString& jid);
Core::Conference* getConference(const QString& jid);