[Pkg-owncloud-commits] [owncloud-client] 108/332: SocketAPI: Merge command_RETRIEVE_FOLDER_STATUS and command_RETRIEVE_FILE_STATUS

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:46 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 db2c198feb0bec4bd870db5e370b5c4cdcbf4dba
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Jun 19 15:02:27 2014 +0200

    SocketAPI: Merge command_RETRIEVE_FOLDER_STATUS and command_RETRIEVE_FILE_STATUS
    
    They do the same thing because fileStatus calls recursiveFolderStatus
    for directories anyway
---
 src/mirall/socketapi.cpp | 54 +++---------------------------------------------
 1 file changed, 3 insertions(+), 51 deletions(-)

diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp
index 8150962..3d8d38b 100644
--- a/src/mirall/socketapi.cpp
+++ b/src/mirall/socketapi.cpp
@@ -292,58 +292,10 @@ void SocketApi::broadcastMessage(const QString& message)
 
 void SocketApi::command_RETRIEVE_FOLDER_STATUS(const QString& argument, QLocalSocket* socket)
 {
-    qDebug() << Q_FUNC_INFO << argument;
-    QString statusString;
-
-    if( !socket ) {
-        qDebug() << "No valid socket object.";
-        return;
-    }
-
-    Folder* folder = FolderMan::instance()->folderForPath( QUrl::fromLocalFile(argument) );
-    // this can happen in offline mode e.g.: nothing to worry about
-    if (!folder) {
-        DEBUG << "folder offline or not watched:" << argument;
-        statusString = QLatin1String("NOP");
-    }
-
-    QDir dir(argument);
-    if( statusString.isEmpty() ) {
-        const QStringList fileEntries = dir.entryList( QDir::Files );
-        foreach(const QString file, fileEntries) {
-            const QString absoluteFilePath = dir.absoluteFilePath(file);
-            SyncFileStatus fileStatus = SocketApiHelper::fileStatus(folder, absoluteFilePath.mid(folder->path().length()) );
-            if( fileStatus == FILE_STATUS_STAT_ERROR ) {
-                qDebug() << "XXXXXXXXXXXX FileStatus is STAT ERROR for " << absoluteFilePath;
-            }
-            if( fileStatus != FILE_STATUS_SYNC ) {
-                qDebug() << "SyncFileStatus for " << absoluteFilePath << " is " << fileStatus;
-                // we found something that is not in sync
-                statusString = QLatin1String("NEED_SYNC");
-                break;
-            }
-        }
-    }
-
-    if( statusString.isEmpty() ) { // if  it is still empty, we check the dirs recursively.
-        const QStringList dirEntries = dir.entryList( QDir::AllDirs | QDir::NoDotAndDotDot );
-
-        foreach(const QString entry, dirEntries) {
-            QString absoluteFilePath = dir.absoluteFilePath(entry);
-            SyncFileStatus sfs = SocketApiHelper::recursiveFolderStatus(folder, absoluteFilePath.mid(folder->path().length()) );
-            if( sfs != FILE_STATUS_SYNC ) {
-                statusString = QLatin1String("NEED_SYNC");
-                break;
-            }
-        }
-    }
-
-    if( statusString.isEmpty() ) {
-        statusString = QLatin1String("OK");
-    }
+    // This command is the same as RETRIEVE_FILE_STATUS
 
-    QString message = QLatin1String("STATUS:")+statusString+QLatin1Char(':')+argument;
-    sendMessage(socket, message);
+    qDebug() << Q_FUNC_INFO << argument;
+    command_RETRIEVE_FILE_STATUS(argument, socket);
 }
 
 void SocketApi::command_RETRIEVE_FILE_STATUS(const QString& argument, QLocalSocket* socket)

-- 
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