Fix crash got with: 1. try to rename / delete a file with an outdated access token...
[pub/Android/ownCloud.git] / src / com / owncloud / android / network / OwnCloudClientUtils.java
index b334fdf..7b2b64f 100644 (file)
@@ -1,9 +1,9 @@
 /* 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
+ *   the Free Software Foundation, either version 2 of the License, or
  *   (at your option) any later version.
  *
  *   This program is distributed in the hope that it will be useful,
@@ -38,7 +38,7 @@ import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
 import org.apache.http.conn.ssl.X509HostnameVerifier;
 
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 
 import eu.alefzero.webdav.WebdavClient;
 
@@ -130,26 +130,7 @@ public class OwnCloudClientUtils {
         
         return client;
     }
-    
-    /**
-     * Creates a WebdavClient to try a new account before saving it
-     * 
-     * @param uri       URL to the ownCloud server
-     * @param username  User name
-     * @param password  User password
-     * @param context   Android context where the WebdavClient is being created.
-     * @return          A WebdavClient object ready to be used
-     */
-    public static WebdavClient createOwnCloudClient(Uri uri, String username, String password, Context context) {
-        //Log.d(TAG, "Creating WebdavClient for " + username + "@" + uri);
-        
-        WebdavClient client = createOwnCloudClient(uri, context);
-        
-        client.setBasicCredentials(username, password);
-        
-        return client;
-    }
-    
+
     
     /**
      * Creates a WebdavClient to access a URL and sets the desired parameters for ownCloud client connections.
@@ -181,32 +162,6 @@ public class OwnCloudClientUtils {
     
     
     /**
-     * Allows or disallows self-signed certificates in ownCloud servers to reach
-     * 
-     * @param allow     'True' to allow, 'false' to disallow
-     */
-    public static void allowSelfsignedCertificates(boolean allow) {
-        Protocol pr = null;
-        try {
-            pr = Protocol.getProtocol("https");
-            if (pr != null && mDefaultHttpsProtocol == null) {
-               mDefaultHttpsProtocol = pr;
-            }
-        } catch (IllegalStateException e) {
-            // nothing to do here; really
-        }
-        boolean isAllowed = (pr != null && pr.getSocketFactory() instanceof EasySSLSocketFactory);
-        if (allow && !isAllowed) {
-            Protocol.registerProtocol("https", new Protocol("https", new EasySSLSocketFactory(), 443));
-        } else if (!allow && isAllowed) {
-               if (mDefaultHttpsProtocol != null) {
-                       Protocol.registerProtocol("https", mDefaultHttpsProtocol);
-               }
-        }
-    }
-
-    
-    /**
      * Registers or unregisters the proper components for advanced SSL handling.
      * @throws IOException 
      */