Преглед изворни кода

Merge git://github.com/NvanAdrichem/client into 2.1, pull #4060

Klaas Freitag пре 10 година
родитељ
комит
8abaf92083
7 измењених фајлова са 46 додато и 0 уклоњено
  1. 6 0
      doc/owncloudcmd.1.rst
  2. 6 0
      doc/owncloudcmd.rst
  3. 18 0
      src/cmd/cmd.cpp
  4. 9 0
      src/libsync/account.cpp
  5. 1 0
      src/libsync/account.h
  6. 5 0
      src/libsync/theme.cpp
  7. 1 0
      src/libsync/theme.h

+ 6 - 0
doc/owncloudcmd.1.rst

@@ -50,6 +50,12 @@ OPTIONS
 ``--httpproxy  http://[user@pass:]<server>:<port>``
       Uses ``server`` as HTTP proxy.
 
+``--nonshib``
+      Uses Non Shibboleth WebDAV Authentication
+
+``--davpath [path]``
+      Overrides the WebDAV Path with ``path``
+
 Example
 =======
 To synchronize the ownCloud directory ``Music`` to the local directory ``media/music``

+ 6 - 0
doc/owncloudcmd.rst

@@ -42,6 +42,12 @@ Other command line switches supported by ``owncloudcmd`` include the following:
 ``--unsyncedfolders [file]`` 
       File containing list of folders to not sync
 
+``--nonshib``
+      Uses Non Shibboleth WebDAV Authentication
+
+``--davpath [path]``
+      Overrides the WebDAV Path with ``path``
+
 Credential Handling
 ~~~~~~~~~~~~~~~~~~~
 

+ 18 - 0
src/cmd/cmd.cpp

@@ -56,8 +56,10 @@ struct CmdOptions {
     bool useNetrc;
     bool interactive;
     bool ignoreHiddenFiles;
+    bool nonShib;
     QString exclude;
     QString unsyncedfolders;
+    QString davPath;
     int restartTimes;
 };
 
@@ -156,6 +158,8 @@ void help()
     std::cout << "  --password, -p [pass]  Use [pass] as password" << std::endl;
     std::cout << "  -n                     Use netrc (5) for login" << std::endl;
     std::cout << "  --non-interactive      Do not block execution with interaction" << std::endl;
+    std::cout << "  --nonshib              Use Non Shibboleth WebDAV authentication" << std::endl;
+    std::cout << "  --davpath [path]       Custom themed dav path, overrides --nonshib" << std::endl;
     std::cout << "  --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl;
     std::cout << "  -h                     Sync hidden files,do not ignore them" << std::endl;
     std::cout << "  --version, -v          Display version and exit" << std::endl;
@@ -224,6 +228,10 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
                 options->exclude = it.next();
         } else if( option == "--unsyncedfolders" && !it.peekNext().startsWith("-") ) {
             options->unsyncedfolders = it.next();
+        } else if( option == "--nonshib" ) {
+            options->nonShib = true;
+        } else if( option == "--davpath" && !it.peekNext().startsWith("-") ) {
+            options->davPath = it.next();
         } else if( option == "--max-sync-retries" && !it.peekNext().startsWith("-") ) {
             options->restartTimes = it.next().toInt();
         } else {
@@ -272,6 +280,7 @@ int main(int argc, char **argv) {
     options.useNetrc = false;
     options.interactive = true;
     options.ignoreHiddenFiles = true;
+    options.nonShib = false;
     options.restartTimes = 3;
     ClientProxy clientProxy;
 
@@ -287,6 +296,15 @@ int main(int argc, char **argv) {
     if(!options.target_url.endsWith("/")) {
         options.target_url.append("/");
     }
+   
+    if( options.nonShib ) {
+        account->setNonShib(true);
+    }
+
+    if(!options.davPath.isEmpty()) {
+        account->setDavPath( options.davPath );
+    }
+ 
     if( !options.target_url.contains( account->davPath() )) {
         options.target_url.append(account->davPath());
     }

+ 9 - 0
src/libsync/account.cpp

@@ -497,6 +497,15 @@ bool Account::rootEtagChangesNotOnlySubFolderEtags()
     return (serverVersionInt() >= 0x080100);
 }
 
+void Account::setNonShib(bool nonShib)
+{
+    if( nonShib ) {
+        _davPath = Theme::instance()->webDavPathNonShib();
+    } else {
+        _davPath = Theme::instance()->webDavPath();
+    } 
+}
+
 
 
 } // namespace OCC

+ 1 - 0
src/libsync/account.h

@@ -67,6 +67,7 @@ public:
      */
     QString davPath() const;
     void setDavPath(const QString&s) { _davPath = s; }
+    void setNonShib(bool nonShib);
 
     static AccountPtr create();
     ~Account();

+ 5 - 0
src/libsync/theme.cpp

@@ -412,5 +412,10 @@ QString Theme::webDavPath() const
     return QLatin1String("remote.php/webdav/");
 }
 
+QString Theme::webDavPathNonShib() const
+{
+    return QLatin1String("remote.php/nonshib-webdav/");
+}
+
 } // end namespace client
 

+ 1 - 0
src/libsync/theme.h

@@ -227,6 +227,7 @@ public:
      * it has a trailing slash, for example "remote.php/webdav/".
      */
     virtual QString webDavPath() const;
+    virtual QString webDavPathNonShib() const;
 
 protected:
 #ifndef TOKEN_AUTH_ONLY