Remove encrypt status job fetching from ClientSideEncryption
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 8 Dec 2020 14:51:48 +0000 (15:51 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:23 +0000 (10:59 +0100)
This is now unused.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/clientsideencryption.cpp
src/libsync/clientsideencryption.h

index 5585fdb3120cb8fb91a739754c4e65414441ad45..69dfafc62235301c190d62959e8cf252da4966dc 100644 (file)
@@ -764,6 +764,8 @@ QByteArray encryptStringAsymmetric(EVP_PKEY *publicKey, const QByteArray& data)
 }
 
 }
+
+
 ClientSideEncryption::ClientSideEncryption() = default;
 
 void ClientSideEncryption::setAccount(AccountPtr account)
@@ -1224,67 +1226,6 @@ void ClientSideEncryption::getPublicKeyFromServer()
     job->start();
 }
 
-void ClientSideEncryption::scheduleFolderEncryptedStatusJob(const QString &path)
-{
-    auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, path, this);
-    connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusReceived,
-            this, &ClientSideEncryption::folderEncryptedStatusFetched);
-    connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusError,
-            this, &ClientSideEncryption::folderEncryptedStatusError);
-    getEncryptedStatus->start();
-
-    _folderStatusJobs.append(getEncryptedStatus);
-}
-
-void ClientSideEncryption::fetchFolderEncryptedStatus()
-{
-    _refreshingEncryptionStatus = true;
-    _folder2encryptedStatus.clear();
-    scheduleFolderEncryptedStatusJob(QString());
-}
-
-void ClientSideEncryption::folderEncryptedStatusFetched(const QHash<QString, bool>& result)
-{
-    auto job = static_cast<GetFolderEncryptStatusJob *>(sender());
-    Q_ASSERT(job);
-
-    _folderStatusJobs.removeAll(job);
-
-    qCDebug(lcCse) << "Retrieved correctly the encrypted status of the folders for" << job->folder() << result;
-
-    // FIXME: Can be replaced by _folder2encryptedStatus.insert(result); once we depend on Qt 5.15
-    for (auto it = result.constKeyValueBegin(); it != result.constKeyValueEnd(); ++it) {
-        _folder2encryptedStatus.insert((*it).first, (*it).second);
-    }
-
-    for (const auto &folder : result.keys()) {
-        if (folder == job->folder()) {
-            continue;
-        }
-        scheduleFolderEncryptedStatusJob(folder);
-    }
-
-    if (_folderStatusJobs.isEmpty()) {
-        _refreshingEncryptionStatus = false;
-        emit folderEncryptedStatusFetchDone(_folder2encryptedStatus);
-    }
-}
-
-void ClientSideEncryption::folderEncryptedStatusError(int error)
-{
-    auto job = static_cast<GetFolderEncryptStatusJob *>(sender());
-    Q_ASSERT(job);
-
-    qCDebug(lcCse) << "Failed to retrieve the status of the folders for" << job->folder() << error;
-
-    _folderStatusJobs.removeAll(job);
-
-    if (_folderStatusJobs.isEmpty()) {
-        _refreshingEncryptionStatus = false;
-        emit folderEncryptedStatusFetchDone(_folder2encryptedStatus);
-    }
-}
-
 FolderMetadata::FolderMetadata(AccountPtr account, const QByteArray& metadata, int statusCode) : _account(account)
 {
     if (metadata.isEmpty() || statusCode == 404) {
index 5622c2d0bef923c76f469ace3b466e2bc55adea3..37d220ec25ec45c30217e6e059c2f4f18eb7466c 100644 (file)
@@ -23,8 +23,6 @@ class ReadPasswordJob;
 
 namespace OCC {
 
-class GetFolderEncryptStatusJob;
-
 QString baseUrl();
 
 namespace EncryptionHelper {
@@ -80,7 +78,6 @@ public:
     void generateKeyPair();
     void generateCSR(EVP_PKEY *keyPair);
     void encryptPrivateKey();
-    void fetchFolderEncryptedStatus();
 
     void forgetSensitiveData();
 
@@ -90,9 +87,6 @@ public slots:
     void slotRequestMnemonic();
 
 private slots:
-    void folderEncryptedStatusFetched(const QHash<QString, bool> &values);
-    void folderEncryptedStatusError(int error);
-
     void publicKeyFetched(QKeychain::Job *incoming);
     void privateKeyFetched(QKeychain::Job *incoming);
     void mnemonicKeyFetched(QKeychain::Job *incoming);
@@ -101,10 +95,8 @@ signals:
     void initializationFinished();
     void mnemonicGenerated(const QString& mnemonic);
     void showMnemonic(const QString& mnemonic);
-    void folderEncryptedStatusFetchDone(const QHash<QString, bool> &values);
 
 private:
-    void scheduleFolderEncryptedStatusJob(const QString &path);
     void getPrivateKeyFromServer();
     void getPublicKeyFromServer();
     void decryptPrivateKey(const QByteArray &key);
@@ -117,10 +109,6 @@ private:
 
     AccountPtr _account;
     bool isInitialized = false;
-    bool _refreshingEncryptionStatus = false;
-    //TODO: Save this on disk.
-    QHash<QString, bool> _folder2encryptedStatus;
-    QVector<GetFolderEncryptStatusJob*> _folderStatusJobs;
 
 public:
     //QSslKey _privateKey;