Verified Commit de513ee3 authored by Phobos D'thorga's avatar Phobos D'thorga 🐲
Browse files

* Working towards fixing SEGFAULT's that occur within Google LevelDB related code.

parent fe62e239
Pipeline #991 passed with stages
in 32 minutes and 6 seconds
......@@ -378,38 +378,6 @@ GkXmppClient::GkXmppClient(const GkUserConn &connection_details, QPointer<GekkoF
});
QObject::connect(this, &QXmppClient::disconnected, this, [=]() {
if (!m_connDetails.server.settings_client.auto_reconnect && !m_connDetails.server.url.isEmpty() &&
!m_connDetails.jid.isEmpty()) {
if (!this->isConnected() && m_askToReconnectAuto) { // We have been disconnected from the given XMPP server!
QMessageBox msgBoxPolicy;
msgBoxPolicy.setParent(nullptr);
msgBoxPolicy.setWindowTitle(tr("Disconnected!"));
msgBoxPolicy.setText(tr("You have been disconnected from the XMPP server, \"%1\"! Do you wish to enable a automatic reconnect policy?").arg(m_connDetails.server.url));
msgBoxPolicy.setStandardButtons(QMessageBox::Apply | QMessageBox::Ignore | QMessageBox::Cancel);
msgBoxPolicy.setDefaultButton(QMessageBox::Apply);
msgBoxPolicy.setIcon(QMessageBox::Icon::Information);
qint32 ret = msgBoxPolicy.exec();
switch (ret) {
case QMessageBox::Apply:
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(true)), GkXmppCfg::XmppAutoReconnect);
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(false)), GkXmppCfg::XmppAutoReconnectIgnore);
return;
case QMessageBox::Ignore:
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(true)), GkXmppCfg::XmppAutoReconnectIgnore);
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(false)), GkXmppCfg::XmppAutoReconnect);
return;
case QMessageBox::Cancel:
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(false)), GkXmppCfg::XmppAutoReconnect);
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(false)), GkXmppCfg::XmppAutoReconnectIgnore);
return;
default:
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(false)), GkXmppCfg::XmppAutoReconnect);
gkDb->write_xmpp_settings(QString::fromStdString(gkDb->boolEnum(false)), GkXmppCfg::XmppAutoReconnectIgnore);
return;
}
}
}
m_rosterList.clear(); // Clear the roster-list upon disconnection from given XMPP server!
});
} catch (const std::exception &e) {
......@@ -933,7 +901,7 @@ void GkXmppClient::getArchivedMessages(const QString &to, const QString &node, c
}
}
m_xmppMamMgr->retrieveArchivedMessages(to, "", jid, start, QDateTime(), resultSetQuery);
m_xmppMamMgr->retrieveArchivedMessages(to, "", jid, QDateTime::currentDateTime().addDays(-28), QDateTime::currentDateTime(), resultSetQuery);
return;
}
......
......@@ -947,7 +947,9 @@ MainWindow::~MainWindow()
vu_meter_thread.join();
}
delete db; // Free the pointer for the Google LevelDB library!
// delete db;
// TODO: Must fix SEGFAULT's that occur with the aforementioned line of code...
delete ui;
}
......
......@@ -168,12 +168,6 @@ GkXmppMessageDialog::GkXmppMessageDialog(QPointer<GekkoFyre::StringFuncs> string
QObject::connect(m_xmppClient, &QXmppClient::disconnected, this, [=]() {
ui->textEdit_tx_msg_dialog->setEnabled(false);
});
QObject::connect(this, &GkXmppMessageDialog::finished, this, [=]() {
for (const auto &bareJid: m_bareJids) {
getArchivedMessagesFromDb(bareJid, false, false);
}
});
} catch (const std::exception &e) {
gkEventLogger->publishEvent(tr("An error has occurred related to XMPP functions. The error in question:\n\n%1").arg(QString::fromStdString(e.what())),
GkSeverity::Fatal, "", false, true, false, true);
......@@ -530,6 +524,7 @@ void GkXmppMessageDialog::getArchivedMessages()
* LevelDB database that is associated with this user's instance of Small World Deluxe, and insert them into the chat
* window, thereby saving bandwidth from not having to unnecessarily re-download messages from the given XMPP server
* again.
* NOTE: The Google LevelDB functionality is currently disabled!
* @author Phobos A. D'thorga <phobos.gekko@gekkofyre.io>
* @param bareJid The user we are in communiqué with!
* @param insertData Whether to insert the archived messages into the given QTableView or not.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment