Timber library p1
This commit is contained in:
parent
cf02795d5e
commit
878fdc0a79
35 changed files with 207 additions and 278 deletions
|
@ -1,6 +1,7 @@
|
||||||
androidCompileSdkVersion=25
|
androidCompileSdkVersion=25
|
||||||
androidBuildToolsVersion=25.0.2
|
androidBuildToolsVersion=25.0.2
|
||||||
androidSupportLibraryVersion=25.2.0
|
androidSupportLibraryVersion=25.2.0
|
||||||
|
timberVersion=4.5.1
|
||||||
|
|
||||||
robolectricVersion=3.2.2
|
robolectricVersion=3.2.2
|
||||||
junitVersion=4.12
|
junitVersion=4.12
|
||||||
|
|
|
@ -20,6 +20,7 @@ dependencies {
|
||||||
compile 'com.jcraft:jzlib:1.0.7'
|
compile 'com.jcraft:jzlib:1.0.7'
|
||||||
compile 'com.beetstra.jutf7:jutf7:1.0.0'
|
compile 'com.beetstra.jutf7:jutf7:1.0.0'
|
||||||
compile "com.android.support:support-annotations:${androidSupportLibraryVersion}"
|
compile "com.android.support:support-annotations:${androidSupportLibraryVersion}"
|
||||||
|
compile "com.jakewharton.timber:timber:${timberVersion}"
|
||||||
|
|
||||||
androidTestCompile 'com.android.support.test:runner:0.4.1'
|
androidTestCompile 'com.android.support.test:runner:0.4.1'
|
||||||
androidTestCompile 'com.madgag.spongycastle:pg:1.51.0.0'
|
androidTestCompile 'com.madgag.spongycastle:pg:1.51.0.0'
|
||||||
|
|
|
@ -12,13 +12,11 @@ import org.apache.james.mime4j.codec.EncoderUtil;
|
||||||
import org.apache.james.mime4j.dom.address.Mailbox;
|
import org.apache.james.mime4j.dom.address.Mailbox;
|
||||||
import org.apache.james.mime4j.dom.address.MailboxList;
|
import org.apache.james.mime4j.dom.address.MailboxList;
|
||||||
import org.apache.james.mime4j.field.address.AddressBuilder;
|
import org.apache.james.mime4j.field.address.AddressBuilder;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.util.Rfc822Token;
|
import android.text.util.Rfc822Token;
|
||||||
import android.text.util.Rfc822Tokenizer;
|
import android.text.util.Rfc822Tokenizer;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
public class Address implements Serializable {
|
public class Address implements Serializable {
|
||||||
private static final Pattern ATOM = Pattern.compile("^(?:[a-zA-Z0-9!#$%&'*+\\-/=?^_`{|}~]|\\s)+$");
|
private static final Pattern ATOM = Pattern.compile("^(?:[a-zA-Z0-9!#$%&'*+\\-/=?^_`{|}~]|\\s)+$");
|
||||||
|
@ -152,12 +150,11 @@ public class Address implements Serializable {
|
||||||
Mailbox mailbox = (Mailbox) address;
|
Mailbox mailbox = (Mailbox) address;
|
||||||
addresses.add(new Address(mailbox.getLocalPart() + "@" + mailbox.getDomain(), mailbox.getName(), false));
|
addresses.add(new Address(mailbox.getLocalPart() + "@" + mailbox.getDomain(), mailbox.getName(), false));
|
||||||
} else {
|
} else {
|
||||||
Log.e(LOG_TAG, "Unknown address type from Mime4J: "
|
Timber.e("Unknown address type from Mime4J: %s", address.getClass().toString());
|
||||||
+ address.getClass().toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (MimeException pe) {
|
} catch (MimeException pe) {
|
||||||
Log.e(LOG_TAG, "MimeException in Address.parse()", pe);
|
Timber.e(pe, "MimeException in Address.parse()");
|
||||||
//but we do an silent failover : we just use the given string as name with empty address
|
//but we do an silent failover : we just use the given string as name with empty address
|
||||||
addresses.add(new Address(null, addressList, false));
|
addresses.add(new Address(null, addressList, false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import android.util.Log;
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
public abstract class Folder<T extends Message> {
|
public abstract class Folder<T extends Message> {
|
||||||
private String status = null;
|
private String status = null;
|
||||||
|
@ -133,8 +132,7 @@ public abstract class Folder<T extends Message> {
|
||||||
// This is causing trouble. Disabled for now. See issue 1733
|
// This is causing trouble. Disabled for now. See issue 1733
|
||||||
//throw new RuntimeException("fetchPart() not implemented.");
|
//throw new RuntimeException("fetchPart() not implemented.");
|
||||||
|
|
||||||
if (K9MailLib.isDebug())
|
Timber.d("fetchPart() not implemented.");
|
||||||
Log.d(LOG_TAG, "fetchPart() not implemented.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void delete(boolean recurse) throws MessagingException;
|
public abstract void delete(boolean recurse) throws MessagingException;
|
||||||
|
|
|
@ -7,7 +7,6 @@ public class K9MailLib {
|
||||||
private K9MailLib() {
|
private K9MailLib() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String LOG_TAG = "k9";
|
|
||||||
public static final int PUSH_WAKE_LOCK_TIMEOUT = 60000;
|
public static final int PUSH_WAKE_LOCK_TIMEOUT = 60000;
|
||||||
public static final String IDENTITY_HEADER = "X-K9mail-Identity";
|
public static final String IDENTITY_HEADER = "X-K9mail-Identity";
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ import android.util.Log;
|
||||||
import com.fsck.k9.mail.filter.CountingOutputStream;
|
import com.fsck.k9.mail.filter.CountingOutputStream;
|
||||||
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
|
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
public abstract class Message implements Part, Body {
|
public abstract class Message implements Part, Body {
|
||||||
|
|
||||||
public enum RecipientType {
|
public enum RecipientType {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.fsck.k9.mail.filter.Base64OutputStream;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.james.mime4j.codec.QuotedPrintableOutputStream;
|
import org.apache.james.mime4j.codec.QuotedPrintableOutputStream;
|
||||||
import org.apache.james.mime4j.util.MimeUtil;
|
import org.apache.james.mime4j.util.MimeUtil;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,7 +137,7 @@ public class BinaryTempFileBody implements RawDataBody, SizeAware {
|
||||||
try {
|
try {
|
||||||
super.close();
|
super.close();
|
||||||
} finally {
|
} finally {
|
||||||
Log.d(K9MailLib.LOG_TAG, "deleting temp file");
|
Timber.d("Deleting temporary binary file");
|
||||||
mFile.delete();
|
mFile.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package com.fsck.k9.mail.internet;
|
package com.fsck.k9.mail.internet;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -14,7 +13,6 @@ import java.nio.charset.Charset;
|
||||||
import java.nio.charset.IllegalCharsetNameException;
|
import java.nio.charset.IllegalCharsetNameException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.internet.JisSupport.SHIFT_JIS;
|
import static com.fsck.k9.mail.internet.JisSupport.SHIFT_JIS;
|
||||||
|
|
||||||
public class CharsetSupport {
|
public class CharsetSupport {
|
||||||
|
@ -111,8 +109,7 @@ public class CharsetSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (charset.matches(rule[0])) {
|
if (charset.matches(rule[0])) {
|
||||||
Log.e(LOG_TAG, "I don't know how to deal with the charset " + charset +
|
Timber.e("I don't know how to deal with the charset %s. Falling back to %s", charset, rule[1]);
|
||||||
". Falling back to " + rule[1]);
|
|
||||||
charset = rule[1];
|
charset = rule[1];
|
||||||
try {
|
try {
|
||||||
supported = Charset.isSupported(charset);
|
supported = Charset.isSupported(charset);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package com.fsck.k9.mail.internet;
|
package com.fsck.k9.mail.internet;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
@ -11,8 +10,7 @@ import java.nio.charset.Charset;
|
||||||
import org.apache.james.mime4j.codec.Base64InputStream;
|
import org.apache.james.mime4j.codec.Base64InputStream;
|
||||||
import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
|
import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
|
||||||
import org.apache.james.mime4j.util.CharsetUtil;
|
import org.apache.james.mime4j.util.CharsetUtil;
|
||||||
|
import timber.log.Timber;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +167,7 @@ class DecoderUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encodedText.isEmpty()) {
|
if (encodedText.isEmpty()) {
|
||||||
Log.w(LOG_TAG, "Missing encoded text in encoded word: '" + body.substring(begin, end) + "'");
|
Timber.w("Missing encoded text in encoded word: '%s'", body.substring(begin, end));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +176,7 @@ class DecoderUtil {
|
||||||
} else if (encoding.equalsIgnoreCase("B")) {
|
} else if (encoding.equalsIgnoreCase("B")) {
|
||||||
return DecoderUtil.decodeB(encodedText, charset);
|
return DecoderUtil.decodeB(encodedText, charset);
|
||||||
} else {
|
} else {
|
||||||
Log.w(LOG_TAG, "Warning: Unknown encoding in encoded word '" + body.substring(begin, end) + "'");
|
Timber.w("Warning: Unknown encoding in encoded word '%s'", body.substring(begin, end));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ import com.fsck.k9.mail.Multipart;
|
||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
import com.fsck.k9.mail.internet.Viewable.Flowed;
|
import com.fsck.k9.mail.internet.Viewable.Flowed;
|
||||||
import org.apache.commons.io.input.BoundedInputStream;
|
import org.apache.commons.io.input.BoundedInputStream;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.internet.CharsetSupport.fixupCharset;
|
import static com.fsck.k9.mail.internet.CharsetSupport.fixupCharset;
|
||||||
import static com.fsck.k9.mail.internet.MimeUtility.getHeaderParameter;
|
import static com.fsck.k9.mail.internet.MimeUtility.getHeaderParameter;
|
||||||
import static com.fsck.k9.mail.internet.MimeUtility.isFormatFlowed;
|
import static com.fsck.k9.mail.internet.MimeUtility.isFormatFlowed;
|
||||||
|
@ -62,9 +62,9 @@ public class MessageExtractor {
|
||||||
throw new MessagingException("Provided invalid part");
|
throw new MessagingException("Provided invalid part");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(LOG_TAG, "Unable to getTextFromPart", e);
|
Timber.e(e, "Unable to getTextFromPart");
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
Log.e(LOG_TAG, "Unable to getTextFromPart", e);
|
Timber.e("Unable to getTextFromPart");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ import org.apache.james.mime4j.codec.Base64InputStream;
|
||||||
import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
|
import org.apache.james.mime4j.codec.QuotedPrintableInputStream;
|
||||||
import org.apache.james.mime4j.util.MimeUtil;
|
import org.apache.james.mime4j.util.MimeUtil;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
public class MimeUtility {
|
public class MimeUtility {
|
||||||
public static final String DEFAULT_ATTACHMENT_MIME_TYPE = "application/octet-stream";
|
public static final String DEFAULT_ATTACHMENT_MIME_TYPE = "application/octet-stream";
|
||||||
|
|
|
@ -18,6 +18,8 @@ import com.fsck.k9.mail.filter.CountingOutputStream;
|
||||||
import com.fsck.k9.mail.filter.SignSafeOutputStream;
|
import com.fsck.k9.mail.filter.SignSafeOutputStream;
|
||||||
import org.apache.james.mime4j.codec.QuotedPrintableOutputStream;
|
import org.apache.james.mime4j.codec.QuotedPrintableOutputStream;
|
||||||
import org.apache.james.mime4j.util.MimeUtil;
|
import org.apache.james.mime4j.util.MimeUtil;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
|
||||||
public class TextBody implements Body, SizeAware {
|
public class TextBody implements Body, SizeAware {
|
||||||
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
|
||||||
|
@ -67,7 +69,7 @@ public class TextBody implements Body, SizeAware {
|
||||||
}
|
}
|
||||||
return new ByteArrayInputStream(b);
|
return new ByteArrayInputStream(b);
|
||||||
} catch (UnsupportedEncodingException uee) {
|
} catch (UnsupportedEncodingException uee) {
|
||||||
Log.e(K9MailLib.LOG_TAG, "Unsupported charset: " + charset, uee);
|
Timber.e(uee, "Unsupported charset: " + charset);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,7 @@ import com.fsck.k9.mail.K9MailLib;
|
||||||
import com.fsck.k9.mail.filter.Base64;
|
import com.fsck.k9.mail.filter.Base64;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import timber.log.Timber;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +22,7 @@ public class XOAuth2ChallengeParser {
|
||||||
String decodedResponse = Base64.decode(response);
|
String decodedResponse = Base64.decode(response);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Challenge response: " + decodedResponse);
|
Timber.v("Challenge response: " + decodedResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -33,7 +32,7 @@ public class XOAuth2ChallengeParser {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (JSONException jsonException) {
|
} catch (JSONException jsonException) {
|
||||||
Log.e(LOG_TAG, "Error decoding JSON response from: " + host + ". Response was: " + decodedResponse);
|
Timber.e("Error decoding JSON response from: " + host + ". Response was: " + decodedResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.fsck.k9.mail.power;
|
package com.fsck.k9.mail.power;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
@ -8,11 +9,9 @@ import android.content.Context;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.K9MailLib;
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
|
import timber.log.Timber;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
public class TracingPowerManager {
|
public class TracingPowerManager {
|
||||||
|
@ -26,7 +25,7 @@ public class TracingPowerManager {
|
||||||
Context appContext = context.getApplicationContext();
|
Context appContext = context.getApplicationContext();
|
||||||
if (tracingPowerManager == null) {
|
if (tracingPowerManager == null) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Creating TracingPowerManager");
|
Timber.v("Creating TracingPowerManager");
|
||||||
}
|
}
|
||||||
tracingPowerManager = new TracingPowerManager(appContext);
|
tracingPowerManager = new TracingPowerManager(appContext);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +55,7 @@ public class TracingPowerManager {
|
||||||
wakeLock = pm.newWakeLock(flags, tag);
|
wakeLock = pm.newWakeLock(flags, tag);
|
||||||
id = wakeLockId.getAndIncrement();
|
id = wakeLockId.getAndIncrement();
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + ": Create");
|
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + ": Create");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void acquire(long timeout) {
|
public void acquire(long timeout) {
|
||||||
|
@ -64,7 +63,7 @@ public class TracingPowerManager {
|
||||||
wakeLock.acquire(timeout);
|
wakeLock.acquire(timeout);
|
||||||
}
|
}
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + " for " + timeout + " ms: acquired");
|
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + " for " + timeout + " ms: acquired");
|
||||||
}
|
}
|
||||||
raiseNotification();
|
raiseNotification();
|
||||||
if (startTime == null) {
|
if (startTime == null) {
|
||||||
|
@ -78,7 +77,7 @@ public class TracingPowerManager {
|
||||||
}
|
}
|
||||||
raiseNotification();
|
raiseNotification();
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.w(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + ": acquired with no timeout. K-9 Mail should not do this");
|
Timber.w("TracingWakeLock for tag " + tag + " / id " + id + ": acquired with no timeout. K-9 Mail should not do this");
|
||||||
}
|
}
|
||||||
if (startTime == null) {
|
if (startTime == null) {
|
||||||
startTime = SystemClock.elapsedRealtime();
|
startTime = SystemClock.elapsedRealtime();
|
||||||
|
@ -94,11 +93,11 @@ public class TracingPowerManager {
|
||||||
if (startTime != null) {
|
if (startTime != null) {
|
||||||
Long endTime = SystemClock.elapsedRealtime();
|
Long endTime = SystemClock.elapsedRealtime();
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + ": releasing after " + (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + ": releasing after " + (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + ", timeout = " + timeout + " ms: releasing");
|
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + ", timeout = " + timeout + " ms: releasing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cancelNotification();
|
cancelNotification();
|
||||||
|
@ -128,11 +127,11 @@ public class TracingPowerManager {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (startTime != null) {
|
if (startTime != null) {
|
||||||
Long endTime = SystemClock.elapsedRealtime();
|
Long endTime = SystemClock.elapsedRealtime();
|
||||||
Log.i(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + ": has been active for "
|
Timber.i("TracingWakeLock for tag " + tag + " / id " + id + ": has been active for "
|
||||||
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.i(LOG_TAG, "TracingWakeLock for tag " + tag + " / id " + id + ": still active, timeout = " + timeout + " ms");
|
Timber.i("TracingWakeLock for tag " + tag + " / id " + id + ": still active, timeout = " + timeout + " ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import android.content.Context;
|
||||||
import android.net.SSLCertificateSocketFactory;
|
import android.net.SSLCertificateSocketFactory;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import javax.net.ssl.KeyManager;
|
import javax.net.ssl.KeyManager;
|
||||||
|
@ -21,8 +20,7 @@ import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLSocket;
|
import javax.net.ssl.SSLSocket;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
|
import timber.log.Timber;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,8 +111,7 @@ public class DefaultTrustedSocketFactory implements TrustedSocketFactory {
|
||||||
*/
|
*/
|
||||||
supportedProtocols = sock.getSupportedProtocols();
|
supportedProtocols = sock.getSupportedProtocols();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Error getting information about available SSL/TLS ciphers and " +
|
Timber.e(e, "Error getting information about available SSL/TLS ciphers and protocols");
|
||||||
"protocols", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasWeakSslImplementation()) {
|
if (hasWeakSslImplementation()) {
|
||||||
|
@ -232,7 +229,7 @@ public class DefaultTrustedSocketFactory implements TrustedSocketFactory {
|
||||||
try {
|
try {
|
||||||
socket.getClass().getMethod("setHostname", String.class).invoke(socket, hostname);
|
socket.getClass().getMethod("setHostname", String.class).invoke(socket, hostname);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(LOG_TAG, "Could not call SSLSocket#setHostname(String) method ", e);
|
Timber.e(e, "Could not call SSLSocket#setHostname(String) method ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,11 @@ import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.security.KeyChain;
|
import android.security.KeyChain;
|
||||||
import android.security.KeyChainException;
|
import android.security.KeyChainException;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.CertificateValidationException;
|
import com.fsck.k9.mail.CertificateValidationException;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.CertificateValidationException.Reason;
|
import static com.fsck.k9.mail.CertificateValidationException.Reason;
|
||||||
import static com.fsck.k9.mail.CertificateValidationException.Reason.RetrievalFailure;
|
import static com.fsck.k9.mail.CertificateValidationException.Reason.RetrievalFailure;
|
||||||
|
|
||||||
|
@ -204,10 +203,10 @@ class KeyChainKeyManager extends X509ExtendedKeyManager {
|
||||||
return mAlias;
|
return mAlias;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.w(LOG_TAG, "Client certificate " + mAlias + " not issued by any of the requested issuers");
|
Timber.w("Client certificate " + mAlias + " not issued by any of the requested issuers");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Log.w(LOG_TAG, "Client certificate " + mAlias + " does not match any of the requested key types");
|
Timber.w("Client certificate " + mAlias + " does not match any of the requested key types");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,8 @@ import java.security.cert.CertificateException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
public class LocalKeyStore {
|
public class LocalKeyStore {
|
||||||
private static final int KEY_STORE_FILE_VERSION = 1;
|
private static final int KEY_STORE_FILE_VERSION = 1;
|
||||||
|
@ -50,7 +48,7 @@ public class LocalKeyStore {
|
||||||
* error, presuming setKeyStoreFile(File) is called next with a
|
* error, presuming setKeyStoreFile(File) is called next with a
|
||||||
* non-null File.
|
* non-null File.
|
||||||
*/
|
*/
|
||||||
Log.w(LOG_TAG, "Local key store has not been initialized");
|
Timber.w("Local key store has not been initialized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +75,7 @@ public class LocalKeyStore {
|
||||||
* Keystore.load. Instead, we let it be created anew.
|
* Keystore.load. Instead, we let it be created anew.
|
||||||
*/
|
*/
|
||||||
if (file.exists() && !file.delete()) {
|
if (file.exists() && !file.delete()) {
|
||||||
Log.d(LOG_TAG, "Failed to delete empty keystore file: " + file.getAbsolutePath());
|
Timber.d("Failed to delete empty keystore file: " + file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +92,7 @@ public class LocalKeyStore {
|
||||||
mKeyStore = store;
|
mKeyStore = store;
|
||||||
mKeyStoreFile = file;
|
mKeyStoreFile = file;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Failed to initialize local key store", e);
|
Timber.e("Failed to initialize local key store", e);
|
||||||
// Use of the local key store is effectively disabled.
|
// Use of the local key store is effectively disabled.
|
||||||
mKeyStore = null;
|
mKeyStore = null;
|
||||||
mKeyStoreFile = null;
|
mKeyStoreFile = null;
|
||||||
|
@ -171,7 +169,7 @@ public class LocalKeyStore {
|
||||||
} catch (KeyStoreException e) {
|
} catch (KeyStoreException e) {
|
||||||
// Ignore: most likely there was no cert. found
|
// Ignore: most likely there was no cert. found
|
||||||
} catch (CertificateException e) {
|
} catch (CertificateException e) {
|
||||||
Log.e(LOG_TAG, "Error updating the local key store file", e);
|
Timber.e(e, "Error updating the local key store file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +178,7 @@ public class LocalKeyStore {
|
||||||
// Blow away version "0" because certificate aliases have changed.
|
// Blow away version "0" because certificate aliases have changed.
|
||||||
File versionZeroFile = new File(getKeyStoreFilePath(0));
|
File versionZeroFile = new File(getKeyStoreFilePath(0));
|
||||||
if (versionZeroFile.exists() && !versionZeroFile.delete()) {
|
if (versionZeroFile.exists() && !versionZeroFile.delete()) {
|
||||||
Log.d(LOG_TAG, "Failed to delete old key-store file: " + versionZeroFile.getAbsolutePath());
|
Timber.d("Failed to delete old key-store file: " + versionZeroFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.util.zip.InflaterInputStream;
|
||||||
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.Authentication;
|
import com.fsck.k9.mail.Authentication;
|
||||||
import com.fsck.k9.mail.AuthenticationFailedException;
|
import com.fsck.k9.mail.AuthenticationFailedException;
|
||||||
|
@ -46,10 +45,10 @@ import com.jcraft.jzlib.JZlib;
|
||||||
import com.jcraft.jzlib.ZOutputStream;
|
import com.jcraft.jzlib.ZOutputStream;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.ConnectionSecurity.STARTTLS_REQUIRED;
|
import static com.fsck.k9.mail.ConnectionSecurity.STARTTLS_REQUIRED;
|
||||||
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_IMAP;
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_IMAP;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.store.RemoteStore.SOCKET_CONNECT_TIMEOUT;
|
import static com.fsck.k9.mail.store.RemoteStore.SOCKET_CONNECT_TIMEOUT;
|
||||||
import static com.fsck.k9.mail.store.RemoteStore.SOCKET_READ_TIMEOUT;
|
import static com.fsck.k9.mail.store.RemoteStore.SOCKET_READ_TIMEOUT;
|
||||||
import static com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase;
|
import static com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase;
|
||||||
|
@ -141,7 +140,7 @@ class ImapConnection {
|
||||||
throw new MessagingException("Unable to open connection to IMAP server due to security error.", e);
|
throw new MessagingException("Unable to open connection to IMAP server due to security error.", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!authSuccess) {
|
if (!authSuccess) {
|
||||||
Log.e(LOG_TAG, "Failed to login, closing connection for " + getLogId());
|
Timber.e("Failed to login, closing connection for %s", getLogId());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +159,7 @@ class ImapConnection {
|
||||||
String[] tokens = message.split("-");
|
String[] tokens = message.split("-");
|
||||||
|
|
||||||
if (tokens.length > 1 && tokens[1] != null) {
|
if (tokens.length > 1 && tokens[1] != null) {
|
||||||
Log.e(LOG_TAG, "Stripping host/port from ConnectionException for " + getLogId(), e);
|
Timber.e(e, "Stripping host/port from ConnectionException for %s", getLogId());
|
||||||
throw new ConnectException(tokens[1].trim());
|
throw new ConnectException(tokens[1].trim());
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -176,13 +175,13 @@ class ImapConnection {
|
||||||
try {
|
try {
|
||||||
Security.setProperty("networkaddress.cache.ttl", "0");
|
Security.setProperty("networkaddress.cache.ttl", "0");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(LOG_TAG, "Could not set DNS ttl to 0 for " + getLogId(), e);
|
Timber.w(e, "Could not set DNS ttl to 0 for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Security.setProperty("networkaddress.cache.negative.ttl", "0");
|
Security.setProperty("networkaddress.cache.negative.ttl", "0");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(LOG_TAG, "Could not set DNS negative ttl to 0 for " + getLogId(), e);
|
Timber.w(e, "Could not set DNS negative ttl to 0 for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +193,7 @@ class ImapConnection {
|
||||||
try {
|
try {
|
||||||
return connectToAddress(address);
|
return connectToAddress(address);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(LOG_TAG, "Could not connect to " + address, e);
|
Timber.w(e, "Could not connect to " + address);
|
||||||
connectException = e;
|
connectException = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +209,7 @@ class ImapConnection {
|
||||||
String clientCertificateAlias = settings.getClientCertificateAlias();
|
String clientCertificateAlias = settings.getClientCertificateAlias();
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
Log.d(LOG_TAG, "Connecting to " + host + " as " + address);
|
Timber.d("Connecting to " + host + " as " + address);
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketAddress socketAddress = new InetSocketAddress(address, port);
|
SocketAddress socketAddress = new InetSocketAddress(address, port);
|
||||||
|
@ -245,7 +244,7 @@ class ImapConnection {
|
||||||
ImapResponse initialResponse = responseParser.readResponse();
|
ImapResponse initialResponse = responseParser.readResponse();
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
Log.v(LOG_TAG, getLogId() + "<<<" + initialResponse);
|
Timber.v(getLogId() + "<<<" + initialResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
extractCapabilities(Collections.singletonList(initialResponse));
|
extractCapabilities(Collections.singletonList(initialResponse));
|
||||||
|
@ -258,7 +257,7 @@ class ImapConnection {
|
||||||
Set<String> receivedCapabilities = capabilityResponse.getCapabilities();
|
Set<String> receivedCapabilities = capabilityResponse.getCapabilities();
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Saving " + receivedCapabilities + " capabilities for " + getLogId());
|
Timber.d("Saving " + receivedCapabilities + " capabilities for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
capabilities = receivedCapabilities;
|
capabilities = receivedCapabilities;
|
||||||
|
@ -273,7 +272,7 @@ class ImapConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Did not get capabilities in banner, requesting CAPABILITY for " + getLogId());
|
Timber.i("Did not get capabilities in banner, requesting CAPABILITY for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
requestCapabilities();
|
requestCapabilities();
|
||||||
|
@ -320,7 +319,7 @@ class ImapConnection {
|
||||||
|
|
||||||
// Per RFC 2595 (3.1): Once TLS has been started, reissue CAPABILITY command
|
// Per RFC 2595 (3.1): Once TLS has been started, reissue CAPABILITY command
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Updating capabilities after STARTTLS for " + getLogId());
|
Timber.i("Updating capabilities after STARTTLS for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
requestCapabilities();
|
requestCapabilities();
|
||||||
|
@ -388,7 +387,7 @@ class ImapConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handlePermanentXoauth2Failure(NegativeImapResponseException e) throws AuthenticationFailedException {
|
private void handlePermanentXoauth2Failure(NegativeImapResponseException e) throws AuthenticationFailedException {
|
||||||
Log.v(LOG_TAG, "Permanent failure during XOAUTH2", e);
|
Timber.v(e, "Permanent failure during XOAUTH2", e);
|
||||||
throw new AuthenticationFailedException(e.getMessage(), e);
|
throw new AuthenticationFailedException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,13 +397,13 @@ class ImapConnection {
|
||||||
//if a token was invalid before use (e.g. due to expiry). But we don't
|
//if a token was invalid before use (e.g. due to expiry). But we don't
|
||||||
//This is the intended behaviour per AccountManager
|
//This is the intended behaviour per AccountManager
|
||||||
|
|
||||||
Log.v(LOG_TAG, "Temporary failure - retrying with new token", e);
|
Timber.v(e, "Temporary failure - retrying with new token", e);
|
||||||
try {
|
try {
|
||||||
attemptXOAuth2();
|
attemptXOAuth2();
|
||||||
} catch (NegativeImapResponseException e2) {
|
} catch (NegativeImapResponseException e2) {
|
||||||
//Okay, we failed on a new token.
|
//Okay, we failed on a new token.
|
||||||
//Invalidate the token anyway but assume it's permanent.
|
//Invalidate the token anyway but assume it's permanent.
|
||||||
Log.v(LOG_TAG, "Authentication exception for new token, permanent error assumed", e);
|
Timber.v(e, "Authentication exception for new token, permanent error assumed", e);
|
||||||
oauthTokenProvider.invalidateToken(settings.getUsername());
|
oauthTokenProvider.invalidateToken(settings.getUsername());
|
||||||
handlePermanentXoauth2Failure(e2);
|
handlePermanentXoauth2Failure(e2);
|
||||||
}
|
}
|
||||||
|
@ -548,7 +547,7 @@ class ImapConnection {
|
||||||
if (networkInfo != null) {
|
if (networkInfo != null) {
|
||||||
int type = networkInfo.getType();
|
int type = networkInfo.getType();
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "On network type " + type);
|
Timber.d("On network type " + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkType networkType = NetworkType.fromConnectivityManagerType(type);
|
NetworkType networkType = NetworkType.fromConnectivityManagerType(type);
|
||||||
|
@ -556,7 +555,7 @@ class ImapConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "useCompression " + useCompression);
|
Timber.d("useCompression " + useCompression);
|
||||||
}
|
}
|
||||||
|
|
||||||
return useCompression;
|
return useCompression;
|
||||||
|
@ -566,7 +565,7 @@ class ImapConnection {
|
||||||
try {
|
try {
|
||||||
executeSimpleCommand(Commands.COMPRESS_DEFLATE);
|
executeSimpleCommand(Commands.COMPRESS_DEFLATE);
|
||||||
} catch (NegativeImapResponseException e) {
|
} catch (NegativeImapResponseException e) {
|
||||||
Log.d(LOG_TAG, "Unable to negotiate compression: " + e.getMessage());
|
Timber.d(e, "Unable to negotiate compression: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,11 +577,11 @@ class ImapConnection {
|
||||||
setUpStreamsAndParser(input, output);
|
setUpStreamsAndParser(input, output);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Compression enabled for " + getLogId());
|
Timber.i("Compression enabled for " + getLogId());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
close();
|
close();
|
||||||
Log.e(LOG_TAG, "Error enabling compression", e);
|
Timber.e(e, "Error enabling compression", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,12 +592,12 @@ class ImapConnection {
|
||||||
|
|
||||||
if (hasCapability(Capabilities.NAMESPACE)) {
|
if (hasCapability(Capabilities.NAMESPACE)) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "pathPrefix is unset and server has NAMESPACE capability");
|
Timber.i("pathPrefix is unset and server has NAMESPACE capability");
|
||||||
}
|
}
|
||||||
handleNamespace();
|
handleNamespace();
|
||||||
} else {
|
} else {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "pathPrefix is unset but server does not have NAMESPACE capability");
|
Timber.i("pathPrefix is unset but server does not have NAMESPACE capability");
|
||||||
}
|
}
|
||||||
settings.setPathPrefix("");
|
settings.setPathPrefix("");
|
||||||
}
|
}
|
||||||
|
@ -617,7 +616,7 @@ class ImapConnection {
|
||||||
settings.setCombinedPrefix(null);
|
settings.setCombinedPrefix(null);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got path '" + prefix + "' and separator '" + hierarchyDelimiter + "'");
|
Timber.d("Got path '" + prefix + "' and separator '" + hierarchyDelimiter + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -633,7 +632,7 @@ class ImapConnection {
|
||||||
try {
|
try {
|
||||||
listResponses = executeSimpleCommand(Commands.LIST + " \"\" \"\"");
|
listResponses = executeSimpleCommand(Commands.LIST + " \"\" \"\"");
|
||||||
} catch (NegativeImapResponseException e) {
|
} catch (NegativeImapResponseException e) {
|
||||||
Log.d(LOG_TAG, "Error getting path delimiter using LIST command", e);
|
Timber.d(e, "Error getting path delimiter using LIST command", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +643,7 @@ class ImapConnection {
|
||||||
settings.setCombinedPrefix(null);
|
settings.setCombinedPrefix(null);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got path delimiter '" + settings.getPathDelimiter() + "' for " + getLogId());
|
Timber.d("Got path delimiter '" + settings.getPathDelimiter() + "' for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -670,7 +669,7 @@ class ImapConnection {
|
||||||
|
|
||||||
protected boolean isIdleCapable() {
|
protected boolean isIdleCapable() {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Connection " + getLogId() + " has " + capabilities.size() + " capabilities");
|
Timber.v("Connection " + getLogId() + " has " + capabilities.size() + " capabilities");
|
||||||
}
|
}
|
||||||
|
|
||||||
return capabilities.contains(Capabilities.IDLE);
|
return capabilities.contains(Capabilities.IDLE);
|
||||||
|
@ -736,9 +735,9 @@ class ImapConnection {
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
Log.v(LOG_TAG, getLogId() + ">>> [Command Hidden, Enable Sensitive Debug Logging To Show]");
|
Timber.v(getLogId() + ">>> [Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||||
} else {
|
} else {
|
||||||
Log.v(LOG_TAG, getLogId() + ">>> " + tag + " " + command + " " + initialClientResponse);
|
Timber.v(getLogId() + ">>> " + tag + " " + command + " " + initialClientResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,9 +759,9 @@ class ImapConnection {
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
Log.v(LOG_TAG, getLogId() + ">>> [Command Hidden, Enable Sensitive Debug Logging To Show]");
|
Timber.v(getLogId() + ">>> [Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||||
} else {
|
} else {
|
||||||
Log.v(LOG_TAG, getLogId() + ">>> " + tag + " " + command);
|
Timber.v(getLogId() + ">>> " + tag + " " + command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,7 +779,7 @@ class ImapConnection {
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
Log.v(LOG_TAG, getLogId() + ">>> " + continuation);
|
Timber.v(getLogId() + ">>> " + continuation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,7 +792,7 @@ class ImapConnection {
|
||||||
ImapResponse response = responseParser.readResponse(callback);
|
ImapResponse response = responseParser.readResponse(callback);
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
Log.v(LOG_TAG, getLogId() + "<<<" + response);
|
Timber.v(getLogId() + "<<<" + response);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
@ -820,7 +819,7 @@ class ImapConnection {
|
||||||
if (responseTag.equalsIgnoreCase(tag)) {
|
if (responseTag.equalsIgnoreCase(tag)) {
|
||||||
throw new MessagingException("Command continuation aborted: " + response);
|
throw new MessagingException("Command continuation aborted: " + response);
|
||||||
} else {
|
} else {
|
||||||
Log.w(LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " +
|
Timber.w("After sending tag " + tag + ", got tag response from previous command " +
|
||||||
response + " for " + getLogId());
|
response + " for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.Body;
|
import com.fsck.k9.mail.Body;
|
||||||
import com.fsck.k9.mail.FetchProfile;
|
import com.fsck.k9.mail.FetchProfile;
|
||||||
|
@ -34,8 +33,8 @@ import com.fsck.k9.mail.internet.MimeHeader;
|
||||||
import com.fsck.k9.mail.internet.MimeMessageHelper;
|
import com.fsck.k9.mail.internet.MimeMessageHelper;
|
||||||
import com.fsck.k9.mail.internet.MimeMultipart;
|
import com.fsck.k9.mail.internet.MimeMultipart;
|
||||||
import com.fsck.k9.mail.internet.MimeUtility;
|
import com.fsck.k9.mail.internet.MimeUtility;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.store.imap.ImapUtility.getLastResponse;
|
import static com.fsck.k9.mail.store.imap.ImapUtility.getLastResponse;
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw ioExceptionHandler(connection, ioe);
|
throw ioExceptionHandler(connection, ioe);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
Log.e(LOG_TAG, "Unable to open connection for " + getLogId(), me);
|
Timber.e(me, "Unable to open connection for " + getLogId(), me);
|
||||||
throw me;
|
throw me;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +210,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// If we are mid-search and we get a close request, we gotta trash the connection.
|
// If we are mid-search and we get a close request, we gotta trash the connection.
|
||||||
if (inSearch && connection != null) {
|
if (inSearch && connection != null) {
|
||||||
Log.i(LOG_TAG, "IMAP search was aborted, shutting down connection.");
|
Timber.i("IMAP search was aborted, shutting down connection.");
|
||||||
connection.close();
|
connection.close();
|
||||||
} else {
|
} else {
|
||||||
store.releaseConnection(connection);
|
store.releaseConnection(connection);
|
||||||
|
@ -354,7 +353,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
// operation fails. This will save a roundtrip if the folder already exists.
|
// operation fails. This will save a roundtrip if the folder already exists.
|
||||||
if (!exists(escapedDestinationFolderName)) {
|
if (!exists(escapedDestinationFolderName)) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "ImapFolder.copyMessages: attempting to create remote folder '" +
|
Timber.i("ImapFolder.copyMessages: attempting to create remote folder '" +
|
||||||
escapedDestinationFolderName + "' for " + getLogId());
|
escapedDestinationFolderName + "' for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +406,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
|
|
||||||
if (!exists(escapedTrashFolderName)) {
|
if (!exists(escapedTrashFolderName)) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "IMAPMessage.delete: attempting to create remote '" + trashFolderName + "' folder " +
|
Timber.i("IMAPMessage.delete: attempting to create remote '" + trashFolderName + "' folder " +
|
||||||
"for " + getLogId());
|
"for " + getLogId());
|
||||||
}
|
}
|
||||||
remoteTrashFolder.create(FolderType.HOLDS_MESSAGES);
|
remoteTrashFolder.create(FolderType.HOLDS_MESSAGES);
|
||||||
|
@ -415,7 +414,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
|
|
||||||
if (exists(escapedTrashFolderName)) {
|
if (exists(escapedTrashFolderName)) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "IMAPMessage.delete: copying remote " + messages.size() + " messages to '" +
|
Timber.d("IMAPMessage.delete: copying remote " + messages.size() + " messages to '" +
|
||||||
trashFolderName + "' for " + getLogId());
|
trashFolderName + "' for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,17 +727,17 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
try {
|
try {
|
||||||
msgSeqUidMap.put(msgSeq, uid);
|
msgSeqUidMap.put(msgSeq, uid);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Stored uid '" + uid + "' for msgSeq " + msgSeq + " into map");
|
Timber.v("Stored uid '" + uid + "' for msgSeq " + msgSeq + " into map");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Unable to store uid '" + uid + "' for msgSeq " + msgSeq);
|
Timber.e("Unable to store uid '" + uid + "' for msgSeq " + msgSeq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Message message = messageMap.get(uid);
|
Message message = messageMap.get(uid);
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Do not have message in messageMap for UID " + uid + " for " +
|
Timber.d("Do not have message in messageMap for UID " + uid + " for " +
|
||||||
getLogId());
|
getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +812,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
|
|
||||||
if (!message.getUid().equals(uid)) {
|
if (!message.getUid().equals(uid)) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Did not ask for UID " + uid + " for " + getLogId());
|
Timber.d("Did not ask for UID " + uid + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUntaggedResponse(response);
|
handleUntaggedResponse(response);
|
||||||
|
@ -902,7 +901,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
parseBodyStructure(bs, message, "TEXT");
|
parseBodyStructure(bs, message, "TEXT");
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Error handling message for " + getLogId(), e);
|
Timber.d(e, "Error handling message for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
message.setBody(null);
|
message.setBody(null);
|
||||||
}
|
}
|
||||||
|
@ -949,7 +948,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
if ("UIDNEXT".equalsIgnoreCase(key)) {
|
if ("UIDNEXT".equalsIgnoreCase(key)) {
|
||||||
uidNext = bracketed.getLong(1);
|
uidNext = bracketed.getLong(1);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got UidNext = " + uidNext + " for " + getLogId());
|
Timber.d("Got UidNext = " + uidNext + " for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -966,7 +965,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXISTS")) {
|
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXISTS")) {
|
||||||
messageCount = response.getNumber(0);
|
messageCount = response.getNumber(0);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got untagged EXISTS with value " + messageCount + " for " + getLogId());
|
Timber.d("Got untagged EXISTS with value " + messageCount + " for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,7 +974,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXPUNGE") && messageCount > 0) {
|
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXPUNGE") && messageCount > 0) {
|
||||||
messageCount--;
|
messageCount--;
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got untagged EXPUNGE with messageCount " + messageCount + " for " + getLogId());
|
Timber.d("Got untagged EXPUNGE with messageCount " + messageCount + " for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1203,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
*/
|
*/
|
||||||
String newUid = getUidFromMessageId(message);
|
String newUid = getUidFromMessageId(message);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got UID " + newUid + " for message for " + getLogId());
|
Timber.d("Got UID " + newUid + " for message for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(newUid)) {
|
if (!TextUtils.isEmpty(newUid)) {
|
||||||
|
@ -1235,14 +1234,14 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
|
|
||||||
if (messageIdHeader.length == 0) {
|
if (messageIdHeader.length == 0) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Did not get a message-id in order to search for UID for " + getLogId());
|
Timber.d("Did not get a message-id in order to search for UID for " + getLogId());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String messageId = messageIdHeader[0];
|
String messageId = messageIdHeader[0];
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Looking for UID for message with message-id " + messageId + " for " + getLogId());
|
Timber.d("Looking for UID for message with message-id " + messageId + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
String command = String.format("UID SEARCH HEADER MESSAGE-ID %s", ImapUtility.encodeString(messageId));
|
String command = String.format("UID SEARCH HEADER MESSAGE-ID %s", ImapUtility.encodeString(messageId));
|
||||||
|
@ -1323,7 +1322,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Exception while updated push state for " + getLogId(), e);
|
Timber.e(e, "Exception while updated push state for " + getLogId());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1355,7 +1354,7 @@ class ImapFolder extends Folder<ImapMessage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
|
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
|
||||||
Log.e(LOG_TAG, "IOException for " + getLogId(), ioe);
|
Timber.e(ioe, "IOException for " + getLogId());
|
||||||
|
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.close();
|
connection.close();
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.List;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.AuthenticationFailedException;
|
import com.fsck.k9.mail.AuthenticationFailedException;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
|
@ -22,8 +21,8 @@ import com.fsck.k9.mail.PushReceiver;
|
||||||
import com.fsck.k9.mail.power.TracingPowerManager;
|
import com.fsck.k9.mail.power.TracingPowerManager;
|
||||||
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
|
||||||
import com.fsck.k9.mail.store.RemoteStore;
|
import com.fsck.k9.mail.store.RemoteStore;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.PUSH_WAKE_LOCK_TIMEOUT;
|
import static com.fsck.k9.mail.K9MailLib.PUSH_WAKE_LOCK_TIMEOUT;
|
||||||
import static com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase;
|
import static com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase;
|
||||||
|
|
||||||
|
@ -89,12 +88,12 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
ImapConnection conn = connection;
|
ImapConnection conn = connection;
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Closing connection to stop pushing for " + getLogId());
|
Timber.v("Closing connection to stop pushing for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.close();
|
conn.close();
|
||||||
} else {
|
} else {
|
||||||
Log.w(LOG_TAG, "Attempt to interrupt null connection to stop pushing on folderPusher for " + getLogId());
|
Timber.w("Attempt to interrupt null connection to stop pushing on folderPusher for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
equalsIgnoreCase(responseType, "EXISTS")) {
|
equalsIgnoreCase(responseType, "EXISTS")) {
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Storing response " + response + " for later processing");
|
Timber.d("Storing response " + response + " for later processing");
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (storedUntaggedResponses) {
|
synchronized (storedUntaggedResponses) {
|
||||||
|
@ -133,7 +132,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Pusher starting for " + getLogId());
|
Timber.i("Pusher starting for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
long lastUidNext = -1L;
|
long lastUidNext = -1L;
|
||||||
|
@ -178,7 +177,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
processStoredUntaggedResponses();
|
processStoredUntaggedResponses();
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "About to IDLE for " + getLogId());
|
Timber.i("About to IDLE for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareForIdle();
|
prepareForIdle();
|
||||||
|
@ -193,7 +192,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
reacquireWakeLockAndCleanUp();
|
reacquireWakeLockAndCleanUp();
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.e(K9MailLib.LOG_TAG, "Authentication failed. Stopping ImapFolderPusher.", e);
|
Timber.e(e, "Authentication failed. Stopping ImapFolderPusher.");
|
||||||
}
|
}
|
||||||
|
|
||||||
pushReceiver.authenticationFailed();
|
pushReceiver.authenticationFailed();
|
||||||
|
@ -202,10 +201,10 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
reacquireWakeLockAndCleanUp();
|
reacquireWakeLockAndCleanUp();
|
||||||
|
|
||||||
if (stop) {
|
if (stop) {
|
||||||
Log.i(LOG_TAG, "Got exception while idling, but stop is set for " + getLogId());
|
Timber.i("Got exception while idling, but stop is set for " + getLogId());
|
||||||
} else {
|
} else {
|
||||||
pushReceiver.pushError("Push error for " + getName(), e);
|
pushReceiver.pushError("Push error for " + getName(), e);
|
||||||
Log.e(LOG_TAG, "Got exception while idling for " + getLogId(), e);
|
Timber.e("Got exception while idling for " + getLogId(), e);
|
||||||
|
|
||||||
pushReceiver.sleep(wakeLock, delayTime);
|
pushReceiver.sleep(wakeLock, delayTime);
|
||||||
|
|
||||||
|
@ -216,7 +215,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
|
|
||||||
idleFailureCount++;
|
idleFailureCount++;
|
||||||
if (idleFailureCount > IDLE_FAILURE_COUNT_LIMIT) {
|
if (idleFailureCount > IDLE_FAILURE_COUNT_LIMIT) {
|
||||||
Log.e(LOG_TAG, "Disabling pusher for " + getLogId() + " after " + idleFailureCount +
|
Timber.e("Disabling pusher for " + getLogId() + " after " + idleFailureCount +
|
||||||
" consecutive errors");
|
" consecutive errors");
|
||||||
pushReceiver.pushError("Push disabled for " + getName() + " after " + idleFailureCount +
|
pushReceiver.pushError("Push disabled for " + getName() + " after " + idleFailureCount +
|
||||||
" consecutive errors", e);
|
" consecutive errors", e);
|
||||||
|
@ -230,12 +229,12 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Pusher for " + getLogId() + " is exiting");
|
Timber.i("Pusher for " + getLogId() + " is exiting");
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
} catch (Exception me) {
|
} catch (Exception me) {
|
||||||
Log.e(LOG_TAG, "Got exception while closing for " + getLogId(), me);
|
Timber.e("Got exception while closing for " + getLogId(), me);
|
||||||
} finally {
|
} finally {
|
||||||
wakeLock.release();
|
wakeLock.release();
|
||||||
}
|
}
|
||||||
|
@ -251,7 +250,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
try {
|
try {
|
||||||
connection.close();
|
connection.close();
|
||||||
} catch (Exception me) {
|
} catch (Exception me) {
|
||||||
Log.e(LOG_TAG, "Got exception while closing for exception for " + getLogId(), me);
|
Timber.e("Got exception while closing for exception for " + getLogId(), me);
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = null;
|
connection = null;
|
||||||
|
@ -264,7 +263,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "uidNext is -1, using search to find highest UID");
|
Timber.d("uidNext is -1, using search to find highest UID");
|
||||||
}
|
}
|
||||||
|
|
||||||
long highestUid = getHighestUid();
|
long highestUid = getHighestUid();
|
||||||
|
@ -275,7 +274,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
newUidNext = highestUid + 1;
|
newUidNext = highestUid + 1;
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "highest UID = " + highestUid + ", set newUidNext to " + newUidNext);
|
Timber.d("highest UID = " + highestUid + ", set newUidNext to " + newUidNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newUidNext;
|
return newUidNext;
|
||||||
|
@ -365,12 +364,12 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
@Override
|
@Override
|
||||||
public void handleAsyncUntaggedResponse(ImapResponse response) {
|
public void handleAsyncUntaggedResponse(ImapResponse response) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Got async response: " + response);
|
Timber.v("Got async response: " + response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stop) {
|
if (stop) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got async untagged response: " + response + ", but stop is set for " + getLogId());
|
Timber.d("Got async untagged response: " + response + ", but stop is set for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
idleStopper.stopIdle();
|
idleStopper.stopIdle();
|
||||||
|
@ -384,14 +383,14 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got useful async untagged response: " + response + " for " + getLogId());
|
Timber.d("Got useful async untagged response: " + response + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
idleStopper.stopIdle();
|
idleStopper.stopIdle();
|
||||||
}
|
}
|
||||||
} else if (response.isContinuationRequested()) {
|
} else if (response.isContinuationRequested()) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Idling " + getLogId());
|
Timber.d("Idling " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
idleStopper.startAcceptingDoneContinuation(connection);
|
idleStopper.startAcceptingDoneContinuation(connection);
|
||||||
|
@ -415,7 +414,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Processing " + untaggedResponses.size() + " untagged responses from previous " +
|
Timber.i("Processing " + untaggedResponses.size() + " untagged responses from previous " +
|
||||||
"commands for " + getLogId());
|
"commands for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +461,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "UIDs for messages needing flag sync are " + flagSyncMsgSeqs + " for " + getLogId());
|
Timber.d("UIDs for messages needing flag sync are " + flagSyncMsgSeqs + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flagSyncMsgSeqs.isEmpty()) {
|
if (!flagSyncMsgSeqs.isEmpty()) {
|
||||||
|
@ -483,12 +482,12 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
try {
|
try {
|
||||||
Object responseType = response.get(1);
|
Object responseType = response.get(1);
|
||||||
if (equalsIgnoreCase(responseType, "FETCH")) {
|
if (equalsIgnoreCase(responseType, "FETCH")) {
|
||||||
Log.i(LOG_TAG, "Got FETCH " + response);
|
Timber.i("Got FETCH " + response);
|
||||||
|
|
||||||
long msgSeq = response.getLong(0);
|
long msgSeq = response.getLong(0);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId());
|
Timber.d("Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flagSyncMsgSeqs.contains(msgSeq)) {
|
if (!flagSyncMsgSeqs.contains(msgSeq)) {
|
||||||
|
@ -503,7 +502,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Got untagged EXPUNGE for msgseq " + msgSeq + " for " + getLogId());
|
Timber.d("Got untagged EXPUNGE for msgseq " + msgSeq + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> newSeqs = new ArrayList<Long>();
|
List<Long> newSeqs = new ArrayList<Long>();
|
||||||
|
@ -525,14 +524,14 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
|
|
||||||
for (long msgSeqNum : msgSeqs) {
|
for (long msgSeqNum : msgSeqs) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Comparing EXPUNGEd msgSeq " + msgSeq + " to " + msgSeqNum);
|
Timber.v("Comparing EXPUNGEd msgSeq " + msgSeq + " to " + msgSeqNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgSeqNum == msgSeq) {
|
if (msgSeqNum == msgSeq) {
|
||||||
String uid = msgSeqUidMap.get(msgSeqNum);
|
String uid = msgSeqUidMap.get(msgSeqNum);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Scheduling removal of UID " + uid + " because msgSeq " + msgSeqNum +
|
Timber.d("Scheduling removal of UID " + uid + " because msgSeq " + msgSeqNum +
|
||||||
" was expunged");
|
" was expunged");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +541,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
String uid = msgSeqUidMap.get(msgSeqNum);
|
String uid = msgSeqUidMap.get(msgSeqNum);
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Reducing msgSeq for UID " + uid + " from " + msgSeqNum + " to " +
|
Timber.d("Reducing msgSeq for UID " + uid + " from " + msgSeqNum + " to " +
|
||||||
(msgSeqNum - 1));
|
(msgSeqNum - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +551,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Could not handle untagged FETCH for " + getLogId(), e);
|
Timber.e("Could not handle untagged FETCH for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +567,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
long newUid = Long.parseLong(messageList.get(0).getUid());
|
long newUid = Long.parseLong(messageList.get(0).getUid());
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Got newUid " + newUid + " for message " + end + " on " + getLogId());
|
Timber.i("Got newUid " + newUid + " for message " + end + " on " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
long startUid = oldUidNext;
|
long startUid = oldUidNext;
|
||||||
|
@ -582,7 +581,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
|
|
||||||
if (newUid >= startUid) {
|
if (newUid >= startUid) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Needs sync from uid " + startUid + " to " + newUid + " for " + getLogId());
|
Timber.i("Needs sync from uid " + startUid + " to " + newUid + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Message> messages = new ArrayList<Message>();
|
List<Message> messages = new ArrayList<Message>();
|
||||||
|
@ -620,7 +619,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
msgSeqUidMap.clear();
|
msgSeqUidMap.clear();
|
||||||
|
|
||||||
String existingUid = existingMessage.getUid();
|
String existingUid = existingMessage.getUid();
|
||||||
Log.w(LOG_TAG, "Message with UID " + existingUid + " still exists on server, not expunging");
|
Timber.w("Message with UID " + existingUid + " still exists on server, not expunging");
|
||||||
|
|
||||||
removeUids.remove(existingUid);
|
removeUids.remove(existingUid);
|
||||||
}
|
}
|
||||||
|
@ -631,7 +630,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
try {
|
try {
|
||||||
message.setFlagInternal(Flag.DELETED, true);
|
message.setFlagInternal(Flag.DELETED, true);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
Log.e(LOG_TAG, "Unable to set DELETED flag on message " + message.getUid());
|
Timber.e("Unable to set DELETED flag on message " + message.getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
|
@ -639,7 +638,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
|
|
||||||
pushReceiver.messagesRemoved(ImapFolderPusher.this, messages);
|
pushReceiver.messagesRemoved(ImapFolderPusher.this, messages);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Cannot remove EXPUNGEd messages", e);
|
Timber.e("Cannot remove EXPUNGEd messages", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +654,7 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
|
|
||||||
private void notifyMessagesArrived(long startUid, long uidNext) {
|
private void notifyMessagesArrived(long startUid, long uidNext) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Needs sync from uid " + startUid + " to " + uidNext + " for " + getLogId());
|
Timber.i("Needs sync from uid " + startUid + " to " + uidNext + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = (int) (uidNext - startUid);
|
int count = (int) (uidNext - startUid);
|
||||||
|
@ -677,10 +676,10 @@ class ImapFolderPusher extends ImapFolder {
|
||||||
oldUidNext = pushState.uidNext;
|
oldUidNext = pushState.uidNext;
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId());
|
Timber.i("Got oldUidNext " + oldUidNext + " for " + getLogId());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e);
|
Timber.e("Unable to get oldUidNext for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldUidNext;
|
return oldUidNext;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.fsck.k9.mail.store.imap;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
|
||||||
class ImapPushState {
|
class ImapPushState {
|
||||||
|
@ -25,7 +25,7 @@ class ImapPushState {
|
||||||
|
|
||||||
return new ImapPushState(newUidNext);
|
return new ImapPushState(newUidNext);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(LOG_TAG, "Unable to part uidNext value " + value, e);
|
Timber.e("Unable to part uidNext value " + value, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createDefaultImapPushState();
|
return createDefaultImapPushState();
|
||||||
|
|
|
@ -9,8 +9,7 @@ import android.util.Log;
|
||||||
import com.fsck.k9.mail.K9MailLib;
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
import com.fsck.k9.mail.PushReceiver;
|
import com.fsck.k9.mail.PushReceiver;
|
||||||
import com.fsck.k9.mail.Pusher;
|
import com.fsck.k9.mail.Pusher;
|
||||||
|
import timber.log.Timber;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
class ImapPusher implements Pusher {
|
class ImapPusher implements Pusher {
|
||||||
|
@ -50,7 +49,7 @@ class ImapPusher implements Pusher {
|
||||||
try {
|
try {
|
||||||
folderPusher.refresh();
|
folderPusher.refresh();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Got exception while refreshing for " + folderPusher.getName(), e);
|
Timber.e("Got exception while refreshing for " + folderPusher.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,19 +58,19 @@ class ImapPusher implements Pusher {
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Requested stop of IMAP pusher");
|
Timber.i("Requested stop of IMAP pusher");
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (folderPushers) {
|
synchronized (folderPushers) {
|
||||||
for (ImapFolderPusher folderPusher : folderPushers) {
|
for (ImapFolderPusher folderPusher : folderPushers) {
|
||||||
try {
|
try {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(LOG_TAG, "Requesting stop of IMAP folderPusher " + folderPusher.getName());
|
Timber.i("Requesting stop of IMAP folderPusher " + folderPusher.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
folderPusher.stop();
|
folderPusher.stop();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(LOG_TAG, "Got exception while stopping " + folderPusher.getName(), e);
|
Timber.e("Got exception while stopping " + folderPusher.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.K9MailLib;
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
import com.fsck.k9.mail.filter.FixedLengthInputStream;
|
import com.fsck.k9.mail.filter.FixedLengthInputStream;
|
||||||
import com.fsck.k9.mail.filter.PeekableInputStream;
|
import com.fsck.k9.mail.filter.PeekableInputStream;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_IMAP;
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_IMAP;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
class ImapResponseParser {
|
class ImapResponseParser {
|
||||||
|
@ -88,11 +86,11 @@ class ImapResponseParser {
|
||||||
response = readResponse();
|
response = readResponse();
|
||||||
|
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
Log.v(LOG_TAG, logId + "<<<" + response);
|
Timber.v(logId + "<<<" + response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.getTag() != null && !response.getTag().equalsIgnoreCase(tag)) {
|
if (response.getTag() != null && !response.getTag().equalsIgnoreCase(tag)) {
|
||||||
Log.w(LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " + response +
|
Timber.w("After sending tag " + tag + ", got tag response from previous command " + response +
|
||||||
" for " + logId);
|
" for " + logId);
|
||||||
|
|
||||||
Iterator<ImapResponse> responseIterator = responses.iterator();
|
Iterator<ImapResponse> responseIterator = responses.iterator();
|
||||||
|
|
|
@ -31,8 +31,7 @@ import com.fsck.k9.mail.oauth.OAuth2TokenProvider;
|
||||||
import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
||||||
import com.fsck.k9.mail.store.RemoteStore;
|
import com.fsck.k9.mail.store.RemoteStore;
|
||||||
import com.fsck.k9.mail.store.StoreConfig;
|
import com.fsck.k9.mail.store.StoreConfig;
|
||||||
|
import timber.log.Timber;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +182,7 @@ public class ImapStore extends RemoteStore {
|
||||||
try {
|
try {
|
||||||
decodedFolderName = folderNameCodec.decode(listResponse.getName());
|
decodedFolderName = folderNameCodec.decode(listResponse.getName());
|
||||||
} catch (CharacterCodingException e) {
|
} catch (CharacterCodingException e) {
|
||||||
Log.w(LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
Timber.w("Folder name not correctly encoded with the UTF-7 variant " +
|
||||||
"as defined by RFC 3501: " + listResponse.getName(), e);
|
"as defined by RFC 3501: " + listResponse.getName(), e);
|
||||||
|
|
||||||
//TODO: Use the raw name returned by the server for all commands that require
|
//TODO: Use the raw name returned by the server for all commands that require
|
||||||
|
@ -239,13 +238,13 @@ public class ImapStore extends RemoteStore {
|
||||||
void autoconfigureFolders(final ImapConnection connection) throws IOException, MessagingException {
|
void autoconfigureFolders(final ImapConnection connection) throws IOException, MessagingException {
|
||||||
if (!connection.hasCapability(Capabilities.SPECIAL_USE)) {
|
if (!connection.hasCapability(Capabilities.SPECIAL_USE)) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "No detected folder auto-configuration methods.");
|
Timber.d("No detected folder auto-configuration methods.");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Folder auto-configuration: Using RFC6154/SPECIAL-USE.");
|
Timber.d("Folder auto-configuration: Using RFC6154/SPECIAL-USE.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String command = String.format("LIST (SPECIAL-USE) \"\" %s", ImapUtility.encodeString(getCombinedPrefix() + "*"));
|
String command = String.format("LIST (SPECIAL-USE) \"\" %s", ImapUtility.encodeString(getCombinedPrefix() + "*"));
|
||||||
|
@ -258,7 +257,7 @@ public class ImapStore extends RemoteStore {
|
||||||
try {
|
try {
|
||||||
decodedFolderName = folderNameCodec.decode(listResponse.getName());
|
decodedFolderName = folderNameCodec.decode(listResponse.getName());
|
||||||
} catch (CharacterCodingException e) {
|
} catch (CharacterCodingException e) {
|
||||||
Log.w(LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
Timber.w("Folder name not correctly encoded with the UTF-7 variant " +
|
||||||
"as defined by RFC 3501: " + listResponse.getName(), e);
|
"as defined by RFC 3501: " + listResponse.getName(), e);
|
||||||
// We currently just skip folders with malformed names.
|
// We currently just skip folders with malformed names.
|
||||||
continue;
|
continue;
|
||||||
|
@ -272,27 +271,27 @@ public class ImapStore extends RemoteStore {
|
||||||
if (listResponse.hasAttribute("\\Archive") || listResponse.hasAttribute("\\All")) {
|
if (listResponse.hasAttribute("\\Archive") || listResponse.hasAttribute("\\All")) {
|
||||||
mStoreConfig.setArchiveFolderName(decodedFolderName);
|
mStoreConfig.setArchiveFolderName(decodedFolderName);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Folder auto-configuration detected Archive folder: " + decodedFolderName);
|
Timber.d("Folder auto-configuration detected Archive folder: " + decodedFolderName);
|
||||||
}
|
}
|
||||||
} else if (listResponse.hasAttribute("\\Drafts")) {
|
} else if (listResponse.hasAttribute("\\Drafts")) {
|
||||||
mStoreConfig.setDraftsFolderName(decodedFolderName);
|
mStoreConfig.setDraftsFolderName(decodedFolderName);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Folder auto-configuration detected Drafts folder: " + decodedFolderName);
|
Timber.d("Folder auto-configuration detected Drafts folder: " + decodedFolderName);
|
||||||
}
|
}
|
||||||
} else if (listResponse.hasAttribute("\\Sent")) {
|
} else if (listResponse.hasAttribute("\\Sent")) {
|
||||||
mStoreConfig.setSentFolderName(decodedFolderName);
|
mStoreConfig.setSentFolderName(decodedFolderName);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Folder auto-configuration detected Sent folder: " + decodedFolderName);
|
Timber.d("Folder auto-configuration detected Sent folder: " + decodedFolderName);
|
||||||
}
|
}
|
||||||
} else if (listResponse.hasAttribute("\\Junk")) {
|
} else if (listResponse.hasAttribute("\\Junk")) {
|
||||||
mStoreConfig.setSpamFolderName(decodedFolderName);
|
mStoreConfig.setSpamFolderName(decodedFolderName);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Folder auto-configuration detected Spam folder: " + decodedFolderName);
|
Timber.d("Folder auto-configuration detected Spam folder: " + decodedFolderName);
|
||||||
}
|
}
|
||||||
} else if (listResponse.hasAttribute("\\Trash")) {
|
} else if (listResponse.hasAttribute("\\Trash")) {
|
||||||
mStoreConfig.setTrashFolderName(decodedFolderName);
|
mStoreConfig.setTrashFolderName(decodedFolderName);
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(LOG_TAG, "Folder auto-configuration detected Trash folder: " + decodedFolderName);
|
Timber.d("Folder auto-configuration detected Trash folder: " + decodedFolderName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,11 @@
|
||||||
|
|
||||||
package com.fsck.k9.mail.store.imap;
|
package com.fsck.k9.mail.store.imap;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods for use with IMAP.
|
* Utility methods for use with IMAP.
|
||||||
|
@ -101,12 +100,12 @@ class ImapUtility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d(LOG_TAG, "Invalid range: " + range);
|
Timber.d("Invalid range: " + range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.d(LOG_TAG, "Invalid range value: " + range, e);
|
Timber.d("Invalid range value: " + range, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -122,7 +121,7 @@ class ImapUtility {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(LOG_TAG, "Invalid UID value: " + number);
|
Timber.d("Invalid UID value: " + number);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.fsck.k9.mail.store.RemoteStore;
|
||||||
import com.fsck.k9.mail.store.StoreConfig;
|
import com.fsck.k9.mail.store.StoreConfig;
|
||||||
|
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
@ -36,7 +37,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_POP3;
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_POP3;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapability;
|
import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapability;
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.decodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.decodeUtf8;
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
||||||
|
@ -664,7 +664,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
// response = "+OK msgNum msgUid"
|
// response = "+OK msgNum msgUid"
|
||||||
String[] uidParts = response.split(" +");
|
String[] uidParts = response.split(" +");
|
||||||
if (uidParts.length < 3 || !"+OK".equals(uidParts[0])) {
|
if (uidParts.length < 3 || !"+OK".equals(uidParts[0])) {
|
||||||
Log.e(LOG_TAG, "ERR response: " + response);
|
Timber.e("ERR response: " + response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String msgUid = uidParts[2];
|
String msgUid = uidParts[2];
|
||||||
|
@ -723,7 +723,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
for (String uid : uids) {
|
for (String uid : uids) {
|
||||||
if (mUidToMsgMap.get(uid) == null) {
|
if (mUidToMsgMap.get(uid) == null) {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(LOG_TAG, "Need to index UID " + uid);
|
Timber.d("Need to index UID " + uid);
|
||||||
}
|
}
|
||||||
unindexedUids.add(uid);
|
unindexedUids.add(uid);
|
||||||
}
|
}
|
||||||
|
@ -749,7 +749,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
String msgUid = uidParts[1];
|
String msgUid = uidParts[1];
|
||||||
if (unindexedUids.contains(msgUid)) {
|
if (unindexedUids.contains(msgUid)) {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
|
Timber.d("Got msgNum " + msgNum + " for UID " + msgUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pop3Message message = mUidToMsgMap.get(msgUid);
|
Pop3Message message = mUidToMsgMap.get(msgUid);
|
||||||
|
@ -764,7 +764,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
|
|
||||||
private void indexMessage(int msgNum, Pop3Message message) {
|
private void indexMessage(int msgNum, Pop3Message message) {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(LOG_TAG, "Adding index for UID " + message.getUid() + " to msgNum " + msgNum);
|
Timber.d("Adding index for UID " + message.getUid() + " to msgNum " + msgNum);
|
||||||
}
|
}
|
||||||
mMsgNumToMsgMap.put(msgNum, message);
|
mMsgNumToMsgMap.put(msgNum, message);
|
||||||
mUidToMsgMap.put(message.getUid(), message);
|
mUidToMsgMap.put(message.getUid(), message);
|
||||||
|
@ -917,7 +917,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
if (lines != -1 && (!mTopNotSupported || mCapabilities.top)) {
|
if (lines != -1 && (!mTopNotSupported || mCapabilities.top)) {
|
||||||
try {
|
try {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
|
||||||
Log.d(LOG_TAG, "This server doesn't support the CAPA command. " +
|
Timber.d("This server doesn't support the CAPA command. " +
|
||||||
"Checking to see if the TOP command is supported nevertheless.");
|
"Checking to see if the TOP command is supported nevertheless.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
throw e;
|
throw e;
|
||||||
} else {
|
} else {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(LOG_TAG, "The server really doesn't support the TOP " +
|
Timber.d("The server really doesn't support the TOP " +
|
||||||
"command. Using RETR instead.");
|
"command. Using RETR instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,7 +1040,7 @@ public class Pop3Store extends RemoteStore {
|
||||||
} while ((d = mIn.read()) != -1);
|
} while ((d = mIn.read()) != -1);
|
||||||
String ret = sb.toString();
|
String ret = sb.toString();
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(LOG_TAG, "<<< " + ret);
|
Timber.d("<<< " + ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1134,10 +1134,10 @@ public class Pop3Store extends RemoteStore {
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
Log.d(LOG_TAG, ">>> "
|
Timber.d(">>> "
|
||||||
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||||
} else {
|
} else {
|
||||||
Log.d(LOG_TAG, ">>> " + command);
|
Timber.d(">>> " + command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.fsck.k9.mail.store.webdav;
|
package com.fsck.k9.mail.store.webdav;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -11,7 +9,7 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
import timber.log.Timber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintains WebDAV data
|
* Maintains WebDAV data
|
||||||
|
@ -189,7 +187,7 @@ class DataSet {
|
||||||
Date parsedDate = dfInput.parse(date);
|
Date parsedDate = dfInput.parse(date);
|
||||||
tempDate = dfOutput.format(parsedDate);
|
tempDate = dfOutput.format(parsedDate);
|
||||||
} catch (java.text.ParseException pe) {
|
} catch (java.text.ParseException pe) {
|
||||||
Log.e(LOG_TAG, "Error parsing date: " + pe + "\nTrace: " + WebDavUtils.processException(pe));
|
Timber.e(pe, "Error parsing date: %s", date);
|
||||||
}
|
}
|
||||||
envelope.addHeader(header, tempDate);
|
envelope.addHeader(header, tempDate);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package com.fsck.k9.mail.store.webdav;
|
package com.fsck.k9.mail.store.webdav;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.K9MailLib;
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
|
|
||||||
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_WEBDAV;
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_WEBDAV;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.decodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.decodeUtf8;
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
||||||
|
|
||||||
|
@ -36,9 +34,7 @@ public class HttpGeneric extends HttpEntityEnclosingRequestBase {
|
||||||
public HttpGeneric(final String uri) {
|
public HttpGeneric(final String uri) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (K9MailLib.isDebug()) {
|
Timber.v("Starting uri = '%s'", uri);
|
||||||
Log.v(LOG_TAG, "Starting uri = '" + uri + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] urlParts = uri.split("/");
|
String[] urlParts = uri.split("/");
|
||||||
int length = urlParts.length;
|
int length = urlParts.length;
|
||||||
|
@ -55,8 +51,7 @@ public class HttpGeneric extends HttpEntityEnclosingRequestBase {
|
||||||
end = end.replaceAll("\\+", "%20");
|
end = end.replaceAll("\\+", "%20");
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: "
|
Timber.e(iae, "IllegalArgumentException caught in HttpGeneric(String uri): %s", end);
|
||||||
+ WebDavUtils.processException(iae));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length - 1; i++) {
|
for (int i = 0; i < length - 1; i++) {
|
||||||
|
@ -67,12 +62,11 @@ public class HttpGeneric extends HttpEntityEnclosingRequestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||||
Log.v(LOG_TAG, "url = '" + url + "' length = " + url.length()
|
Timber.v("url = '%s' length = %s, end = '%s' length = %s", url, url.length(), end, end.length());
|
||||||
+ ", end = '" + end + "' length = " + end.length());
|
|
||||||
}
|
}
|
||||||
url = url + "/" + end;
|
url = url + "/" + end;
|
||||||
|
|
||||||
Log.i(LOG_TAG, "url = " + url);
|
Timber.d("url = %s", url);
|
||||||
setURI(URI.create(url));
|
setURI(URI.create(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.fsck.k9.mail.store.webdav;
|
package com.fsck.k9.mail.store.webdav;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.FetchProfile;
|
import com.fsck.k9.mail.FetchProfile;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
import com.fsck.k9.mail.Folder;
|
import com.fsck.k9.mail.Folder;
|
||||||
|
@ -16,6 +14,7 @@ import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
@ -35,7 +34,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_WEBDAV;
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_WEBDAV;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +135,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
headers.put("Brief", "t");
|
headers.put("Brief", "t");
|
||||||
headers.put("If-Match", "*");
|
headers.put("If-Match", "*");
|
||||||
String action = (isMove ? "BMOVE" : "BCOPY");
|
String action = (isMove ? "BMOVE" : "BCOPY");
|
||||||
Log.i(LOG_TAG, "Moving " + messages.size() + " messages to " + destFolder.mFolderUrl);
|
Timber.v("Moving " + messages.size() + " messages to " + destFolder.mFolderUrl);
|
||||||
|
|
||||||
store.processRequest(mFolderUrl, action, messageBody, headers, false);
|
store.processRequest(mFolderUrl, action, messageBody, headers, false);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +159,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
messageCount = dataset.getMessageCount();
|
messageCount = dataset.getMessageCount();
|
||||||
}
|
}
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||||
Log.v(LOG_TAG, "Counted messages and webdav returned: " + messageCount);
|
Timber.v("Counted messages and webdav returned: " + messageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messageCount;
|
return messageCount;
|
||||||
|
@ -354,7 +352,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
*/
|
*/
|
||||||
if (wdMessage.getUrl().equals("")) {
|
if (wdMessage.getUrl().equals("")) {
|
||||||
wdMessage.setUrl(getMessageUrls(new String[]{wdMessage.getUid()}).get(wdMessage.getUid()));
|
wdMessage.setUrl(getMessageUrls(new String[]{wdMessage.getUid()}).get(wdMessage.getUid()));
|
||||||
Log.i(LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
|
Timber.i("Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
|
||||||
+ wdMessage.getUrl() + "'");
|
+ wdMessage.getUrl() + "'");
|
||||||
if (wdMessage.getUrl().equals("")) {
|
if (wdMessage.getUrl().equals("")) {
|
||||||
throw new MessagingException("Unable to get URL for message");
|
throw new MessagingException("Unable to get URL for message");
|
||||||
|
@ -362,7 +360,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log.i(LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
|
Timber.i("Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
|
||||||
+ wdMessage.getUrl() + "'");
|
+ wdMessage.getUrl() + "'");
|
||||||
HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl()));
|
HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl()));
|
||||||
HttpResponse response;
|
HttpResponse response;
|
||||||
|
@ -415,27 +413,25 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
wdMessage.parse(istream);
|
wdMessage.parse(istream);
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(LOG_TAG, "IOException: " + ioe.getMessage() + "\nTrace: "
|
Timber.e(ioe, "IOException: " + ioe.getMessage());
|
||||||
+ WebDavUtils.processException(ioe));
|
|
||||||
throw new MessagingException("I/O Error", ioe);
|
throw new MessagingException("I/O Error", ioe);
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(reader);
|
IOUtils.closeQuietly(reader);
|
||||||
IOUtils.closeQuietly(istream);
|
IOUtils.closeQuietly(istream);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(LOG_TAG, "Empty response");
|
Timber.v("Empty response");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(LOG_TAG, "IllegalArgumentException caught " + iae + "\nTrace: " + WebDavUtils.processException(iae));
|
Timber.e(iae, "IllegalArgumentException caught");
|
||||||
throw new MessagingException("IllegalArgumentException caught", iae);
|
throw new MessagingException("IllegalArgumentException caught", iae);
|
||||||
} catch (URISyntaxException use) {
|
} catch (URISyntaxException use) {
|
||||||
Log.e(LOG_TAG, "URISyntaxException caught " + use + "\nTrace: " + WebDavUtils.processException(use));
|
Timber.e(use, "URISyntaxException caught");
|
||||||
throw new MessagingException("URISyntaxException caught", use);
|
throw new MessagingException("URISyntaxException caught", use);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(LOG_TAG, "Non-success response code loading message, response code was " + statusCode
|
Timber.e(ioe, "Non-success response code loading message, response code was " + statusCode
|
||||||
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
|
+ "\nURL: " + wdMessage.getUrl());
|
||||||
+ WebDavUtils.processException(ioe));
|
|
||||||
throw new MessagingException("Failure code " + statusCode, ioe);
|
throw new MessagingException("Failure code " + statusCode, ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +496,8 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
try {
|
try {
|
||||||
wdMessage.setFlagInternal(Flag.SEEN, uidToReadStatus.get(wdMessage.getUid()));
|
wdMessage.setFlagInternal(Flag.SEEN, uidToReadStatus.get(wdMessage.getUid()));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
Log.v(LOG_TAG, "Under some weird circumstances, setting the read status when syncing from webdav threw an NPE. Skipping.");
|
Timber.v(e, "Under some weird circumstances, " +
|
||||||
|
"setting the read status when syncing from webdav threw an NPE. Skipping.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -562,7 +559,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
message.setNewHeaders(envelope);
|
message.setNewHeaders(envelope);
|
||||||
message.setFlagInternal(Flag.SEEN, envelope.getReadStatus());
|
message.setFlagInternal(Flag.SEEN, envelope.getReadStatus());
|
||||||
} else {
|
} else {
|
||||||
Log.e(LOG_TAG, "Asked to get metadata for a non-existent message: " + message.getUid());
|
Timber.e("Asked to get metadata for a non-existent message: " + message.getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
@ -676,7 +673,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
}
|
}
|
||||||
messageURL += encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
messageURL += encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
||||||
|
|
||||||
Log.i(LOG_TAG, "Uploading message as " + messageURL);
|
Timber.i("Uploading message as " + messageURL);
|
||||||
|
|
||||||
store.sendRequest(messageURL, "PUT", bodyEntity, null, true);
|
store.sendRequest(messageURL, "PUT", bodyEntity, null, true);
|
||||||
|
|
||||||
|
@ -701,16 +698,14 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUidFromMessageId(Message message) throws MessagingException {
|
public String getUidFromMessageId(Message message) throws MessagingException {
|
||||||
Log.e(LOG_TAG,
|
Timber.e("Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages "
|
||||||
"Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages "
|
|
||||||
+ " being uploaded to the Sent folder");
|
+ " being uploaded to the Sent folder");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(final Set<Flag> flags, boolean value) throws MessagingException {
|
public void setFlags(final Set<Flag> flags, boolean value) throws MessagingException {
|
||||||
Log.e(LOG_TAG,
|
Timber.e("Unimplemented method setFlags(Set<Flag>, boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
||||||
"Unimplemented method setFlags(Set<Flag>, boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
|
||||||
// Try to make this efficient by not retrieving all of the messages
|
// Try to make this efficient by not retrieving all of the messages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.fsck.k9.mail.store.webdav;
|
package com.fsck.k9.mail.store.webdav;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpRequest;
|
import org.apache.http.HttpRequest;
|
||||||
|
@ -9,13 +7,12 @@ import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.methods.HttpUriRequest;
|
import org.apache.http.client.methods.HttpUriRequest;
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP client for WebDAV communication
|
* HTTP client for WebDAV communication
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +38,7 @@ public class WebDavHttpClient extends DefaultHttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void modifyRequestToAcceptGzipResponse(HttpRequest request) {
|
public static void modifyRequestToAcceptGzipResponse(HttpRequest request) {
|
||||||
Log.i(LOG_TAG, "Requesting gzipped data");
|
Timber.i("Requesting gzipped data");
|
||||||
request.addHeader("Accept-Encoding", "gzip");
|
request.addHeader("Accept-Encoding", "gzip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +54,7 @@ public class WebDavHttpClient extends DefaultHttpClient {
|
||||||
if (contentEncoding == null)
|
if (contentEncoding == null)
|
||||||
return responseStream;
|
return responseStream;
|
||||||
if (contentEncoding.contains("gzip")) {
|
if (contentEncoding.contains("gzip")) {
|
||||||
Log.i(LOG_TAG, "Response is gzipped");
|
Timber.i("Response is gzipped");
|
||||||
responseStream = new GZIPInputStream(responseStream);
|
responseStream = new GZIPInputStream(responseStream);
|
||||||
}
|
}
|
||||||
return responseStream;
|
return responseStream;
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
package com.fsck.k9.mail.store.webdav;
|
package com.fsck.k9.mail.store.webdav;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
import com.fsck.k9.mail.Folder;
|
import com.fsck.k9.mail.Folder;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
import com.fsck.k9.mail.internet.MimeMessage;
|
import com.fsck.k9.mail.internet.MimeMessage;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.decodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.decodeUtf8;
|
||||||
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
import static com.fsck.k9.mail.helper.UrlEncodingHelper.encodeUtf8;
|
||||||
|
|
||||||
|
@ -52,8 +50,7 @@ class WebDavMessage extends MimeMessage {
|
||||||
end = encodeUtf8(end);
|
end = encodeUtf8(end);
|
||||||
end = end.replaceAll("\\+", "%20");
|
end = end.replaceAll("\\+", "%20");
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
|
Timber.e(iae, "IllegalArgumentException caught in setUrl: ");
|
||||||
+ WebDavUtils.processException(iae));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length - 1; i++) {
|
for (int i = 0; i < length - 1; i++) {
|
||||||
|
@ -101,7 +98,7 @@ class WebDavMessage extends MimeMessage {
|
||||||
@Override
|
@Override
|
||||||
public void delete(String trashFolderName) throws MessagingException {
|
public void delete(String trashFolderName) throws MessagingException {
|
||||||
WebDavFolder wdFolder = (WebDavFolder) getFolder();
|
WebDavFolder wdFolder = (WebDavFolder) getFolder();
|
||||||
Log.i(LOG_TAG, "Deleting message by moving to " + trashFolderName);
|
Timber.i("Deleting message by moving to " + trashFolderName);
|
||||||
wdFolder.moveMessages(Collections.singletonList(this), wdFolder.getStore().getFolder(trashFolderName));
|
wdFolder.moveMessages(Collections.singletonList(this), wdFolder.getStore().getFolder(trashFolderName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.fsck.k9.mail.store.webdav;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility methods for WebDAV code.
|
|
||||||
*/
|
|
||||||
class WebDavUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a string of the stacktrace for a Throwable to allow for easy inline printing of errors.
|
|
||||||
*/
|
|
||||||
static String processException(Throwable t) {
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
||||||
PrintStream ps = new PrintStream(baos);
|
|
||||||
|
|
||||||
t.printStackTrace(ps);
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
return baos.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,8 +14,6 @@ import com.fsck.k9.mail.store.webdav.WebDavStore;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
public class WebDavTransport extends Transport {
|
public class WebDavTransport extends Transport {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
import com.fsck.k9.mail.AuthType;
|
import com.fsck.k9.mail.AuthType;
|
||||||
|
@ -50,10 +49,10 @@ import com.fsck.k9.mail.ssl.TrustedSocketFactory;
|
||||||
import com.fsck.k9.mail.store.StoreConfig;
|
import com.fsck.k9.mail.store.StoreConfig;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapability;
|
import static com.fsck.k9.mail.CertificateValidationException.Reason.MissingCapability;
|
||||||
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_SMTP;
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_SMTP;
|
||||||
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
|
||||||
|
|
||||||
public class SmtpTransport extends Transport {
|
public class SmtpTransport extends Transport {
|
||||||
public static final int SMTP_CONTINUE_REQUEST = 334;
|
public static final int SMTP_CONTINUE_REQUEST = 334;
|
||||||
|
@ -463,7 +462,7 @@ public class SmtpTransport extends Transport {
|
||||||
mLargestAcceptableMessage = Integer.parseInt(optionalsizeValue);
|
mLargestAcceptableMessage = Integer.parseInt(optionalsizeValue);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(LOG_TAG, "Tried to parse " + optionalsizeValue + " and get an int", e);
|
Timber.d("Tried to parse " + optionalsizeValue + " and get an int", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,13 +501,13 @@ public class SmtpTransport extends Transport {
|
||||||
}
|
}
|
||||||
} catch (NegativeSmtpReplyException e) {
|
} catch (NegativeSmtpReplyException e) {
|
||||||
if (K9MailLib.isDebug()) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(LOG_TAG, "Server doesn't support the EHLO command. Trying HELO...");
|
Timber.v("Server doesn't support the EHLO command. Trying HELO...");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
executeCommand("HELO %s", host);
|
executeCommand("HELO %s", host);
|
||||||
} catch (NegativeSmtpReplyException e2) {
|
} catch (NegativeSmtpReplyException e2) {
|
||||||
Log.w(LOG_TAG, "Server doesn't support the HELO command. Continuing anyway.");
|
Timber.w("Server doesn't support the HELO command. Continuing anyway.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return extensions;
|
return extensions;
|
||||||
|
@ -552,7 +551,7 @@ public class SmtpTransport extends Transport {
|
||||||
open();
|
open();
|
||||||
|
|
||||||
if (!m8bitEncodingAllowed) {
|
if (!m8bitEncodingAllowed) {
|
||||||
Log.d(LOG_TAG, "Server does not support 8bit transfer encoding");
|
Timber.d("Server does not support 8bit transfer encoding");
|
||||||
}
|
}
|
||||||
// If the message has attachments and our server has told us about a limit on
|
// If the message has attachments and our server has told us about a limit on
|
||||||
// the size of messages, count the message's size before sending it
|
// the size of messages, count the message's size before sending it
|
||||||
|
@ -628,7 +627,7 @@ public class SmtpTransport extends Transport {
|
||||||
}
|
}
|
||||||
String ret = sb.toString();
|
String ret = sb.toString();
|
||||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP)
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP)
|
||||||
Log.d(LOG_TAG, "SMTP <<< " + ret);
|
Timber.d("SMTP <<< " + ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -641,7 +640,7 @@ public class SmtpTransport extends Transport {
|
||||||
} else {
|
} else {
|
||||||
commandToLog = "SMTP >>> " + s;
|
commandToLog = "SMTP >>> " + s;
|
||||||
}
|
}
|
||||||
Log.d(LOG_TAG, commandToLog);
|
Timber.d(commandToLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] data = s.concat("\r\n").getBytes();
|
byte[] data = s.concat("\r\n").getBytes();
|
||||||
|
@ -860,7 +859,7 @@ public class SmtpTransport extends Transport {
|
||||||
//if a token was invalid before use (e.g. due to expiry). But we don't
|
//if a token was invalid before use (e.g. due to expiry). But we don't
|
||||||
//This is the intended behaviour per AccountManager
|
//This is the intended behaviour per AccountManager
|
||||||
|
|
||||||
Log.v(LOG_TAG, "Authentication exception, re-trying with new token", negativeResponseFromOldToken);
|
Timber.v("Authentication exception, re-trying with new token", negativeResponseFromOldToken);
|
||||||
try {
|
try {
|
||||||
attemptXoauth2(username);
|
attemptXoauth2(username);
|
||||||
} catch (NegativeSmtpReplyException negativeResponseFromNewToken) {
|
} catch (NegativeSmtpReplyException negativeResponseFromNewToken) {
|
||||||
|
@ -870,7 +869,7 @@ public class SmtpTransport extends Transport {
|
||||||
|
|
||||||
//Okay, we failed on a new token.
|
//Okay, we failed on a new token.
|
||||||
//Invalidate the token anyway but assume it's permanent.
|
//Invalidate the token anyway but assume it's permanent.
|
||||||
Log.v(LOG_TAG, "Authentication exception for new token, permanent error assumed",
|
Timber.v("Authentication exception for new token, permanent error assumed",
|
||||||
negativeResponseFromNewToken);
|
negativeResponseFromNewToken);
|
||||||
|
|
||||||
oauthTokenProvider.invalidateToken(username);
|
oauthTokenProvider.invalidateToken(username);
|
||||||
|
|
|
@ -34,7 +34,7 @@ dependencies {
|
||||||
compile 'de.cketti.safecontentresolver:safe-content-resolver-v14:0.9.0'
|
compile 'de.cketti.safecontentresolver:safe-content-resolver-v14:0.9.0'
|
||||||
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
|
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
|
||||||
compile 'com.squareup.moshi:moshi:1.2.0'
|
compile 'com.squareup.moshi:moshi:1.2.0'
|
||||||
compile 'com.jakewharton.timber:timber:4.5.1'
|
compile "com.jakewharton.timber:timber:${timberVersion}"
|
||||||
|
|
||||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue