Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-02-17 20:31:03 +0400
committerOlivier Goffart <ogoffart@woboq.com>2014-02-17 20:31:03 +0400
commita39caa1cda3f4cde4294dcd13fb4c1d8eb621c8a (patch)
tree3cdb1c4bb5d7692da6d7072aac2824d5e4d93641 /src/owncloudcmd
parenta4ee8d6f6fd2fdf73e1963a55404d09dc5af881b (diff)
Make owncloudcmd work with the parallel upload/download
Also make it work when there syncing a remote subfolder
Diffstat (limited to 'src/owncloudcmd')
-rw-r--r--src/owncloudcmd/owncloudcmd.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index d8e53a6da..6bf02a87b 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -27,10 +27,13 @@
#include "logger.h"
#include "csync.h"
#include "mirall/clientproxy.h"
+#include "account.h"
+#include <creds/httpcredentials.h>
using namespace Mirall;
-int getauth(const char* prompt, char* buf, size_t len, int echo, int verify, void*)
+
+int getauth(const char* prompt, char* buf, size_t len, int, int, void*)
{
std::cout << "** Authentication required: \n" << prompt << std::endl;
std::string s;
@@ -115,6 +118,21 @@ int main(int argc, char **argv) {
parseOptions( app.arguments(), &options );
+
+ QUrl url(options.target_url.toUtf8());
+ Account account;
+
+ // Find the folder and the original owncloud url
+ QStringList splitted = url.path().split(Account::davPath());
+ url.setPath(splitted.value(0));
+ url.setScheme(url.scheme().replace("owncloud", "http"));
+ QString folder = splitted.value(1);
+
+ account.setUrl(url);
+ account.setCredentials(new HttpCredentials(url.userName(), url.password()));
+ AccountManager::instance()->setAccount(&account);
+
+
CSYNC *_csync_ctx;
if( csync_create( &_csync_ctx, options.source_dir.toUtf8(),
options.target_url.toUtf8()) < 0 ) {
@@ -175,7 +193,7 @@ int main(int argc, char **argv) {
}
SyncJournalDb db(options.source_dir);
- CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), &db);
+ CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
QObject::connect(&csyncthread, SIGNAL(finished()), &app, SLOT(quit()));
csyncthread.startSync();