forked from blue/squawk
some refactoring, some improvements
This commit is contained in:
parent
be466fbad1
commit
e31ef78e71
13 changed files with 188 additions and 147 deletions
|
@ -266,6 +266,7 @@ void Core::Account::onClientStateChange(QXmppClient::State st) {
|
|||
#ifdef WITH_OMEMO
|
||||
if (!oh->hasOwnDevice()) {
|
||||
qDebug() << "setting up OMEMO data for account" << getName();
|
||||
om->changeDeviceLabel(QGuiApplication::applicationDisplayName() + " - " + QSysInfo::productType());
|
||||
QXmppTask<bool> future = om->setUp();
|
||||
future.then(this, [this] (bool result) {
|
||||
if (result)
|
||||
|
@ -342,9 +343,8 @@ void Core::Account::setAvailability(Shared::Availability avail) {
|
|||
QXmppPresence::AvailableStatusType pres = static_cast<QXmppPresence::AvailableStatusType>(avail);
|
||||
|
||||
presence.setAvailableStatusType(pres);
|
||||
if (state != Shared::ConnectionState::disconnected) {
|
||||
if (state != Shared::ConnectionState::disconnected)
|
||||
client.setClientPresence(presence);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,9 +437,9 @@ void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMess
|
|||
|
||||
void Core::Account::requestArchive(const QString& jid, int count, const QString& before) {
|
||||
qDebug() << "An archive request for " << jid << ", before " << before;
|
||||
RosterItem* contact = rh->getRosterItem(jid);
|
||||
RosterItem* item = rh->getRosterItem(jid);
|
||||
|
||||
if (contact == nullptr) {
|
||||
if (item == 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;
|
||||
|
@ -447,10 +447,18 @@ void Core::Account::requestArchive(const QString& jid, int count, const QString&
|
|||
|
||||
if (state != Shared::ConnectionState::connected) {
|
||||
qDebug() << "An attempt to request archive for" << jid << "in account" << name << ", but the account is not online, skipping";
|
||||
emit responseArchive(contact->jid, std::list<Shared::Message>(), false);
|
||||
emit responseArchive(jid, std::list<Shared::Message>(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
contact->requestHistory(count, before);
|
||||
#ifdef WITH_OMEMO
|
||||
if (!item->isMuc()) {
|
||||
Contact* contact = static_cast<Contact*>(item);
|
||||
if (contact->omemoBundles == Shared::Possible::unknown)
|
||||
oh->requestBundles(jid);
|
||||
}
|
||||
#endif
|
||||
item->requestHistory(count, before);
|
||||
}
|
||||
|
||||
void Core::Account::onContactNeedHistory(const QString& before, const QString& after, const QDateTime& at) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue