X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/a4ba6170ea7696e085b07adfef73eeb8b77cb8e2..5dc43aab3cc1243f9989dd6a0c7dd3350c3f709b:/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java diff --git a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java index e8b1fcb2..469ee3b6 100644 --- a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java @@ -1,10 +1,10 @@ /* ownCloud Android client application * Copyright (C) 2011 Bartek Przybylski + * Copyright (C) 2012-2013 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,8 +28,9 @@ import org.apache.http.client.ClientProtocolException; import org.apache.http.conn.ConnectionKeepAliveStrategy; import org.apache.http.protocol.HttpContext; -import com.owncloud.android.authenticator.AccountAuthenticator; +import com.owncloud.android.AccountUtils; import com.owncloud.android.datamodel.DataStorageManager; +import com.owncloud.android.network.OwnCloudClientUtils; import android.accounts.Account; import android.accounts.AccountManager; @@ -38,7 +39,6 @@ import android.accounts.OperationCanceledException; import android.content.AbstractThreadedSyncAdapter; import android.content.ContentProviderClient; import android.content.Context; -import android.net.Uri; import eu.alefzero.webdav.WebdavClient; /** @@ -142,23 +142,14 @@ public abstract class AbstractOwnCloudSyncAdapter extends return null; } - protected Uri getUri() { - return Uri.parse(this.getAccountManager().getUserData(getAccount(), - AccountAuthenticator.KEY_OC_URL)); - } - - protected WebdavClient getClient() throws OperationCanceledException, - AuthenticatorException, IOException { - if (mClient == null) { - if (this.getAccountManager().getUserData(getAccount(), - AccountAuthenticator.KEY_OC_URL) == null) { - throw new UnknownHostException(); - } - mClient = new WebdavClient(account, getContext()); - mClient.allowSelfsignedCertificates(); - // mHost = mClient.getTargetHost(); + protected void initClientForCurrentAccount() throws OperationCanceledException, AuthenticatorException, IOException { + if (AccountUtils.constructFullURLForAccount(getContext(), account) == null) { + throw new UnknownHostException(); } - + mClient = OwnCloudClientUtils.createOwnCloudClient(account, getContext()); + } + + protected WebdavClient getClient() { return mClient; } } \ No newline at end of file