X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/6da5d3c212d80042e07c29e9cedbf40643039b4b..d83491f62df97f912c650f0de499a87d14a494d0:/src/com/owncloud/android/authentication/AccountUtils.java diff --git a/src/com/owncloud/android/authentication/AccountUtils.java b/src/com/owncloud/android/authentication/AccountUtils.java index 33c7e6a9..bd3a8e79 100644 --- a/src/com/owncloud/android/authentication/AccountUtils.java +++ b/src/com/owncloud/android/authentication/AccountUtils.java @@ -1,6 +1,8 @@ -/* ownCloud Android client application +/** + * ownCloud Android client application + * * Copyright (C) 2012 Bartek Przybylski - * Copyright (C) 2012-2013 ownCloud Inc. + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -18,9 +20,11 @@ package com.owncloud.android.authentication; +import java.util.Locale; + import com.owncloud.android.MainApp; -import com.owncloud.android.oc_framework.accounts.AccountTypeUtils; -import com.owncloud.android.oc_framework.utils.OwnCloudVersion; +import com.owncloud.android.lib.common.accounts.AccountTypeUtils; +import com.owncloud.android.lib.resources.status.OwnCloudVersion; import android.accounts.Account; import android.accounts.AccountManager; @@ -81,8 +85,18 @@ public class AccountUtils { MainApp.getAccountType()); if (account != null && account.name != null) { - for (Account ac : ocAccounts) { - if (ac.name.equals(account.name)) { + int lastAtPos = account.name.lastIndexOf("@"); + String hostAndPort = account.name.substring(lastAtPos + 1); + String username = account.name.substring(0, lastAtPos); + String otherHostAndPort, otherUsername; + Locale currentLocale = context.getResources().getConfiguration().locale; + for (Account otherAccount : ocAccounts) { + lastAtPos = otherAccount.name.lastIndexOf("@"); + otherHostAndPort = otherAccount.name.substring(lastAtPos + 1); + otherUsername = otherAccount.name.substring(0, lastAtPos); + if (otherHostAndPort.equals(hostAndPort) && + otherUsername.toLowerCase(currentLocale). + equals(username.toLowerCase(currentLocale))) { return true; } }