This commit is contained in:
Jesse Vincent 2010-08-02 01:27:40 +00:00
parent a4381696f9
commit 7fc921c0b7
5 changed files with 43 additions and 39 deletions

View file

@ -566,13 +566,13 @@ public class Account implements BaseAccount
// Always get stats about the INBOX (see issue 1817) // Always get stats about the INBOX (see issue 1817)
if (folder.getName().equals(K9.INBOX) || ( if (folder.getName().equals(K9.INBOX) || (
!folder.getName().equals(getTrashFolderName()) && !folder.getName().equals(getTrashFolderName()) &&
!folder.getName().equals(getDraftsFolderName()) && !folder.getName().equals(getDraftsFolderName()) &&
!folder.getName().equals(getArchiveFolderName()) && !folder.getName().equals(getArchiveFolderName()) &&
!folder.getName().equals(getSpamFolderName()) && !folder.getName().equals(getSpamFolderName()) &&
!folder.getName().equals(getOutboxFolderName()) && !folder.getName().equals(getOutboxFolderName()) &&
!folder.getName().equals(getSentFolderName()) && !folder.getName().equals(getSentFolderName()) &&
!folder.getName().equals(getErrorFolderName()))) !folder.getName().equals(getErrorFolderName())))
{ {
if (aMode == Account.FolderMode.NONE) if (aMode == Account.FolderMode.NONE)
{ {

View file

@ -1080,7 +1080,7 @@ public class MessageView extends K9Activity implements OnClickListener
mSpamScrolling.setEnabled(enableSpam); mSpamScrolling.setEnabled(enableSpam);
} }
else else
{ {
disableMoveButtons(); disableMoveButtons();
} }
@ -2398,7 +2398,7 @@ public class MessageView extends K9Activity implements OnClickListener
if (mCrypto.getSignatureKeyId() != 0) if (mCrypto.getSignatureKeyId() != 0)
{ {
mCryptoSignatureUserIdRest.setText( mCryptoSignatureUserIdRest.setText(
getString(R.string.key_id, Long.toHexString(mCrypto.getSignatureKeyId() & 0xffffffffL))); getString(R.string.key_id, Long.toHexString(mCrypto.getSignatureKeyId() & 0xffffffffL)));
String userId = mCrypto.getSignatureUserId(); String userId = mCrypto.getSignatureUserId();
if (userId == null) if (userId == null)
{ {

View file

@ -4541,7 +4541,7 @@ public class MessagingController implements Runnable
{ {
// Do not notify if the user does not have notifications // Do not notify if the user does not have notifications
// enabled or if the message has been read // enabled or if the message has been read
if (!account.isNotifyNewMail() || message.isSet(Flag.SEEN) || ( account.getName() == null) ) if (!account.isNotifyNewMail() || message.isSet(Flag.SEEN) || (account.getName() == null))
{ {
return false; return false;
} }

View file

@ -33,14 +33,14 @@ public class Apg extends CryptoProvider
public static final String AUTHORITY = "org.thialfihar.android.apg.provider"; public static final String AUTHORITY = "org.thialfihar.android.apg.provider";
public static final Uri CONTENT_URI_SECRET_KEY_RING_BY_KEY_ID = public static final Uri CONTENT_URI_SECRET_KEY_RING_BY_KEY_ID =
Uri.parse("content://" + AUTHORITY + "/key_rings/secret/key_id/"); Uri.parse("content://" + AUTHORITY + "/key_rings/secret/key_id/");
public static final Uri CONTENT_URI_SECRET_KEY_RING_BY_EMAILS = public static final Uri CONTENT_URI_SECRET_KEY_RING_BY_EMAILS =
Uri.parse("content://" + AUTHORITY + "/key_rings/secret/emails/"); Uri.parse("content://" + AUTHORITY + "/key_rings/secret/emails/");
public static final Uri CONTENT_URI_PUBLIC_KEY_RING_BY_KEY_ID = public static final Uri CONTENT_URI_PUBLIC_KEY_RING_BY_KEY_ID =
Uri.parse("content://" + AUTHORITY + "/key_rings/public/key_id/"); Uri.parse("content://" + AUTHORITY + "/key_rings/public/key_id/");
public static final Uri CONTENT_URI_PUBLIC_KEY_RING_BY_EMAILS = public static final Uri CONTENT_URI_PUBLIC_KEY_RING_BY_EMAILS =
Uri.parse("content://" + AUTHORITY + "/key_rings/public/emails/"); Uri.parse("content://" + AUTHORITY + "/key_rings/public/emails/");
public static class Intent public static class Intent
{ {
@ -83,12 +83,12 @@ public class Apg extends CryptoProvider
public static final int SELECT_SECRET_KEY = 0x21070004; public static final int SELECT_SECRET_KEY = 0x21070004;
public static Pattern PGP_MESSAGE = public static Pattern PGP_MESSAGE =
Pattern.compile(".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*", Pattern.compile(".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*",
Pattern.DOTALL); Pattern.DOTALL);
public static Pattern PGP_SIGNED_MESSAGE = public static Pattern PGP_SIGNED_MESSAGE =
Pattern.compile(".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*", Pattern.compile(".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*",
Pattern.DOTALL); Pattern.DOTALL);
public static Apg createInstance(Account account) public static Apg createInstance(Account account)
{ {
@ -172,11 +172,11 @@ public class Apg extends CryptoProvider
try try
{ {
Uri contentUri = Uri.withAppendedPath( Uri contentUri = Uri.withAppendedPath(
Apg.CONTENT_URI_PUBLIC_KEY_RING_BY_EMAILS, Apg.CONTENT_URI_PUBLIC_KEY_RING_BY_EMAILS,
emails); emails);
Cursor c = activity.getContentResolver().query(contentUri, Cursor c = activity.getContentResolver().query(contentUri,
new String[] { "master_key_id" }, new String[] { "master_key_id" },
null, null, null); null, null, null);
if (c != null) if (c != null)
{ {
while (c.moveToNext()) while (c.moveToNext())
@ -240,8 +240,8 @@ public class Apg extends CryptoProvider
Uri contentUri = Uri.withAppendedPath(Apg.CONTENT_URI_SECRET_KEY_RING_BY_EMAILS, Uri contentUri = Uri.withAppendedPath(Apg.CONTENT_URI_SECRET_KEY_RING_BY_EMAILS,
email); email);
Cursor c = context.getContentResolver().query(contentUri, Cursor c = context.getContentResolver().query(contentUri,
new String[] { "master_key_id" }, new String[] { "master_key_id" },
null, null, null); null, null, null);
if (c != null && c.getCount() > 0) if (c != null && c.getCount() > 0)
{ {
ids = new long[c.getCount()]; ids = new long[c.getCount()];
@ -280,11 +280,11 @@ public class Apg extends CryptoProvider
try try
{ {
Uri contentUri = ContentUris.withAppendedId( Uri contentUri = ContentUris.withAppendedId(
Apg.CONTENT_URI_SECRET_KEY_RING_BY_KEY_ID, Apg.CONTENT_URI_SECRET_KEY_RING_BY_KEY_ID,
keyId); keyId);
Cursor c = context.getContentResolver().query(contentUri, Cursor c = context.getContentResolver().query(contentUri,
new String[] { "user_id" }, new String[] { "user_id" },
null, null, null); null, null, null);
if (c != null && c.moveToFirst()) if (c != null && c.moveToFirst())
{ {
userId = c.getString(0); userId = c.getString(0);
@ -355,7 +355,8 @@ public class Apg extends CryptoProvider
mEncryptedData = data.getStringExtra(Apg.EXTRA_ENCRYPTED_MESSAGE); mEncryptedData = data.getStringExtra(Apg.EXTRA_ENCRYPTED_MESSAGE);
// this was a stupid bug in an earlier version, just gonna leave this in for an APG // this was a stupid bug in an earlier version, just gonna leave this in for an APG
// version or two // version or two
if (mEncryptedData == null) { if (mEncryptedData == null)
{
mEncryptedData = data.getStringExtra(Apg.EXTRA_DECRYPTED_MESSAGE); mEncryptedData = data.getStringExtra(Apg.EXTRA_DECRYPTED_MESSAGE);
} }
if (mEncryptedData != null) if (mEncryptedData != null)
@ -450,7 +451,8 @@ public class Apg extends CryptoProvider
public boolean isEncrypted(Message message) public boolean isEncrypted(Message message)
{ {
String data = null; String data = null;
try { try
{
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain"); Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
if (part == null) if (part == null)
{ {
@ -479,7 +481,8 @@ public class Apg extends CryptoProvider
public boolean isSigned(Message message) public boolean isSigned(Message message)
{ {
String data = null; String data = null;
try { try
{
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain"); Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
if (part == null) if (part == null)
{ {
@ -532,11 +535,11 @@ public class Apg extends CryptoProvider
{ {
// try out one content provider to check permissions // try out one content provider to check permissions
Uri contentUri = ContentUris.withAppendedId( Uri contentUri = ContentUris.withAppendedId(
Apg.CONTENT_URI_SECRET_KEY_RING_BY_KEY_ID, Apg.CONTENT_URI_SECRET_KEY_RING_BY_KEY_ID,
12345); 12345);
Cursor c = context.getContentResolver().query(contentUri, Cursor c = context.getContentResolver().query(contentUri,
new String[] { "user_id" }, new String[] { "user_id" },
null, null, null); null, null, null);
if (c != null) if (c != null)
{ {
c.close(); c.close();

View file

@ -390,7 +390,7 @@ public class MimeUtility
IOUtils.copy(in, out); IOUtils.copy(in, out);
in.close(); in.close();
in = null; // we want all of our memory back, and close might not release in = null; // we want all of our memory back, and close might not release
// Cargo culted from AOSP - This disagrees with the platform docs // Cargo culted from AOSP - This disagrees with the platform docs
/* /*
* Convert and return as new String * Convert and return as new String
@ -523,7 +523,8 @@ public class MimeUtility
* If the part is HTML and it got this far it's part of a mixed (et * If the part is HTML and it got this far it's part of a mixed (et
* al) and should be rendered inline. * al) and should be rendered inline.
*/ */
else if (isPartTextualBody(part)) { else if (isPartTextualBody(part))
{
viewables.add(part); viewables.add(part);
} }
else else
@ -534,7 +535,7 @@ public class MimeUtility
} }
public static Boolean isPartTextualBody (Part part) throws MessagingException public static Boolean isPartTextualBody(Part part) throws MessagingException
{ {
String disposition = part.getDisposition(); String disposition = part.getDisposition();
String dispositionType = null; String dispositionType = null;
@ -549,7 +550,7 @@ public class MimeUtility
* A best guess that this part is intended to be an attachment and not inline. * A best guess that this part is intended to be an attachment and not inline.
*/ */
boolean attachment = ("attachment".equalsIgnoreCase(dispositionType) boolean attachment = ("attachment".equalsIgnoreCase(dispositionType)
|| (dispositionFilename != null)); || (dispositionFilename != null));
if ((!attachment) && (part.getMimeType().equalsIgnoreCase("text/html"))) if ((!attachment) && (part.getMimeType().equalsIgnoreCase("text/html")))
{ {