|
|
|
@ -219,6 +219,8 @@ void Core::Account::onClientConnected()
|
|
|
|
|
|
|
|
|
|
void Core::Account::onClientDisconnected()
|
|
|
|
|
{
|
|
|
|
|
cancelHistoryRequests();
|
|
|
|
|
pendingVCardRequests.clear();
|
|
|
|
|
clearConferences();
|
|
|
|
|
if (state != Shared::ConnectionState::disconnected) {
|
|
|
|
|
if (reconnectTimes > 0) {
|
|
|
|
@ -854,6 +856,7 @@ void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMess
|
|
|
|
|
{
|
|
|
|
|
if (msg.id().size() > 0 && (msg.body().size() > 0 || msg.outOfBandUrl().size() > 0)) {
|
|
|
|
|
std::map<QString, QString>::const_iterator itr = achiveQueries.find(queryId);
|
|
|
|
|
if (itr != achiveQueries.end()) {
|
|
|
|
|
QString jid = itr->second;
|
|
|
|
|
RosterItem* item = getRosterItem(jid);
|
|
|
|
|
|
|
|
|
@ -868,6 +871,7 @@ void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMess
|
|
|
|
|
item->addMessageToArchive(sMsg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//handleChatMessage(msg, false, true, true);
|
|
|
|
|
}
|
|
|
|
@ -896,10 +900,15 @@ void Core::Account::requestArchive(const QString& jid, int count, const QString&
|
|
|
|
|
|
|
|
|
|
if (contact == 0) {
|
|
|
|
|
qDebug() << "An attempt to request archive for" << jid << "in account" << name << ", but the contact with such id wasn't found, skipping";
|
|
|
|
|
emit responseArchive(contact->jid, std::list<Shared::Message>());
|
|
|
|
|
emit responseArchive(jid, std::list<Shared::Message>());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (contact->getArchiveState() == RosterItem::empty && before.size() == 0) {
|
|
|
|
|
QXmppMessage msg(getFullJid(), jid, "", "");
|
|
|
|
|
QString last = Shared::generateUUID();
|
|
|
|
@ -952,6 +961,7 @@ void Core::Account::onContactNeedHistory(const QString& before, const QString& a
|
|
|
|
|
void Core::Account::onMamResultsReceived(const QString& queryId, const QXmppResultSetReply& resultSetReply, bool complete)
|
|
|
|
|
{
|
|
|
|
|
std::map<QString, QString>::const_iterator itr = achiveQueries.find(queryId);
|
|
|
|
|
if (itr != achiveQueries.end()) {
|
|
|
|
|
QString jid = itr->second;
|
|
|
|
|
achiveQueries.erase(itr);
|
|
|
|
|
|
|
|
|
@ -961,6 +971,7 @@ void Core::Account::onMamResultsReceived(const QString& queryId, const QXmppResu
|
|
|
|
|
qDebug() << "Flushing messages for" << jid;
|
|
|
|
|
ri->flushMessagesToArchive(complete, resultSetReply.first(), resultSetReply.last());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Core::Account::onMamLog(QXmppLogger::MessageType type, const QString& msg)
|
|
|
|
@ -1743,3 +1754,14 @@ void Core::Account::onReceiptReceived(const QString& jid, const QString& id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Core::Account::cancelHistoryRequests()
|
|
|
|
|
{
|
|
|
|
|
for (const std::pair<QString, Conference*>& pair : conferences) {
|
|
|
|
|
pair.second->clearArchiveRequests();
|
|
|
|
|
}
|
|
|
|
|
for (const std::pair<QString, Contact*>& pair : contacts) {
|
|
|
|
|
pair.second->clearArchiveRequests();
|
|
|
|
|
}
|
|
|
|
|
achiveQueries.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|