[Sharing] Also add sync status to SHARE_STATUS command
authorRoeland Jago Douma <rullzer@owncloud.com>
Wed, 25 Nov 2015 08:40:21 +0000 (09:40 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Wed, 25 Nov 2015 08:40:21 +0000 (09:40 +0100)
src/gui/socketapi.cpp

index 6dfbfd3fe8bd07bd73182d6ef02d8ec2ff448be3..1f75ad5d5f8703d811378c8cbc72ddda7c0c7f39 100644 (file)
@@ -435,6 +435,17 @@ void SocketApi::command_SHARE_STATUS(const QString &localFile, QIODevice *socket
         const QString message = QLatin1String("SHARE_STATUS:NOP:")+QDir::toNativeSeparators(localFile);
         sendMessage(socket, message);
     } else {
+        const QString file = QDir::cleanPath(localFile).mid(shareFolder->cleanPath().length()+1);
+        SyncFileStatus fileStatus = this->fileStatus(shareFolder, file);
+
+        // Verify the file is on the server (to our knowledge of course)
+        if (fileStatus.tag() != SyncFileStatus::STATUS_SYNC &&
+            fileStatus.tag() != SyncFileStatus::STATUS_UPDATED) {
+            const QString message = QLatin1String("SHARE_STATUS:NOTSYNCED:")+QDir::toNativeSeparators(localFile);
+            sendMessage(socket, message);
+            return;
+        }
+
         const Capabilities capabilities = shareFolder->accountState()->account()->capabilities();
 
         if (!capabilities.shareAPI()) {