mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
break/centralize dependencies to K9
This commit is contained in:
parent
245a6330ed
commit
231684936b
@ -136,37 +136,6 @@ public class K9 extends Application {
|
|||||||
*/
|
*/
|
||||||
public static boolean DEBUG = false;
|
public static boolean DEBUG = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Should K-9 log the conversation it has over the wire with
|
|
||||||
* SMTP servers?
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static boolean DEBUG_PROTOCOL_SMTP = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should K-9 log the conversation it has over the wire with
|
|
||||||
* IMAP servers?
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static boolean DEBUG_PROTOCOL_IMAP = true;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should K-9 log the conversation it has over the wire with
|
|
||||||
* POP3 servers?
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static boolean DEBUG_PROTOCOL_POP3 = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Should K-9 log the conversation it has over the wire with
|
|
||||||
* WebDAV servers?
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static boolean DEBUG_PROTOCOL_WEBDAV = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is enabled than logging that normally hides sensitive information
|
* If this is enabled than logging that normally hides sensitive information
|
||||||
* like passwords will show that information.
|
* like passwords will show that information.
|
||||||
|
@ -11,17 +11,12 @@ 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 android.text.Spannable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.SpannableStringBuilder;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
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 android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
||||||
|
|
||||||
|
|
||||||
public class Address {
|
public class Address {
|
||||||
private static final Pattern ATOM = Pattern.compile("^(?:[a-zA-Z0-9!#$%&'*+\\-/=?^_`{|}~]|\\s)+$");
|
private static final Pattern ATOM = Pattern.compile("^(?:[a-zA-Z0-9!#$%&'*+\\-/=?^_`{|}~]|\\s)+$");
|
||||||
@ -150,12 +145,12 @@ public class Address {
|
|||||||
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(K9.LOG_TAG, "Unknown address type from Mime4J: "
|
Log.e(LOG_TAG, "Unknown address type from Mime4J: "
|
||||||
+ address.getClass().toString());
|
+ address.getClass().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (MimeException pe) {
|
} catch (MimeException pe) {
|
||||||
Log.e(K9.LOG_TAG, "MimeException in Address.parse()", pe);
|
Log.e(LOG_TAG, "MimeException in Address.parse()", pe);
|
||||||
//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));
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
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;
|
||||||
@ -146,8 +146,8 @@ 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 (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "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;
|
||||||
|
44
src/com/fsck/k9/mail/K9MailLib.java
Normal file
44
src/com/fsck/k9/mail/K9MailLib.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.fsck.k9.mail;
|
||||||
|
|
||||||
|
import com.fsck.k9.K9;
|
||||||
|
|
||||||
|
public class K9MailLib {
|
||||||
|
private K9MailLib() {}
|
||||||
|
|
||||||
|
public static final String LOG_TAG = K9.LOG_TAG;
|
||||||
|
|
||||||
|
public static final int PUSH_WAKE_LOCK_TIMEOUT = K9.PUSH_WAKE_LOCK_TIMEOUT;
|
||||||
|
public static final String IDENTITY_HEADER = K9.IDENTITY_HEADER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should K-9 log the conversation it has over the wire with
|
||||||
|
* SMTP servers?
|
||||||
|
*/
|
||||||
|
public static boolean DEBUG_PROTOCOL_SMTP = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should K-9 log the conversation it has over the wire with
|
||||||
|
* IMAP servers?
|
||||||
|
*/
|
||||||
|
public static boolean DEBUG_PROTOCOL_IMAP = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should K-9 log the conversation it has over the wire with
|
||||||
|
* POP3 servers?
|
||||||
|
*/
|
||||||
|
public static boolean DEBUG_PROTOCOL_POP3 = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should K-9 log the conversation it has over the wire with
|
||||||
|
* WebDAV servers?
|
||||||
|
*/
|
||||||
|
public static boolean DEBUG_PROTOCOL_WEBDAV = true;
|
||||||
|
|
||||||
|
public static boolean isDebug() {
|
||||||
|
return K9.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDebugSensitive() {
|
||||||
|
return K9.DEBUG_SENSITIVE;
|
||||||
|
}
|
||||||
|
}
|
@ -9,10 +9,11 @@ import java.util.Set;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
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, CompositeBody {
|
public abstract class Message implements Part, CompositeBody {
|
||||||
public enum RecipientType {
|
public enum RecipientType {
|
||||||
@ -231,9 +232,9 @@ public abstract class Message implements Part, CompositeBody {
|
|||||||
eolOut.flush();
|
eolOut.flush();
|
||||||
return out.getCount();
|
return out.getCount();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to calculate a message size", e);
|
Log.e(LOG_TAG, "Failed to calculate a message size", e);
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to calculate a message size", e);
|
Log.e(LOG_TAG, "Failed to calculate a message size", e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.fsck.k9.mail.internet;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
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;
|
||||||
@ -15,6 +14,7 @@ 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,7 +111,7 @@ public class CharsetSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (charset.matches(rule[0])) {
|
if (charset.matches(rule[0])) {
|
||||||
Log.e(K9.LOG_TAG, "I don't know how to deal with the charset " + charset +
|
Log.e(LOG_TAG, "I don't know how to deal with the charset " + charset +
|
||||||
". Falling back to " + rule[1]);
|
". Falling back to " + rule[1]);
|
||||||
charset = rule[1];
|
charset = rule[1];
|
||||||
try {
|
try {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
package com.fsck.k9.mail.internet;
|
package com.fsck.k9.mail.internet;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.fsck.k9.K9;
|
|
||||||
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;
|
||||||
@ -13,6 +12,8 @@ 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 static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static methods for decoding strings, byte arrays and encoded words.
|
* Static methods for decoding strings, byte arrays and encoded words.
|
||||||
@ -168,7 +169,7 @@ class DecoderUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (encodedText.isEmpty()) {
|
if (encodedText.isEmpty()) {
|
||||||
Log.w(K9.LOG_TAG, "Missing encoded text in encoded word: '" + body.substring(begin, end) + "'");
|
Log.w(LOG_TAG, "Missing encoded text in encoded word: '" + body.substring(begin, end) + "'");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,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(K9.LOG_TAG, "Warning: Unknown encoding in encoded word '" + body.substring(begin, end) + "'");
|
Log.w(LOG_TAG, "Warning: Unknown encoding in encoded word '" + body.substring(begin, end) + "'");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.fsck.k9.mail.internet;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
import com.fsck.k9.mail.Body;
|
import com.fsck.k9.mail.Body;
|
||||||
import com.fsck.k9.mail.BodyPart;
|
import com.fsck.k9.mail.BodyPart;
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
@ -19,6 +18,7 @@ import java.util.Set;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
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.Viewable.Alternative;
|
import static com.fsck.k9.mail.internet.Viewable.Alternative;
|
||||||
@ -110,13 +110,13 @@ public class MessageExtractor {
|
|||||||
* If we are not able to process the body there's nothing we can do about it. Return
|
* If we are not able to process the body there's nothing we can do about it. Return
|
||||||
* null and let the upper layers handle the missing content.
|
* null and let the upper layers handle the missing content.
|
||||||
*/
|
*/
|
||||||
Log.e(K9.LOG_TAG, "Unable to getTextFromPart " + oom.toString());
|
Log.e(LOG_TAG, "Unable to getTextFromPart " + oom.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
/*
|
/*
|
||||||
* If we are not able to process the body there's nothing we can do about it. Return
|
* If we are not able to process the body there's nothing we can do about it. Return
|
||||||
* null and let the upper layers handle the missing content.
|
* null and let the upper layers handle the missing content.
|
||||||
*/
|
*/
|
||||||
Log.e(K9.LOG_TAG, "Unable to getTextFromPart", e);
|
Log.e(LOG_TAG, "Unable to getTextFromPart", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,12 @@ import android.security.KeyChain;
|
|||||||
import android.security.KeyChainException;
|
import android.security.KeyChainException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
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 static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For client certificate authentication! Provide private keys and certificates
|
* For client certificate authentication! Provide private keys and certificates
|
||||||
* during the TLS handshake using the Android 4.0 KeyChain API.
|
* during the TLS handshake using the Android 4.0 KeyChain API.
|
||||||
@ -207,10 +208,10 @@ class KeyChainKeyManager extends X509ExtendedKeyManager {
|
|||||||
return mAlias;
|
return mAlias;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.w(K9.LOG_TAG, "Client certificate " + mAlias + " not issued by any of the requested issuers");
|
Log.w(LOG_TAG, "Client certificate " + mAlias + " not issued by any of the requested issuers");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Log.w(K9.LOG_TAG, "Client certificate " + mAlias + " does not match any of the requested key types");
|
Log.w(LOG_TAG, "Client certificate " + mAlias + " does not match any of the requested key types");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import org.apache.commons.io.IOUtils;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
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 +50,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(K9.LOG_TAG, "Local key store has not been initialized");
|
Log.w(LOG_TAG, "Local key store has not been initialized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public class LocalKeyStore {
|
|||||||
mKeyStore = store;
|
mKeyStore = store;
|
||||||
mKeyStoreFile = file;
|
mKeyStoreFile = file;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to initialize local key store", e);
|
Log.e(LOG_TAG, "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;
|
||||||
@ -169,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(K9.LOG_TAG, "Error updating the local key store file", e);
|
Log.e(LOG_TAG, "Error updating the local key store file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter and reorder list of cipher suites and TLS versions.
|
* Filter and reorder list of cipher suites and TLS versions.
|
||||||
@ -90,7 +92,7 @@ public class TrustedSocketFactory {
|
|||||||
*/
|
*/
|
||||||
supportedProtocols = sock.getSupportedProtocols();
|
supportedProtocols = sock.getSupportedProtocols();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Error getting information about available SSL/TLS ciphers and " +
|
Log.e(LOG_TAG, "Error getting information about available SSL/TLS ciphers and " +
|
||||||
"protocols", e);
|
"protocols", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ class ImapResponseParser {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Catch everything else and save it for later.
|
// Catch everything else and save it for later.
|
||||||
mException = e;
|
mException = e;
|
||||||
//Log.e(K9.LOG_TAG, "parseLiteral(): Exception in callback method", e);
|
//Log.e(LOG_TAG, "parseLiteral(): Exception in callback method", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if only some of the literal data was read
|
// Check if only some of the literal data was read
|
||||||
|
@ -68,6 +68,7 @@ import com.fsck.k9.mail.ConnectionSecurity;
|
|||||||
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;
|
||||||
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
import com.fsck.k9.mail.Message;
|
import com.fsck.k9.mail.Message;
|
||||||
import com.fsck.k9.mail.MessageRetrievalListener;
|
import com.fsck.k9.mail.MessageRetrievalListener;
|
||||||
import com.fsck.k9.mail.MessagingException;
|
import com.fsck.k9.mail.MessagingException;
|
||||||
@ -94,6 +95,10 @@ import com.jcraft.jzlib.JZlib;
|
|||||||
import com.jcraft.jzlib.ZOutputStream;
|
import com.jcraft.jzlib.ZOutputStream;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
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.K9MailLib.PUSH_WAKE_LOCK_TIMEOUT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* TODO Need to start keeping track of UIDVALIDITY
|
* TODO Need to start keeping track of UIDVALIDITY
|
||||||
@ -539,7 +544,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
boolean includeFolder = true;
|
boolean includeFolder = true;
|
||||||
|
|
||||||
if (response.size() > 4 || !(response.getObject(3) instanceof String)) {
|
if (response.size() > 4 || !(response.getObject(3) instanceof String)) {
|
||||||
Log.w(K9.LOG_TAG, "Skipping incorrectly parsed " + commandResponse +
|
Log.w(LOG_TAG, "Skipping incorrectly parsed " + commandResponse +
|
||||||
" reply: " + response);
|
" reply: " + response);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -548,7 +553,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
decodedFolderName = decodeFolderName(response.getString(3));
|
decodedFolderName = decodeFolderName(response.getString(3));
|
||||||
} catch (CharacterCodingException e) {
|
} catch (CharacterCodingException e) {
|
||||||
Log.w(K9.LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
Log.w(LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
||||||
"as defined by RFC 3501: " + response.getString(3), e);
|
"as defined by RFC 3501: " + response.getString(3), 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
|
||||||
@ -619,14 +624,14 @@ public class ImapStore extends RemoteStore {
|
|||||||
String commandOptions = "";
|
String commandOptions = "";
|
||||||
|
|
||||||
if (connection.capabilities.contains("XLIST")) {
|
if (connection.capabilities.contains("XLIST")) {
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "Folder auto-configuration: Using XLIST.");
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "Folder auto-configuration: Using XLIST.");
|
||||||
commandResponse = "XLIST";
|
commandResponse = "XLIST";
|
||||||
} else if(connection.capabilities.contains("SPECIAL-USE")) {
|
} else if(connection.capabilities.contains("SPECIAL-USE")) {
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "Folder auto-configuration: Using RFC6154/SPECIAL-USE.");
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "Folder auto-configuration: Using RFC6154/SPECIAL-USE.");
|
||||||
commandResponse = "LIST";
|
commandResponse = "LIST";
|
||||||
commandOptions = " (SPECIAL-USE)";
|
commandOptions = " (SPECIAL-USE)";
|
||||||
} else {
|
} else {
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "No detected folder auto-configuration methods.");
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "No detected folder auto-configuration methods.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +646,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
decodedFolderName = decodeFolderName(response.getString(3));
|
decodedFolderName = decodeFolderName(response.getString(3));
|
||||||
} catch (CharacterCodingException e) {
|
} catch (CharacterCodingException e) {
|
||||||
Log.w(K9.LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
Log.w(LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " +
|
||||||
"as defined by RFC 3501: " + response.getString(3), e);
|
"as defined by RFC 3501: " + response.getString(3), e);
|
||||||
// We currently just skip folders with malformed names.
|
// We currently just skip folders with malformed names.
|
||||||
continue;
|
continue;
|
||||||
@ -657,17 +662,17 @@ public class ImapStore extends RemoteStore {
|
|||||||
String attribute = attributes.getString(i);
|
String attribute = attributes.getString(i);
|
||||||
if (attribute.equals("\\Drafts")) {
|
if (attribute.equals("\\Drafts")) {
|
||||||
mStoreConfig.setDraftsFolderName(decodedFolderName);
|
mStoreConfig.setDraftsFolderName(decodedFolderName);
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "Folder auto-configuration detected draft folder: " + decodedFolderName);
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "Folder auto-configuration detected draft folder: " + decodedFolderName);
|
||||||
} else if (attribute.equals("\\Sent")) {
|
} else if (attribute.equals("\\Sent")) {
|
||||||
mStoreConfig.setSentFolderName(decodedFolderName);
|
mStoreConfig.setSentFolderName(decodedFolderName);
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "Folder auto-configuration detected sent folder: " + decodedFolderName);
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "Folder auto-configuration detected sent folder: " + decodedFolderName);
|
||||||
} else if (attribute.equals("\\Spam") || attribute.equals("\\Junk")) {
|
} else if (attribute.equals("\\Spam") || attribute.equals("\\Junk")) {
|
||||||
//rfc6154 just mentions \Junk
|
//rfc6154 just mentions \Junk
|
||||||
mStoreConfig.setSpamFolderName(decodedFolderName);
|
mStoreConfig.setSpamFolderName(decodedFolderName);
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "Folder auto-configuration detected spam folder: " + decodedFolderName);
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "Folder auto-configuration detected spam folder: " + decodedFolderName);
|
||||||
} else if (attribute.equals("\\Trash")) {
|
} else if (attribute.equals("\\Trash")) {
|
||||||
mStoreConfig.setTrashFolderName(decodedFolderName);
|
mStoreConfig.setTrashFolderName(decodedFolderName);
|
||||||
if (K9.DEBUG) Log.d(K9.LOG_TAG, "Folder auto-configuration detected trash folder: " + decodedFolderName);
|
if (K9MailLib.isDebug()) Log.d(LOG_TAG, "Folder auto-configuration detected trash folder: " + decodedFolderName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -909,7 +914,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw ioExceptionHandler(mConnection, ioe);
|
throw ioExceptionHandler(mConnection, ioe);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to open connection for " + getLogId(), me);
|
Log.e(LOG_TAG, "Unable to open connection for " + getLogId(), me);
|
||||||
throw me;
|
throw me;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -963,7 +968,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
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 (mInSearch && mConnection != null) {
|
if (mInSearch && mConnection != null) {
|
||||||
Log.i(K9.LOG_TAG, "IMAP search was aborted, shutting down connection.");
|
Log.i(LOG_TAG, "IMAP search was aborted, shutting down connection.");
|
||||||
mConnection.close();
|
mConnection.close();
|
||||||
} else {
|
} else {
|
||||||
releaseConnection(mConnection);
|
releaseConnection(mConnection);
|
||||||
@ -1112,8 +1117,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
/*
|
/*
|
||||||
* If the remote folder doesn't exist we try to create it.
|
* If the remote folder doesn't exist we try to create it.
|
||||||
*/
|
*/
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(K9.LOG_TAG, "ImapFolder.copyMessages: attempting to create remote " +
|
Log.i(LOG_TAG, "ImapFolder.copyMessages: attempting to create remote " +
|
||||||
"folder '" + remoteDestName + "' for " + getLogId());
|
"folder '" + remoteDestName + "' for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,15 +1169,15 @@ public class ImapStore extends RemoteStore {
|
|||||||
uidMap.put(srcUid, destUid);
|
uidMap.put(srcUid, destUid);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(K9.LOG_TAG, "Parse error: size of source UIDs " +
|
Log.v(LOG_TAG, "Parse error: size of source UIDs " +
|
||||||
"list is not the same as size of destination " +
|
"list is not the same as size of destination " +
|
||||||
"UIDs list.");
|
"UIDs list.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(K9.LOG_TAG, "Parsing of the sequence set failed.");
|
Log.v(LOG_TAG, "Parsing of the sequence set failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1209,14 +1214,14 @@ public class ImapStore extends RemoteStore {
|
|||||||
/*
|
/*
|
||||||
* If the remote trash folder doesn't exist we try to create it.
|
* If the remote trash folder doesn't exist we try to create it.
|
||||||
*/
|
*/
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "IMAPMessage.delete: attempting to create remote '" + trashFolderName + "' folder for " + getLogId());
|
Log.i(LOG_TAG, "IMAPMessage.delete: attempting to create remote '" + trashFolderName + "' folder for " + getLogId());
|
||||||
remoteTrashFolder.create(FolderType.HOLDS_MESSAGES);
|
remoteTrashFolder.create(FolderType.HOLDS_MESSAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists(remoteTrashName)) {
|
if (exists(remoteTrashName)) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "IMAPMessage.delete: copying remote " + messages.size() + " messages to '" + trashFolderName + "' for " + getLogId());
|
Log.d(LOG_TAG, "IMAPMessage.delete: copying remote " + messages.size() + " messages to '" + trashFolderName + "' for " + getLogId());
|
||||||
|
|
||||||
moveMessages(messages, remoteTrashFolder);
|
moveMessages(messages, remoteTrashFolder);
|
||||||
} else {
|
} else {
|
||||||
@ -1276,7 +1281,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
return Long.parseLong(messages.get(0).getUid());
|
return Long.parseLong(messages.get(0).getUid());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to find highest UID in folder " + getName(), e);
|
Log.e(LOG_TAG, "Unable to find highest UID in folder " + getName(), e);
|
||||||
}
|
}
|
||||||
return -1L;
|
return -1L;
|
||||||
|
|
||||||
@ -1456,7 +1461,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
fetchFields.add("INTERNALDATE");
|
fetchFields.add("INTERNALDATE");
|
||||||
fetchFields.add("RFC822.SIZE");
|
fetchFields.add("RFC822.SIZE");
|
||||||
fetchFields.add("BODY.PEEK[HEADER.FIELDS (date subject from content-type to cc " +
|
fetchFields.add("BODY.PEEK[HEADER.FIELDS (date subject from content-type to cc " +
|
||||||
"reply-to message-id references in-reply-to " + K9.IDENTITY_HEADER + ")]");
|
"reply-to message-id references in-reply-to " + K9MailLib.IDENTITY_HEADER + ")]");
|
||||||
}
|
}
|
||||||
if (fp.contains(FetchProfile.Item.STRUCTURE)) {
|
if (fp.contains(FetchProfile.Item.STRUCTURE)) {
|
||||||
fetchFields.add("BODYSTRUCTURE");
|
fetchFields.add("BODYSTRUCTURE");
|
||||||
@ -1501,18 +1506,18 @@ public class ImapStore extends RemoteStore {
|
|||||||
if (uid != null) {
|
if (uid != null) {
|
||||||
try {
|
try {
|
||||||
msgSeqUidMap.put(msgSeq, uid);
|
msgSeqUidMap.put(msgSeq, uid);
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(K9.LOG_TAG, "Stored uid '" + uid + "' for msgSeq " + msgSeq + " into map " /*+ msgSeqUidMap.toString() */);
|
Log.v(LOG_TAG, "Stored uid '" + uid + "' for msgSeq " + msgSeq + " into map " /*+ msgSeqUidMap.toString() */);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to store uid '" + uid + "' for msgSeq " + msgSeq);
|
Log.e(LOG_TAG, "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 (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Do not have message in messageMap for UID " + uid + " for " + getLogId());
|
Log.d(LOG_TAG, "Do not have message in messageMap for UID " + uid + " for " + getLogId());
|
||||||
|
|
||||||
handleUntaggedResponse(response);
|
handleUntaggedResponse(response);
|
||||||
continue;
|
continue;
|
||||||
@ -1591,8 +1596,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
String uid = fetchList.getKeyedString("UID");
|
String uid = fetchList.getKeyedString("UID");
|
||||||
|
|
||||||
if (!message.getUid().equals(uid)) {
|
if (!message.getUid().equals(uid)) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Did not ask for UID " + uid + " for " + getLogId());
|
Log.d(LOG_TAG, "Did not ask for UID " + uid + " for " + getLogId());
|
||||||
|
|
||||||
handleUntaggedResponse(response);
|
handleUntaggedResponse(response);
|
||||||
continue;
|
continue;
|
||||||
@ -1679,8 +1684,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
parseBodyStructure(bs, message, "TEXT");
|
parseBodyStructure(bs, message, "TEXT");
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Error handling message for " + getLogId(), e);
|
Log.d(LOG_TAG, "Error handling message for " + getLogId(), e);
|
||||||
message.setBody(null);
|
message.setBody(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1728,8 +1733,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
String key = (String)keyObj;
|
String key = (String)keyObj;
|
||||||
if ("UIDNEXT".equalsIgnoreCase(key)) {
|
if ("UIDNEXT".equalsIgnoreCase(key)) {
|
||||||
uidNext = bracketed.getLong(1);
|
uidNext = bracketed.getLong(1);
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got UidNext = " + uidNext + " for " + getLogId());
|
Log.d(LOG_TAG, "Got UidNext = " + uidNext + " for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1747,15 +1752,15 @@ public class ImapStore extends RemoteStore {
|
|||||||
if (response.mTag == null && response.size() > 1) {
|
if (response.mTag == null && response.size() > 1) {
|
||||||
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXISTS")) {
|
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXISTS")) {
|
||||||
mMessageCount = response.getNumber(0);
|
mMessageCount = response.getNumber(0);
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got untagged EXISTS with value " + mMessageCount + " for " + getLogId());
|
Log.d(LOG_TAG, "Got untagged EXISTS with value " + mMessageCount + " for " + getLogId());
|
||||||
}
|
}
|
||||||
handlePossibleUidNext(response);
|
handlePossibleUidNext(response);
|
||||||
|
|
||||||
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXPUNGE") && mMessageCount > 0) {
|
if (ImapResponseParser.equalsIgnoreCase(response.get(1), "EXPUNGE") && mMessageCount > 0) {
|
||||||
mMessageCount--;
|
mMessageCount--;
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got untagged EXPUNGE with mMessageCount " + mMessageCount + " for " + getLogId());
|
Log.d(LOG_TAG, "Got untagged EXPUNGE with mMessageCount " + mMessageCount + " for " + getLogId());
|
||||||
}
|
}
|
||||||
// if (response.size() > 1) {
|
// if (response.size() > 1) {
|
||||||
// Object bracketedObj = response.get(1);
|
// Object bracketedObj = response.get(1);
|
||||||
@ -1777,7 +1782,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
// sb.append(' ');
|
// sb.append(' ');
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Log.w(K9.LOG_TAG, "ALERT: " + sb.toString() + " for " + getLogId());
|
// Log.w(LOG_TAG, "ALERT: " + sb.toString() + " for " + getLogId());
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@ -1786,7 +1791,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
//Log.i(K9.LOG_TAG, "mMessageCount = " + mMessageCount + " for " + getLogId());
|
//Log.i(LOG_TAG, "mMessageCount = " + mMessageCount + " for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseBodyStructure(ImapList bs, Part part, String id)
|
private void parseBodyStructure(ImapList bs, Part part, String id)
|
||||||
@ -2015,8 +2020,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
* not implement the APPENDUID response code.
|
* not implement the APPENDUID response code.
|
||||||
*/
|
*/
|
||||||
String newUid = getUidFromMessageId(message);
|
String newUid = getUidFromMessageId(message);
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(K9.LOG_TAG, "Got UID " + newUid + " for message for " + getLogId());
|
Log.d(LOG_TAG, "Got UID " + newUid + " for message for " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(newUid)) {
|
if (!TextUtils.isEmpty(newUid)) {
|
||||||
@ -2046,13 +2051,13 @@ public class ImapStore extends RemoteStore {
|
|||||||
String[] messageIdHeader = message.getHeader("Message-ID");
|
String[] messageIdHeader = message.getHeader("Message-ID");
|
||||||
|
|
||||||
if (messageIdHeader == null || messageIdHeader.length == 0) {
|
if (messageIdHeader == null || messageIdHeader.length == 0) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Did not get a message-id in order to search for UID for " + getLogId());
|
Log.d(LOG_TAG, "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 (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Looking for UID for message with message-id " + messageId + " for " + getLogId());
|
Log.d(LOG_TAG, "Looking for UID for message with message-id " + messageId + " for " + getLogId());
|
||||||
|
|
||||||
List<ImapResponse> responses =
|
List<ImapResponse> responses =
|
||||||
executeSimpleCommand(
|
executeSimpleCommand(
|
||||||
@ -2131,7 +2136,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Exception while updated push state for " + getLogId(), e);
|
Log.e(LOG_TAG, "Exception while updated push state for " + getLogId(), e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2163,7 +2168,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
|
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
|
||||||
Log.e(K9.LOG_TAG, "IOException for " + getLogId(), ioe);
|
Log.e(LOG_TAG, "IOException for " + getLogId(), ioe);
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
@ -2346,14 +2351,14 @@ public class ImapStore extends RemoteStore {
|
|||||||
|
|
||||||
if (capabilityList != null && !capabilityList.isEmpty() &&
|
if (capabilityList != null && !capabilityList.isEmpty() &&
|
||||||
ImapResponseParser.equalsIgnoreCase(capabilityList.get(0), CAPABILITY_CAPABILITY)) {
|
ImapResponseParser.equalsIgnoreCase(capabilityList.get(0), CAPABILITY_CAPABILITY)) {
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(K9.LOG_TAG, "Saving " + capabilityList.size() + " capabilities for " + getLogId());
|
Log.d(LOG_TAG, "Saving " + capabilityList.size() + " capabilities for " + getLogId());
|
||||||
}
|
}
|
||||||
for (Object capability : capabilityList) {
|
for (Object capability : capabilityList) {
|
||||||
if (capability instanceof String) {
|
if (capability instanceof String) {
|
||||||
// if (K9.DEBUG)
|
// if (K9MailLib.isDebug())
|
||||||
// {
|
// {
|
||||||
// Log.v(K9.LOG_TAG, "Saving capability '" + capability + "' for " + getLogId());
|
// Log.v(LOG_TAG, "Saving capability '" + capability + "' for " + getLogId());
|
||||||
// }
|
// }
|
||||||
capabilities.add(((String)capability).toUpperCase(Locale.US));
|
capabilities.add(((String)capability).toUpperCase(Locale.US));
|
||||||
}
|
}
|
||||||
@ -2374,14 +2379,14 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
Security.setProperty("networkaddress.cache.ttl", "0");
|
Security.setProperty("networkaddress.cache.ttl", "0");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(K9.LOG_TAG, "Could not set DNS ttl to 0 for " + getLogId(), e);
|
Log.w(LOG_TAG, "Could not set DNS ttl to 0 for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Security.setProperty("networkaddress.cache.negative.ttl", "0");
|
Security.setProperty("networkaddress.cache.negative.ttl", "0");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(K9.LOG_TAG, "Could not set DNS negative ttl to 0 for " + getLogId(), e);
|
Log.w(LOG_TAG, "Could not set DNS negative ttl to 0 for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -2391,8 +2396,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
InetAddress[] addresses = InetAddress.getAllByName(mSettings.getHost());
|
InetAddress[] addresses = InetAddress.getAllByName(mSettings.getHost());
|
||||||
for (int i = 0; i < addresses.length; i++) {
|
for (int i = 0; i < addresses.length; i++) {
|
||||||
try {
|
try {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
Log.d(K9.LOG_TAG, "Connecting to " + mSettings.getHost() + " as " +
|
Log.d(LOG_TAG, "Connecting to " + mSettings.getHost() + " as " +
|
||||||
addresses[i]);
|
addresses[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2428,16 +2433,16 @@ public class ImapStore extends RemoteStore {
|
|||||||
|
|
||||||
capabilities.clear();
|
capabilities.clear();
|
||||||
ImapResponse nullResponse = mParser.readResponse();
|
ImapResponse nullResponse = mParser.readResponse();
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP)
|
||||||
Log.v(K9.LOG_TAG, getLogId() + "<<<" + nullResponse);
|
Log.v(LOG_TAG, getLogId() + "<<<" + nullResponse);
|
||||||
|
|
||||||
List<ImapResponse> nullResponses = new LinkedList<ImapResponse>();
|
List<ImapResponse> nullResponses = new LinkedList<ImapResponse>();
|
||||||
nullResponses.add(nullResponse);
|
nullResponses.add(nullResponse);
|
||||||
receiveCapabilities(nullResponses);
|
receiveCapabilities(nullResponses);
|
||||||
|
|
||||||
if (!hasCapability(CAPABILITY_CAPABILITY)) {
|
if (!hasCapability(CAPABILITY_CAPABILITY)) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Did not get capabilities in banner, requesting CAPABILITY for " + getLogId());
|
Log.i(LOG_TAG, "Did not get capabilities in banner, requesting CAPABILITY for " + getLogId());
|
||||||
List<ImapResponse> responses = receiveCapabilities(executeSimpleCommand(COMMAND_CAPABILITY));
|
List<ImapResponse> responses = receiveCapabilities(executeSimpleCommand(COMMAND_CAPABILITY));
|
||||||
if (responses.size() != 2) {
|
if (responses.size() != 2) {
|
||||||
throw new MessagingException("Invalid CAPABILITY response received");
|
throw new MessagingException("Invalid CAPABILITY response received");
|
||||||
@ -2459,8 +2464,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
mParser = new ImapResponseParser(mIn);
|
mParser = new ImapResponseParser(mIn);
|
||||||
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024);
|
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024);
|
||||||
// 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 (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Updating capabilities after STARTTLS for " + getLogId());
|
Log.i(LOG_TAG, "Updating capabilities after STARTTLS for " + getLogId());
|
||||||
capabilities.clear();
|
capabilities.clear();
|
||||||
List<ImapResponse> responses = receiveCapabilities(executeSimpleCommand(COMMAND_CAPABILITY));
|
List<ImapResponse> responses = receiveCapabilities(executeSimpleCommand(COMMAND_CAPABILITY));
|
||||||
if (responses.size() != 2) {
|
if (responses.size() != 2) {
|
||||||
@ -2514,8 +2519,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
"Unhandled authentication method found in the server settings (bug).");
|
"Unhandled authentication method found in the server settings (bug).");
|
||||||
}
|
}
|
||||||
authSuccess = true;
|
authSuccess = true;
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(K9.LOG_TAG, CAPABILITY_COMPRESS_DEFLATE + " = " + hasCapability(CAPABILITY_COMPRESS_DEFLATE));
|
Log.d(LOG_TAG, CAPABILITY_COMPRESS_DEFLATE + " = " + hasCapability(CAPABILITY_COMPRESS_DEFLATE));
|
||||||
}
|
}
|
||||||
if (hasCapability(CAPABILITY_COMPRESS_DEFLATE)) {
|
if (hasCapability(CAPABILITY_COMPRESS_DEFLATE)) {
|
||||||
ConnectivityManager connectivityManager = (ConnectivityManager)K9.app.getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager connectivityManager = (ConnectivityManager)K9.app.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
@ -2524,13 +2529,13 @@ public class ImapStore extends RemoteStore {
|
|||||||
NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();
|
NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();
|
||||||
if (netInfo != null) {
|
if (netInfo != null) {
|
||||||
int type = netInfo.getType();
|
int type = netInfo.getType();
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "On network type " + type);
|
Log.d(LOG_TAG, "On network type " + type);
|
||||||
useCompression = mSettings.useCompression(type);
|
useCompression = mSettings.useCompression(type);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "useCompression " + useCompression);
|
Log.d(LOG_TAG, "useCompression " + useCompression);
|
||||||
if (useCompression) {
|
if (useCompression) {
|
||||||
try {
|
try {
|
||||||
executeSimpleCommand(COMMAND_COMPRESS_DEFLATE);
|
executeSimpleCommand(COMMAND_COMPRESS_DEFLATE);
|
||||||
@ -2541,53 +2546,53 @@ public class ImapStore extends RemoteStore {
|
|||||||
ZOutputStream zOutputStream = new ZOutputStream(mSocket.getOutputStream(), JZlib.Z_BEST_SPEED, true);
|
ZOutputStream zOutputStream = new ZOutputStream(mSocket.getOutputStream(), JZlib.Z_BEST_SPEED, true);
|
||||||
mOut = new BufferedOutputStream(zOutputStream, 1024);
|
mOut = new BufferedOutputStream(zOutputStream, 1024);
|
||||||
zOutputStream.setFlushMode(JZlib.Z_PARTIAL_FLUSH);
|
zOutputStream.setFlushMode(JZlib.Z_PARTIAL_FLUSH);
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.i(K9.LOG_TAG, "Compression enabled for " + getLogId());
|
Log.i(LOG_TAG, "Compression enabled for " + getLogId());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to negotiate compression", e);
|
Log.e(LOG_TAG, "Unable to negotiate compression", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
|
Log.d(LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
|
||||||
+ ", mPathPrefix = " + mSettings.getPathPrefix());
|
+ ", mPathPrefix = " + mSettings.getPathPrefix());
|
||||||
|
|
||||||
if (mSettings.getPathPrefix() == null) {
|
if (mSettings.getPathPrefix() == null) {
|
||||||
if (hasCapability(CAPABILITY_NAMESPACE)) {
|
if (hasCapability(CAPABILITY_NAMESPACE)) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "mPathPrefix is unset and server has NAMESPACE capability");
|
Log.i(LOG_TAG, "mPathPrefix is unset and server has NAMESPACE capability");
|
||||||
List<ImapResponse> namespaceResponses =
|
List<ImapResponse> namespaceResponses =
|
||||||
executeSimpleCommand(COMMAND_NAMESPACE);
|
executeSimpleCommand(COMMAND_NAMESPACE);
|
||||||
for (ImapResponse response : namespaceResponses) {
|
for (ImapResponse response : namespaceResponses) {
|
||||||
if (ImapResponseParser.equalsIgnoreCase(response.get(0), COMMAND_NAMESPACE)) {
|
if (ImapResponseParser.equalsIgnoreCase(response.get(0), COMMAND_NAMESPACE)) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId());
|
Log.d(LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId());
|
||||||
|
|
||||||
Object personalNamespaces = response.get(1);
|
Object personalNamespaces = response.get(1);
|
||||||
if (personalNamespaces != null && personalNamespaces instanceof ImapList) {
|
if (personalNamespaces != null && personalNamespaces instanceof ImapList) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got personal namespaces: " + personalNamespaces);
|
Log.d(LOG_TAG, "Got personal namespaces: " + personalNamespaces);
|
||||||
ImapList bracketed = (ImapList)personalNamespaces;
|
ImapList bracketed = (ImapList)personalNamespaces;
|
||||||
Object firstNamespace = bracketed.get(0);
|
Object firstNamespace = bracketed.get(0);
|
||||||
if (firstNamespace != null && firstNamespace instanceof ImapList) {
|
if (firstNamespace != null && firstNamespace instanceof ImapList) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got first personal namespaces: " + firstNamespace);
|
Log.d(LOG_TAG, "Got first personal namespaces: " + firstNamespace);
|
||||||
bracketed = (ImapList)firstNamespace;
|
bracketed = (ImapList)firstNamespace;
|
||||||
mSettings.setPathPrefix(bracketed.getString(0));
|
mSettings.setPathPrefix(bracketed.getString(0));
|
||||||
mSettings.setPathDelimeter(bracketed.getString(1));
|
mSettings.setPathDelimeter(bracketed.getString(1));
|
||||||
mSettings.setCombinedPrefix(null);
|
mSettings.setCombinedPrefix(null);
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got path '" + mSettings.getPathPrefix() + "' and separator '" + mSettings.getPathDelimeter() + "'");
|
Log.d(LOG_TAG, "Got path '" + mSettings.getPathPrefix() + "' and separator '" + mSettings.getPathDelimeter() + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability");
|
Log.i(LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability");
|
||||||
mSettings.setPathPrefix("");
|
mSettings.setPathPrefix("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2599,12 +2604,12 @@ public class ImapStore extends RemoteStore {
|
|||||||
if (ImapResponseParser.equalsIgnoreCase(response.get(0), "LIST")) {
|
if (ImapResponseParser.equalsIgnoreCase(response.get(0), "LIST")) {
|
||||||
mSettings.setPathDelimeter(response.getString(2));
|
mSettings.setPathDelimeter(response.getString(2));
|
||||||
mSettings.setCombinedPrefix(null);
|
mSettings.setCombinedPrefix(null);
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got path delimeter '" + mSettings.getPathDelimeter() + "' for " + getLogId());
|
Log.d(LOG_TAG, "Got path delimeter '" + mSettings.getPathDelimeter() + "' for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to get path delimeter using LIST", e);
|
Log.e(LOG_TAG, "Unable to get path delimeter using LIST", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2621,14 +2626,14 @@ public class ImapStore extends RemoteStore {
|
|||||||
String ceMess = ce.getMessage();
|
String ceMess = ce.getMessage();
|
||||||
String[] tokens = ceMess.split("-");
|
String[] tokens = ceMess.split("-");
|
||||||
if (tokens != null && tokens.length > 1 && tokens[1] != null) {
|
if (tokens != null && tokens.length > 1 && tokens[1] != null) {
|
||||||
Log.e(K9.LOG_TAG, "Stripping host/port from ConnectionException for " + getLogId(), ce);
|
Log.e(LOG_TAG, "Stripping host/port from ConnectionException for " + getLogId(), ce);
|
||||||
throw new ConnectException(tokens[1].trim());
|
throw new ConnectException(tokens[1].trim());
|
||||||
} else {
|
} else {
|
||||||
throw ce;
|
throw ce;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (!authSuccess) {
|
if (!authSuccess) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to login, closing connection for " + getLogId());
|
Log.e(LOG_TAG, "Failed to login, closing connection for " + getLogId());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2721,7 +2726,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
throw new MessagingException(
|
throw new MessagingException(
|
||||||
"Command continuation aborted: " + response);
|
"Command continuation aborted: " + response);
|
||||||
} else {
|
} else {
|
||||||
Log.w(K9.LOG_TAG, "After sending tag " + tag
|
Log.w(LOG_TAG, "After sending tag " + tag
|
||||||
+ ", got tag response from previous command "
|
+ ", got tag response from previous command "
|
||||||
+ response + " for " + getLogId());
|
+ response + " for " + getLogId());
|
||||||
}
|
}
|
||||||
@ -2737,11 +2742,11 @@ public class ImapStore extends RemoteStore {
|
|||||||
ImapResponse response;
|
ImapResponse response;
|
||||||
do {
|
do {
|
||||||
response = mParser.readResponse();
|
response = mParser.readResponse();
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP)
|
||||||
Log.v(K9.LOG_TAG, getLogId() + "<<<" + response);
|
Log.v(LOG_TAG, getLogId() + "<<<" + response);
|
||||||
|
|
||||||
if (response.mTag != null && !response.mTag.equalsIgnoreCase(tag)) {
|
if (response.mTag != null && !response.mTag.equalsIgnoreCase(tag)) {
|
||||||
Log.w(K9.LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " + response + " for " + getLogId());
|
Log.w(LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " + response + " for " + getLogId());
|
||||||
Iterator<ImapResponse> iter = responses.iterator();
|
Iterator<ImapResponse> iter = responses.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
ImapResponse delResponse = iter.next();
|
ImapResponse delResponse = iter.next();
|
||||||
@ -2772,8 +2777,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isIdleCapable() {
|
protected boolean isIdleCapable() {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.v(K9.LOG_TAG, "Connection " + getLogId() + " has " + capabilities.size() + " capabilities");
|
Log.v(LOG_TAG, "Connection " + getLogId() + " has " + capabilities.size() + " capabilities");
|
||||||
|
|
||||||
return capabilities.contains(CAPABILITY_IDLE);
|
return capabilities.contains(CAPABILITY_IDLE);
|
||||||
}
|
}
|
||||||
@ -2809,8 +2814,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
public ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException {
|
public ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException {
|
||||||
try {
|
try {
|
||||||
ImapResponse response = mParser.readResponse(callback);
|
ImapResponse response = mParser.readResponse(callback);
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP)
|
||||||
Log.v(K9.LOG_TAG, getLogId() + "<<<" + response);
|
Log.v(LOG_TAG, getLogId() + "<<<" + response);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
@ -2825,8 +2830,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
mOut.write('\n');
|
mOut.write('\n');
|
||||||
mOut.flush();
|
mOut.flush();
|
||||||
|
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP)
|
||||||
Log.v(K9.LOG_TAG, getLogId() + ">>> " + continuation);
|
Log.v(LOG_TAG, getLogId() + ">>> " + continuation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2839,12 +2844,12 @@ public class ImapStore extends RemoteStore {
|
|||||||
mOut.write(commandToSend.getBytes());
|
mOut.write(commandToSend.getBytes());
|
||||||
mOut.flush();
|
mOut.flush();
|
||||||
|
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||||
if (sensitive && !K9.DEBUG_SENSITIVE) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
Log.v(K9.LOG_TAG, getLogId() + ">>> "
|
Log.v(LOG_TAG, getLogId() + ">>> "
|
||||||
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||||
} else {
|
} else {
|
||||||
Log.v(K9.LOG_TAG, getLogId() + ">>> " + commandToSend);
|
Log.v(LOG_TAG, getLogId() + ">>> " + commandToSend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2874,17 +2879,17 @@ public class ImapStore extends RemoteStore {
|
|||||||
public List<ImapResponse> executeSimpleCommand(String command, boolean sensitive, UntaggedHandler untaggedHandler)
|
public List<ImapResponse> executeSimpleCommand(String command, boolean sensitive, UntaggedHandler untaggedHandler)
|
||||||
throws IOException, ImapException, MessagingException {
|
throws IOException, ImapException, MessagingException {
|
||||||
String commandToLog = command;
|
String commandToLog = command;
|
||||||
if (sensitive && !K9.DEBUG_SENSITIVE) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
commandToLog = "*sensitive*";
|
commandToLog = "*sensitive*";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if (K9.DEBUG)
|
//if (K9MailLib.isDebug())
|
||||||
// Log.v(K9.LOG_TAG, "Sending IMAP command " + commandToLog + " on connection " + getLogId());
|
// Log.v(LOG_TAG, "Sending IMAP command " + commandToLog + " on connection " + getLogId());
|
||||||
|
|
||||||
String tag = sendCommand(command, sensitive);
|
String tag = sendCommand(command, sensitive);
|
||||||
//if (K9.DEBUG)
|
//if (K9MailLib.isDebug())
|
||||||
// Log.v(K9.LOG_TAG, "Sent IMAP command " + commandToLog + " with tag " + tag + " for " + getLogId());
|
// Log.v(LOG_TAG, "Sent IMAP command " + commandToLog + " with tag " + tag + " for " + getLogId());
|
||||||
|
|
||||||
return readStatusResponse(tag, commandToLog, untaggedHandler);
|
return readStatusResponse(tag, commandToLog, untaggedHandler);
|
||||||
}
|
}
|
||||||
@ -2954,7 +2959,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
public void refresh() throws IOException, MessagingException {
|
public void refresh() throws IOException, MessagingException {
|
||||||
if (idling.get()) {
|
if (idling.get()) {
|
||||||
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
sendDone();
|
sendDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2982,9 +2987,9 @@ public class ImapStore extends RemoteStore {
|
|||||||
Runnable runner = new Runnable() {
|
Runnable runner = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Pusher starting for " + getLogId());
|
Log.i(LOG_TAG, "Pusher starting for " + getLogId());
|
||||||
|
|
||||||
long lastUidNext = -1L;
|
long lastUidNext = -1L;
|
||||||
while (!stop.get()) {
|
while (!stop.get()) {
|
||||||
@ -2994,10 +2999,10 @@ public class ImapStore extends RemoteStore {
|
|||||||
String pushStateS = receiver.getPushState(getName());
|
String pushStateS = receiver.getPushState(getName());
|
||||||
ImapPushState pushState = ImapPushState.parse(pushStateS);
|
ImapPushState pushState = ImapPushState.parse(pushStateS);
|
||||||
oldUidNext = pushState.uidNext;
|
oldUidNext = pushState.uidNext;
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId());
|
Log.i(LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e);
|
Log.e(LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3042,16 +3047,16 @@ public class ImapStore extends RemoteStore {
|
|||||||
long newUidNext = uidNext;
|
long newUidNext = uidNext;
|
||||||
|
|
||||||
if (newUidNext == -1) {
|
if (newUidNext == -1) {
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(K9.LOG_TAG, "uidNext is -1, using search to find highest UID");
|
Log.d(LOG_TAG, "uidNext is -1, using search to find highest UID");
|
||||||
}
|
}
|
||||||
long highestUid = getHighestUid();
|
long highestUid = getHighestUid();
|
||||||
if (highestUid != -1L) {
|
if (highestUid != -1L) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "highest UID = " + highestUid);
|
Log.d(LOG_TAG, "highest UID = " + highestUid);
|
||||||
newUidNext = highestUid + 1;
|
newUidNext = highestUid + 1;
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "highest UID = " + highestUid
|
Log.d(LOG_TAG, "highest UID = " + highestUid
|
||||||
+ ", set newUidNext to " + newUidNext);
|
+ ", set newUidNext to " + newUidNext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3066,8 +3071,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
lastUidNext = newUidNext;
|
lastUidNext = newUidNext;
|
||||||
if (newUidNext > startUid) {
|
if (newUidNext > startUid) {
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Needs sync from uid " + startUid + " to " + newUidNext + " for " + getLogId());
|
Log.i(LOG_TAG, "Needs sync from uid " + startUid + " to " + newUidNext + " for " + getLogId());
|
||||||
List<Message> messages = new ArrayList<Message>();
|
List<Message> messages = new ArrayList<Message>();
|
||||||
for (long uid = startUid; uid < newUidNext; uid++) {
|
for (long uid = startUid; uid < newUidNext; uid++) {
|
||||||
ImapMessage message = new ImapMessage("" + uid, ImapFolderPusher.this);
|
ImapMessage message = new ImapMessage("" + uid, ImapFolderPusher.this);
|
||||||
@ -3080,15 +3085,15 @@ public class ImapStore extends RemoteStore {
|
|||||||
} else {
|
} else {
|
||||||
List<ImapResponse> untaggedResponses = null;
|
List<ImapResponse> untaggedResponses = null;
|
||||||
while (!storedUntaggedResponses.isEmpty()) {
|
while (!storedUntaggedResponses.isEmpty()) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Processing " + storedUntaggedResponses.size() + " untagged responses from previous commands for " + getLogId());
|
Log.i(LOG_TAG, "Processing " + storedUntaggedResponses.size() + " untagged responses from previous commands for " + getLogId());
|
||||||
untaggedResponses = new ArrayList<ImapResponse>(storedUntaggedResponses);
|
untaggedResponses = new ArrayList<ImapResponse>(storedUntaggedResponses);
|
||||||
storedUntaggedResponses.clear();
|
storedUntaggedResponses.clear();
|
||||||
processUntaggedResponses(untaggedResponses);
|
processUntaggedResponses(untaggedResponses);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId());
|
Log.i(LOG_TAG, "About to IDLE for " + getLogId());
|
||||||
|
|
||||||
receiver.setPushActive(getName(), true);
|
receiver.setPushActive(getName(), true);
|
||||||
idling.set(true);
|
idling.set(true);
|
||||||
@ -3101,20 +3106,20 @@ public class ImapStore extends RemoteStore {
|
|||||||
idleFailureCount.set(0);
|
idleFailureCount.set(0);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
storedUntaggedResponses.clear();
|
storedUntaggedResponses.clear();
|
||||||
idling.set(false);
|
idling.set(false);
|
||||||
receiver.setPushActive(getName(), false);
|
receiver.setPushActive(getName(), false);
|
||||||
try {
|
try {
|
||||||
close();
|
close();
|
||||||
} catch (Exception me) {
|
} catch (Exception me) {
|
||||||
Log.e(K9.LOG_TAG, "Got exception while closing for exception for " + getLogId(), me);
|
Log.e(LOG_TAG, "Got exception while closing for exception for " + getLogId(), me);
|
||||||
}
|
}
|
||||||
if (stop.get()) {
|
if (stop.get()) {
|
||||||
Log.i(K9.LOG_TAG, "Got exception while idling, but stop is set for " + getLogId());
|
Log.i(LOG_TAG, "Got exception while idling, but stop is set for " + getLogId());
|
||||||
} else {
|
} else {
|
||||||
receiver.pushError("Push error for " + getName(), e);
|
receiver.pushError("Push error for " + getName(), e);
|
||||||
Log.e(K9.LOG_TAG, "Got exception while idling for " + getLogId(), e);
|
Log.e(LOG_TAG, "Got exception while idling for " + getLogId(), e);
|
||||||
int delayTimeInt = delayTime.get();
|
int delayTimeInt = delayTime.get();
|
||||||
receiver.sleep(wakeLock, delayTimeInt);
|
receiver.sleep(wakeLock, delayTimeInt);
|
||||||
delayTimeInt *= 2;
|
delayTimeInt *= 2;
|
||||||
@ -3123,7 +3128,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
delayTime.set(delayTimeInt);
|
delayTime.set(delayTimeInt);
|
||||||
if (idleFailureCount.incrementAndGet() > IDLE_FAILURE_COUNT_LIMIT) {
|
if (idleFailureCount.incrementAndGet() > IDLE_FAILURE_COUNT_LIMIT) {
|
||||||
Log.e(K9.LOG_TAG, "Disabling pusher for " + getLogId() + " after " + idleFailureCount.get() + " consecutive errors");
|
Log.e(LOG_TAG, "Disabling pusher for " + getLogId() + " after " + idleFailureCount.get() + " consecutive errors");
|
||||||
receiver.pushError("Push disabled for " + getName() + " after " + idleFailureCount.get() + " consecutive errors", e);
|
receiver.pushError("Push disabled for " + getName() + " after " + idleFailureCount.get() + " consecutive errors", e);
|
||||||
stop.set(true);
|
stop.set(true);
|
||||||
}
|
}
|
||||||
@ -3133,11 +3138,11 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
receiver.setPushActive(getName(), false);
|
receiver.setPushActive(getName(), false);
|
||||||
try {
|
try {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Pusher for " + getLogId() + " is exiting");
|
Log.i(LOG_TAG, "Pusher for " + getLogId() + " is exiting");
|
||||||
close();
|
close();
|
||||||
} catch (Exception me) {
|
} catch (Exception me) {
|
||||||
Log.e(K9.LOG_TAG, "Got exception while closing for " + getLogId(), me);
|
Log.e(LOG_TAG, "Got exception while closing for " + getLogId(), me);
|
||||||
} finally {
|
} finally {
|
||||||
wakeLock.release();
|
wakeLock.release();
|
||||||
}
|
}
|
||||||
@ -3154,8 +3159,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
if (ImapResponseParser.equalsIgnoreCase(responseType, "FETCH")
|
if (ImapResponseParser.equalsIgnoreCase(responseType, "FETCH")
|
||||||
|| ImapResponseParser.equalsIgnoreCase(responseType, "EXPUNGE")
|
|| ImapResponseParser.equalsIgnoreCase(responseType, "EXPUNGE")
|
||||||
|| ImapResponseParser.equalsIgnoreCase(responseType, "EXISTS")) {
|
|| ImapResponseParser.equalsIgnoreCase(responseType, "EXISTS")) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Storing response " + response + " for later processing");
|
Log.d(LOG_TAG, "Storing response " + response + " for later processing");
|
||||||
|
|
||||||
storedUntaggedResponses.add(response);
|
storedUntaggedResponses.add(response);
|
||||||
}
|
}
|
||||||
@ -3183,8 +3188,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
syncMessages(mMessageCount, true);
|
syncMessages(mMessageCount, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "UIDs for messages needing flag sync are " + flagSyncMsgSeqs + " for " + getLogId());
|
Log.d(LOG_TAG, "UIDs for messages needing flag sync are " + flagSyncMsgSeqs + " for " + getLogId());
|
||||||
|
|
||||||
if (!flagSyncMsgSeqs.isEmpty()) {
|
if (!flagSyncMsgSeqs.isEmpty()) {
|
||||||
syncMessages(flagSyncMsgSeqs);
|
syncMessages(flagSyncMsgSeqs);
|
||||||
@ -3200,17 +3205,17 @@ public class ImapStore extends RemoteStore {
|
|||||||
String pushStateS = receiver.getPushState(getName());
|
String pushStateS = receiver.getPushState(getName());
|
||||||
ImapPushState pushState = ImapPushState.parse(pushStateS);
|
ImapPushState pushState = ImapPushState.parse(pushStateS);
|
||||||
oldUidNext = pushState.uidNext;
|
oldUidNext = pushState.uidNext;
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId());
|
Log.i(LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e);
|
Log.e(LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<? extends Message> messageList = getMessages(end, end, null, true, null);
|
List<? extends Message> messageList = getMessages(end, end, null, true, null);
|
||||||
if (messageList != null && messageList.size() > 0) {
|
if (messageList != null && messageList.size() > 0) {
|
||||||
long newUid = Long.parseLong(messageList.get(0).getUid());
|
long newUid = Long.parseLong(messageList.get(0).getUid());
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Got newUid " + newUid + " for message " + end + " on " + getLogId());
|
Log.i(LOG_TAG, "Got newUid " + newUid + " for message " + end + " on " + getLogId());
|
||||||
long startUid = oldUidNext;
|
long startUid = oldUidNext;
|
||||||
if (startUid < newUid - 10) {
|
if (startUid < newUid - 10) {
|
||||||
startUid = newUid - 10;
|
startUid = newUid - 10;
|
||||||
@ -3220,8 +3225,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
if (newUid >= startUid) {
|
if (newUid >= startUid) {
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Needs sync from uid " + startUid + " to " + newUid + " for " + getLogId());
|
Log.i(LOG_TAG, "Needs sync from uid " + startUid + " to " + newUid + " for " + getLogId());
|
||||||
List<Message> messages = new ArrayList<Message>();
|
List<Message> messages = new ArrayList<Message>();
|
||||||
for (long uid = startUid; uid <= newUid; uid++) {
|
for (long uid = startUid; uid <= newUid; uid++) {
|
||||||
ImapMessage message = new ImapMessage(Long.toString(uid), ImapFolderPusher.this);
|
ImapMessage message = new ImapMessage(Long.toString(uid), ImapFolderPusher.this);
|
||||||
@ -3256,7 +3261,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
needsPoll.set(true);
|
needsPoll.set(true);
|
||||||
msgSeqUidMap.clear();
|
msgSeqUidMap.clear();
|
||||||
String existingUid = existingMessage.getUid();
|
String existingUid = existingMessage.getUid();
|
||||||
Log.w(K9.LOG_TAG, "Message with UID " + existingUid + " still exists on server, not expunging");
|
Log.w(LOG_TAG, "Message with UID " + existingUid + " still exists on server, not expunging");
|
||||||
removeUids.remove(existingUid);
|
removeUids.remove(existingUid);
|
||||||
}
|
}
|
||||||
for (String uid : removeUids) {
|
for (String uid : removeUids) {
|
||||||
@ -3264,13 +3269,13 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
message.setFlagInternal(Flag.DELETED, true);
|
message.setFlagInternal(Flag.DELETED, true);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to set DELETED flag on message " + message.getUid());
|
Log.e(LOG_TAG, "Unable to set DELETED flag on message " + message.getUid());
|
||||||
}
|
}
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
}
|
}
|
||||||
receiver.messagesRemoved(this, messages);
|
receiver.messagesRemoved(this, messages);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Cannot remove EXPUNGEd messages", e);
|
Log.e(LOG_TAG, "Cannot remove EXPUNGEd messages", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3282,11 +3287,11 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
Object responseType = response.get(1);
|
Object responseType = response.get(1);
|
||||||
if (ImapResponseParser.equalsIgnoreCase(responseType, "FETCH")) {
|
if (ImapResponseParser.equalsIgnoreCase(responseType, "FETCH")) {
|
||||||
Log.i(K9.LOG_TAG, "Got FETCH " + response);
|
Log.i(LOG_TAG, "Got FETCH " + response);
|
||||||
long msgSeq = response.getLong(0);
|
long msgSeq = response.getLong(0);
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId());
|
Log.d(LOG_TAG, "Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId());
|
||||||
|
|
||||||
if (!flagSyncMsgSeqs.contains(msgSeq)) {
|
if (!flagSyncMsgSeqs.contains(msgSeq)) {
|
||||||
flagSyncMsgSeqs.add(msgSeq);
|
flagSyncMsgSeqs.add(msgSeq);
|
||||||
@ -3297,8 +3302,8 @@ public class ImapStore extends RemoteStore {
|
|||||||
if (msgSeq <= oldMessageCount) {
|
if (msgSeq <= oldMessageCount) {
|
||||||
messageCountDelta = -1;
|
messageCountDelta = -1;
|
||||||
}
|
}
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got untagged EXPUNGE for msgseq " + msgSeq + " for " + getLogId());
|
Log.d(LOG_TAG, "Got untagged EXPUNGE for msgseq " + msgSeq + " for " + getLogId());
|
||||||
|
|
||||||
List<Long> newSeqs = new ArrayList<Long>();
|
List<Long> newSeqs = new ArrayList<Long>();
|
||||||
Iterator<Long> flagIter = flagSyncMsgSeqs.iterator();
|
Iterator<Long> flagIter = flagSyncMsgSeqs.iterator();
|
||||||
@ -3318,20 +3323,20 @@ public class ImapStore extends RemoteStore {
|
|||||||
Collections.sort(msgSeqs); // Have to do comparisons in order because of msgSeq reductions
|
Collections.sort(msgSeqs); // Have to do comparisons in order because of msgSeq reductions
|
||||||
|
|
||||||
for (long msgSeqNum : msgSeqs) {
|
for (long msgSeqNum : msgSeqs) {
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(K9.LOG_TAG, "Comparing EXPUNGEd msgSeq " + msgSeq + " to " + msgSeqNum);
|
Log.v(LOG_TAG, "Comparing EXPUNGEd msgSeq " + msgSeq + " to " + msgSeqNum);
|
||||||
}
|
}
|
||||||
if (msgSeqNum == msgSeq) {
|
if (msgSeqNum == msgSeq) {
|
||||||
String uid = msgSeqUidMap.get(msgSeqNum);
|
String uid = msgSeqUidMap.get(msgSeqNum);
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(K9.LOG_TAG, "Scheduling removal of UID " + uid + " because msgSeq " + msgSeqNum + " was expunged");
|
Log.d(LOG_TAG, "Scheduling removal of UID " + uid + " because msgSeq " + msgSeqNum + " was expunged");
|
||||||
}
|
}
|
||||||
removeMsgUids.add(uid);
|
removeMsgUids.add(uid);
|
||||||
msgSeqUidMap.remove(msgSeqNum);
|
msgSeqUidMap.remove(msgSeqNum);
|
||||||
} else if (msgSeqNum > msgSeq) {
|
} else if (msgSeqNum > msgSeq) {
|
||||||
String uid = msgSeqUidMap.get(msgSeqNum);
|
String uid = msgSeqUidMap.get(msgSeqNum);
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.d(K9.LOG_TAG, "Reducing msgSeq for UID " + uid + " from " + msgSeqNum + " to " + (msgSeqNum - 1));
|
Log.d(LOG_TAG, "Reducing msgSeq for UID " + uid + " from " + msgSeqNum + " to " + (msgSeqNum - 1));
|
||||||
}
|
}
|
||||||
msgSeqUidMap.remove(msgSeqNum);
|
msgSeqUidMap.remove(msgSeqNum);
|
||||||
msgSeqUidMap.put(msgSeqNum - 1, uid);
|
msgSeqUidMap.put(msgSeqNum - 1, uid);
|
||||||
@ -3339,7 +3344,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Could not handle untagged FETCH for " + getLogId(), e);
|
Log.e(LOG_TAG, "Could not handle untagged FETCH for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return messageCountDelta;
|
return messageCountDelta;
|
||||||
@ -3370,27 +3375,27 @@ public class ImapStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
ImapConnection conn = mConnection;
|
ImapConnection conn = mConnection;
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.v(K9.LOG_TAG, "Closing mConnection to stop pushing for " + getLogId());
|
Log.v(LOG_TAG, "Closing mConnection to stop pushing for " + getLogId());
|
||||||
conn.close();
|
conn.close();
|
||||||
} else {
|
} else {
|
||||||
Log.w(K9.LOG_TAG, "Attempt to interrupt null mConnection to stop pushing on folderPusher for " + getLogId());
|
Log.w(LOG_TAG, "Attempt to interrupt null mConnection to stop pushing on folderPusher for " + getLogId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleAsyncUntaggedResponse(ImapResponse response) {
|
public void handleAsyncUntaggedResponse(ImapResponse response) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.v(K9.LOG_TAG, "Got async response: " + response);
|
Log.v(LOG_TAG, "Got async response: " + response);
|
||||||
|
|
||||||
if (stop.get()) {
|
if (stop.get()) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got async untagged response: " + response + ", but stop is set for " + getLogId());
|
Log.d(LOG_TAG, "Got async untagged response: " + response + ", but stop is set for " + getLogId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendDone();
|
sendDone();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
|
Log.e(LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (response.mTag == null) {
|
if (response.mTag == null) {
|
||||||
@ -3400,22 +3405,22 @@ public class ImapStore extends RemoteStore {
|
|||||||
if (ImapResponseParser.equalsIgnoreCase(responseType, "EXISTS") || ImapResponseParser.equalsIgnoreCase(responseType, "EXPUNGE") ||
|
if (ImapResponseParser.equalsIgnoreCase(responseType, "EXISTS") || ImapResponseParser.equalsIgnoreCase(responseType, "EXPUNGE") ||
|
||||||
ImapResponseParser.equalsIgnoreCase(responseType, "FETCH")) {
|
ImapResponseParser.equalsIgnoreCase(responseType, "FETCH")) {
|
||||||
if (!started) {
|
if (!started) {
|
||||||
wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT);
|
wakeLock.acquire(PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
started = true;
|
started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Got useful async untagged response: " + response + " for " + getLogId());
|
Log.d(LOG_TAG, "Got useful async untagged response: " + response + " for " + getLogId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendDone();
|
sendDone();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
|
Log.e(LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (response.mCommandContinuationRequested) {
|
} else if (response.mCommandContinuationRequested) {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, "Idling " + getLogId());
|
Log.d(LOG_TAG, "Idling " + getLogId());
|
||||||
|
|
||||||
wakeLock.release();
|
wakeLock.release();
|
||||||
}
|
}
|
||||||
@ -3463,7 +3468,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
folderPusher.refresh();
|
folderPusher.refresh();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Got exception while refreshing for " + folderPusher.getName(), e);
|
Log.e(LOG_TAG, "Got exception while refreshing for " + folderPusher.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3471,17 +3476,17 @@ public class ImapStore extends RemoteStore {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Requested stop of IMAP pusher");
|
Log.i(LOG_TAG, "Requested stop of IMAP pusher");
|
||||||
|
|
||||||
synchronized (folderPushers) {
|
synchronized (folderPushers) {
|
||||||
for (ImapFolderPusher folderPusher : folderPushers.values()) {
|
for (ImapFolderPusher folderPusher : folderPushers.values()) {
|
||||||
try {
|
try {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.i(K9.LOG_TAG, "Requesting stop of IMAP folderPusher " + folderPusher.getName());
|
Log.i(LOG_TAG, "Requesting stop of IMAP folderPusher " + folderPusher.getName());
|
||||||
folderPusher.stop();
|
folderPusher.stop();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Got exception while stopping " + folderPusher.getName(), e);
|
Log.e(LOG_TAG, "Got exception while stopping " + folderPusher.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
folderPushers.clear();
|
folderPushers.clear();
|
||||||
@ -3527,7 +3532,7 @@ public class ImapStore extends RemoteStore {
|
|||||||
try {
|
try {
|
||||||
newUidNext = Long.parseLong(value);
|
newUidNext = Long.parseLong(value);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(K9.LOG_TAG, "Unable to part uidNext value " + value, e);
|
Log.e(LOG_TAG, "Unable to part uidNext value " + value, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@ package com.fsck.k9.mail.store;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods for use with IMAP.
|
* Utility methods for use with IMAP.
|
||||||
*/
|
*/
|
||||||
@ -101,12 +101,12 @@ class ImapUtility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d(K9.LOG_TAG, "Invalid range: " + range);
|
Log.d(LOG_TAG, "Invalid range: " + range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.d(K9.LOG_TAG, "Invalid range value: " + range, e);
|
Log.d(LOG_TAG, "Invalid range value: " + range, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@ -122,7 +122,7 @@ class ImapUtility {
|
|||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(K9.LOG_TAG, "Invalid UID value: " + number);
|
Log.d(LOG_TAG, "Invalid UID value: " + number);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
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.LOG_TAG;
|
||||||
|
|
||||||
public class Pop3Store extends RemoteStore {
|
public class Pop3Store extends RemoteStore {
|
||||||
public static final String STORE_TYPE = "POP3";
|
public static final String STORE_TYPE = "POP3";
|
||||||
|
|
||||||
@ -631,7 +634,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(K9.LOG_TAG, "ERR response: " + response);
|
Log.e(LOG_TAG, "ERR response: " + response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String msgUid = uidParts[2];
|
String msgUid = uidParts[2];
|
||||||
@ -689,8 +692,8 @@ public class Pop3Store extends RemoteStore {
|
|||||||
Set<String> unindexedUids = new HashSet<String>();
|
Set<String> unindexedUids = new HashSet<String>();
|
||||||
for (String uid : uids) {
|
for (String uid : uids) {
|
||||||
if (mUidToMsgMap.get(uid) == null) {
|
if (mUidToMsgMap.get(uid) == null) {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(K9.LOG_TAG, "Need to index UID " + uid);
|
Log.d(LOG_TAG, "Need to index UID " + uid);
|
||||||
}
|
}
|
||||||
unindexedUids.add(uid);
|
unindexedUids.add(uid);
|
||||||
}
|
}
|
||||||
@ -715,8 +718,8 @@ public class Pop3Store extends RemoteStore {
|
|||||||
Integer msgNum = Integer.valueOf(uidParts[0]);
|
Integer msgNum = Integer.valueOf(uidParts[0]);
|
||||||
String msgUid = uidParts[1];
|
String msgUid = uidParts[1];
|
||||||
if (unindexedUids.contains(msgUid)) {
|
if (unindexedUids.contains(msgUid)) {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
|
Log.d(LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pop3Message message = mUidToMsgMap.get(msgUid);
|
Pop3Message message = mUidToMsgMap.get(msgUid);
|
||||||
@ -730,8 +733,8 @@ public class Pop3Store extends RemoteStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void indexMessage(int msgNum, Pop3Message message) {
|
private void indexMessage(int msgNum, Pop3Message message) {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(K9.LOG_TAG, "Adding index for UID " + message.getUid() + " to msgNum " + msgNum);
|
Log.d(LOG_TAG, "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);
|
||||||
@ -902,8 +905,8 @@ public class Pop3Store extends RemoteStore {
|
|||||||
// Try hard to use the TOP command if we're not asked to download the whole message.
|
// Try hard to use the TOP command if we're not asked to download the whole message.
|
||||||
if (lines != -1 && (!mTopNotSupported || mCapabilities.top)) {
|
if (lines != -1 && (!mTopNotSupported || mCapabilities.top)) {
|
||||||
try {
|
try {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3 && !mCapabilities.top) {
|
||||||
Log.d(K9.LOG_TAG, "This server doesn't support the CAPA command. " +
|
Log.d(LOG_TAG, "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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,8 +920,8 @@ public class Pop3Store extends RemoteStore {
|
|||||||
// The TOP command should be supported but something went wrong.
|
// The TOP command should be supported but something went wrong.
|
||||||
throw e;
|
throw e;
|
||||||
} else {
|
} else {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(K9.LOG_TAG, "The server really doesn't support the TOP " +
|
Log.d(LOG_TAG, "The server really doesn't support the TOP " +
|
||||||
"command. Using RETR instead.");
|
"command. Using RETR instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1025,8 +1028,8 @@ public class Pop3Store extends RemoteStore {
|
|||||||
}
|
}
|
||||||
} while ((d = mIn.read()) != -1);
|
} while ((d = mIn.read()) != -1);
|
||||||
String ret = sb.toString();
|
String ret = sb.toString();
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
Log.d(K9.LOG_TAG, "<<< " + ret);
|
Log.d(LOG_TAG, "<<< " + ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1118,12 +1121,12 @@ public class Pop3Store extends RemoteStore {
|
|||||||
open(Folder.OPEN_MODE_RW);
|
open(Folder.OPEN_MODE_RW);
|
||||||
|
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||||
if (sensitive && !K9.DEBUG_SENSITIVE) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
Log.d(K9.LOG_TAG, ">>> "
|
Log.d(LOG_TAG, ">>> "
|
||||||
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||||
} else {
|
} else {
|
||||||
Log.d(K9.LOG_TAG, ">>> " + command);
|
Log.d(LOG_TAG, ">>> " + command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1195,7 +1198,7 @@ public class Pop3Store extends RemoteStore {
|
|||||||
// }
|
// }
|
||||||
// catch (MessagingException me)
|
// catch (MessagingException me)
|
||||||
// {
|
// {
|
||||||
// Log.w(K9.LOG_TAG, "Could not delete non-existent message", me);
|
// Log.w(LOG_TAG, "Could not delete non-existent message", me);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@ package com.fsck.k9.mail.store;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
|
||||||
|
|
||||||
import com.fsck.k9.mail.*;
|
import com.fsck.k9.mail.*;
|
||||||
import com.fsck.k9.mail.filter.Base64;
|
import com.fsck.k9.mail.filter.Base64;
|
||||||
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
|
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
|
||||||
@ -47,6 +45,9 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
import static com.fsck.k9.mail.K9MailLib.DEBUG_PROTOCOL_WEBDAV;
|
||||||
|
import static com.fsck.k9.mail.K9MailLib.LOG_TAG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* Uses WebDAV formatted HTTP calls to an MS Exchange server to fetch email
|
* Uses WebDAV formatted HTTP calls to an MS Exchange server to fetch email
|
||||||
@ -719,7 +720,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
doFBA(null);
|
doFBA(null);
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(K9.LOG_TAG, "Error during authentication: " + ioe + "\nStack: " + processException(ioe));
|
Log.e(LOG_TAG, "Error during authentication: " + ioe + "\nStack: " + processException(ioe));
|
||||||
throw new MessagingException("Error during authentication", ioe);
|
throw new MessagingException("Error during authentication", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,7 +790,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
} catch (SSLException e) {
|
} catch (SSLException e) {
|
||||||
throw new CertificateValidationException(e.getMessage(), e);
|
throw new CertificateValidationException(e.getMessage(), e);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(K9.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe));
|
Log.e(LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe));
|
||||||
throw new MessagingException("IOException", ioe);
|
throw new MessagingException("IOException", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +892,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
response = httpClient.executeOverride(request, mContext);
|
response = httpClient.executeOverride(request, mContext);
|
||||||
authenticated = testAuthenticationResponse(response);
|
authenticated = testAuthenticationResponse(response);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
Log.e(K9.LOG_TAG, "URISyntaxException caught " + e + "\nTrace: " + processException(e));
|
Log.e(LOG_TAG, "URISyntaxException caught " + e + "\nTrace: " + processException(e));
|
||||||
throw new MessagingException("URISyntaxException caught", e);
|
throw new MessagingException("URISyntaxException caught", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -985,7 +986,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
Log.e(K9.LOG_TAG, "URISyntaxException caught " + e + "\nTrace: " + processException(e));
|
Log.e(LOG_TAG, "URISyntaxException caught " + e + "\nTrace: " + processException(e));
|
||||||
throw new MessagingException("URISyntaxException caught", e);
|
throw new MessagingException("URISyntaxException caught", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1022,10 +1023,10 @@ public class WebDavStore extends RemoteStore {
|
|||||||
Scheme s = new Scheme("https", new WebDavSocketFactory(mHost, 443), 443);
|
Scheme s = new Scheme("https", new WebDavSocketFactory(mHost, 443), 443);
|
||||||
reg.register(s);
|
reg.register(s);
|
||||||
} catch (NoSuchAlgorithmException nsa) {
|
} catch (NoSuchAlgorithmException nsa) {
|
||||||
Log.e(K9.LOG_TAG, "NoSuchAlgorithmException in getHttpClient: " + nsa);
|
Log.e(LOG_TAG, "NoSuchAlgorithmException in getHttpClient: " + nsa);
|
||||||
throw new MessagingException("NoSuchAlgorithmException in getHttpClient: " + nsa);
|
throw new MessagingException("NoSuchAlgorithmException in getHttpClient: " + nsa);
|
||||||
} catch (KeyManagementException kme) {
|
} catch (KeyManagementException kme) {
|
||||||
Log.e(K9.LOG_TAG, "KeyManagementException in getHttpClient: " + kme);
|
Log.e(LOG_TAG, "KeyManagementException in getHttpClient: " + kme);
|
||||||
throw new MessagingException("KeyManagementException in getHttpClient: " + kme);
|
throw new MessagingException("KeyManagementException in getHttpClient: " + kme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1092,10 +1093,10 @@ public class WebDavStore extends RemoteStore {
|
|||||||
istream = WebDavHttpClient.getUngzippedContent(entity);
|
istream = WebDavHttpClient.getUngzippedContent(entity);
|
||||||
}
|
}
|
||||||
} catch (UnsupportedEncodingException uee) {
|
} catch (UnsupportedEncodingException uee) {
|
||||||
Log.e(K9.LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee));
|
Log.e(LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee));
|
||||||
throw new MessagingException("UnsupportedEncodingException", uee);
|
throw new MessagingException("UnsupportedEncodingException", uee);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(K9.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe));
|
Log.e(LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe));
|
||||||
throw new MessagingException("IOException", ioe);
|
throw new MessagingException("IOException", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1120,8 +1121,8 @@ public class WebDavStore extends RemoteStore {
|
|||||||
boolean needsParsing)
|
boolean needsParsing)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
DataSet dataset = new DataSet();
|
DataSet dataset = new DataSet();
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||||
Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '"
|
Log.v(LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '"
|
||||||
+ messageBody + "'");
|
+ messageBody + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,10 +1154,10 @@ public class WebDavStore extends RemoteStore {
|
|||||||
|
|
||||||
dataset = myHandler.getDataSet();
|
dataset = myHandler.getDataSet();
|
||||||
} catch (SAXException se) {
|
} catch (SAXException se) {
|
||||||
Log.e(K9.LOG_TAG, "SAXException in processRequest() " + se + "\nTrace: " + processException(se));
|
Log.e(LOG_TAG, "SAXException in processRequest() " + se + "\nTrace: " + processException(se));
|
||||||
throw new MessagingException("SAXException in processRequest() ", se);
|
throw new MessagingException("SAXException in processRequest() ", se);
|
||||||
} catch (ParserConfigurationException pce) {
|
} catch (ParserConfigurationException pce) {
|
||||||
Log.e(K9.LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: "
|
Log.e(LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: "
|
||||||
+ processException(pce));
|
+ processException(pce));
|
||||||
throw new MessagingException("ParserConfigurationException in processRequest() ", pce);
|
throw new MessagingException("ParserConfigurationException in processRequest() ", pce);
|
||||||
}
|
}
|
||||||
@ -1164,10 +1165,10 @@ public class WebDavStore extends RemoteStore {
|
|||||||
istream.close();
|
istream.close();
|
||||||
}
|
}
|
||||||
} catch (UnsupportedEncodingException uee) {
|
} catch (UnsupportedEncodingException uee) {
|
||||||
Log.e(K9.LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee));
|
Log.e(LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee));
|
||||||
throw new MessagingException("UnsupportedEncodingException in processRequest() ", uee);
|
throw new MessagingException("UnsupportedEncodingException in processRequest() ", uee);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(K9.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe));
|
Log.e(LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe));
|
||||||
throw new MessagingException("IOException in processRequest() ", ioe);
|
throw new MessagingException("IOException in processRequest() ", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1308,7 +1309,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
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(K9.LOG_TAG, "Moving " + messages.size() + " messages to " + destFolder.mFolderUrl);
|
Log.i(LOG_TAG, "Moving " + messages.size() + " messages to " + destFolder.mFolderUrl);
|
||||||
|
|
||||||
processRequest(mFolderUrl, action, messageBody, headers, false);
|
processRequest(mFolderUrl, action, messageBody, headers, false);
|
||||||
}
|
}
|
||||||
@ -1331,8 +1332,8 @@ public class WebDavStore extends RemoteStore {
|
|||||||
if (dataset != null) {
|
if (dataset != null) {
|
||||||
messageCount = dataset.getMessageCount();
|
messageCount = dataset.getMessageCount();
|
||||||
}
|
}
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||||
Log.v(K9.LOG_TAG, "Counted messages and webdav returned: "+messageCount);
|
Log.v(LOG_TAG, "Counted messages and webdav returned: "+messageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messageCount;
|
return messageCount;
|
||||||
@ -1559,7 +1560,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
*/
|
*/
|
||||||
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(K9.LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
|
Log.i(LOG_TAG, "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");
|
||||||
@ -1567,7 +1568,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log.i(K9.LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
|
Log.i(LOG_TAG, "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;
|
||||||
@ -1623,13 +1624,13 @@ public class WebDavStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(K9.LOG_TAG, "IllegalArgumentException caught " + iae + "\nTrace: " + processException(iae));
|
Log.e(LOG_TAG, "IllegalArgumentException caught " + iae + "\nTrace: " + processException(iae));
|
||||||
throw new MessagingException("IllegalArgumentException caught", iae);
|
throw new MessagingException("IllegalArgumentException caught", iae);
|
||||||
} catch (URISyntaxException use) {
|
} catch (URISyntaxException use) {
|
||||||
Log.e(K9.LOG_TAG, "URISyntaxException caught " + use + "\nTrace: " + processException(use));
|
Log.e(LOG_TAG, "URISyntaxException caught " + use + "\nTrace: " + processException(use));
|
||||||
throw new MessagingException("URISyntaxException caught", use);
|
throw new MessagingException("URISyntaxException caught", use);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
Log.e(K9.LOG_TAG, "Non-success response code loading message, response code was " + statusCode
|
Log.e(LOG_TAG, "Non-success response code loading message, response code was " + statusCode
|
||||||
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
|
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
|
||||||
+ processException(ioe));
|
+ processException(ioe));
|
||||||
throw new MessagingException("Failure code " + statusCode, ioe);
|
throw new MessagingException("Failure code " + statusCode, ioe);
|
||||||
@ -1700,7 +1701,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
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(K9.LOG_TAG,"Under some weird circumstances, setting the read status when syncing from webdav threw an NPE. Skipping.");
|
Log.v(LOG_TAG,"Under some weird circumstances, setting the read status when syncing from webdav threw an NPE. Skipping.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
@ -1769,7 +1770,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
wdMessage.setNewHeaders(envelope);
|
wdMessage.setNewHeaders(envelope);
|
||||||
wdMessage.setFlagInternal(Flag.SEEN, envelope.getReadStatus());
|
wdMessage.setFlagInternal(Flag.SEEN, envelope.getReadStatus());
|
||||||
} else {
|
} else {
|
||||||
Log.e(K9.LOG_TAG,"Asked to get metadata for a non-existent message: "+wdMessage.getUid());
|
Log.e(LOG_TAG,"Asked to get metadata for a non-existent message: "+wdMessage.getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
@ -1881,7 +1882,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
}
|
}
|
||||||
messageURL += encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
messageURL += encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
||||||
|
|
||||||
Log.i(K9.LOG_TAG, "Uploading message as " + messageURL);
|
Log.i(LOG_TAG, "Uploading message as " + messageURL);
|
||||||
|
|
||||||
httpmethod = new HttpGeneric(messageURL);
|
httpmethod = new HttpGeneric(messageURL);
|
||||||
httpmethod.setMethod("PUT");
|
httpmethod.setMethod("PUT");
|
||||||
@ -1920,7 +1921,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUidFromMessageId(Message message) throws MessagingException {
|
public String getUidFromMessageId(Message message) throws MessagingException {
|
||||||
Log.e(K9.LOG_TAG,
|
Log.e(LOG_TAG,
|
||||||
"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;
|
||||||
@ -1928,7 +1929,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
|
|
||||||
@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(K9.LOG_TAG,
|
Log.e(LOG_TAG,
|
||||||
"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
|
||||||
}
|
}
|
||||||
@ -1970,7 +1971,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
end = encodeUtf8(end);
|
end = encodeUtf8(end);
|
||||||
end = end.replaceAll("\\+", "%20");
|
end = end.replaceAll("\\+", "%20");
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
|
Log.e(LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
|
||||||
+ processException(iae));
|
+ processException(iae));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2020,7 +2021,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
@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(K9.LOG_TAG, "Deleting message by moving to " + trashFolderName);
|
Log.i(LOG_TAG, "Deleting message by moving to " + trashFolderName);
|
||||||
wdFolder.moveMessages(Collections.singletonList(this), wdFolder.getStore().getFolder(trashFolderName));
|
wdFolder.moveMessages(Collections.singletonList(this), wdFolder.getStore().getFolder(trashFolderName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2318,7 +2319,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
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(K9.LOG_TAG, "Error parsing date: " + pe + "\nTrace: " + processException(pe));
|
Log.e(LOG_TAG, "Error parsing date: " + pe + "\nTrace: " + processException(pe));
|
||||||
}
|
}
|
||||||
envelope.addHeader(header, tempDate);
|
envelope.addHeader(header, tempDate);
|
||||||
} else {
|
} else {
|
||||||
@ -2357,8 +2358,8 @@ public class WebDavStore extends RemoteStore {
|
|||||||
public HttpGeneric(final String uri) {
|
public HttpGeneric(final String uri) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(K9.LOG_TAG, "Starting uri = '" + uri + "'");
|
Log.v(LOG_TAG, "Starting uri = '" + uri + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] urlParts = uri.split("/");
|
String[] urlParts = uri.split("/");
|
||||||
@ -2376,7 +2377,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
end = end.replaceAll("\\+", "%20");
|
end = end.replaceAll("\\+", "%20");
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: "
|
Log.e(LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: "
|
||||||
+ processException(iae));
|
+ processException(iae));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2387,13 +2388,13 @@ public class WebDavStore extends RemoteStore {
|
|||||||
url = urlParts[i];
|
url = urlParts[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||||
Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length()
|
Log.v(LOG_TAG, "url = '" + url + "' length = " + url.length()
|
||||||
+ ", end = '" + end + "' length = " + end.length());
|
+ ", end = '" + end + "' length = " + end.length());
|
||||||
}
|
}
|
||||||
url = url + "/" + end;
|
url = url + "/" + end;
|
||||||
|
|
||||||
Log.i(K9.LOG_TAG, "url = " + url);
|
Log.i(LOG_TAG, "url = " + url);
|
||||||
setURI(URI.create(url));
|
setURI(URI.create(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2423,7 +2424,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
* the License for the specific language governing permissions and limitations under the License.
|
* the License for the specific language governing permissions and limitations under the License.
|
||||||
*/
|
*/
|
||||||
public static void modifyRequestToAcceptGzipResponse(HttpRequest request) {
|
public static void modifyRequestToAcceptGzipResponse(HttpRequest request) {
|
||||||
Log.i(K9.LOG_TAG, "Requesting gzipped data");
|
Log.i(LOG_TAG, "Requesting gzipped data");
|
||||||
request.addHeader("Accept-Encoding", "gzip");
|
request.addHeader("Accept-Encoding", "gzip");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2439,7 +2440,7 @@ public class WebDavStore extends RemoteStore {
|
|||||||
if (contentEncoding == null)
|
if (contentEncoding == null)
|
||||||
return responseStream;
|
return responseStream;
|
||||||
if (contentEncoding.contains("gzip")) {
|
if (contentEncoding.contains("gzip")) {
|
||||||
Log.i(K9.LOG_TAG, "Response is gzipped");
|
Log.i(LOG_TAG, "Response is gzipped");
|
||||||
responseStream = new GZIPInputStream(responseStream);
|
responseStream = new GZIPInputStream(responseStream);
|
||||||
}
|
}
|
||||||
return responseStream;
|
return responseStream;
|
||||||
|
@ -26,6 +26,9 @@ import java.net.*;
|
|||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
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 String TRANSPORT_TYPE = "SMTP";
|
public static final String TRANSPORT_TYPE = "SMTP";
|
||||||
|
|
||||||
@ -303,8 +306,8 @@ public class SmtpTransport extends Transport {
|
|||||||
try {
|
try {
|
||||||
mLargestAcceptableMessage = Integer.parseInt(extensions.get("SIZE"));
|
mLargestAcceptableMessage = Integer.parseInt(extensions.get("SIZE"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP) {
|
||||||
Log.d(K9.LOG_TAG, "Tried to parse " + extensions.get("SIZE") + " and get an int", e);
|
Log.d(LOG_TAG, "Tried to parse " + extensions.get("SIZE") + " and get an int", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,14 +439,14 @@ public class SmtpTransport extends Transport {
|
|||||||
extensions.put(pair[0].toUpperCase(Locale.US), pair.length == 1 ? "" : pair[1]);
|
extensions.put(pair[0].toUpperCase(Locale.US), pair.length == 1 ? "" : pair[1]);
|
||||||
}
|
}
|
||||||
} catch (NegativeSmtpReplyException e) {
|
} catch (NegativeSmtpReplyException e) {
|
||||||
if (K9.DEBUG) {
|
if (K9MailLib.isDebug()) {
|
||||||
Log.v(K9.LOG_TAG, "Server doesn't support the EHLO command. Trying HELO...");
|
Log.v(LOG_TAG, "Server doesn't support the EHLO command. Trying HELO...");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
executeSimpleCommand("HELO " + host);
|
executeSimpleCommand("HELO " + host);
|
||||||
} catch (NegativeSmtpReplyException e2) {
|
} catch (NegativeSmtpReplyException e2) {
|
||||||
Log.w(K9.LOG_TAG, "Server doesn't support the HELO command. Continuing anyway.");
|
Log.w(LOG_TAG, "Server doesn't support the HELO command. Continuing anyway.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return extensions;
|
return extensions;
|
||||||
@ -527,7 +530,7 @@ public class SmtpTransport extends Transport {
|
|||||||
// "5xx text" -responses are permanent failures
|
// "5xx text" -responses are permanent failures
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
if (msg != null && msg.startsWith("5")) {
|
if (msg != null && msg.startsWith("5")) {
|
||||||
Log.w(K9.LOG_TAG, "handling 5xx SMTP error code as a permanent failure");
|
Log.w(LOG_TAG, "handling 5xx SMTP error code as a permanent failure");
|
||||||
possibleSend = false;
|
possibleSend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,21 +583,21 @@ public class SmtpTransport extends Transport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String ret = sb.toString();
|
String ret = sb.toString();
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP)
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP)
|
||||||
Log.d(K9.LOG_TAG, "SMTP <<< " + ret);
|
Log.d(LOG_TAG, "SMTP <<< " + ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeLine(String s, boolean sensitive) throws IOException {
|
private void writeLine(String s, boolean sensitive) throws IOException {
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP) {
|
||||||
final String commandToLog;
|
final String commandToLog;
|
||||||
if (sensitive && !K9.DEBUG_SENSITIVE) {
|
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||||
commandToLog = "SMTP >>> *sensitive*";
|
commandToLog = "SMTP >>> *sensitive*";
|
||||||
} else {
|
} else {
|
||||||
commandToLog = "SMTP >>> " + s;
|
commandToLog = "SMTP >>> " + s;
|
||||||
}
|
}
|
||||||
Log.d(K9.LOG_TAG, commandToLog);
|
Log.d(LOG_TAG, commandToLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] data = s.concat("\r\n").getBytes();
|
byte[] data = s.concat("\r\n").getBytes();
|
||||||
|
@ -3,7 +3,7 @@ package com.fsck.k9.mail.transport;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.K9;
|
import com.fsck.k9.mail.K9MailLib;
|
||||||
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.ServerSettings;
|
import com.fsck.k9.mail.ServerSettings;
|
||||||
@ -13,6 +13,8 @@ import com.fsck.k9.mail.store.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 {
|
||||||
public static final String TRANSPORT_TYPE = WebDavStore.STORE_TYPE;
|
public static final String TRANSPORT_TYPE = WebDavStore.STORE_TYPE;
|
||||||
|
|
||||||
@ -46,14 +48,14 @@ public class WebDavTransport extends Transport {
|
|||||||
public WebDavTransport(StoreConfig storeConfig) throws MessagingException {
|
public WebDavTransport(StoreConfig storeConfig) throws MessagingException {
|
||||||
store = new WebDavStore(storeConfig);
|
store = new WebDavStore(storeConfig);
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, ">>> New WebDavTransport creation complete");
|
Log.d(LOG_TAG, ">>> New WebDavTransport creation complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open() throws MessagingException {
|
public void open() throws MessagingException {
|
||||||
if (K9.DEBUG)
|
if (K9MailLib.isDebug())
|
||||||
Log.d(K9.LOG_TAG, ">>> open called on WebDavTransport ");
|
Log.d(LOG_TAG, ">>> open called on WebDavTransport ");
|
||||||
|
|
||||||
store.getHttpClient();
|
store.getHttpClient();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user