Skip to content

Commit

Permalink
Review comments. Part II.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Dec 6, 2023
1 parent 07e0504 commit 0d44818
Show file tree
Hide file tree
Showing 18 changed files with 738 additions and 490 deletions.
6 changes: 6 additions & 0 deletions src/libsync/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ set(libsync_SRCS
clientproxy.cpp
clientstatusreporting.h
clientstatusreporting.cpp
clientstatusreportingcommon.h
clientstatusreportingcommon.cpp
clientstatusreportingdatabase.h
clientstatusreportingdatabase.cpp
clientstatusreportingnetwork.h
clientstatusreportingnetwork.cpp
clientstatusreportingrecord.h
cookiejar.h
cookiejar.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void Account::trySetupClientStatusReporting()
}
}

void Account::reportClientStatus(const ClientStatusReporting::Status status) const
void Account::reportClientStatus(const ClientStatusReportingStatus status) const
{
if (_clientStatusReporting) {
_clientStatusReporting->reportClientStatus(status);
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/account.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class OWNCLOUDSYNC_EXPORT Account : public QObject

void trySetupClientStatusReporting();

void reportClientStatus(const ClientStatusReporting::Status status) const;
void reportClientStatus(const ClientStatusReportingStatus status) const;

[[nodiscard]] std::shared_ptr<UserStatusConnector> userStatusConnector() const;

Expand Down
18 changes: 9 additions & 9 deletions src/libsync/clientsideencryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ bool ClientSideEncryption::sensitiveDataRemaining() const
void ClientSideEncryption::failedToInitialize(const AccountPtr &account)
{
forgetSensitiveData(account);
account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
Q_EMIT initializationFinished();
}

Expand Down Expand Up @@ -1776,7 +1776,7 @@ void FolderMetadata::setupExistingMetadata(const QByteArray& metadata)

if (metadataKeys.isEmpty()) {
qCDebug(lcCse()) << "Could not migrate. No metadata keys found!";
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return;
}

Expand All @@ -1789,7 +1789,7 @@ void FolderMetadata::setupExistingMetadata(const QByteArray& metadata)

if (_metadataKey.isEmpty()) {
qCDebug(lcCse()) << "Could not setup existing metadata with missing metadataKeys!";
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return;
}

Expand Down Expand Up @@ -1864,7 +1864,7 @@ void FolderMetadata::setupExistingMetadata(const QByteArray& metadata)
} else {
_metadataKey.clear();
_files.clear();
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return;
}
}
Expand Down Expand Up @@ -1903,7 +1903,7 @@ QByteArray FolderMetadata::decryptData(const QByteArray &data) const
if (decryptResult.isEmpty())
{
qCDebug(lcCse()) << "ERROR. Could not decrypt the metadata key";
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return {};
}
return QByteArray::fromBase64(decryptResult);
Expand All @@ -1921,7 +1921,7 @@ QByteArray FolderMetadata::decryptDataUsingKey(const QByteArray &data,
if (decryptResult.isEmpty())
{
qCDebug(lcCse()) << "ERROR. Could not decrypt";
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return {};
}

Expand Down Expand Up @@ -1985,7 +1985,7 @@ QByteArray FolderMetadata::encryptedMetadata() const {

if (_metadataKey.isEmpty()) {
qCDebug(lcCse) << "Metadata generation failed! Empty metadata key!";
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
return {};
}
const auto version = _account->capabilities().clientSideEncryptionVersion();
Expand All @@ -2007,7 +2007,7 @@ QByteArray FolderMetadata::encryptedMetadata() const {

QString encryptedEncrypted = encryptJsonObject(encryptedDoc.toJson(QJsonDocument::Compact), _metadataKey);
if (encryptedEncrypted.isEmpty()) {
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
qCDebug(lcCse) << "Metadata generation failed!";
}
QJsonObject file;
Expand Down Expand Up @@ -2095,7 +2095,7 @@ bool FolderMetadata::moveFromFileDropToFiles()

if (decryptedKey.isEmpty() || decryptedAuthenticationTag.isEmpty() || decryptedInitializationVector.isEmpty()) {
qCDebug(lcCseMetadata) << "failed to decrypt filedrop entry" << it.key();
_account->reportClientStatus(OCC::ClientStatusReporting::Status::E2EeError_GeneralError);
_account->reportClientStatus(OCC::ClientStatusReportingStatus::E2EeError_GeneralError);
continue;
}

Expand Down
Loading

0 comments on commit 0d44818

Please sign in to comment.