[Pkg-owncloud-commits] [owncloud-client] 171/211: SocketAPI: Fix the shared symbol, including for owncloud6 Shared dir

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 22dd275b152ade49e0c2685f975ee36d674a11fb
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Oct 22 15:05:37 2014 +0200

    SocketAPI: Fix the shared symbol, including for owncloud6 Shared dir
    
    The shared symbol would not appear if the status came for estimateState
    
    Also added the shared symbol for the Shared/ directories (owncloud 6 compat)
---
 src/mirall/socketapi.cpp | 85 +++++++++++++++++++++++-------------------------
 1 file changed, 41 insertions(+), 44 deletions(-)

diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp
index 6a72591..d5b526a 100644
--- a/src/mirall/socketapi.cpp
+++ b/src/mirall/socketapi.cpp
@@ -517,71 +517,68 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa
         }
     }
 
-
     SyncFileStatus status(SyncFileStatus::STATUS_NONE);
-    if (type == CSYNC_FTW_TYPE_DIR) {
-        if (folder->estimateState(fileName, type, &status)) {
-            qDebug() << Q_FUNC_INFO << "Folder estimated status for" << fileName << "to" << status.toSocketAPIString();
+    SyncJournalFileRecord rec = dbFileRecord_capi(folder, unixFileName );
+
+    if (folder->estimateState(fileName, type, &status)) {
+        qDebug() << Q_FUNC_INFO << "Folder estimated status for" << fileName << "to" << status.toSocketAPIString();
+    } else if (fileName == "") {
+        // sync folder itself
+        switch (folder->syncResult().status()) {
+        case SyncResult::Undefined:
+        case SyncResult::NotYetStarted:
+        case SyncResult::SyncPrepare:
+        case SyncResult::SyncRunning:
+            status.set(SyncFileStatus::STATUS_EVAL);
             return status;
-        }
-        if (fileName == "") {
-            // sync folder itself
-            switch (folder->syncResult().status()) {
-            case SyncResult::Undefined:
-            case SyncResult::NotYetStarted:
-            case SyncResult::SyncPrepare:
-            case SyncResult::SyncRunning:
-                status.set(SyncFileStatus::STATUS_EVAL);
-                return status;
 
-            case SyncResult::Success:
-            case SyncResult::Problem:
-                status.set(SyncFileStatus::STATUS_SYNC);
-                return status;
+        case SyncResult::Success:
+        case SyncResult::Problem:
+            status.set(SyncFileStatus::STATUS_SYNC);
+            return status;
 
-            case SyncResult::Error:
-            case SyncResult::SetupError:
-            case SyncResult::SyncAbortRequested:
-                status.set(SyncFileStatus::STATUS_ERROR);
-                return status;
+        case SyncResult::Error:
+        case SyncResult::SetupError:
+        case SyncResult::SyncAbortRequested:
+            status.set(SyncFileStatus::STATUS_ERROR);
+            return status;
 
-            case SyncResult::Paused:
-                status.set(SyncFileStatus::STATUS_IGNORE);
-                return status;
-            }
+        case SyncResult::Paused:
+            status.set(SyncFileStatus::STATUS_IGNORE);
+            return status;
         }
-        SyncJournalFileRecord rec = dbFileRecord_capi(folder, unixFileName );
+    } else if (type == CSYNC_FTW_TYPE_DIR) {
         if (rec.isValid()) {
             status.set(SyncFileStatus::STATUS_SYNC);
-            if (rec._remotePerm.contains("S")) {
-               status.setSharedWithMe(true);
-            }
         } else {
-            qDebug() << Q_FUNC_INFO << "Could not determine state for folder" << fileName << "will set STATUS_EVAL";
-            status.set(SyncFileStatus::STATUS_EVAL);
+            qDebug() << Q_FUNC_INFO << "Could not determine state for folder" << fileName << "will set STATUS_NEW";
+            status.set(SyncFileStatus::STATUS_NEW);
         }
     } else if (type == CSYNC_FTW_TYPE_FILE) {
-        if (folder->estimateState(fileName, type, &status)) {
-            return status;
-        }
-        SyncJournalFileRecord rec = dbFileRecord_capi(folder, unixFileName );
         if (rec.isValid()) {
-            if (rec._remotePerm.contains("S")) {
-               status.setSharedWithMe(true);
-            }
             if( FileSystem::getModTime(fi.absoluteFilePath()) == Utility::qDateTimeToTime_t(rec._modtime) ) {
                 status.set(SyncFileStatus::STATUS_SYNC);
-                return status;
             } else {
                 status.set(SyncFileStatus::STATUS_EVAL);
-                return status;
             }
+        } else {
+            qDebug() << Q_FUNC_INFO << "Could not determine state for file" << fileName << "will set STATUS_NEW";
+            status.set(SyncFileStatus::STATUS_NEW);
         }
-        qDebug() << Q_FUNC_INFO << "Could not determine state for file" << fileName << "will set STATUS_NEW";
         status.set(SyncFileStatus::STATUS_NEW);
-        return status;
     }
 
+    if (rec.isValid()) {
+        if (rec._remotePerm.isNull()) {
+            // probably owncloud 6, that does not have permissions flag yet.
+            QString url = folder->remoteUrl().toString() + fileName;
+            if (url.contains(QLatin1String("/remote.php/webdav/Shared/"))) {
+                status.setSharedWithMe(true);
+            }
+        } else if (rec._remotePerm.contains("S")) {
+            status.setSharedWithMe(true);
+        }
+    }
     return status;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list