mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-07 02:30:10 -05:00
find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren
This commit is contained in:
parent
6b5bcd2c4d
commit
1a66072910
@ -175,7 +175,7 @@ public class Account implements BaseAccount
|
|||||||
mIdleRefreshMinutes = preferences.getPreferences().getInt(mUuid
|
mIdleRefreshMinutes = preferences.getPreferences().getInt(mUuid
|
||||||
+ ".idleRefreshMinutes", 24);
|
+ ".idleRefreshMinutes", 24);
|
||||||
mSaveAllHeaders = preferences.getPreferences().getBoolean(mUuid
|
mSaveAllHeaders = preferences.getPreferences().getBoolean(mUuid
|
||||||
+ ".saveAllHeaders", false);
|
+ ".saveAllHeaders", false);
|
||||||
mPushPollOnConnect = preferences.getPreferences().getBoolean(mUuid
|
mPushPollOnConnect = preferences.getPreferences().getBoolean(mUuid
|
||||||
+ ".pushPollOnConnect", true);
|
+ ".pushPollOnConnect", true);
|
||||||
mDisplayCount = preferences.getPreferences().getInt(mUuid + ".displayCount", -1);
|
mDisplayCount = preferences.getPreferences().getInt(mUuid + ".displayCount", -1);
|
||||||
|
@ -360,9 +360,9 @@ public class FolderList extends K9ListActivity
|
|||||||
// This will be called either automatically for you on 2.0
|
// This will be called either automatically for you on 2.0
|
||||||
// or later, or by the code above on earlier versions of the
|
// or later, or by the code above on earlier versions of the
|
||||||
// platform.
|
// platform.
|
||||||
if (K9.manageBack() )
|
if (K9.manageBack())
|
||||||
{
|
{
|
||||||
onAccounts();
|
onAccounts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
keyCode == KeyEvent.KEYCODE_BACK
|
keyCode == KeyEvent.KEYCODE_BACK
|
||||||
&& event.getRepeatCount() == 0
|
&& event.getRepeatCount() == 0
|
||||||
&& K9.manageBack() )
|
&& K9.manageBack())
|
||||||
{
|
{
|
||||||
// Take care of calling this method on earlier versions of
|
// Take care of calling this method on earlier versions of
|
||||||
// the platform where it doesn't exist.
|
// the platform where it doesn't exist.
|
||||||
|
@ -396,8 +396,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
//TODO: Use constant Intent.ACTION_SEND_MULTIPLE once we drop Android 1.5 support
|
//TODO: Use constant Intent.ACTION_SEND_MULTIPLE once we drop Android 1.5 support
|
||||||
else if (Intent.ACTION_SEND.equals(action)
|
else if (Intent.ACTION_SEND.equals(action)
|
||||||
|| Intent.ACTION_SENDTO.equals(action)
|
|| Intent.ACTION_SENDTO.equals(action)
|
||||||
|| "android.intent.action.SEND_MULTIPLE".equals(action))
|
|| "android.intent.action.SEND_MULTIPLE".equals(action))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Someone is trying to compose an email with an attachment, probably Pictures.
|
* Someone is trying to compose an email with an attachment, probably Pictures.
|
||||||
|
@ -580,10 +580,12 @@ public class MessageList
|
|||||||
// This will be called either automatically for you on 2.0
|
// This will be called either automatically for you on 2.0
|
||||||
// or later, or by the code above on earlier versions of the
|
// or later, or by the code above on earlier versions of the
|
||||||
// platform.
|
// platform.
|
||||||
if (K9.manageBack())
|
if (K9.manageBack())
|
||||||
{
|
{
|
||||||
onShowFolderList();
|
onShowFolderList();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,8 +598,8 @@ public class MessageList
|
|||||||
// XXX TODO - when we go to android 2.0, uncomment this
|
// XXX TODO - when we go to android 2.0, uncomment this
|
||||||
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
// android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&
|
||||||
keyCode == KeyEvent.KEYCODE_BACK
|
keyCode == KeyEvent.KEYCODE_BACK
|
||||||
&& event.getRepeatCount() == 0
|
&& event.getRepeatCount() == 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Take care of calling this method on earlier versions of
|
// Take care of calling this method on earlier versions of
|
||||||
// the platform where it doesn't exist.
|
// the platform where it doesn't exist.
|
||||||
|
@ -100,7 +100,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
|
|
||||||
private FontSizes mFontSizes = K9.getFontSizes();
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pair class is only available since API Level 5, so we need
|
* Pair class is only available since API Level 5, so we need
|
||||||
* this helper class unfortunately
|
* this helper class unfortunately
|
||||||
*/
|
*/
|
||||||
@ -108,7 +108,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
{
|
{
|
||||||
public String label;
|
public String label;
|
||||||
public String value;
|
public String value;
|
||||||
|
|
||||||
public HeaderEntry(String label, String value)
|
public HeaderEntry(String label, String value)
|
||||||
{
|
{
|
||||||
this.label = label;
|
this.label = label;
|
||||||
@ -438,8 +438,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
*/
|
*/
|
||||||
public void hideAdditionalHeaders()
|
public void hideAdditionalHeaders()
|
||||||
{
|
{
|
||||||
runOnUiThread(new Runnable()
|
runOnUiThread(new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
mAdditionalHeadersView.setVisibility(View.GONE);
|
mAdditionalHeadersView.setVisibility(View.GONE);
|
||||||
@ -459,19 +459,19 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
{
|
{
|
||||||
runOnUiThread(new Runnable()
|
runOnUiThread(new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Integer messageToShow = null;
|
Integer messageToShow = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Retrieve additional headers
|
// Retrieve additional headers
|
||||||
boolean allHeadersDownloaded = mMessage.isSet(Flag.X_GOT_ALL_HEADERS);
|
boolean allHeadersDownloaded = mMessage.isSet(Flag.X_GOT_ALL_HEADERS);
|
||||||
List<HeaderEntry> additionalHeaders = getAdditionalHeaders(mMessage);
|
List<HeaderEntry> additionalHeaders = getAdditionalHeaders(mMessage);
|
||||||
|
|
||||||
if (!additionalHeaders.isEmpty())
|
if (!additionalHeaders.isEmpty())
|
||||||
{
|
{
|
||||||
// Show the additional headers that we have got.
|
// Show the additional headers that we have got.
|
||||||
setupAdditionalHeadersView(additionalHeaders);
|
setupAdditionalHeadersView(additionalHeaders);
|
||||||
mAdditionalHeadersView.setVisibility(View.VISIBLE);
|
mAdditionalHeadersView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
* NOTE: This is only a temporary solution... in fact,
|
* NOTE: This is only a temporary solution... in fact,
|
||||||
* the system should download headers on-demand when they
|
* the system should download headers on-demand when they
|
||||||
* have not been saved in their entirety initially.
|
* have not been saved in their entirety initially.
|
||||||
*/
|
*/
|
||||||
messageToShow = R.string.message_additional_headers_not_downloaded;
|
messageToShow = R.string.message_additional_headers_not_downloaded;
|
||||||
}
|
}
|
||||||
else if (additionalHeaders.isEmpty())
|
else if (additionalHeaders.isEmpty())
|
||||||
@ -492,7 +492,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
messageToShow = R.string.message_no_additional_headers_available;
|
messageToShow = R.string.message_no_additional_headers_available;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(MessagingException e)
|
catch (MessagingException e)
|
||||||
{
|
{
|
||||||
messageToShow = R.string.message_additional_headers_retrieval_failed;
|
messageToShow = R.string.message_additional_headers_retrieval_failed;
|
||||||
}
|
}
|
||||||
@ -503,19 +503,19 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
Toast toast = Toast.makeText(MessageView.this, messageToShow, Toast.LENGTH_LONG);
|
Toast toast = Toast.makeText(MessageView.this, messageToShow, Toast.LENGTH_LONG);
|
||||||
toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0);
|
toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the additional headers text view with the supplied header data.
|
* Set up the additional headers text view with the supplied header data.
|
||||||
*
|
*
|
||||||
* @param additionalHeaders
|
* @param additionalHeaders
|
||||||
* List of header entries. Each entry consists of a header
|
* List of header entries. Each entry consists of a header
|
||||||
* name and a header value. Header names may appear multiple
|
* name and a header value. Header names may appear multiple
|
||||||
* times.
|
* times.
|
||||||
*
|
*
|
||||||
* This method is always called from within the UI thread by
|
* This method is always called from within the UI thread by
|
||||||
* {@link #showAdditionalHeaders()}.
|
* {@link #showAdditionalHeaders()}.
|
||||||
*/
|
*/
|
||||||
@ -639,7 +639,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
|
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
|
||||||
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
|
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
|
||||||
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders());
|
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders());
|
||||||
mAdditionalHeadersView.setVisibility(View.GONE);
|
mAdditionalHeadersView.setVisibility(View.GONE);
|
||||||
mAttachments.setVisibility(View.GONE);
|
mAttachments.setVisibility(View.GONE);
|
||||||
mAttachmentIcon.setVisibility(View.GONE);
|
mAttachmentIcon.setVisibility(View.GONE);
|
||||||
|
|
||||||
@ -1031,8 +1031,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<HeaderEntry> getAdditionalHeaders(final Message message)
|
private List<HeaderEntry> getAdditionalHeaders(final Message message)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
List<HeaderEntry> additionalHeaders = new LinkedList<HeaderEntry>();
|
List<HeaderEntry> additionalHeaders = new LinkedList<HeaderEntry>();
|
||||||
|
|
||||||
// Do not include the following headers, since they are always visible anyway
|
// Do not include the following headers, since they are always visible anyway
|
||||||
@ -1277,8 +1277,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
onShowPictures();
|
onShowPictures();
|
||||||
break;
|
break;
|
||||||
case R.id.header_container:
|
case R.id.header_container:
|
||||||
onShowAdditionalHeaders();
|
onShowAdditionalHeaders();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1363,7 +1363,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
if (additionalHeadersItem != null)
|
if (additionalHeadersItem != null)
|
||||||
{
|
{
|
||||||
additionalHeadersItem.setTitle((mAdditionalHeadersView.getVisibility() == View.VISIBLE) ?
|
additionalHeadersItem.setTitle((mAdditionalHeadersView.getVisibility() == View.VISIBLE) ?
|
||||||
R.string.hide_full_header_action : R.string.show_full_header_action);
|
R.string.hide_full_header_action : R.string.show_full_header_action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +429,7 @@ public class AccountSettings extends K9PreferenceActivity
|
|||||||
|
|
||||||
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));
|
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));
|
||||||
boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
|
boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
|
||||||
|
|
||||||
if (mAccount.getFolderPushMode() != FolderMode.NONE)
|
if (mAccount.getFolderPushMode() != FolderMode.NONE)
|
||||||
{
|
{
|
||||||
needsPushRestart |= displayModeChanged;
|
needsPushRestart |= displayModeChanged;
|
||||||
|
@ -901,7 +901,7 @@ public class MessagingController implements Runnable
|
|||||||
String[] queryFields = {"html_content","subject","sender_list"};
|
String[] queryFields = {"html_content","subject","sender_list"};
|
||||||
LocalStore localStore = account.getLocalStore();
|
LocalStore localStore = account.getLocalStore();
|
||||||
localStore.searchForMessages(retrievalListener, queryFields
|
localStore.searchForMessages(retrievalListener, queryFields
|
||||||
, query, foldersToSearch,
|
, query, foldersToSearch,
|
||||||
messagesToSearch == null ? null : messagesToSearch.toArray(new Message[0]),
|
messagesToSearch == null ? null : messagesToSearch.toArray(new Message[0]),
|
||||||
requiredFlags, forbiddenFlags);
|
requiredFlags, forbiddenFlags);
|
||||||
|
|
||||||
@ -1542,7 +1542,7 @@ public class MessagingController implements Runnable
|
|||||||
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
|
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4096,7 +4096,7 @@ public class MessagingController implements Runnable
|
|||||||
if (useManualWakeLock)
|
if (useManualWakeLock)
|
||||||
{
|
{
|
||||||
TracingPowerManager pm = TracingPowerManager.getPowerManager(context);
|
TracingPowerManager pm = TracingPowerManager.getPowerManager(context);
|
||||||
|
|
||||||
twakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9 MessagingController.checkMail");
|
twakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9 MessagingController.checkMail");
|
||||||
twakeLock.setReferenceCounted(false);
|
twakeLock.setReferenceCounted(false);
|
||||||
twakeLock.acquire(K9.MANUAL_WAKE_LOCK_TIMEOUT);
|
twakeLock.acquire(K9.MANUAL_WAKE_LOCK_TIMEOUT);
|
||||||
|
@ -53,7 +53,7 @@ public class DomainNameChecker
|
|||||||
/**
|
/**
|
||||||
* Checks the site certificate against the domain name of the site being
|
* Checks the site certificate against the domain name of the site being
|
||||||
* visited
|
* visited
|
||||||
*
|
*
|
||||||
* @param certificate
|
* @param certificate
|
||||||
* The certificate to check
|
* The certificate to check
|
||||||
* @param thisDomain
|
* @param thisDomain
|
||||||
@ -95,7 +95,7 @@ public class DomainNameChecker
|
|||||||
if (rval)
|
if (rval)
|
||||||
{
|
{
|
||||||
rval = domain.equals(InetAddress.getByName(domain)
|
rval = domain.equals(InetAddress.getByName(domain)
|
||||||
.getHostAddress());
|
.getHostAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e)
|
catch (UnknownHostException e)
|
||||||
@ -109,7 +109,7 @@ public class DomainNameChecker
|
|||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "DomainNameChecker.isIpAddress(): "
|
Log.v(K9.LOG_TAG, "DomainNameChecker.isIpAddress(): "
|
||||||
+ errorMessage);
|
+ errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
rval = false;
|
rval = false;
|
||||||
@ -122,7 +122,7 @@ public class DomainNameChecker
|
|||||||
/**
|
/**
|
||||||
* Checks the site certificate against the IP domain name of the site being
|
* Checks the site certificate against the IP domain name of the site being
|
||||||
* visited
|
* visited
|
||||||
*
|
*
|
||||||
* @param certificate
|
* @param certificate
|
||||||
* The certificate to check
|
* The certificate to check
|
||||||
* @param thisDomain
|
* @param thisDomain
|
||||||
@ -144,15 +144,15 @@ public class DomainNameChecker
|
|||||||
Iterator<?> i = subjectAltNames.iterator();
|
Iterator<?> i = subjectAltNames.iterator();
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
List<?> altNameEntry = (List<?>) (i.next());
|
List<?> altNameEntry = (List<?>)(i.next());
|
||||||
if ((altNameEntry != null) && (2 <= altNameEntry.size()))
|
if ((altNameEntry != null) && (2 <= altNameEntry.size()))
|
||||||
{
|
{
|
||||||
Integer altNameType = (Integer) (altNameEntry.get(0));
|
Integer altNameType = (Integer)(altNameEntry.get(0));
|
||||||
if (altNameType != null)
|
if (altNameType != null)
|
||||||
{
|
{
|
||||||
if (altNameType.intValue() == ALT_IPA_NAME)
|
if (altNameType.intValue() == ALT_IPA_NAME)
|
||||||
{
|
{
|
||||||
String altName = (String) (altNameEntry.get(1));
|
String altName = (String)(altNameEntry.get(1));
|
||||||
if (altName != null)
|
if (altName != null)
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
@ -180,7 +180,7 @@ public class DomainNameChecker
|
|||||||
/**
|
/**
|
||||||
* Checks the site certificate against the DNS domain name of the site being
|
* Checks the site certificate against the DNS domain name of the site being
|
||||||
* visited
|
* visited
|
||||||
*
|
*
|
||||||
* @param certificate
|
* @param certificate
|
||||||
* The certificate to check
|
* The certificate to check
|
||||||
* @param thisDomain
|
* @param thisDomain
|
||||||
@ -198,16 +198,16 @@ public class DomainNameChecker
|
|||||||
Iterator<?> i = subjectAltNames.iterator();
|
Iterator<?> i = subjectAltNames.iterator();
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
{
|
{
|
||||||
List<?> altNameEntry = (List<?>) (i.next());
|
List<?> altNameEntry = (List<?>)(i.next());
|
||||||
if ((altNameEntry != null) && (2 <= altNameEntry.size()))
|
if ((altNameEntry != null) && (2 <= altNameEntry.size()))
|
||||||
{
|
{
|
||||||
Integer altNameType = (Integer) (altNameEntry.get(0));
|
Integer altNameType = (Integer)(altNameEntry.get(0));
|
||||||
if (altNameType != null)
|
if (altNameType != null)
|
||||||
{
|
{
|
||||||
if (altNameType.intValue() == ALT_DNS_NAME)
|
if (altNameType.intValue() == ALT_DNS_NAME)
|
||||||
{
|
{
|
||||||
hasDns = true;
|
hasDns = true;
|
||||||
String altName = (String) (altNameEntry.get(1));
|
String altName = (String)(altNameEntry.get(1));
|
||||||
if (altName != null)
|
if (altName != null)
|
||||||
{
|
{
|
||||||
if (matchDns(thisDomain, altName))
|
if (matchDns(thisDomain, altName))
|
||||||
@ -237,7 +237,7 @@ public class DomainNameChecker
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log.v(K9.LOG_TAG, "DomainNameChecker.matchDns(): "
|
Log.v(K9.LOG_TAG, "DomainNameChecker.matchDns(): "
|
||||||
+ errorMessage);
|
+ errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ public class DomainNameChecker
|
|||||||
{
|
{
|
||||||
if (oid.elementAt(i).equals(X509Name.CN))
|
if (oid.elementAt(i).equals(X509Name.CN))
|
||||||
{
|
{
|
||||||
return matchDns(thisDomain, (String) (val.elementAt(i)));
|
return matchDns(thisDomain, (String)(val.elementAt(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,8 +270,8 @@ public class DomainNameChecker
|
|||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "DomainNameChecker.matchDns():"
|
Log.v(K9.LOG_TAG, "DomainNameChecker.matchDns():"
|
||||||
+ " this domain: " + thisDomain + " that domain: "
|
+ " this domain: " + thisDomain + " that domain: "
|
||||||
+ thatDomain);
|
+ thatDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((thisDomain == null) || (thisDomain.length() == 0)
|
if ((thisDomain == null) || (thisDomain.length() == 0)
|
||||||
@ -311,7 +311,7 @@ public class DomainNameChecker
|
|||||||
// (d) OR we have a *-component match:
|
// (d) OR we have a *-component match:
|
||||||
// f*.com matches foo.com but not bar.com
|
// f*.com matches foo.com but not bar.com
|
||||||
rval = domainTokenMatch(thisDomainTokens[0],
|
rval = domainTokenMatch(thisDomainTokens[0],
|
||||||
thatDomainTokens[0]);
|
thatDomainTokens[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ public class DomainNameChecker
|
|||||||
String suffix = thatDomainToken.substring(starIndex + 1);
|
String suffix = thatDomainToken.substring(starIndex + 1);
|
||||||
|
|
||||||
return thisDomainToken.startsWith(prefix)
|
return thisDomainToken.startsWith(prefix)
|
||||||
&& thisDomainToken.endsWith(suffix);
|
&& thisDomainToken.endsWith(suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,32 +28,32 @@ public class Regex
|
|||||||
* This pattern is auto-generated by //device/tools/make-iana-tld-pattern.py
|
* This pattern is auto-generated by //device/tools/make-iana-tld-pattern.py
|
||||||
*/
|
*/
|
||||||
public static final Pattern TOP_LEVEL_DOMAIN_PATTERN
|
public static final Pattern TOP_LEVEL_DOMAIN_PATTERN
|
||||||
= Pattern.compile(
|
= Pattern.compile(
|
||||||
"((aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
|
"((aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
|
||||||
+ "|(biz|b[abdefghijmnorstvwyz])"
|
+ "|(biz|b[abdefghijmnorstvwyz])"
|
||||||
+ "|(cat|com|coop|c[acdfghiklmnoruvxyz])"
|
+ "|(cat|com|coop|c[acdfghiklmnoruvxyz])"
|
||||||
+ "|d[ejkmoz]"
|
+ "|d[ejkmoz]"
|
||||||
+ "|(edu|e[cegrstu])"
|
+ "|(edu|e[cegrstu])"
|
||||||
+ "|f[ijkmor]"
|
+ "|f[ijkmor]"
|
||||||
+ "|(gov|g[abdefghilmnpqrstuwy])"
|
+ "|(gov|g[abdefghilmnpqrstuwy])"
|
||||||
+ "|h[kmnrtu]"
|
+ "|h[kmnrtu]"
|
||||||
+ "|(info|int|i[delmnoqrst])"
|
+ "|(info|int|i[delmnoqrst])"
|
||||||
+ "|(jobs|j[emop])"
|
+ "|(jobs|j[emop])"
|
||||||
+ "|k[eghimnrwyz]"
|
+ "|k[eghimnrwyz]"
|
||||||
+ "|l[abcikrstuvy]"
|
+ "|l[abcikrstuvy]"
|
||||||
+ "|(mil|mobi|museum|m[acdghklmnopqrstuvwxyz])"
|
+ "|(mil|mobi|museum|m[acdghklmnopqrstuvwxyz])"
|
||||||
+ "|(name|net|n[acefgilopruz])"
|
+ "|(name|net|n[acefgilopruz])"
|
||||||
+ "|(org|om)"
|
+ "|(org|om)"
|
||||||
+ "|(pro|p[aefghklmnrstwy])"
|
+ "|(pro|p[aefghklmnrstwy])"
|
||||||
+ "|qa"
|
+ "|qa"
|
||||||
+ "|r[eouw]"
|
+ "|r[eouw]"
|
||||||
+ "|s[abcdeghijklmnortuvyz]"
|
+ "|s[abcdeghijklmnortuvyz]"
|
||||||
+ "|(tel|travel|t[cdfghjklmnoprtvwz])"
|
+ "|(tel|travel|t[cdfghjklmnoprtvwz])"
|
||||||
+ "|u[agkmsyz]"
|
+ "|u[agkmsyz]"
|
||||||
+ "|v[aceginu]"
|
+ "|v[aceginu]"
|
||||||
+ "|w[fs]"
|
+ "|w[fs]"
|
||||||
+ "|y[etu]"
|
+ "|y[etu]"
|
||||||
+ "|z[amw])");
|
+ "|z[amw])");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regular expression pattern to match RFC 1738 URLs
|
* Regular expression pattern to match RFC 1738 URLs
|
||||||
@ -62,72 +62,72 @@ public class Regex
|
|||||||
* This pattern is auto-generated by //device/tools/make-iana-tld-pattern.py
|
* This pattern is auto-generated by //device/tools/make-iana-tld-pattern.py
|
||||||
*/
|
*/
|
||||||
public static final Pattern WEB_URL_PATTERN
|
public static final Pattern WEB_URL_PATTERN
|
||||||
= Pattern.compile(
|
= Pattern.compile(
|
||||||
"((?:(http|https|Http|Https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
|
"((?:(http|https|Http|Https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
|
||||||
+ "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_"
|
+ "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_"
|
||||||
+ "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?"
|
+ "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?"
|
||||||
+ "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}\\.)+" // named host
|
+ "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}\\.)+" // named host
|
||||||
+ "(?:" // plus top level domain
|
+ "(?:" // plus top level domain
|
||||||
+ "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
|
+ "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
|
||||||
+ "|(?:biz|b[abdefghijmnorstvwyz])"
|
+ "|(?:biz|b[abdefghijmnorstvwyz])"
|
||||||
+ "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])"
|
+ "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])"
|
||||||
+ "|d[ejkmoz]"
|
+ "|d[ejkmoz]"
|
||||||
+ "|(?:edu|e[cegrstu])"
|
+ "|(?:edu|e[cegrstu])"
|
||||||
+ "|f[ijkmor]"
|
+ "|f[ijkmor]"
|
||||||
+ "|(?:gov|g[abdefghilmnpqrstuwy])"
|
+ "|(?:gov|g[abdefghilmnpqrstuwy])"
|
||||||
+ "|h[kmnrtu]"
|
+ "|h[kmnrtu]"
|
||||||
+ "|(?:info|int|i[delmnoqrst])"
|
+ "|(?:info|int|i[delmnoqrst])"
|
||||||
+ "|(?:jobs|j[emop])"
|
+ "|(?:jobs|j[emop])"
|
||||||
+ "|k[eghimnrwyz]"
|
+ "|k[eghimnrwyz]"
|
||||||
+ "|l[abcikrstuvy]"
|
+ "|l[abcikrstuvy]"
|
||||||
+ "|(?:mil|mobi|museum|m[acdghklmnopqrstuvwxyz])"
|
+ "|(?:mil|mobi|museum|m[acdghklmnopqrstuvwxyz])"
|
||||||
+ "|(?:name|net|n[acefgilopruz])"
|
+ "|(?:name|net|n[acefgilopruz])"
|
||||||
+ "|(?:org|om)"
|
+ "|(?:org|om)"
|
||||||
+ "|(?:pro|p[aefghklmnrstwy])"
|
+ "|(?:pro|p[aefghklmnrstwy])"
|
||||||
+ "|qa"
|
+ "|qa"
|
||||||
+ "|r[eouw]"
|
+ "|r[eouw]"
|
||||||
+ "|s[abcdeghijklmnortuvyz]"
|
+ "|s[abcdeghijklmnortuvyz]"
|
||||||
+ "|(?:tel|travel|t[cdfghjklmnoprtvwz])"
|
+ "|(?:tel|travel|t[cdfghjklmnoprtvwz])"
|
||||||
+ "|u[agkmsyz]"
|
+ "|u[agkmsyz]"
|
||||||
+ "|v[aceginu]"
|
+ "|v[aceginu]"
|
||||||
+ "|w[fs]"
|
+ "|w[fs]"
|
||||||
+ "|y[etu]"
|
+ "|y[etu]"
|
||||||
+ "|z[amw]))"
|
+ "|z[amw]))"
|
||||||
+ "|(?:(?:25[0-5]|2[0-4]" // or ip address
|
+ "|(?:(?:25[0-5]|2[0-4]" // or ip address
|
||||||
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]"
|
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]"
|
||||||
+ "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]"
|
+ "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]"
|
||||||
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
|
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
|
||||||
+ "|[1-9][0-9]|[0-9])))"
|
+ "|[1-9][0-9]|[0-9])))"
|
||||||
+ "(?:\\:\\d{1,5})?)" // plus option port number
|
+ "(?:\\:\\d{1,5})?)" // plus option port number
|
||||||
+ "(\\/(?:(?:[a-zA-Z0-9\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params
|
+ "(\\/(?:(?:[a-zA-Z0-9\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params
|
||||||
+ "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?"
|
+ "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?"
|
||||||
+ "(?:\\b|$)"); // and finally, a word boundary or end of
|
+ "(?:\\b|$)"); // and finally, a word boundary or end of
|
||||||
// input. This is to stop foo.sure from
|
// input. This is to stop foo.sure from
|
||||||
// matching as foo.su
|
// matching as foo.su
|
||||||
|
|
||||||
public static final Pattern IP_ADDRESS_PATTERN
|
public static final Pattern IP_ADDRESS_PATTERN
|
||||||
= Pattern.compile(
|
= Pattern.compile(
|
||||||
"((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
|
"((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
|
||||||
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
|
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
|
||||||
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
|
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
|
||||||
+ "|[1-9][0-9]|[0-9]))");
|
+ "|[1-9][0-9]|[0-9]))");
|
||||||
|
|
||||||
public static final Pattern DOMAIN_NAME_PATTERN
|
public static final Pattern DOMAIN_NAME_PATTERN
|
||||||
= Pattern.compile(
|
= Pattern.compile(
|
||||||
"(((([a-zA-Z0-9][a-zA-Z0-9\\-]*)*[a-zA-Z0-9]\\.)+"
|
"(((([a-zA-Z0-9][a-zA-Z0-9\\-]*)*[a-zA-Z0-9]\\.)+"
|
||||||
+ TOP_LEVEL_DOMAIN_PATTERN + ")|"
|
+ TOP_LEVEL_DOMAIN_PATTERN + ")|"
|
||||||
+ IP_ADDRESS_PATTERN + ")");
|
+ IP_ADDRESS_PATTERN + ")");
|
||||||
|
|
||||||
public static final Pattern EMAIL_ADDRESS_PATTERN
|
public static final Pattern EMAIL_ADDRESS_PATTERN
|
||||||
= Pattern.compile(
|
= Pattern.compile(
|
||||||
"[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}" +
|
"[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}" +
|
||||||
"\\@" +
|
"\\@" +
|
||||||
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
|
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
|
||||||
"(" +
|
"(" +
|
||||||
"\\." +
|
"\\." +
|
||||||
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
|
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
|
||||||
")+"
|
")+"
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This pattern is intended for searching for things that look like they
|
* This pattern is intended for searching for things that look like they
|
||||||
@ -144,10 +144,10 @@ public class Regex
|
|||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public static final Pattern PHONE_PATTERN
|
public static final Pattern PHONE_PATTERN
|
||||||
= Pattern.compile( // sdd = space, dot, or dash
|
= Pattern.compile( // sdd = space, dot, or dash
|
||||||
"(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>*
|
"(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>*
|
||||||
+ "(\\([0-9]+\\)[\\- \\.]*)?" // (<digits>)<sdd>*
|
+ "(\\([0-9]+\\)[\\- \\.]*)?" // (<digits>)<sdd>*
|
||||||
+ "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit>
|
+ "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to take all of the non-null matching groups in a
|
* Convenience method to take all of the non-null matching groups in a
|
||||||
|
@ -17,7 +17,7 @@ public class TracingPowerManager
|
|||||||
PowerManager pm = null;
|
PowerManager pm = null;
|
||||||
private static TracingPowerManager tracingPowerManager;
|
private static TracingPowerManager tracingPowerManager;
|
||||||
private Timer timer = null;
|
private Timer timer = null;
|
||||||
|
|
||||||
public static synchronized TracingPowerManager getPowerManager(Context context)
|
public static synchronized TracingPowerManager getPowerManager(Context context)
|
||||||
{
|
{
|
||||||
if (tracingPowerManager == null)
|
if (tracingPowerManager == null)
|
||||||
@ -30,17 +30,17 @@ public class TracingPowerManager
|
|||||||
}
|
}
|
||||||
return tracingPowerManager;
|
return tracingPowerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TracingPowerManager(Context context)
|
private TracingPowerManager(Context context)
|
||||||
{
|
{
|
||||||
pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
if (TRACE)
|
if (TRACE)
|
||||||
{
|
{
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TracingWakeLock newWakeLock(int flags, String tag)
|
public TracingWakeLock newWakeLock(int flags, String tag)
|
||||||
{
|
{
|
||||||
return new TracingWakeLock(flags, tag);
|
return new TracingWakeLock(flags, tag);
|
||||||
@ -65,14 +65,14 @@ public class TracingPowerManager
|
|||||||
}
|
}
|
||||||
public void acquire(long timeout)
|
public void acquire(long timeout)
|
||||||
{
|
{
|
||||||
synchronized(wakeLock)
|
synchronized (wakeLock)
|
||||||
{
|
{
|
||||||
wakeLock.acquire(timeout);
|
wakeLock.acquire(timeout);
|
||||||
}
|
}
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id
|
Log.v(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id
|
||||||
+ " for " + timeout + " ms");
|
+ " for " + timeout + " ms");
|
||||||
}
|
}
|
||||||
raiseNotification();
|
raiseNotification();
|
||||||
if (startTime == null)
|
if (startTime == null)
|
||||||
@ -83,15 +83,15 @@ public class TracingPowerManager
|
|||||||
}
|
}
|
||||||
public void acquire()
|
public void acquire()
|
||||||
{
|
{
|
||||||
synchronized(wakeLock)
|
synchronized (wakeLock)
|
||||||
{
|
{
|
||||||
wakeLock.acquire();
|
wakeLock.acquire();
|
||||||
}
|
}
|
||||||
raiseNotification();
|
raiseNotification();
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.w(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id
|
Log.w(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id
|
||||||
+ " with no timeout. K-9 Mail should not do this");
|
+ " with no timeout. K-9 Mail should not do this");
|
||||||
}
|
}
|
||||||
if (startTime == null)
|
if (startTime == null)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ public class TracingPowerManager
|
|||||||
}
|
}
|
||||||
public void setReferenceCounted(boolean counted)
|
public void setReferenceCounted(boolean counted)
|
||||||
{
|
{
|
||||||
synchronized(wakeLock)
|
synchronized (wakeLock)
|
||||||
{
|
{
|
||||||
wakeLock.setReferenceCounted(counted);
|
wakeLock.setReferenceCounted(counted);
|
||||||
}
|
}
|
||||||
@ -113,8 +113,8 @@ public class TracingPowerManager
|
|||||||
Long endTime = System.currentTimeMillis();
|
Long endTime = System.currentTimeMillis();
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "Releasing TracingWakeLock for tag " + tag + " and id " + id + " after "
|
Log.v(K9.LOG_TAG, "Releasing TracingWakeLock for tag " + tag + " and id " + id + " after "
|
||||||
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -125,7 +125,7 @@ public class TracingPowerManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cancelNotification();
|
cancelNotification();
|
||||||
synchronized(wakeLock)
|
synchronized (wakeLock)
|
||||||
{
|
{
|
||||||
wakeLock.release();
|
wakeLock.release();
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ public class TracingPowerManager
|
|||||||
{
|
{
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
{
|
{
|
||||||
synchronized(timer)
|
synchronized (timer)
|
||||||
{
|
{
|
||||||
if (timerTask != null)
|
if (timerTask != null)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ public class TracingPowerManager
|
|||||||
{
|
{
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
{
|
{
|
||||||
synchronized(timer)
|
synchronized (timer)
|
||||||
{
|
{
|
||||||
if (timerTask != null)
|
if (timerTask != null)
|
||||||
{
|
{
|
||||||
@ -163,21 +163,21 @@ public class TracingPowerManager
|
|||||||
if (startTime != null)
|
if (startTime != null)
|
||||||
{
|
{
|
||||||
Long endTime = System.currentTimeMillis();
|
Long endTime = System.currentTimeMillis();
|
||||||
Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " has been active for "
|
Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " has been active for "
|
||||||
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " still active, timeout = " + timeout + " ms");
|
Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " still active, timeout = " + timeout + " ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
timer.schedule(timerTask, 1000, 1000);
|
timer.schedule(timerTask, 1000, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ public abstract class Folder
|
|||||||
MessageRetrievalListener listener) throws MessagingException;
|
MessageRetrievalListener listener) throws MessagingException;
|
||||||
|
|
||||||
public void fetchPart(Message message, Part part,
|
public void fetchPart(Message message, Part part,
|
||||||
MessageRetrievalListener listener) throws MessagingException
|
MessageRetrievalListener listener) throws MessagingException
|
||||||
{
|
{
|
||||||
throw new RuntimeException("fetchPart() not implemented.");
|
throw new RuntimeException("fetchPart() not implemented.");
|
||||||
}
|
}
|
||||||
|
@ -384,20 +384,20 @@ public class MimeMessage extends Message
|
|||||||
* But at least one implementations seems to have problems with 998
|
* But at least one implementations seems to have problems with 998
|
||||||
* characters, so we adjust for that fact.
|
* characters, so we adjust for that fact.
|
||||||
*/
|
*/
|
||||||
final int limit = 1000 - 2 /* CRLF */ - 12 /* "References: " */ - 1 /* Off-by-one bugs */;
|
final int limit = 1000 - 2 /* CRLF */ - 12 /* "References: " */ - 1 /* Off-by-one bugs */;
|
||||||
final int originalLength = references.length();
|
final int originalLength = references.length();
|
||||||
if (originalLength >= limit)
|
if (originalLength >= limit)
|
||||||
{
|
{
|
||||||
// Find start of first reference
|
// Find start of first reference
|
||||||
final int start = references.indexOf('<');
|
final int start = references.indexOf('<');
|
||||||
|
|
||||||
// First reference + SPACE
|
// First reference + SPACE
|
||||||
final String firstReference = references.substring(start,
|
final String firstReference = references.substring(start,
|
||||||
references.indexOf('<', start + 1));
|
references.indexOf('<', start + 1));
|
||||||
|
|
||||||
// Find longest tail
|
// Find longest tail
|
||||||
final String tail = references.substring(references.indexOf('<',
|
final String tail = references.substring(references.indexOf('<',
|
||||||
firstReference.length() + originalLength - limit));
|
firstReference.length() + originalLength - limit));
|
||||||
|
|
||||||
references = firstReference + tail;
|
references = firstReference + tail;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class ImapResponseParser
|
|||||||
{
|
{
|
||||||
return readResponse(null);
|
return readResponse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the next response available on the stream and returns an
|
* Reads the next response available on the stream and returns an
|
||||||
* ImapResponse object that represents it.
|
* ImapResponse object that represents it.
|
||||||
@ -47,7 +47,7 @@ public class ImapResponseParser
|
|||||||
ImapResponse response = new ImapResponse();
|
ImapResponse response = new ImapResponse();
|
||||||
mResponse = response;
|
mResponse = response;
|
||||||
mResponse.mCallback = callback;
|
mResponse.mCallback = callback;
|
||||||
|
|
||||||
int ch = mIn.peek();
|
int ch = mIn.peek();
|
||||||
if (ch == '*')
|
if (ch == '*')
|
||||||
{
|
{
|
||||||
@ -69,12 +69,12 @@ public class ImapResponseParser
|
|||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "<<< " + response.toString());
|
Log.v(K9.LOG_TAG, "<<< " + response.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mException != null)
|
if (mException != null)
|
||||||
{
|
{
|
||||||
throw new RuntimeException("readResponse(): Exception in callback method", mException);
|
throw new RuntimeException("readResponse(): Exception in callback method", mException);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -315,7 +315,7 @@ public class ImapResponseParser
|
|||||||
if (mResponse.mCallback != null)
|
if (mResponse.mCallback != null)
|
||||||
{
|
{
|
||||||
FixedLengthInputStream fixed = new FixedLengthInputStream(mIn, size);
|
FixedLengthInputStream fixed = new FixedLengthInputStream(mIn, size);
|
||||||
|
|
||||||
Object result = null;
|
Object result = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -340,7 +340,7 @@ public class ImapResponseParser
|
|||||||
// If so, skip the rest
|
// If so, skip the rest
|
||||||
fixed.skip(fixed.available());
|
fixed.skip(fixed.available());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@ -358,7 +358,7 @@ public class ImapResponseParser
|
|||||||
}
|
}
|
||||||
read += count;
|
read += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new String(data, "US-ASCII");
|
return new String(data, "US-ASCII");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ public class ImapResponseParser
|
|||||||
return o1 == o2;
|
return o1 == o2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IImapResponseCallback
|
public interface IImapResponseCallback
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -672,6 +672,6 @@ public class ImapResponseParser
|
|||||||
* complete IMAP response has been parsed.
|
* complete IMAP response has been parsed.
|
||||||
*/
|
*/
|
||||||
public Object foundLiteral(ImapResponse response, FixedLengthInputStream literal)
|
public Object foundLiteral(ImapResponse response, FixedLengthInputStream literal)
|
||||||
throws IOException, Exception;
|
throws IOException, Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
connection.open();
|
connection.open();
|
||||||
}
|
}
|
||||||
catch (IOException ioe)
|
catch (IOException ioe)
|
||||||
@ -1170,7 +1170,7 @@ public class ImapStore extends Store
|
|||||||
), false);
|
), false);
|
||||||
ImapResponse response;
|
ImapResponse response;
|
||||||
int messageNumber = 0;
|
int messageNumber = 0;
|
||||||
|
|
||||||
ImapResponseParser.IImapResponseCallback callback = null;
|
ImapResponseParser.IImapResponseCallback callback = null;
|
||||||
if (fp.contains(FetchProfile.Item.BODY) || fp.contains(FetchProfile.Item.BODY_SANE) || fp.contains(FetchProfile.Item.ENVELOPE))
|
if (fp.contains(FetchProfile.Item.BODY) || fp.contains(FetchProfile.Item.BODY_SANE) || fp.contains(FetchProfile.Item.ENVELOPE))
|
||||||
{
|
{
|
||||||
@ -1230,7 +1230,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
else if (literal instanceof Integer)
|
else if (literal instanceof Integer)
|
||||||
{
|
{
|
||||||
// All the work was done in FetchBodyCallback.foundLiteral()
|
// All the work was done in FetchBodyCallback.foundLiteral()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1260,10 +1260,10 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fetchPart(Message message, Part part, MessageRetrievalListener listener)
|
public void fetchPart(Message message, Part part, MessageRetrievalListener listener)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
checkOpen();
|
checkOpen();
|
||||||
|
|
||||||
@ -1272,7 +1272,7 @@ public class ImapStore extends Store
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String fetch;
|
String fetch;
|
||||||
String partId = parts[0];
|
String partId = parts[0];
|
||||||
if ("TEXT".equalsIgnoreCase(partId))
|
if ("TEXT".equalsIgnoreCase(partId))
|
||||||
@ -1287,12 +1287,12 @@ public class ImapStore extends Store
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
mConnection.sendCommand(
|
mConnection.sendCommand(
|
||||||
String.format("UID FETCH %s (UID %s)", message.getUid(), fetch),
|
String.format("UID FETCH %s (UID %s)", message.getUid(), fetch),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
ImapResponse response;
|
ImapResponse response;
|
||||||
int messageNumber = 0;
|
int messageNumber = 0;
|
||||||
|
|
||||||
ImapResponseParser.IImapResponseCallback callback = new FetchPartCallback(part);
|
ImapResponseParser.IImapResponseCallback callback = new FetchPartCallback(part);
|
||||||
|
|
||||||
do
|
do
|
||||||
@ -1321,7 +1321,7 @@ public class ImapStore extends Store
|
|||||||
ImapMessage imapMessage = (ImapMessage) message;
|
ImapMessage imapMessage = (ImapMessage) message;
|
||||||
|
|
||||||
Object literal = handleFetchResponse(imapMessage, fetchList);
|
Object literal = handleFetchResponse(imapMessage, fetchList);
|
||||||
|
|
||||||
if (literal != null)
|
if (literal != null)
|
||||||
{
|
{
|
||||||
if (literal instanceof Body)
|
if (literal instanceof Body)
|
||||||
@ -1333,9 +1333,9 @@ public class ImapStore extends Store
|
|||||||
{
|
{
|
||||||
String bodyString = (String)literal;
|
String bodyString = (String)literal;
|
||||||
InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes());
|
InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes());
|
||||||
|
|
||||||
String contentTransferEncoding = part.getHeader(
|
String contentTransferEncoding = part.getHeader(
|
||||||
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
||||||
part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding));
|
part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2335,7 +2335,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SSLException e)
|
catch (SSLException e)
|
||||||
{
|
{
|
||||||
@ -2519,7 +2519,7 @@ public class ImapStore extends Store
|
|||||||
{
|
{
|
||||||
return readResponse(null);
|
return readResponse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException, MessagingException
|
private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException, MessagingException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -2772,7 +2772,7 @@ public class ImapStore extends Store
|
|||||||
TracingPowerManager pm = TracingPowerManager.getPowerManager(receiver.getContext());
|
TracingPowerManager pm = TracingPowerManager.getPowerManager(receiver.getContext());
|
||||||
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ImapFolderPusher " + store.getAccount().getDescription() + ":" + getName());
|
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ImapFolderPusher " + store.getAccount().getDescription() + ":" + getName());
|
||||||
wakeLock.setReferenceCounted(false);
|
wakeLock.setReferenceCounted(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void refresh() throws IOException, MessagingException
|
public void refresh() throws IOException, MessagingException
|
||||||
{
|
{
|
||||||
@ -2912,9 +2912,9 @@ public class ImapStore extends Store
|
|||||||
storedUntaggedResponses.clear();
|
storedUntaggedResponses.clear();
|
||||||
processUntaggedResponses(untaggedResponses);
|
processUntaggedResponses(untaggedResponses);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId());
|
Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId());
|
||||||
|
|
||||||
receiver.setPushActive(getName(), true);
|
receiver.setPushActive(getName(), true);
|
||||||
idling.set(true);
|
idling.set(true);
|
||||||
@ -2923,7 +2923,7 @@ public class ImapStore extends Store
|
|||||||
untaggedResponses = executeSimpleCommand(COMMAND_IDLE, false, ImapFolderPusher.this);
|
untaggedResponses = executeSimpleCommand(COMMAND_IDLE, false, ImapFolderPusher.this);
|
||||||
idling.set(false);
|
idling.set(false);
|
||||||
|
|
||||||
|
|
||||||
delayTime.set(NORMAL_DELAY_TIME);
|
delayTime.set(NORMAL_DELAY_TIME);
|
||||||
idleFailureCount.set(0);
|
idleFailureCount.set(0);
|
||||||
}
|
}
|
||||||
@ -3510,12 +3510,12 @@ public class ImapStore extends Store
|
|||||||
|
|
||||||
FetchBodyCallback(HashMap<String, Message> mesageMap)
|
FetchBodyCallback(HashMap<String, Message> mesageMap)
|
||||||
{
|
{
|
||||||
mMessageMap = mesageMap;
|
mMessageMap = mesageMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object foundLiteral(ImapResponse response,
|
public Object foundLiteral(ImapResponse response,
|
||||||
FixedLengthInputStream literal) throws IOException, Exception
|
FixedLengthInputStream literal) throws IOException, Exception
|
||||||
{
|
{
|
||||||
if (response.mTag == null &&
|
if (response.mTag == null &&
|
||||||
ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH"))
|
ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH"))
|
||||||
@ -3544,7 +3544,7 @@ public class ImapStore extends Store
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object foundLiteral(ImapResponse response,
|
public Object foundLiteral(ImapResponse response,
|
||||||
FixedLengthInputStream literal) throws IOException, Exception
|
FixedLengthInputStream literal) throws IOException, Exception
|
||||||
{
|
{
|
||||||
if (response.mTag == null &&
|
if (response.mTag == null &&
|
||||||
ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH"))
|
ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH"))
|
||||||
@ -3552,7 +3552,7 @@ public class ImapStore extends Store
|
|||||||
//TODO: check for correct UID
|
//TODO: check for correct UID
|
||||||
|
|
||||||
String contentTransferEncoding = mPart.getHeader(
|
String contentTransferEncoding = mPart.getHeader(
|
||||||
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
||||||
|
|
||||||
return MimeUtility.decodeBody(literal, contentTransferEncoding);
|
return MimeUtility.decodeBody(literal, contentTransferEncoding);
|
||||||
}
|
}
|
||||||
|
@ -655,8 +655,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
boolean anyAdded = false;
|
boolean anyAdded = false;
|
||||||
String likeString = "%"+queryString+"%";
|
String likeString = "%"+queryString+"%";
|
||||||
whereClause.append(" AND (");
|
whereClause.append(" AND (");
|
||||||
for (String queryField : queryFields) {
|
for (String queryField : queryFields)
|
||||||
|
{
|
||||||
|
|
||||||
if (anyAdded == true)
|
if (anyAdded == true)
|
||||||
{
|
{
|
||||||
whereClause.append(" OR ");
|
whereClause.append(" OR ");
|
||||||
@ -1455,7 +1456,7 @@ public class LocalStore extends Store implements Serializable
|
|||||||
/**
|
/**
|
||||||
* Populate the header fields of the given list of messages by reading
|
* Populate the header fields of the given list of messages by reading
|
||||||
* the saved header data from the database.
|
* the saved header data from the database.
|
||||||
*
|
*
|
||||||
* @param messages
|
* @param messages
|
||||||
* The messages whose headers should be loaded.
|
* The messages whose headers should be loaded.
|
||||||
*/
|
*/
|
||||||
@ -1922,7 +1923,7 @@ public class LocalStore extends Store implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gotAdditionalHeaders)
|
if (!gotAdditionalHeaders)
|
||||||
{
|
{
|
||||||
// Remember that all headers for this message have been saved, so it is
|
// Remember that all headers for this message have been saved, so it is
|
||||||
// not necessary to download them again in case the user wants to see all headers.
|
// not necessary to download them again in case the user wants to see all headers.
|
||||||
List<Flag> appendedFlags = new ArrayList<Flag>();
|
List<Flag> appendedFlags = new ArrayList<Flag>();
|
||||||
@ -1930,7 +1931,7 @@ public class LocalStore extends Store implements Serializable
|
|||||||
appendedFlags.add(Flag.X_GOT_ALL_HEADERS);
|
appendedFlags.add(Flag.X_GOT_ALL_HEADERS);
|
||||||
|
|
||||||
mDb.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[]
|
mDb.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[]
|
||||||
{ Utility.combine(appendedFlags.toArray(), ',').toUpperCase(), id } );
|
{ Utility.combine(appendedFlags.toArray(), ',').toUpperCase(), id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2778,7 +2779,8 @@ public class LocalStore extends Store implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getHeaderNames() {
|
public Set<String> getHeaderNames()
|
||||||
|
{
|
||||||
if (!mHeadersLoaded)
|
if (!mHeadersLoaded)
|
||||||
loadHeaders();
|
loadHeaders();
|
||||||
return super.getHeaderNames();
|
return super.getHeaderNames();
|
||||||
|
@ -23,7 +23,7 @@ public class BootReceiver extends CoreReceiver
|
|||||||
|
|
||||||
public static String ALARMED_INTENT = "com.fsck.k9.service.BroadcastReceiver.pendingIntent";
|
public static String ALARMED_INTENT = "com.fsck.k9.service.BroadcastReceiver.pendingIntent";
|
||||||
public static String AT_TIME = "com.fsck.k9.service.BroadcastReceiver.atTime";
|
public static String AT_TIME = "com.fsck.k9.service.BroadcastReceiver.atTime";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer receive(Context context, Intent intent, Integer tmpWakeLockId)
|
public Integer receive(Context context, Intent intent, Integer tmpWakeLockId)
|
||||||
{
|
{
|
||||||
|
@ -132,9 +132,9 @@ public class MailService extends CoreService
|
|||||||
|
|
||||||
Log.i(K9.LOG_TAG, "AutoSync help is available, autoSync = " + autoSync);
|
Log.i(K9.LOG_TAG, "AutoSync help is available, autoSync = " + autoSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
K9.BACKGROUND_OPS bOps = K9.getBackgroundOps();
|
K9.BACKGROUND_OPS bOps = K9.getBackgroundOps();
|
||||||
|
|
||||||
switch (bOps)
|
switch (bOps)
|
||||||
{
|
{
|
||||||
case NEVER:
|
case NEVER:
|
||||||
@ -149,8 +149,8 @@ public class MailService extends CoreService
|
|||||||
case WHEN_CHECKED_AUTO_SYNC:
|
case WHEN_CHECKED_AUTO_SYNC:
|
||||||
doBackground = backgroundData & autoSync;
|
doBackground = backgroundData & autoSync;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
@ -460,7 +460,7 @@ public class MailService extends CoreService
|
|||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(K9.LOG_TAG, "PUSHREFRESH: refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
|
Log.d(K9.LOG_TAG, "PUSHREFRESH: refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
|
||||||
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
|
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
|
||||||
}
|
}
|
||||||
pusher.refresh();
|
pusher.refresh();
|
||||||
pusher.setLastRefresh(nowTime);
|
pusher.setLastRefresh(nowTime);
|
||||||
@ -470,7 +470,7 @@ public class MailService extends CoreService
|
|||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(K9.LOG_TAG, "PUSHREFRESH: NOT refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
|
Log.d(K9.LOG_TAG, "PUSHREFRESH: NOT refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval
|
||||||
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
|
+ ", nowTime = " + nowTime + ", sinceLast = " + sinceLast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,10 @@ public class SleepService extends CoreService
|
|||||||
{
|
{
|
||||||
reacquireWakeLock(releaseDatum);
|
reacquireWakeLock(releaseDatum);
|
||||||
}
|
}
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long actualSleep = endTime - startTime;
|
long actualSleep = endTime - startTime;
|
||||||
|
|
||||||
if (actualSleep < sleepTime)
|
if (actualSleep < sleepTime)
|
||||||
{
|
{
|
||||||
Log.w(K9.LOG_TAG, "SleepService sleep time too short: requested was " + sleepTime + ", actual was " + actualSleep);
|
Log.w(K9.LOG_TAG, "SleepService sleep time too short: requested was " + sleepTime + ", actual was " + actualSleep);
|
||||||
@ -93,7 +93,7 @@ public class SleepService extends CoreService
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep);
|
Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user