/* ownCloud Android client application\r
* Copyright (C) 2011 Bartek Przybylski\r
+ * Copyright (C) 2012-2013 ownCloud Inc.\r
*\r
* This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
+ * it under the terms of the GNU General Public License version 2,\r
+ * as published by the Free Software Foundation.\r
*\r
* This program is distributed in the hope that it will be useful,\r
* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
import org.apache.http.conn.ConnectionKeepAliveStrategy;\r
import org.apache.http.protocol.HttpContext;\r
\r
-import com.owncloud.android.authenticator.AccountAuthenticator;\r
+import com.owncloud.android.AccountUtils;\r
import com.owncloud.android.datamodel.DataStorageManager;\r
+import com.owncloud.android.network.OwnCloudClientUtils;\r
\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
import android.content.AbstractThreadedSyncAdapter;\r
import android.content.ContentProviderClient;\r
import android.content.Context;\r
-import android.net.Uri;\r
import eu.alefzero.webdav.WebdavClient;\r
\r
/**\r
return null;\r
}\r
\r
- protected Uri getUri() {\r
- return Uri.parse(this.getAccountManager().getUserData(getAccount(),\r
- AccountAuthenticator.KEY_OC_URL));\r
- }\r
-\r
- protected WebdavClient getClient() throws OperationCanceledException,\r
- AuthenticatorException, IOException {\r
- if (mClient == null) {\r
- if (this.getAccountManager().getUserData(getAccount(),\r
- AccountAuthenticator.KEY_OC_URL) == null) {\r
- throw new UnknownHostException();\r
- }\r
- mClient = new WebdavClient(account, getContext());\r
- mClient.allowSelfsignedCertificates();\r
- // mHost = mClient.getTargetHost();\r
+ protected void initClientForCurrentAccount() throws OperationCanceledException, AuthenticatorException, IOException {\r
+ if (AccountUtils.constructFullURLForAccount(getContext(), account) == null) {\r
+ throw new UnknownHostException();\r
}\r
-\r
+ mClient = OwnCloudClientUtils.createOwnCloudClient(account, getContext());\r
+ }\r
+ \r
+ protected WebdavClient getClient() {\r
return mClient;\r
}\r
}
\ No newline at end of file