mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
always use import for UrlEncodingHelper
This commit is contained in:
parent
2226ae6a8e
commit
010d8c9f7e
@ -33,6 +33,7 @@ import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.activity.K9Activity;
|
||||
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.AuthType;
|
||||
import com.fsck.k9.mail.ConnectionSecurity;
|
||||
@ -279,8 +280,8 @@ public class AccountSetupBasics extends K9Activity
|
||||
URI incomingUri = null;
|
||||
URI outgoingUri = null;
|
||||
try {
|
||||
String userEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(user);
|
||||
String passwordEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(password);
|
||||
String userEnc = UrlEncodingHelper.encodeUtf8(user);
|
||||
String passwordEnc = UrlEncodingHelper.encodeUtf8(password);
|
||||
|
||||
String incomingUsername = mProvider.incomingUsernameTemplate;
|
||||
incomingUsername = incomingUsername.replaceAll("\\$email", email);
|
||||
|
@ -62,6 +62,7 @@ import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.controller.MessageRetrievalListener;
|
||||
import com.fsck.k9.helper.StringUtils;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.helper.power.TracingPowerManager;
|
||||
import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock;
|
||||
@ -202,19 +203,19 @@ public class ImapStore extends Store {
|
||||
if (userinfo.endsWith(":")) {
|
||||
// Password is empty. This can only happen after an account was imported.
|
||||
authenticationType = AuthType.valueOf(userInfoParts[0]);
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
} else if (userInfoParts.length == 2) {
|
||||
authenticationType = AuthType.PLAIN;
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
password = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
password = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
} else if (userInfoParts.length == 3) {
|
||||
authenticationType = AuthType.valueOf(userInfoParts[0]);
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
|
||||
if (AuthType.EXTERNAL == authenticationType) {
|
||||
clientCertificateAlias = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[2]);
|
||||
clientCertificateAlias = UrlEncodingHelper.decodeUtf8(userInfoParts[2]);
|
||||
} else {
|
||||
password = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[2]);
|
||||
password = UrlEncodingHelper.decodeUtf8(userInfoParts[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,11 +254,11 @@ public class ImapStore extends Store {
|
||||
* @see ImapStore#decodeUri(String)
|
||||
*/
|
||||
public static String createUri(ServerSettings server) {
|
||||
String userEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.username);
|
||||
String userEnc = UrlEncodingHelper.encodeUtf8(server.username);
|
||||
String passwordEnc = (server.password != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.clientCertificateAlias) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.clientCertificateAlias) : "";
|
||||
|
||||
String scheme;
|
||||
switch (server.connectionSecurity) {
|
||||
|
@ -7,6 +7,7 @@ import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.controller.MessageRetrievalListener;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.*;
|
||||
import com.fsck.k9.mail.filter.Base64;
|
||||
@ -125,12 +126,12 @@ public class Pop3Store extends Store {
|
||||
passwordIndex++;
|
||||
authType = AuthType.valueOf(userInfoParts[0]);
|
||||
}
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[userIndex]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[userIndex]);
|
||||
if (userInfoParts.length > passwordIndex) {
|
||||
if (authType == AuthType.EXTERNAL) {
|
||||
clientCertificateAlias = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[passwordIndex]);
|
||||
clientCertificateAlias = UrlEncodingHelper.decodeUtf8(userInfoParts[passwordIndex]);
|
||||
} else {
|
||||
password = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[passwordIndex]);
|
||||
password = UrlEncodingHelper.decodeUtf8(userInfoParts[passwordIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,11 +152,11 @@ public class Pop3Store extends Store {
|
||||
* @see Pop3Store#decodeUri(String)
|
||||
*/
|
||||
public static String createUri(ServerSettings server) {
|
||||
String userEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.username);
|
||||
String userEnc = UrlEncodingHelper.encodeUtf8(server.username);
|
||||
String passwordEnc = (server.password != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.clientCertificateAlias) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.clientCertificateAlias) : "";
|
||||
|
||||
String scheme;
|
||||
switch (server.connectionSecurity) {
|
||||
|
@ -5,6 +5,7 @@ import android.util.Log;
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.controller.MessageRetrievalListener;
|
||||
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.*;
|
||||
@ -41,8 +42,6 @@ import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.DateFormat;
|
||||
@ -141,7 +140,7 @@ public class WebDavStore extends Store {
|
||||
String userInfo = webDavUri.getUserInfo();
|
||||
if (userInfo != null) {
|
||||
String[] userInfoParts = userInfo.split(":");
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
String userParts[] = username.split("\\\\", 2);
|
||||
|
||||
if (userParts.length > 1) {
|
||||
@ -150,7 +149,7 @@ public class WebDavStore extends Store {
|
||||
alias = username;
|
||||
}
|
||||
if (userInfoParts.length > 1) {
|
||||
password = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
password = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,9 +189,9 @@ public class WebDavStore extends Store {
|
||||
* @see WebDavStore#decodeUri(String)
|
||||
*/
|
||||
public static String createUri(ServerSettings server) {
|
||||
String userEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.username);
|
||||
String userEnc = UrlEncodingHelper.encodeUtf8(server.username);
|
||||
String passwordEnc = (server.password != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
|
||||
String scheme;
|
||||
switch (server.connectionSecurity) {
|
||||
@ -1241,9 +1240,9 @@ public class WebDavStore extends Store {
|
||||
String url = "";
|
||||
for (int i = 0, count = urlParts.length; i < count; i++) {
|
||||
if (i != 0) {
|
||||
url = url + "/" + com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(urlParts[i]);
|
||||
url = url + "/" + UrlEncodingHelper.encodeUtf8(urlParts[i]);
|
||||
} else {
|
||||
url = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(urlParts[i]);
|
||||
url = UrlEncodingHelper.encodeUtf8(urlParts[i]);
|
||||
}
|
||||
}
|
||||
encodedName = url;
|
||||
@ -1884,7 +1883,7 @@ public class WebDavStore extends Store {
|
||||
if (!messageURL.endsWith("/")) {
|
||||
messageURL += "/";
|
||||
}
|
||||
messageURL += com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
||||
messageURL += UrlEncodingHelper.encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
||||
|
||||
Log.i(K9.LOG_TAG, "Uploading message as " + messageURL);
|
||||
|
||||
@ -1972,7 +1971,7 @@ public class WebDavStore extends Store {
|
||||
*/
|
||||
try {
|
||||
end = UrlEncodingHelper.decodeUtf8(end);
|
||||
end = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(end);
|
||||
end = UrlEncodingHelper.encodeUtf8(end);
|
||||
end = end.replaceAll("\\+", "%20");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
|
||||
@ -2377,7 +2376,7 @@ public class WebDavStore extends Store {
|
||||
try {
|
||||
if (length > 3) {
|
||||
end = UrlEncodingHelper.decodeUtf8(end);
|
||||
end = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(end);
|
||||
end = UrlEncodingHelper.encodeUtf8(end);
|
||||
end = end.replaceAll("\\+", "%20");
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
|
@ -26,6 +26,7 @@ import com.fsck.k9.K9;
|
||||
import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.controller.MessageRetrievalListener;
|
||||
import com.fsck.k9.helper.StringUtils;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.Flag;
|
||||
import com.fsck.k9.mail.Folder;
|
||||
@ -467,7 +468,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
public void addPendingCommand(PendingCommand command) throws UnavailableStorageException {
|
||||
for (int i = 0; i < command.arguments.length; i++) {
|
||||
command.arguments[i] = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(command.arguments[i]);
|
||||
command.arguments[i] = UrlEncodingHelper.encodeUtf8(command.arguments[i]);
|
||||
}
|
||||
final ContentValues cv = new ContentValues();
|
||||
cv.put("command", command.command);
|
||||
|
@ -6,6 +6,7 @@ import android.util.Log;
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.*;
|
||||
import com.fsck.k9.mail.Message.RecipientType;
|
||||
@ -94,19 +95,19 @@ public class SmtpTransport extends Transport {
|
||||
String[] userInfoParts = smtpUri.getUserInfo().split(":");
|
||||
if (userInfoParts.length == 1) {
|
||||
authType = AuthType.PLAIN;
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
} else if (userInfoParts.length == 2) {
|
||||
authType = AuthType.PLAIN;
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
password = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
password = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
} else if (userInfoParts.length == 3) {
|
||||
// NOTE: In SmptTransport URIs, the authType comes last!
|
||||
authType = AuthType.valueOf(userInfoParts[2]);
|
||||
username = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
username = UrlEncodingHelper.decodeUtf8(userInfoParts[0]);
|
||||
if (authType == AuthType.EXTERNAL) {
|
||||
clientCertificateAlias = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
clientCertificateAlias = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
} else {
|
||||
password = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
password = UrlEncodingHelper.decodeUtf8(userInfoParts[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,11 +129,11 @@ public class SmtpTransport extends Transport {
|
||||
*/
|
||||
public static String createUri(ServerSettings server) {
|
||||
String userEnc = (server.username != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.username) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.username) : "";
|
||||
String passwordEnc = (server.password != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.password) : "";
|
||||
String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ?
|
||||
com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(server.clientCertificateAlias) : "";
|
||||
UrlEncodingHelper.encodeUtf8(server.clientCertificateAlias) : "";
|
||||
|
||||
String scheme;
|
||||
switch (server.connectionSecurity) {
|
||||
|
@ -9,6 +9,7 @@ import android.database.sqlite.SQLiteStatement;
|
||||
import android.util.Log;
|
||||
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
|
||||
import java.net.URI;
|
||||
@ -59,11 +60,11 @@ public class Storage implements SharedPreferences {
|
||||
if (transportUriStr != null) {
|
||||
String[] userInfoParts = uri.getUserInfo().split(":");
|
||||
|
||||
String usernameEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
String usernameEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
String passwordEnc = "";
|
||||
String authType = "";
|
||||
if (userInfoParts.length > 1) {
|
||||
passwordEnc = ":" + com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
passwordEnc = ":" + UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
}
|
||||
if (userInfoParts.length > 2) {
|
||||
authType = ":" + userInfoParts[2];
|
||||
@ -83,34 +84,34 @@ public class Storage implements SharedPreferences {
|
||||
if (storeUriStr.startsWith("imap")) {
|
||||
String[] userInfoParts = uri.getUserInfo().split(":");
|
||||
if (userInfoParts.length == 2) {
|
||||
String usernameEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
String passwordEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
String usernameEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
String passwordEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
|
||||
newUserInfo = usernameEnc + ":" + passwordEnc;
|
||||
} else {
|
||||
String authType = userInfoParts[0];
|
||||
String usernameEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
String passwordEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[2]);
|
||||
String usernameEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
String passwordEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[2]);
|
||||
|
||||
newUserInfo = authType + ":" + usernameEnc + ":" + passwordEnc;
|
||||
}
|
||||
} else if (storeUriStr.startsWith("pop3")) {
|
||||
String[] userInfoParts = uri.getUserInfo().split(":", 2);
|
||||
String usernameEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
String usernameEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
|
||||
String passwordEnc = "";
|
||||
if (userInfoParts.length > 1) {
|
||||
passwordEnc = ":" + com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
passwordEnc = ":" + UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
}
|
||||
|
||||
newUserInfo = usernameEnc + passwordEnc;
|
||||
} else if (storeUriStr.startsWith("webdav")) {
|
||||
String[] userInfoParts = uri.getUserInfo().split(":", 2);
|
||||
String usernameEnc = com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
String usernameEnc = UrlEncodingHelper.encodeUtf8(userInfoParts[0]);
|
||||
|
||||
String passwordEnc = "";
|
||||
if (userInfoParts.length > 1) {
|
||||
passwordEnc = ":" + com.fsck.k9.helper.UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
passwordEnc = ":" + UrlEncodingHelper.encodeUtf8(userInfoParts[1]);
|
||||
}
|
||||
|
||||
newUserInfo = usernameEnc + passwordEnc;
|
||||
|
@ -47,6 +47,7 @@ import com.fsck.k9.fragment.MessageViewFragment;
|
||||
import com.fsck.k9.helper.ClipboardManager;
|
||||
import com.fsck.k9.helper.Contacts;
|
||||
import com.fsck.k9.helper.HtmlConverter;
|
||||
import com.fsck.k9.helper.UrlEncodingHelper;
|
||||
import com.fsck.k9.helper.Utility;
|
||||
import com.fsck.k9.mail.Address;
|
||||
import com.fsck.k9.mail.Flag;
|
||||
@ -790,7 +791,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
||||
// Try to get the filename from the URL
|
||||
int start = path.lastIndexOf("/");
|
||||
if (start != -1 && start + 1 < path.length()) {
|
||||
filename = com.fsck.k9.helper.UrlEncodingHelper.decodeUtf8(path.substring(start + 1));
|
||||
filename = UrlEncodingHelper.decodeUtf8(path.substring(start + 1));
|
||||
} else {
|
||||
// Use a dummy filename if necessary
|
||||
filename = "saved_image";
|
||||
|
Loading…
Reference in New Issue
Block a user