Fix compilation with e2ee disabled

This commit is contained in:
Carl Schwan
2023-07-28 13:01:54 +02:00
parent c22c74f735
commit 7c1b43bcad
2 changed files with 8 additions and 0 deletions

View File

@@ -185,8 +185,10 @@ int main(int argc, char *argv[])
initLogging(); initLogging();
#if Quotient_VERSION_MINOR == 8 #if Quotient_VERSION_MINOR == 8
#ifdef Quotient_E2EE_ENABLED
Connection::setEncryptionDefault(true); Connection::setEncryptionDefault(true);
#endif #endif
#endif
#ifdef NEOCHAT_FLATPAK #ifdef NEOCHAT_FLATPAK
// Copy over the included FontConfig configuration to the // Copy over the included FontConfig configuration to the

View File

@@ -56,6 +56,7 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const
if (device.deviceId == m_connection->deviceId()) { if (device.deviceId == m_connection->deviceId()) {
return This; return This;
} }
#ifdef Quotient_E2EE_ENABLED
if (!m_connection->isKnownE2eeCapableDevice(m_connection->userId(), device.deviceId)) { if (!m_connection->isKnownE2eeCapableDevice(m_connection->userId(), device.deviceId)) {
return Unencrypted; return Unencrypted;
} }
@@ -64,6 +65,9 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const
} else { } else {
return Unverified; return Unverified;
} }
#else
return Unverified;
#endif
} }
return {}; return {};
} }
@@ -147,6 +151,7 @@ void DevicesModel::setConnection(Connection *connection)
Q_EMIT connectionChanged(); Q_EMIT connectionChanged();
fetchDevices(); fetchDevices();
#ifdef Quotient_E2EE_ENABLED
connect(m_connection, &Connection::sessionVerified, this, [this](const QString &userId, const QString &deviceId) { connect(m_connection, &Connection::sessionVerified, this, [this](const QString &userId, const QString &deviceId) {
Q_UNUSED(deviceId); Q_UNUSED(deviceId);
if (userId == Controller::instance().activeConnection()->userId()) { if (userId == Controller::instance().activeConnection()->userId()) {
@@ -156,6 +161,7 @@ void DevicesModel::setConnection(Connection *connection)
connect(m_connection, &Connection::finishedQueryingKeys, this, [this]() { connect(m_connection, &Connection::finishedQueryingKeys, this, [this]() {
fetchDevices(); fetchDevices();
}); });
#endif
} }
#include "moc_devicesmodel.cpp" #include "moc_devicesmodel.cpp"