diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 7d75e7f93..6bb7069d4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -19,15 +19,15 @@ - - + - + @@ -36,98 +36,98 @@ + android:name="com.fsck.k9.activity.FolderList"> + android:name="com.fsck.k9.activity.MessageList"> + android:name="com.fsck.k9.activity.MessageView"> @@ -185,7 +185,7 @@ - @@ -204,38 +204,38 @@ - + - + diff --git a/build.xml b/build.xml index b4eaaeb69..29ef3a712 100644 --- a/build.xml +++ b/build.xml @@ -170,12 +170,6 @@ - - - - - - diff --git a/src/com/android/email/Email.java b/src/com/android/email/Email.java deleted file mode 100644 index 55bd68fce..000000000 --- a/src/com/android/email/Email.java +++ /dev/null @@ -1,597 +0,0 @@ - -package com.android.email; - -import android.app.Application; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.util.Log; -import com.android.email.activity.MessageCompose; -import com.android.email.mail.Address; -import com.android.email.mail.Message; -import com.android.email.mail.MessagingException; -import com.android.email.mail.internet.BinaryTempFileBody; -import com.android.email.service.BootReceiver; -import com.android.email.service.MailService; - -import java.io.File; - -public class Email extends Application -{ - public static Application app = null; - public static File tempDirectory; - public static final String LOG_TAG = "k9"; - - public enum BACKGROUND_OPS - { - WHEN_CHECKED, ALWAYS, NEVER - } - - private static int theme = android.R.style.Theme_Light; - - private static BACKGROUND_OPS backgroundOps = BACKGROUND_OPS.WHEN_CHECKED; - /** - * Some log messages can be sent to a file, so that the logs - * can be read using unprivileged access (eg. Terminal Emulator) - * on the phone, without adb. Set to null to disable - */ - public static final String logFile = null; - //public static final String logFile = "/sdcard/k9mail/debug.log"; - - /** - * If this is enabled there will be additional logging information sent to - * Log.d, including protocol dumps. - * Controlled by Preferences at run-time - */ - public static boolean DEBUG = false; - - /** - * If this is enabled than logging that normally hides sensitive information - * like passwords will show that information. - */ - public static boolean DEBUG_SENSITIVE = false; - - /** - * Can create messages containing stack traces that can be forwarded - * to the development team. - */ - public static boolean ENABLE_ERROR_FOLDER = true; - public static String ERROR_FOLDER_NAME = "K9mail-errors"; - - /** - * The MIME type(s) of attachments we're willing to send. At the moment it is not possible - * to open a chooser with a list of filter types, so the chooser is only opened with the first - * item in the list. The entire list will be used to filter down attachments that are added - * with Intent.ACTION_SEND. - */ - public static final String[] ACCEPTABLE_ATTACHMENT_SEND_TYPES = new String[] - { - "*/*" - }; - - /** - * The MIME type(s) of attachments we're willing to view. - */ - public static final String[] ACCEPTABLE_ATTACHMENT_VIEW_TYPES = new String[] - { - "*/*", - }; - - /** - * The MIME type(s) of attachments we're not willing to view. - */ - public static final String[] UNACCEPTABLE_ATTACHMENT_VIEW_TYPES = new String[] - { - }; - - /** - * The MIME type(s) of attachments we're willing to download to SD. - */ - public static final String[] ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] - { - "*/*", - }; - - /** - * The MIME type(s) of attachments we're not willing to download to SD. - */ - public static final String[] UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] - { - }; - - /** - * The special name "INBOX" is used throughout the application to mean "Whatever folder - * the server refers to as the user's Inbox. Placed here to ease use. - */ - public static final String INBOX = "INBOX"; - - /** - * For use when displaying that no folder is selected - */ - public static final String FOLDER_NONE = "-NONE-"; - - public static final String LOCAL_UID_PREFIX = "K9LOCAL:"; - - public static final String REMOTE_UID_PREFIX = "K9REMOTE:"; - - public static final String K9MAIL_IDENTITY = "X-K9mail-Identity"; - - /** - * Specifies how many messages will be shown in a folder by default. This number is set - * on each new folder and can be incremented with "Load more messages..." by the - * VISIBLE_LIMIT_INCREMENT - */ - public static int DEFAULT_VISIBLE_LIMIT = 25; - - /** - * Number of additioanl messages to load when a user selectes "Load more messages..." - */ - public static int VISIBLE_LIMIT_INCREMENT = 25; - - public static int MAX_SEND_ATTEMPTS = 5; - - /** - * The maximum size of an attachment we're willing to download (either View or Save) - * Attachments that are base64 encoded (most) will be about 1.375x their actual size - * so we should probably factor that in. A 5MB attachment will generally be around - * 6.8MB downloaded but only 5MB saved. - */ - public static final int MAX_ATTACHMENT_DOWNLOAD_SIZE = (5 * 1024 * 1024); - - /** - * Max time (in millis) the wake lock will be held for when background sync is happening - */ - public static final int WAKE_LOCK_TIMEOUT = 600000; - - public static final int MANUAL_WAKE_LOCK_TIMEOUT = 120000; - - public static final int PUSH_WAKE_LOCK_TIMEOUT = 60000; - - public static final int MAIL_SERVICE_WAKE_LOCK_TIMEOUT = 30000; - - public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 60000; - - - /** - * LED color used for the new email notitication - */ - public static final int NOTIFICATION_LED_COLOR = 0xffff00ff; - - /** - * Time the LED is on when blicking on new email notification - */ - public static final int NOTIFICATION_LED_ON_TIME = 500; - - /** - * Time the LED is off when blicking on new email notification - */ - public static final int NOTIFICATION_LED_OFF_TIME = 2000; - - public static final boolean NOTIFICATION_LED_WHILE_SYNCING = false; - public static final int NOTIFICATION_LED_DIM_COLOR = 0x77770077; - public static final int NOTIFICATION_LED_FAST_ON_TIME = 100; - public static final int NOTIFICATION_LED_FAST_OFF_TIME = 100; - - public static final int NOTIFICATION_LED_SENDING_FAILURE_COLOR = 0xffff0000; - - // Must not conflict with an account number - public static final int FETCHING_EMAIL_NOTIFICATION_ID = -4; - public static final int FETCHING_EMAIL_NOTIFICATION_MULTI_ACCOUNT_ID = -1; - public static final int FETCHING_EMAIL_NOTIFICATION_NO_ACCOUNT = -2; - public static final int CONNECTIVITY_ID = -3; - - /* - * http://www.w3schools.com/media/media_mimeref.asp - * + png - */ - public static final String[][] CONTENT_TYPE_BY_EXTENSION_MAP = new String[][] - { - { "", "application/octet-stream" }, - { "323", "text/h323"}, - { "acx", "application/internet-property-stream"}, - { "ai", "application/postscript"}, - { "aif", "audio/x-aiff"}, - { "aifc", "audio/x-aiff"}, - { "aiff", "audio/x-aiff"}, - { "asf", "video/x-ms-asf"}, - { "asr", "video/x-ms-asf"}, - { "asx", "video/x-ms-asf"}, - { "au", "audio/basic"}, - { "avi", "video/x-msvideo"}, - { "axs", "application/olescript"}, - { "bas", "text/plain"}, - { "bcpio", "application/x-bcpio"}, - { "bin", "application/octet-stream"}, - { "bmp", "image/bmp"}, - { "c", "text/plain"}, - { "cat", "application/vnd.ms-pkiseccat"}, - { "cdf", "application/x-cdf"}, - { "cer", "application/x-x509-ca-cert"}, - { "class", "application/octet-stream"}, - { "clp", "application/x-msclip"}, - { "cmx", "image/x-cmx"}, - { "cod", "image/cis-cod"}, - { "cpio", "application/x-cpio"}, - { "crd", "application/x-mscardfile"}, - { "crl", "application/pkix-crl"}, - { "crt", "application/x-x509-ca-cert"}, - { "csh", "application/x-csh"}, - { "css", "text/css"}, - { "dcr", "application/x-director"}, - { "der", "application/x-x509-ca-cert"}, - { "dir", "application/x-director"}, - { "dll", "application/x-msdownload"}, - { "dms", "application/octet-stream"}, - { "doc", "application/msword"}, - { "dot", "application/msword"}, - { "dvi", "application/x-dvi"}, - { "dxr", "application/x-director"}, - { "eps", "application/postscript"}, - { "etx", "text/x-setext"}, - { "evy", "application/envoy"}, - { "exe", "application/octet-stream"}, - { "fif", "application/fractals"}, - { "flr", "x-world/x-vrml"}, - { "gif", "image/gif"}, - { "gtar", "application/x-gtar"}, - { "gz", "application/x-gzip"}, - { "h", "text/plain"}, - { "hdf", "application/x-hdf"}, - { "hlp", "application/winhlp"}, - { "hqx", "application/mac-binhex40"}, - { "hta", "application/hta"}, - { "htc", "text/x-component"}, - { "htm", "text/html"}, - { "html", "text/html"}, - { "htt", "text/webviewhtml"}, - { "ico", "image/x-icon"}, - { "ief", "image/ief"}, - { "iii", "application/x-iphone"}, - { "ins", "application/x-internet-signup"}, - { "isp", "application/x-internet-signup"}, - { "jfif", "image/pipeg"}, - { "jpe", "image/jpeg"}, - { "jpeg", "image/jpeg"}, - { "jpg", "image/jpeg"}, - { "js", "application/x-javascript"}, - { "latex", "application/x-latex"}, - { "lha", "application/octet-stream"}, - { "lsf", "video/x-la-asf"}, - { "lsx", "video/x-la-asf"}, - { "lzh", "application/octet-stream"}, - { "m13", "application/x-msmediaview"}, - { "m14", "application/x-msmediaview"}, - { "m3u", "audio/x-mpegurl"}, - { "man", "application/x-troff-man"}, - { "mdb", "application/x-msaccess"}, - { "me", "application/x-troff-me"}, - { "mht", "message/rfc822"}, - { "mhtml", "message/rfc822"}, - { "mid", "audio/mid"}, - { "mny", "application/x-msmoney"}, - { "mov", "video/quicktime"}, - { "movie", "video/x-sgi-movie"}, - { "mp2", "video/mpeg"}, - { "mp3", "audio/mpeg"}, - { "mpa", "video/mpeg"}, - { "mpe", "video/mpeg"}, - { "mpeg", "video/mpeg"}, - { "mpg", "video/mpeg"}, - { "mpp", "application/vnd.ms-project"}, - { "mpv2", "video/mpeg"}, - { "ms", "application/x-troff-ms"}, - { "mvb", "application/x-msmediaview"}, - { "nws", "message/rfc822"}, - { "oda", "application/oda"}, - { "p10", "application/pkcs10"}, - { "p12", "application/x-pkcs12"}, - { "p7b", "application/x-pkcs7-certificates"}, - { "p7c", "application/x-pkcs7-mime"}, - { "p7m", "application/x-pkcs7-mime"}, - { "p7r", "application/x-pkcs7-certreqresp"}, - { "p7s", "application/x-pkcs7-signature"}, - { "pbm", "image/x-portable-bitmap"}, - { "pdf", "application/pdf"}, - { "pfx", "application/x-pkcs12"}, - { "pgm", "image/x-portable-graymap"}, - { "pko", "application/ynd.ms-pkipko"}, - { "pma", "application/x-perfmon"}, - { "pmc", "application/x-perfmon"}, - { "pml", "application/x-perfmon"}, - { "pmr", "application/x-perfmon"}, - { "pmw", "application/x-perfmon"}, - { "png", "image/png"}, - { "pnm", "image/x-portable-anymap"}, - { "pot,", "application/vnd.ms-powerpoint"}, - { "ppm", "image/x-portable-pixmap"}, - { "pps", "application/vnd.ms-powerpoint"}, - { "ppt", "application/vnd.ms-powerpoint"}, - { "prf", "application/pics-rules"}, - { "ps", "application/postscript"}, - { "pub", "application/x-mspublisher"}, - { "qt", "video/quicktime"}, - { "ra", "audio/x-pn-realaudio"}, - { "ram", "audio/x-pn-realaudio"}, - { "ras", "image/x-cmu-raster"}, - { "rgb", "image/x-rgb"}, - { "rmi", "audio/mid"}, - { "roff", "application/x-troff"}, - { "rtf", "application/rtf"}, - { "rtx", "text/richtext"}, - { "scd", "application/x-msschedule"}, - { "sct", "text/scriptlet"}, - { "setpay", "application/set-payment-initiation"}, - { "setreg", "application/set-registration-initiation"}, - { "sh", "application/x-sh"}, - { "shar", "application/x-shar"}, - { "sit", "application/x-stuffit"}, - { "snd", "audio/basic"}, - { "spc", "application/x-pkcs7-certificates"}, - { "spl", "application/futuresplash"}, - { "src", "application/x-wais-source"}, - { "sst", "application/vnd.ms-pkicertstore"}, - { "stl", "application/vnd.ms-pkistl"}, - { "stm", "text/html"}, - { "svg", "image/svg+xml"}, - { "sv4cpio","application/x-sv4cpio"}, - { "sv4crc", "application/x-sv4crc"}, - { "swf", "application/x-shockwave-flash"}, - { "t", "application/x-troff"}, - { "tar", "application/x-tar"}, - { "tcl", "application/x-tcl"}, - { "tex", "application/x-tex"}, - { "texi", "application/x-texinfo"}, - { "texinfo","application/x-texinfo"}, - { "tgz", "application/x-compressed"}, - { "tif", "image/tiff"}, - { "tiff", "image/tiff"}, - { "tr", "application/x-troff"}, - { "trm", "application/x-msterminal"}, - { "tsv", "text/tab-separated-values"}, - { "txt", "text/plain"}, - { "uls", "text/iuls"}, - { "ustar", "application/x-ustar"}, - { "vcf", "text/x-vcard"}, - { "vrml", "x-world/x-vrml"}, - { "wav", "audio/x-wav"}, - { "wcm", "application/vnd.ms-works"}, - { "wdb", "application/vnd.ms-works"}, - { "wks", "application/vnd.ms-works"}, - { "wmf", "application/x-msmetafile"}, - { "wps", "application/vnd.ms-works"}, - { "wri", "application/x-mswrite"}, - { "wrl", "x-world/x-vrml"}, - { "wrz", "x-world/x-vrml"}, - { "xaf", "x-world/x-vrml"}, - { "xbm", "image/x-xbitmap"}, - { "xla", "application/vnd.ms-excel"}, - { "xlc", "application/vnd.ms-excel"}, - { "xlm", "application/vnd.ms-excel"}, - { "xls", "application/vnd.ms-excel"}, - { "xlt", "application/vnd.ms-excel"}, - { "xlw", "application/vnd.ms-excel"}, - { "xof", "x-world/x-vrml"}, - { "xpm", "image/x-xpixmap"}, - { "xwd", "image/x-xwindowdump"}, - { "z", "application/x-compress"}, - { "zip", "application/zip"} - }; - - public class Intents - { - - public class EmailReceived - { - public static final String ACTION_EMAIL_RECEIVED = "com.android.email.intent.action.EMAIL_RECEIVED"; - public static final String ACTION_EMAIL_DELETED = "com.android.email.intent.action.EMAIL_DELETED"; - public static final String EXTRA_ACCOUNT = "com.android.email.intent.extra.ACCOUNT"; - public static final String EXTRA_FOLDER = "com.android.email.intent.extra.FOLDER"; - public static final String EXTRA_SENT_DATE = "com.android.email.intent.extra.SENT_DATE"; - public static final String EXTRA_FROM = "com.android.email.intent.extra.FROM"; - public static final String EXTRA_TO = "com.android.email.intent.extra.TO"; - public static final String EXTRA_CC = "com.android.email.intent.extra.CC"; - public static final String EXTRA_BCC = "com.android.email.intent.extra.BCC"; - public static final String EXTRA_SUBJECT = "com.android.email.intent.extra.SUBJECT"; - public static final String EXTRA_FROM_SELF = "com.android.email.intent.extra.FROM_SELF"; - } - - } - - /** - * Called throughout the application when the number of accounts has changed. This method - * enables or disables the Compose activity, the boot receiver and the service based on - * whether any accounts are configured. - */ - public static void setServicesEnabled(Context context) - { - - int acctLength = Preferences.getPreferences(context).getAccounts().length; - - setServicesEnabled(context, acctLength > 0, null); - - } - - public static void setServicesEnabled(Context context, Integer wakeLockId) - { - setServicesEnabled(context, Preferences.getPreferences(context).getAccounts().length > 0, wakeLockId); - } - - public static void setServicesEnabled(Context context, boolean enabled, Integer wakeLockId) - { - - PackageManager pm = context.getPackageManager(); - - if (!enabled && pm.getComponentEnabledSetting(new ComponentName(context, MailService.class)) == - PackageManager.COMPONENT_ENABLED_STATE_ENABLED) - { - /* - * If no accounts now exist but the service is still enabled we're about to disable it - * so we'll reschedule to kill off any existing alarms. - */ - MailService.actionReschedule(context, wakeLockId); - } - Class[] classes = { MessageCompose.class, BootReceiver.class, MailService.class }; - - for (Class clazz : classes) - { - - boolean alreadyEnabled = pm.getComponentEnabledSetting(new ComponentName(context, clazz)) == - PackageManager.COMPONENT_ENABLED_STATE_ENABLED; - - if (enabled != alreadyEnabled) - { - pm.setComponentEnabledSetting( - new ComponentName(context, clazz), - enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : - PackageManager.COMPONENT_ENABLED_STATE_DISABLED, - PackageManager.DONT_KILL_APP); - } - } - - if (enabled && pm.getComponentEnabledSetting(new ComponentName(context, MailService.class)) == - PackageManager.COMPONENT_ENABLED_STATE_ENABLED) - { - /* - * And now if accounts do exist then we've just enabled the service and we want to - * schedule alarms for the new accounts. - */ - MailService.actionReschedule(context, wakeLockId); - } - - } - - public static void save(SharedPreferences.Editor editor) - { - editor.putBoolean("enableDebugLogging", Email.DEBUG); - editor.putBoolean("enableSensitiveLogging", Email.DEBUG_SENSITIVE); - editor.putString("backgroundOperations", Email.backgroundOps.toString()); - editor.putInt("theme", theme); - } - - @Override - public void onCreate() - { - super.onCreate(); - app = this; - Preferences prefs = Preferences.getPreferences(this); - SharedPreferences sprefs = prefs.getPreferences(); - DEBUG = sprefs.getBoolean("enableDebugLogging", false); - DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); - - try - { - setBackgroundOps(BACKGROUND_OPS.valueOf(sprefs.getString("backgroundOperations", "WHEN_CHECKED"))); - } - catch (Exception e) - { - setBackgroundOps(BACKGROUND_OPS.WHEN_CHECKED); - } - - Email.setK9Theme(sprefs.getInt("theme", android.R.style.Theme_Light)); - MessagingController.getInstance(this).resetVisibleLimits(prefs.getAccounts()); - - /* - * We have to give MimeMessage a temp directory because File.createTempFile(String, String) - * doesn't work in Android and MimeMessage does not have access to a Context. - */ - BinaryTempFileBody.setTempDirectory(getCacheDir()); - - /* - * Enable background sync of messages - */ - - setServicesEnabled(this); - - MessagingController.getInstance(this).addListener(new MessagingListener() - { - private void broadcastIntent(String action, Account account, String folder, Message message) - { - try - { - Uri uri = Uri.parse("email://messages/" + account.getAccountNumber() + "/" + Uri.encode(folder) + "/" + Uri.encode(message.getUid())); - Intent intent = new Intent(action, uri); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_ACCOUNT, account.getDescription()); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_FOLDER, folder); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_SENT_DATE, message.getSentDate()); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_FROM, Address.toString(message.getFrom())); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_TO, Address.toString(message.getRecipients(Message.RecipientType.TO))); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_CC, Address.toString(message.getRecipients(Message.RecipientType.CC))); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_BCC, Address.toString(message.getRecipients(Message.RecipientType.BCC))); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_SUBJECT, message.getSubject()); - intent.putExtra(Email.Intents.EmailReceived.EXTRA_FROM_SELF, account.isAnIdentity(message.getFrom())); - Email.this.sendBroadcast(intent); - Log.d(Email.LOG_TAG, "Broadcasted: action=" + action - + " account=" + account.getDescription() - + " folder=" + folder - + " message uid=" + message.getUid() - ); - } - catch (MessagingException e) - { - Log.w(Email.LOG_TAG, "Error: action=" + action - + " account=" + account.getDescription() - + " folder=" + folder - + " message uid=" + message.getUid() - ); - - } - } - - @Override - public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) - { - broadcastIntent(Email.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message); - } - - @Override - public void messageDeleted(Account account, String folder, Message message) - { - broadcastIntent(Email.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message); - } - - @Override - public void synchronizeMailboxNewMessage(Account account, String folder, Message message) - { - broadcastIntent(Email.Intents.EmailReceived.ACTION_EMAIL_RECEIVED, account, folder, message); - } - - }); - - } - - public static int getK9Theme() - { - return theme; - } - - public static void setK9Theme(int ntheme) - { - theme = ntheme; - } - - public static BACKGROUND_OPS getBackgroundOps() - { - return backgroundOps; - } - - public static void setBackgroundOps(BACKGROUND_OPS backgroundOps) - { - Email.backgroundOps = backgroundOps; - } - - public static void setBackgroundOps(String nbackgroundOps) - { - Email.backgroundOps = BACKGROUND_OPS.valueOf(nbackgroundOps); - } -} - - - - - - - - diff --git a/src/com/android/email/EmailReceivedIntent.java b/src/com/android/email/EmailReceivedIntent.java deleted file mode 100644 index 0dc570502..000000000 --- a/src/com/android/email/EmailReceivedIntent.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.android.email; - -public class EmailReceivedIntent -{ - - public static final String ACTION_EMAIL_RECEIVED = "com.android.email.intent.action.EMAIL_RECEIVED"; - public static final String EXTRA_ACCOUNT = "com.android.email.intent.extra.ACCOUNT"; - public static final String EXTRA_FOLDER = "com.android.email.intent.extra.FOLDER"; - public static final String EXTRA_SENT_DATE = "com.android.email.intent.extra.SENT_DATE"; - public static final String EXTRA_FROM = "com.android.email.intent.extra.FROM"; - public static final String EXTRA_TO = "com.android.email.intent.extra.TO"; - public static final String EXTRA_CC = "com.android.email.intent.extra.CC"; - public static final String EXTRA_BCC = "com.android.email.intent.extra.BCC"; - public static final String EXTRA_SUBJECT = "com.android.email.intent.extra.SUBJECT"; -} diff --git a/src/com/android/email/Manifest.java b/src/com/android/email/Manifest.java deleted file mode 100644 index 0daaff859..000000000 --- a/src/com/android/email/Manifest.java +++ /dev/null @@ -1,16 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.android.email; - -public final class Manifest -{ - public static final class permission - { - public static final String READ_ATTACHMENT="com.android.email.permission.READ_ATTACHMENT"; - } -} diff --git a/src/com/android/email/Account.java b/src/com/fsck/k9/Account.java similarity index 98% rename from src/com/android/email/Account.java rename to src/com/fsck/k9/Account.java index 1f7b2635b..30ab8739d 100644 --- a/src/com/android/email/Account.java +++ b/src/com/fsck/k9/Account.java @@ -1,16 +1,16 @@ -package com.android.email; +package com.fsck.k9; import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import android.net.Uri; -import com.android.email.mail.Address; -import com.android.email.mail.Folder; -import com.android.email.mail.MessagingException; -import com.android.email.mail.Store; -import com.android.email.mail.store.LocalStore; -import com.android.email.mail.store.LocalStore.LocalFolder; +import com.fsck.k9.mail.Address; +import com.fsck.k9.mail.Folder; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.Store; +import com.fsck.k9.mail.store.LocalStore; +import com.fsck.k9.mail.store.LocalStore.LocalFolder; import java.io.Serializable; import java.util.ArrayList; @@ -718,7 +718,7 @@ public class Account implements Serializable { if (mDisplayCount == -1) { - this.mDisplayCount = Email.DEFAULT_VISIBLE_LIMIT; + this.mDisplayCount = K9.DEFAULT_VISIBLE_LIMIT; } return mDisplayCount; } @@ -742,7 +742,7 @@ public class Account implements Serializable } else { - this.mDisplayCount = Email.DEFAULT_VISIBLE_LIMIT; + this.mDisplayCount = K9.DEFAULT_VISIBLE_LIMIT; } } @@ -793,7 +793,7 @@ public class Account implements Serializable public String getErrorFolderName() { - return Email.ERROR_FOLDER_NAME; + return K9.ERROR_FOLDER_NAME; } public void setSentFolderName(String sentFolderName) diff --git a/src/com/android/email/EmailAddressAdapter.java b/src/com/fsck/k9/EmailAddressAdapter.java similarity index 97% rename from src/com/android/email/EmailAddressAdapter.java rename to src/com/fsck/k9/EmailAddressAdapter.java index f03eb7710..1b9ee9041 100644 --- a/src/com/android/email/EmailAddressAdapter.java +++ b/src/com/fsck/k9/EmailAddressAdapter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.email; +package com.fsck.k9; import android.content.ContentResolver; import android.content.Context; @@ -25,7 +25,7 @@ import android.provider.Contacts.People; import android.view.View; import android.widget.ResourceCursorAdapter; import android.widget.TextView; -import com.android.email.mail.Address; +import com.fsck.k9.mail.Address; import static android.provider.Contacts.ContactMethods.CONTENT_EMAIL_URI; diff --git a/src/com/android/email/EmailAddressValidator.java b/src/com/fsck/k9/EmailAddressValidator.java similarity index 93% rename from src/com/android/email/EmailAddressValidator.java rename to src/com/fsck/k9/EmailAddressValidator.java index b700de366..f88fe6eb9 100644 --- a/src/com/android/email/EmailAddressValidator.java +++ b/src/com/fsck/k9/EmailAddressValidator.java @@ -1,5 +1,5 @@ -package com.android.email; +package com.fsck.k9; import android.text.util.Rfc822Tokenizer; import android.widget.AutoCompleteTextView.Validator; diff --git a/src/com/fsck/k9/EmailReceivedIntent.java b/src/com/fsck/k9/EmailReceivedIntent.java new file mode 100644 index 000000000..c834e67a6 --- /dev/null +++ b/src/com/fsck/k9/EmailReceivedIntent.java @@ -0,0 +1,15 @@ +package com.fsck.k9; + +public class EmailReceivedIntent +{ + + public static final String ACTION_EMAIL_RECEIVED = "com.fsck.k9.intent.action.EMAIL_RECEIVED"; + public static final String EXTRA_ACCOUNT = "com.fsck.k9.intent.extra.ACCOUNT"; + public static final String EXTRA_FOLDER = "com.fsck.k9.intent.extra.FOLDER"; + public static final String EXTRA_SENT_DATE = "com.fsck.k9.intent.extra.SENT_DATE"; + public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.FROM"; + public static final String EXTRA_TO = "com.fsck.k9.intent.extra.TO"; + public static final String EXTRA_CC = "com.fsck.k9.intent.extra.CC"; + public static final String EXTRA_BCC = "com.fsck.k9.intent.extra.BCC"; + public static final String EXTRA_SUBJECT = "com.fsck.k9.intent.extra.SUBJECT"; +} diff --git a/src/com/android/email/FixedLengthInputStream.java b/src/com/fsck/k9/FixedLengthInputStream.java similarity index 98% rename from src/com/android/email/FixedLengthInputStream.java rename to src/com/fsck/k9/FixedLengthInputStream.java index c9523cde4..1f6c109a1 100644 --- a/src/com/android/email/FixedLengthInputStream.java +++ b/src/com/fsck/k9/FixedLengthInputStream.java @@ -1,5 +1,5 @@ -package com.android.email; +package com.fsck.k9; import java.io.IOException; import java.io.InputStream; diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index a12bb3ac8..e412521ef 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -1,6 +1,598 @@ + package com.fsck.k9; -import com.android.email.Email; +import android.app.Application; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.util.Log; +import com.fsck.k9.activity.MessageCompose; +import com.fsck.k9.mail.Address; +import com.fsck.k9.mail.Message; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.internet.BinaryTempFileBody; +import com.fsck.k9.service.BootReceiver; +import com.fsck.k9.service.MailService; -public class K9 extends Email { +import java.io.File; + +public class K9 extends Application +{ + public static Application app = null; + public static File tempDirectory; + public static final String LOG_TAG = "k9"; + + public enum BACKGROUND_OPS + { + WHEN_CHECKED, ALWAYS, NEVER + } + + private static int theme = android.R.style.Theme_Light; + + private static BACKGROUND_OPS backgroundOps = BACKGROUND_OPS.WHEN_CHECKED; + /** + * Some log messages can be sent to a file, so that the logs + * can be read using unprivileged access (eg. Terminal Emulator) + * on the phone, without adb. Set to null to disable + */ + public static final String logFile = null; + //public static final String logFile = "/sdcard/k9mail/debug.log"; + + /** + * If this is enabled there will be additional logging information sent to + * Log.d, including protocol dumps. + * Controlled by Preferences at run-time + */ + public static boolean DEBUG = false; + + /** + * If this is enabled than logging that normally hides sensitive information + * like passwords will show that information. + */ + public static boolean DEBUG_SENSITIVE = false; + + /** + * Can create messages containing stack traces that can be forwarded + * to the development team. + */ + public static boolean ENABLE_ERROR_FOLDER = true; + public static String ERROR_FOLDER_NAME = "K9mail-errors"; + + /** + * The MIME type(s) of attachments we're willing to send. At the moment it is not possible + * to open a chooser with a list of filter types, so the chooser is only opened with the first + * item in the list. The entire list will be used to filter down attachments that are added + * with Intent.ACTION_SEND. + */ + public static final String[] ACCEPTABLE_ATTACHMENT_SEND_TYPES = new String[] + { + "*/*" + }; + + /** + * The MIME type(s) of attachments we're willing to view. + */ + public static final String[] ACCEPTABLE_ATTACHMENT_VIEW_TYPES = new String[] + { + "*/*", + }; + + /** + * The MIME type(s) of attachments we're not willing to view. + */ + public static final String[] UNACCEPTABLE_ATTACHMENT_VIEW_TYPES = new String[] + { + }; + + /** + * The MIME type(s) of attachments we're willing to download to SD. + */ + public static final String[] ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] + { + "*/*", + }; + + /** + * The MIME type(s) of attachments we're not willing to download to SD. + */ + public static final String[] UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] + { + }; + + /** + * The special name "INBOX" is used throughout the application to mean "Whatever folder + * the server refers to as the user's Inbox. Placed here to ease use. + */ + public static final String INBOX = "INBOX"; + + /** + * For use when displaying that no folder is selected + */ + public static final String FOLDER_NONE = "-NONE-"; + + public static final String LOCAL_UID_PREFIX = "K9LOCAL:"; + + public static final String REMOTE_UID_PREFIX = "K9REMOTE:"; + + public static final String K9MAIL_IDENTITY = "X-K9mail-Identity"; + + /** + * Specifies how many messages will be shown in a folder by default. This number is set + * on each new folder and can be incremented with "Load more messages..." by the + * VISIBLE_LIMIT_INCREMENT + */ + public static int DEFAULT_VISIBLE_LIMIT = 25; + + /** + * Number of additioanl messages to load when a user selectes "Load more messages..." + */ + public static int VISIBLE_LIMIT_INCREMENT = 25; + + public static int MAX_SEND_ATTEMPTS = 5; + + /** + * The maximum size of an attachment we're willing to download (either View or Save) + * Attachments that are base64 encoded (most) will be about 1.375x their actual size + * so we should probably factor that in. A 5MB attachment will generally be around + * 6.8MB downloaded but only 5MB saved. + */ + public static final int MAX_ATTACHMENT_DOWNLOAD_SIZE = (5 * 1024 * 1024); + + /** + * Max time (in millis) the wake lock will be held for when background sync is happening + */ + public static final int WAKE_LOCK_TIMEOUT = 600000; + + public static final int MANUAL_WAKE_LOCK_TIMEOUT = 120000; + + public static final int PUSH_WAKE_LOCK_TIMEOUT = 60000; + + public static final int MAIL_SERVICE_WAKE_LOCK_TIMEOUT = 30000; + + public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 60000; + + + /** + * LED color used for the new email notitication + */ + public static final int NOTIFICATION_LED_COLOR = 0xffff00ff; + + /** + * Time the LED is on when blicking on new email notification + */ + public static final int NOTIFICATION_LED_ON_TIME = 500; + + /** + * Time the LED is off when blicking on new email notification + */ + public static final int NOTIFICATION_LED_OFF_TIME = 2000; + + public static final boolean NOTIFICATION_LED_WHILE_SYNCING = false; + public static final int NOTIFICATION_LED_DIM_COLOR = 0x77770077; + public static final int NOTIFICATION_LED_FAST_ON_TIME = 100; + public static final int NOTIFICATION_LED_FAST_OFF_TIME = 100; + + public static final int NOTIFICATION_LED_SENDING_FAILURE_COLOR = 0xffff0000; + + // Must not conflict with an account number + public static final int FETCHING_EMAIL_NOTIFICATION_ID = -4; + public static final int FETCHING_EMAIL_NOTIFICATION_MULTI_ACCOUNT_ID = -1; + public static final int FETCHING_EMAIL_NOTIFICATION_NO_ACCOUNT = -2; + public static final int CONNECTIVITY_ID = -3; + + /* + * http://www.w3schools.com/media/media_mimeref.asp + * + png + */ + public static final String[][] CONTENT_TYPE_BY_EXTENSION_MAP = new String[][] + { + { "", "application/octet-stream" }, + { "323", "text/h323"}, + { "acx", "application/internet-property-stream"}, + { "ai", "application/postscript"}, + { "aif", "audio/x-aiff"}, + { "aifc", "audio/x-aiff"}, + { "aiff", "audio/x-aiff"}, + { "asf", "video/x-ms-asf"}, + { "asr", "video/x-ms-asf"}, + { "asx", "video/x-ms-asf"}, + { "au", "audio/basic"}, + { "avi", "video/x-msvideo"}, + { "axs", "application/olescript"}, + { "bas", "text/plain"}, + { "bcpio", "application/x-bcpio"}, + { "bin", "application/octet-stream"}, + { "bmp", "image/bmp"}, + { "c", "text/plain"}, + { "cat", "application/vnd.ms-pkiseccat"}, + { "cdf", "application/x-cdf"}, + { "cer", "application/x-x509-ca-cert"}, + { "class", "application/octet-stream"}, + { "clp", "application/x-msclip"}, + { "cmx", "image/x-cmx"}, + { "cod", "image/cis-cod"}, + { "cpio", "application/x-cpio"}, + { "crd", "application/x-mscardfile"}, + { "crl", "application/pkix-crl"}, + { "crt", "application/x-x509-ca-cert"}, + { "csh", "application/x-csh"}, + { "css", "text/css"}, + { "dcr", "application/x-director"}, + { "der", "application/x-x509-ca-cert"}, + { "dir", "application/x-director"}, + { "dll", "application/x-msdownload"}, + { "dms", "application/octet-stream"}, + { "doc", "application/msword"}, + { "dot", "application/msword"}, + { "dvi", "application/x-dvi"}, + { "dxr", "application/x-director"}, + { "eps", "application/postscript"}, + { "etx", "text/x-setext"}, + { "evy", "application/envoy"}, + { "exe", "application/octet-stream"}, + { "fif", "application/fractals"}, + { "flr", "x-world/x-vrml"}, + { "gif", "image/gif"}, + { "gtar", "application/x-gtar"}, + { "gz", "application/x-gzip"}, + { "h", "text/plain"}, + { "hdf", "application/x-hdf"}, + { "hlp", "application/winhlp"}, + { "hqx", "application/mac-binhex40"}, + { "hta", "application/hta"}, + { "htc", "text/x-component"}, + { "htm", "text/html"}, + { "html", "text/html"}, + { "htt", "text/webviewhtml"}, + { "ico", "image/x-icon"}, + { "ief", "image/ief"}, + { "iii", "application/x-iphone"}, + { "ins", "application/x-internet-signup"}, + { "isp", "application/x-internet-signup"}, + { "jfif", "image/pipeg"}, + { "jpe", "image/jpeg"}, + { "jpeg", "image/jpeg"}, + { "jpg", "image/jpeg"}, + { "js", "application/x-javascript"}, + { "latex", "application/x-latex"}, + { "lha", "application/octet-stream"}, + { "lsf", "video/x-la-asf"}, + { "lsx", "video/x-la-asf"}, + { "lzh", "application/octet-stream"}, + { "m13", "application/x-msmediaview"}, + { "m14", "application/x-msmediaview"}, + { "m3u", "audio/x-mpegurl"}, + { "man", "application/x-troff-man"}, + { "mdb", "application/x-msaccess"}, + { "me", "application/x-troff-me"}, + { "mht", "message/rfc822"}, + { "mhtml", "message/rfc822"}, + { "mid", "audio/mid"}, + { "mny", "application/x-msmoney"}, + { "mov", "video/quicktime"}, + { "movie", "video/x-sgi-movie"}, + { "mp2", "video/mpeg"}, + { "mp3", "audio/mpeg"}, + { "mpa", "video/mpeg"}, + { "mpe", "video/mpeg"}, + { "mpeg", "video/mpeg"}, + { "mpg", "video/mpeg"}, + { "mpp", "application/vnd.ms-project"}, + { "mpv2", "video/mpeg"}, + { "ms", "application/x-troff-ms"}, + { "mvb", "application/x-msmediaview"}, + { "nws", "message/rfc822"}, + { "oda", "application/oda"}, + { "p10", "application/pkcs10"}, + { "p12", "application/x-pkcs12"}, + { "p7b", "application/x-pkcs7-certificates"}, + { "p7c", "application/x-pkcs7-mime"}, + { "p7m", "application/x-pkcs7-mime"}, + { "p7r", "application/x-pkcs7-certreqresp"}, + { "p7s", "application/x-pkcs7-signature"}, + { "pbm", "image/x-portable-bitmap"}, + { "pdf", "application/pdf"}, + { "pfx", "application/x-pkcs12"}, + { "pgm", "image/x-portable-graymap"}, + { "pko", "application/ynd.ms-pkipko"}, + { "pma", "application/x-perfmon"}, + { "pmc", "application/x-perfmon"}, + { "pml", "application/x-perfmon"}, + { "pmr", "application/x-perfmon"}, + { "pmw", "application/x-perfmon"}, + { "png", "image/png"}, + { "pnm", "image/x-portable-anymap"}, + { "pot,", "application/vnd.ms-powerpoint"}, + { "ppm", "image/x-portable-pixmap"}, + { "pps", "application/vnd.ms-powerpoint"}, + { "ppt", "application/vnd.ms-powerpoint"}, + { "prf", "application/pics-rules"}, + { "ps", "application/postscript"}, + { "pub", "application/x-mspublisher"}, + { "qt", "video/quicktime"}, + { "ra", "audio/x-pn-realaudio"}, + { "ram", "audio/x-pn-realaudio"}, + { "ras", "image/x-cmu-raster"}, + { "rgb", "image/x-rgb"}, + { "rmi", "audio/mid"}, + { "roff", "application/x-troff"}, + { "rtf", "application/rtf"}, + { "rtx", "text/richtext"}, + { "scd", "application/x-msschedule"}, + { "sct", "text/scriptlet"}, + { "setpay", "application/set-payment-initiation"}, + { "setreg", "application/set-registration-initiation"}, + { "sh", "application/x-sh"}, + { "shar", "application/x-shar"}, + { "sit", "application/x-stuffit"}, + { "snd", "audio/basic"}, + { "spc", "application/x-pkcs7-certificates"}, + { "spl", "application/futuresplash"}, + { "src", "application/x-wais-source"}, + { "sst", "application/vnd.ms-pkicertstore"}, + { "stl", "application/vnd.ms-pkistl"}, + { "stm", "text/html"}, + { "svg", "image/svg+xml"}, + { "sv4cpio","application/x-sv4cpio"}, + { "sv4crc", "application/x-sv4crc"}, + { "swf", "application/x-shockwave-flash"}, + { "t", "application/x-troff"}, + { "tar", "application/x-tar"}, + { "tcl", "application/x-tcl"}, + { "tex", "application/x-tex"}, + { "texi", "application/x-texinfo"}, + { "texinfo","application/x-texinfo"}, + { "tgz", "application/x-compressed"}, + { "tif", "image/tiff"}, + { "tiff", "image/tiff"}, + { "tr", "application/x-troff"}, + { "trm", "application/x-msterminal"}, + { "tsv", "text/tab-separated-values"}, + { "txt", "text/plain"}, + { "uls", "text/iuls"}, + { "ustar", "application/x-ustar"}, + { "vcf", "text/x-vcard"}, + { "vrml", "x-world/x-vrml"}, + { "wav", "audio/x-wav"}, + { "wcm", "application/vnd.ms-works"}, + { "wdb", "application/vnd.ms-works"}, + { "wks", "application/vnd.ms-works"}, + { "wmf", "application/x-msmetafile"}, + { "wps", "application/vnd.ms-works"}, + { "wri", "application/x-mswrite"}, + { "wrl", "x-world/x-vrml"}, + { "wrz", "x-world/x-vrml"}, + { "xaf", "x-world/x-vrml"}, + { "xbm", "image/x-xbitmap"}, + { "xla", "application/vnd.ms-excel"}, + { "xlc", "application/vnd.ms-excel"}, + { "xlm", "application/vnd.ms-excel"}, + { "xls", "application/vnd.ms-excel"}, + { "xlt", "application/vnd.ms-excel"}, + { "xlw", "application/vnd.ms-excel"}, + { "xof", "x-world/x-vrml"}, + { "xpm", "image/x-xpixmap"}, + { "xwd", "image/x-xwindowdump"}, + { "z", "application/x-compress"}, + { "zip", "application/zip"} + }; + + public class Intents + { + + public class EmailReceived + { + public static final String ACTION_EMAIL_RECEIVED = "com.fsck.k9.intent.action.EMAIL_RECEIVED"; + public static final String ACTION_EMAIL_DELETED = "com.fsck.k9.intent.action.EMAIL_DELETED"; + public static final String EXTRA_ACCOUNT = "com.fsck.k9.intent.extra.ACCOUNT"; + public static final String EXTRA_FOLDER = "com.fsck.k9.intent.extra.FOLDER"; + public static final String EXTRA_SENT_DATE = "com.fsck.k9.intent.extra.SENT_DATE"; + public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.FROM"; + public static final String EXTRA_TO = "com.fsck.k9.intent.extra.TO"; + public static final String EXTRA_CC = "com.fsck.k9.intent.extra.CC"; + public static final String EXTRA_BCC = "com.fsck.k9.intent.extra.BCC"; + public static final String EXTRA_SUBJECT = "com.fsck.k9.intent.extra.SUBJECT"; + public static final String EXTRA_FROM_SELF = "com.fsck.k9.intent.extra.FROM_SELF"; + } + + } + + /** + * Called throughout the application when the number of accounts has changed. This method + * enables or disables the Compose activity, the boot receiver and the service based on + * whether any accounts are configured. + */ + public static void setServicesEnabled(Context context) + { + + int acctLength = Preferences.getPreferences(context).getAccounts().length; + + setServicesEnabled(context, acctLength > 0, null); + + } + + public static void setServicesEnabled(Context context, Integer wakeLockId) + { + setServicesEnabled(context, Preferences.getPreferences(context).getAccounts().length > 0, wakeLockId); + } + + public static void setServicesEnabled(Context context, boolean enabled, Integer wakeLockId) + { + + PackageManager pm = context.getPackageManager(); + + if (!enabled && pm.getComponentEnabledSetting(new ComponentName(context, MailService.class)) == + PackageManager.COMPONENT_ENABLED_STATE_ENABLED) + { + /* + * If no accounts now exist but the service is still enabled we're about to disable it + * so we'll reschedule to kill off any existing alarms. + */ + MailService.actionReschedule(context, wakeLockId); + } + Class[] classes = { MessageCompose.class, BootReceiver.class, MailService.class }; + + for (Class clazz : classes) + { + + boolean alreadyEnabled = pm.getComponentEnabledSetting(new ComponentName(context, clazz)) == + PackageManager.COMPONENT_ENABLED_STATE_ENABLED; + + if (enabled != alreadyEnabled) + { + pm.setComponentEnabledSetting( + new ComponentName(context, clazz), + enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : + PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + PackageManager.DONT_KILL_APP); + } + } + + if (enabled && pm.getComponentEnabledSetting(new ComponentName(context, MailService.class)) == + PackageManager.COMPONENT_ENABLED_STATE_ENABLED) + { + /* + * And now if accounts do exist then we've just enabled the service and we want to + * schedule alarms for the new accounts. + */ + MailService.actionReschedule(context, wakeLockId); + } + + } + + public static void save(SharedPreferences.Editor editor) + { + editor.putBoolean("enableDebugLogging", K9.DEBUG); + editor.putBoolean("enableSensitiveLogging", K9.DEBUG_SENSITIVE); + editor.putString("backgroundOperations", K9.backgroundOps.toString()); + editor.putInt("theme", theme); + } + + @Override + public void onCreate() + { + super.onCreate(); + app = this; + Preferences prefs = Preferences.getPreferences(this); + SharedPreferences sprefs = prefs.getPreferences(); + DEBUG = sprefs.getBoolean("enableDebugLogging", false); + DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); + + try + { + setBackgroundOps(BACKGROUND_OPS.valueOf(sprefs.getString("backgroundOperations", "WHEN_CHECKED"))); + } + catch (Exception e) + { + setBackgroundOps(BACKGROUND_OPS.WHEN_CHECKED); + } + + K9.setK9Theme(sprefs.getInt("theme", android.R.style.Theme_Light)); + MessagingController.getInstance(this).resetVisibleLimits(prefs.getAccounts()); + + /* + * We have to give MimeMessage a temp directory because File.createTempFile(String, String) + * doesn't work in Android and MimeMessage does not have access to a Context. + */ + BinaryTempFileBody.setTempDirectory(getCacheDir()); + + /* + * Enable background sync of messages + */ + + setServicesEnabled(this); + + MessagingController.getInstance(this).addListener(new MessagingListener() + { + private void broadcastIntent(String action, Account account, String folder, Message message) + { + try + { + Uri uri = Uri.parse("email://messages/" + account.getAccountNumber() + "/" + Uri.encode(folder) + "/" + Uri.encode(message.getUid())); + Intent intent = new Intent(action, uri); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_ACCOUNT, account.getDescription()); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_FOLDER, folder); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_SENT_DATE, message.getSentDate()); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_FROM, Address.toString(message.getFrom())); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_TO, Address.toString(message.getRecipients(Message.RecipientType.TO))); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_CC, Address.toString(message.getRecipients(Message.RecipientType.CC))); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_BCC, Address.toString(message.getRecipients(Message.RecipientType.BCC))); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_SUBJECT, message.getSubject()); + intent.putExtra(K9.Intents.EmailReceived.EXTRA_FROM_SELF, account.isAnIdentity(message.getFrom())); + K9.this.sendBroadcast(intent); + Log.d(K9.LOG_TAG, "Broadcasted: action=" + action + + " account=" + account.getDescription() + + " folder=" + folder + + " message uid=" + message.getUid() + ); + + } + catch (MessagingException e) + { + Log.w(K9.LOG_TAG, "Error: action=" + action + + " account=" + account.getDescription() + + " folder=" + folder + + " message uid=" + message.getUid() + ); + } + } + + @Override + public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) + { + broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message); + } + + @Override + public void messageDeleted(Account account, String folder, Message message) + { + broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message); + } + + @Override + public void synchronizeMailboxNewMessage(Account account, String folder, Message message) + { + broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_RECEIVED, account, folder, message); + } + + + }); + + } + + public static int getK9Theme() + { + return theme; + } + + public static void setK9Theme(int ntheme) + { + theme = ntheme; + } + + public static BACKGROUND_OPS getBackgroundOps() + { + return backgroundOps; + } + + public static void setBackgroundOps(BACKGROUND_OPS backgroundOps) + { + K9.backgroundOps = backgroundOps; + } + + public static void setBackgroundOps(String nbackgroundOps) + { + K9.backgroundOps = BACKGROUND_OPS.valueOf(nbackgroundOps); + } } + + + + + + + + diff --git a/src/com/android/email/K9Activity.java b/src/com/fsck/k9/K9Activity.java similarity index 87% rename from src/com/android/email/K9Activity.java rename to src/com/fsck/k9/K9Activity.java index 75ee3d99e..ff02584a9 100644 --- a/src/com/android/email/K9Activity.java +++ b/src/com/fsck/k9/K9Activity.java @@ -1,9 +1,9 @@ -package com.android.email; +package com.fsck.k9; import android.app.Activity; import android.os.Bundle; -import com.android.email.activity.DateFormatter; +import com.fsck.k9.activity.DateFormatter; public class K9Activity extends Activity @@ -11,7 +11,7 @@ public class K9Activity extends Activity @Override public void onCreate(Bundle icicle) { - setTheme(Email.getK9Theme()); + setTheme(K9.getK9Theme()); super.onCreate(icicle); setupFormats(); } diff --git a/src/com/android/email/K9ListActivity.java b/src/com/fsck/k9/K9ListActivity.java similarity index 87% rename from src/com/android/email/K9ListActivity.java rename to src/com/fsck/k9/K9ListActivity.java index 8ddced7ae..2ca59cead 100644 --- a/src/com/android/email/K9ListActivity.java +++ b/src/com/fsck/k9/K9ListActivity.java @@ -1,8 +1,8 @@ -package com.android.email; +package com.fsck.k9; import android.app.ListActivity; import android.os.Bundle; -import com.android.email.activity.DateFormatter; +import com.fsck.k9.activity.DateFormatter; public class K9ListActivity extends ListActivity @@ -10,7 +10,7 @@ public class K9ListActivity extends ListActivity @Override public void onCreate(Bundle icicle) { - setTheme(Email.getK9Theme()); + setTheme(K9.getK9Theme()); super.onCreate(icicle); setupFormats(); } diff --git a/src/com/android/email/K9PreferenceActivity.java b/src/com/fsck/k9/K9PreferenceActivity.java similarity index 78% rename from src/com/android/email/K9PreferenceActivity.java rename to src/com/fsck/k9/K9PreferenceActivity.java index 3e0e23cf1..f247e8d5d 100644 --- a/src/com/android/email/K9PreferenceActivity.java +++ b/src/com/fsck/k9/K9PreferenceActivity.java @@ -1,4 +1,4 @@ -package com.android.email; +package com.fsck.k9; import android.os.Bundle; import android.preference.PreferenceActivity; @@ -10,7 +10,7 @@ public class K9PreferenceActivity extends PreferenceActivity @Override public void onCreate(Bundle icicle) { - setTheme(Email.getK9Theme()); + setTheme(K9.getK9Theme()); super.onCreate(icicle); } diff --git a/src/com/android/email/MessagingController.java b/src/com/fsck/k9/MessagingController.java similarity index 89% rename from src/com/android/email/MessagingController.java rename to src/com/fsck/k9/MessagingController.java index 89167b6e7..478b6de94 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -1,5 +1,5 @@ -package com.android.email; +package com.fsck.k9; import android.app.Application; import android.app.Notification; @@ -13,17 +13,17 @@ import android.os.PowerManager.WakeLock; import android.os.Process; import android.text.TextUtils; import android.util.Log; -import com.android.email.activity.FolderList; -import com.android.email.mail.*; -import com.android.email.mail.Folder.FolderType; -import com.android.email.mail.Folder.OpenMode; -import com.android.email.mail.internet.MimeMessage; -import com.android.email.mail.internet.MimeUtility; -import com.android.email.mail.internet.TextBody; -import com.android.email.mail.store.LocalStore; -import com.android.email.mail.store.LocalStore.LocalFolder; -import com.android.email.mail.store.LocalStore.LocalMessage; -import com.android.email.mail.store.LocalStore.PendingCommand; +import com.fsck.k9.activity.FolderList; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Folder.FolderType; +import com.fsck.k9.mail.Folder.OpenMode; +import com.fsck.k9.mail.internet.MimeMessage; +import com.fsck.k9.mail.internet.MimeUtility; +import com.fsck.k9.mail.internet.TextBody; +import com.fsck.k9.mail.store.LocalStore; +import com.fsck.k9.mail.store.LocalStore.LocalFolder; +import com.fsck.k9.mail.store.LocalStore.LocalMessage; +import com.fsck.k9.mail.store.LocalStore.PendingCommand; import java.io.ByteArrayOutputStream; import java.io.File; @@ -68,13 +68,13 @@ public class MessagingController implements Runnable */ private static final int MAX_SMALL_MESSAGE_SIZE = Store.FETCH_BODY_SANE_SUGGESTED_SIZE; - private static final String PENDING_COMMAND_MOVE_OR_COPY = "com.android.email.MessagingController.moveOrCopy"; - private static final String PENDING_COMMAND_MOVE_OR_COPY_BULK = "com.android.email.MessagingController.moveOrCopyBulk"; - private static final String PENDING_COMMAND_EMPTY_TRASH = "com.android.email.MessagingController.emptyTrash"; - private static final String PENDING_COMMAND_SET_FLAG_BULK = "com.android.email.MessagingController.setFlagBulk"; - private static final String PENDING_COMMAND_SET_FLAG = "com.android.email.MessagingController.setFlag"; - private static final String PENDING_COMMAND_APPEND = "com.android.email.MessagingController.append"; - private static final String PENDING_COMMAND_MARK_ALL_AS_READ = "com.android.email.MessagingController.markAllAsRead"; + private static final String PENDING_COMMAND_MOVE_OR_COPY = "com.fsck.k9.MessagingController.moveOrCopy"; + private static final String PENDING_COMMAND_MOVE_OR_COPY_BULK = "com.fsck.k9.MessagingController.moveOrCopyBulk"; + private static final String PENDING_COMMAND_EMPTY_TRASH = "com.fsck.k9.MessagingController.emptyTrash"; + private static final String PENDING_COMMAND_SET_FLAG_BULK = "com.fsck.k9.MessagingController.setFlagBulk"; + private static final String PENDING_COMMAND_SET_FLAG = "com.fsck.k9.MessagingController.setFlag"; + private static final String PENDING_COMMAND_APPEND = "com.fsck.k9.MessagingController.append"; + private static final String PENDING_COMMAND_MARK_ALL_AS_READ = "com.fsck.k9.MessagingController.markAllAsRead"; private static MessagingController inst = null; private BlockingQueue mCommands = new PriorityBlockingQueue(); @@ -165,7 +165,7 @@ public class MessagingController implements Runnable return; } String messKey = createMessageKey(account, folder, message); - // Log.d(Email.LOG_TAG, "Suppressing message with key " + messKey); + // Log.d(K9.LOG_TAG, "Suppressing message with key " + messKey); deletedUids.put(messKey, "true"); } @@ -185,7 +185,7 @@ public class MessagingController implements Runnable return; } String messKey = createMessageKey(account, folder, uid); - //Log.d(Email.LOG_TAG, "Unsuppressing message with key " + messKey); + //Log.d(K9.LOG_TAG, "Unsuppressing message with key " + messKey); deletedUids.remove(messKey); } @@ -197,10 +197,10 @@ public class MessagingController implements Runnable return false; } String messKey = createMessageKey(account, folder, message); - //Log.d(Email.LOG_TAG, "Checking suppression of message with key " + messKey); + //Log.d(K9.LOG_TAG, "Checking suppression of message with key " + messKey); if (deletedUids.containsKey(messKey)) { - //Log.d(Email.LOG_TAG, "Message with key " + messKey + " is suppressed"); + //Log.d(K9.LOG_TAG, "Message with key " + messKey + " is suppressed"); return true; } Long expungedUidL = expungedUid.get(createFolderKey(account, folder)); @@ -240,19 +240,19 @@ public class MessagingController implements Runnable public void log(String logmess) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, logmess); + Log.d(K9.LOG_TAG, logmess); } - if (Email.logFile != null) + if (K9.logFile != null) { FileOutputStream fos = null; try { - File logFile = new File(Email.logFile); + File logFile = new File(K9.logFile); fos = new FileOutputStream(logFile, true); PrintStream ps = new PrintStream(fos); - ps.println(new Date() + ":" + Email.LOG_TAG + ":" + logmess); + ps.println(new Date() + ":" + K9.LOG_TAG + ":" + logmess); ps.flush(); ps.close(); fos.flush(); @@ -260,7 +260,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to log message '" + logmess + "'", e); + Log.e(K9.LOG_TAG, "Unable to log message '" + logmess + "'", e); } finally { @@ -313,10 +313,10 @@ public class MessagingController implements Runnable { commandDescription = command.description; String ground = (command.isForeground ? "Foreground" : "Background"); - Log.i(Email.LOG_TAG, "Running " + ground + " command '" + command.description + "', seq = " + command.sequence); + Log.i(K9.LOG_TAG, "Running " + ground + " command '" + command.description + "', seq = " + command.sequence); mBusy = true; command.runnable.run(); - Log.i(Email.LOG_TAG, ground + " Command '" + command.description + "' completed"); + Log.i(K9.LOG_TAG, ground + " Command '" + command.description + "' completed"); for (MessagingListener l : getListeners()) { l.controllerCommandCompleted(mCommands.size() > 0); @@ -329,7 +329,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Error running command '" + commandDescription + "'", e); + Log.e(K9.LOG_TAG, "Error running command '" + commandDescription + "'", e); } mBusy = false; } @@ -504,7 +504,7 @@ public class MessagingController implements Runnable for (Folder localFolder : localFolders) { String localFolderName = localFolder.getName(); - if (localFolderName.equalsIgnoreCase(Email.INBOX) || + if (localFolderName.equalsIgnoreCase(K9.INBOX) || localFolderName.equals(account.getTrashFolderName()) || localFolderName.equals(account.getOutboxFolderName()) || localFolderName.equals(account.getDraftsFolderName()) || @@ -579,9 +579,9 @@ public class MessagingController implements Runnable boolean stop = false; public void run() { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "listLocalMessages callbackRunner started"); + Log.v(K9.LOG_TAG, "listLocalMessages callbackRunner started"); } while (stop == false) { @@ -596,7 +596,7 @@ public class MessagingController implements Runnable } catch (InterruptedException ie) { - Log.i(Email.LOG_TAG, "listLocalMessages callbackRunner interrupted"); + Log.i(K9.LOG_TAG, "listLocalMessages callbackRunner interrupted"); } } else @@ -621,9 +621,9 @@ public class MessagingController implements Runnable callbackPending(); } latch.countDown(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "listLocalMessages callbackRunner finished"); + Log.v(K9.LOG_TAG, "listLocalMessages callbackRunner finished"); } } private void callbackPending() @@ -691,9 +691,9 @@ public class MessagingController implements Runnable queue.add(messCont); latch.await(1000, TimeUnit.MILLISECONDS); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Got ack that callbackRunner finished"); + Log.v(K9.LOG_TAG, "Got ack that callbackRunner finished"); } for (MessagingListener l : getListeners()) { @@ -732,7 +732,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while closing folder", e); + Log.e(K9.LOG_TAG, "Exception while closing folder", e); } } } @@ -771,7 +771,7 @@ public class MessagingController implements Runnable { addErrorMessage(account, e); - Log.e(Email.LOG_TAG, "Unable to reset visible limits", e); + Log.e(K9.LOG_TAG, "Unable to reset visible limits", e); } } } @@ -815,7 +815,7 @@ public class MessagingController implements Runnable return; } String debugLine = "Synchronizing folder " + account.getDescription() + ":" + folder; - Log.i(Email.LOG_TAG, debugLine); + Log.i(K9.LOG_TAG, debugLine); log(debugLine); for (MessagingListener l : getListeners()) @@ -830,9 +830,9 @@ public class MessagingController implements Runnable Exception commandException = null; try { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SYNC: About to process pending commands for folder " + + Log.d(K9.LOG_TAG, "SYNC: About to process pending commands for folder " + account.getDescription() + ":" + folder); } try @@ -843,7 +843,7 @@ public class MessagingController implements Runnable { addErrorMessage(account, e); - Log.e(Email.LOG_TAG, "Failure processing command, but allow message sync attempt", e); + Log.e(K9.LOG_TAG, "Failure processing command, but allow message sync attempt", e); commandException = e; } @@ -851,9 +851,9 @@ public class MessagingController implements Runnable * Get the message list from the local store and create an index of * the uids within the list. */ - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: About to get local folder " + folder); + Log.v(K9.LOG_TAG, "SYNC: About to get local folder " + folder); } final LocalStore localStore = (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication); tLocalFolder = (LocalFolder) localStore.getFolder(folder); @@ -866,15 +866,15 @@ public class MessagingController implements Runnable localUidMap.put(message.getUid(), message); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: About to get remote store for " + folder); + Log.v(K9.LOG_TAG, "SYNC: About to get remote store for " + folder); } Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: About to get remote folder " + folder); + Log.v(K9.LOG_TAG, "SYNC: About to get remote folder " + folder); } Folder remoteFolder = remoteStore.getFolder(folder); @@ -902,7 +902,7 @@ public class MessagingController implements Runnable { listener.synchronizeMailboxFinished(account, folder, 0, 0); } - Log.i(Email.LOG_TAG, "Done synchronizing folder " + folder); + Log.i(K9.LOG_TAG, "Done synchronizing folder " + folder); return; } } @@ -913,8 +913,8 @@ public class MessagingController implements Runnable Open the folder Upload any local messages that are marked as PENDING_UPLOAD (Drafts, Sent, Trash) Get the message count - Get the list of the newest Email.DEFAULT_VISIBLE_LIMIT messages - getMessages(messageCount - Email.DEFAULT_VISIBLE_LIMIT, messageCount) + Get the list of the newest K9.DEFAULT_VISIBLE_LIMIT messages + getMessages(messageCount - K9.DEFAULT_VISIBLE_LIMIT, messageCount) See if we have each message locally, if not fetch it's flags and envelope Get and update the unread count for the folder Update the remote flags of any messages we have locally with an internal date @@ -930,9 +930,9 @@ public class MessagingController implements Runnable /* * Open the remote folder. This pre-loads certain metadata like message count. */ - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: About to open remote folder " + folder); + Log.v(K9.LOG_TAG, "SYNC: About to open remote folder " + folder); } remoteFolder.open(OpenMode.READ_WRITE); @@ -949,9 +949,9 @@ public class MessagingController implements Runnable // final ArrayList unsyncedMessages = new ArrayList(); HashMap remoteUidMap = new HashMap(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: Remote message count for folder " + folder + " is " + + Log.v(K9.LOG_TAG, "SYNC: Remote message count for folder " + folder + " is " + remoteMessageCount); } @@ -963,9 +963,9 @@ public class MessagingController implements Runnable int remoteStart = Math.max(0, remoteMessageCount - visibleLimit) + 1; int remoteEnd = remoteMessageCount; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: About to get messages " + remoteStart + " through " + remoteEnd + " for folder " + folder); + Log.v(K9.LOG_TAG, "SYNC: About to get messages " + remoteStart + " through " + remoteEnd + " for folder " + folder); } remoteMessageArray = remoteFolder.getMessages(remoteStart, remoteEnd, null); @@ -974,9 +974,9 @@ public class MessagingController implements Runnable remoteMessages.add(thisMess); remoteUidMap.put(thisMess.getUid(), thisMess); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "SYNC: Got " + remoteUidMap.size() + " messages for folder " + folder); + Log.v(K9.LOG_TAG, "SYNC: Got " + remoteUidMap.size() + " messages for folder " + folder); } remoteMessageArray = null; @@ -994,7 +994,7 @@ public class MessagingController implements Runnable if (remoteUidMap.get(localMessage.getUid()) == null && !localMessage.isSet(Flag.DELETED)) { localMessage.setFlag(Flag.X_DESTROYED, true); - // Log.d(Email.LOG_TAG, "Destroying message " + localMessage.getUid() + " which isn't in the most recent group on server"); + // Log.d(K9.LOG_TAG, "Destroying message " + localMessage.getUid() + " which isn't in the most recent group on server"); for (MessagingListener l : getListeners()) { l.synchronizeMailboxRemovedMessage(account, folder, localMessage); @@ -1024,7 +1024,7 @@ public class MessagingController implements Runnable remoteFolder.close(false); localFolder.close(false); - if (Email.DEBUG) + if (K9.DEBUG) { log("Done synchronizing folder " + account.getDescription() + ":" + folder + " @ " + new Date() + @@ -1044,7 +1044,7 @@ public class MessagingController implements Runnable if (commandException != null) { String rootMessage = getRootCauseMessage(commandException); - Log.e(Email.LOG_TAG, "Root cause failure in " + account.getDescription() + ":" + + Log.e(K9.LOG_TAG, "Root cause failure in " + account.getDescription() + ":" + tLocalFolder.getName() + " was '" + rootMessage + "'"); localFolder.setStatus(rootMessage); for (MessagingListener l : getListeners()) @@ -1061,7 +1061,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "synchronizeMailbox", e); + Log.e(K9.LOG_TAG, "synchronizeMailbox", e); // If we don't set the last checked, it can try too often during // failure conditions String rootMessage = getRootCauseMessage(e); @@ -1075,7 +1075,7 @@ public class MessagingController implements Runnable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Could not set last checked on folder " + account.getDescription() + ":" + + Log.e(K9.LOG_TAG, "Could not set last checked on folder " + account.getDescription() + ":" + tLocalFolder.getName(), e); } } @@ -1134,18 +1134,18 @@ public class MessagingController implements Runnable { if (!message.isSet(Flag.X_DOWNLOADED_FULL) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is not downloaded at all"); + Log.v(K9.LOG_TAG, "Message with uid " + message.getUid() + " is not downloaded at all"); } unsyncedMessages.add(message); } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is partially or fully downloaded"); + Log.v(K9.LOG_TAG, "Message with uid " + message.getUid() + " is partially or fully downloaded"); } // Store the updated message locally localFolder.appendMessages(new Message[] { message }); @@ -1168,9 +1168,9 @@ public class MessagingController implements Runnable } else if (localMessage.isSet(Flag.DELETED) == false) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + " is already locally present"); + Log.v(K9.LOG_TAG, "Message with uid " + message.getUid() + " is already locally present"); } String newPushState = remoteFolder.getNewPushState(localFolder.getPushState(), message); if (newPushState != null) @@ -1179,9 +1179,9 @@ public class MessagingController implements Runnable } if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Message with uid " + message.getUid() + Log.v(K9.LOG_TAG, "Message with uid " + message.getUid() + " is not downloaded, even partially; trying again"); } unsyncedMessages.add(message); @@ -1194,7 +1194,7 @@ public class MessagingController implements Runnable } } - Log.i(Email.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages"); + Log.i(K9.LOG_TAG, "SYNC: Have " + unsyncedMessages.size() + " unsynced messages"); messages.clear(); final ArrayList largeMessages = new ArrayList(); @@ -1222,9 +1222,9 @@ public class MessagingController implements Runnable } fp.add(FetchProfile.Item.ENVELOPE); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SYNC: About to sync " + unsyncedMessages.size() + " unsynced messages for folder " + folder); + Log.d(K9.LOG_TAG, "SYNC: About to sync " + unsyncedMessages.size() + " unsynced messages for folder " + folder); } remoteFolder.fetch(unsyncedMessages.toArray(new Message[0]), fp, @@ -1275,9 +1275,9 @@ public class MessagingController implements Runnable { Message localMessage = localFolder.getMessage(message.getUid()); syncFlags(localMessage, message); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "About to notify listeners that we got a new unsynced message " + Log.v(K9.LOG_TAG, "About to notify listeners that we got a new unsynced message " + account + ":" + folder + ":" + message.getUid()); } for (MessagingListener l : getListeners()) @@ -1290,7 +1290,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Error while storing downloaded message.", e); + Log.e(K9.LOG_TAG, "Error while storing downloaded message.", e); addErrorMessage(account, e); } @@ -1312,13 +1312,13 @@ public class MessagingController implements Runnable localFolder.setPushState(newPushState); } } - Log.i(Email.LOG_TAG, "SYNC: Synced unsynced messages for folder " + folder); + Log.i(K9.LOG_TAG, "SYNC: Synced unsynced messages for folder " + folder); } - Log.i(Email.LOG_TAG, "SYNC: Have " + Log.i(K9.LOG_TAG, "SYNC: Have " + largeMessages.size() + " large messages and " + smallMessages.size() + " small messages out of " + unsyncedMessages.size() + " unsynced messages"); @@ -1335,7 +1335,7 @@ public class MessagingController implements Runnable // fp.add(FetchProfile.Item.FLAGS); // fp.add(FetchProfile.Item.ENVELOPE); - Log.i(Email.LOG_TAG, "SYNC: Fetching small messages for folder " + folder); + Log.i(K9.LOG_TAG, "SYNC: Fetching small messages for folder " + folder); remoteFolder.fetch(smallMessages.toArray(new Message[smallMessages.size()]), fp, new MessageRetrievalListener() @@ -1351,9 +1351,9 @@ public class MessagingController implements Runnable // Set a flag indicating this message has now be fully downloaded localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "About to notify listeners that we got a new small message " + Log.v(K9.LOG_TAG, "About to notify listeners that we got a new small message " + account + ":" + folder + ":" + message.getUid()); } // Update the listener with what we've found @@ -1371,7 +1371,7 @@ public class MessagingController implements Runnable { addErrorMessage(account, me); - Log.e(Email.LOG_TAG, "SYNC: fetch small messages", me); + Log.e(K9.LOG_TAG, "SYNC: fetch small messages", me); } } @@ -1382,7 +1382,7 @@ public class MessagingController implements Runnable public void messagesFinished(int total) {} }); - Log.i(Email.LOG_TAG, "SYNC: Done fetching small messages for folder " + folder); + Log.i(K9.LOG_TAG, "SYNC: Done fetching small messages for folder " + folder); smallMessages.clear(); /* @@ -1391,7 +1391,7 @@ public class MessagingController implements Runnable fp.clear(); fp.add(FetchProfile.Item.STRUCTURE); - Log.i(Email.LOG_TAG, "SYNC: Fetching large messages for folder " + folder); + Log.i(K9.LOG_TAG, "SYNC: Fetching large messages for folder " + folder); remoteFolder.fetch(largeMessages.toArray(new Message[largeMessages.size()]), fp, null); for (Message message : largeMessages) @@ -1468,9 +1468,9 @@ public class MessagingController implements Runnable // viewed. localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "About to notify listeners that we got a new large message " + Log.v(K9.LOG_TAG, "About to notify listeners that we got a new large message " + account + ":" + folder + ":" + message.getUid()); } // Update the listener with what we've found @@ -1484,7 +1484,7 @@ public class MessagingController implements Runnable } } }//for large messsages - Log.i(Email.LOG_TAG, "SYNC: Done fetching large messages for folder " + folder); + Log.i(K9.LOG_TAG, "SYNC: Done fetching large messages for folder " + folder); largeMessages.clear(); @@ -1496,7 +1496,7 @@ public class MessagingController implements Runnable { - Log.i(Email.LOG_TAG, "SYNC: About to sync flags for " + Log.i(K9.LOG_TAG, "SYNC: About to sync flags for " + syncFlagMessages.size() + " remote messages for folder " + folder); @@ -1517,7 +1517,7 @@ public class MessagingController implements Runnable } } } - Log.i(Email.LOG_TAG, "SYNC: Synced remote messages for folder " + folder + ", " + newMessages.get() + " new messages"); + Log.i(K9.LOG_TAG, "SYNC: Synced remote messages for folder " + folder + ", " + newMessages.get() + " new messages"); localFolder.purgeToVisibleLimit(new MessageRemovalListener() { @@ -1602,7 +1602,7 @@ public class MessagingController implements Runnable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "processPendingCommands", me); + Log.e(K9.LOG_TAG, "processPendingCommands", me); addErrorMessage(account, me); @@ -1627,9 +1627,9 @@ public class MessagingController implements Runnable for (PendingCommand command : commands) { processingCommand = command; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Processing pending command '" + command + "'"); + Log.d(K9.LOG_TAG, "Processing pending command '" + command + "'"); } /* * We specifically do not catch any exceptions here. If a command fails it is @@ -1667,9 +1667,9 @@ public class MessagingController implements Runnable processPendingEmptyTrash(command, account); } localStore.removePendingCommand(command); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Done processing pending command '" + command + "'"); + Log.d(K9.LOG_TAG, "Done processing pending command '" + command + "'"); } } catch (MessagingException me) @@ -1677,7 +1677,7 @@ public class MessagingController implements Runnable if (me.isPermanentFailure()) { addErrorMessage(account, me); - Log.e(Email.LOG_TAG, "Failure of command '" + command + "' was permanent, removing command from queue"); + Log.e(K9.LOG_TAG, "Failure of command '" + command + "' was permanent, removing command from queue"); localStore.removePendingCommand(processingCommand); } else @@ -1690,7 +1690,7 @@ public class MessagingController implements Runnable catch (MessagingException me) { addErrorMessage(account, me); - Log.e(Email.LOG_TAG, "Could not process command '" + processingCommand + "'", me); + Log.e(K9.LOG_TAG, "Could not process command '" + processingCommand + "'", me); throw me; } } @@ -1747,7 +1747,7 @@ public class MessagingController implements Runnable } Message remoteMessage = null; - if (!localMessage.getUid().startsWith(Email.LOCAL_UID_PREFIX)) + if (!localMessage.getUid().startsWith(K9.LOCAL_UID_PREFIX)) { remoteMessage = remoteFolder.getMessage(localMessage.getUid()); } @@ -1756,13 +1756,13 @@ public class MessagingController implements Runnable { if (localMessage.isSet(Flag.X_REMOTE_COPY_STARTED)) { - Log.w(Email.LOG_TAG, "Local message with uid " + localMessage.getUid() + + Log.w(K9.LOG_TAG, "Local message with uid " + localMessage.getUid() + " has flag " + Flag.X_REMOTE_COPY_STARTED + " already set, checking for remote message with " + " same message id"); String rUid = remoteFolder.getUidFromMessageId(localMessage); if (rUid != null) { - Log.w(Email.LOG_TAG, "Local message has flag " + Flag.X_REMOTE_COPY_STARTED + " already set, and there is a remote message with " + + Log.w(K9.LOG_TAG, "Local message has flag " + Flag.X_REMOTE_COPY_STARTED + " already set, and there is a remote message with " + " uid " + rUid + ", assuming message was already copied and aborting this copy"); String oldUid = localMessage.getUid(); @@ -1776,7 +1776,7 @@ public class MessagingController implements Runnable } else { - Log.w(Email.LOG_TAG, "No remote message with message-id found, proceeding with append"); + Log.w(K9.LOG_TAG, "No remote message with message-id found, proceeding with append"); } } @@ -1895,7 +1895,7 @@ public class MessagingController implements Runnable for (int i = 3; i < command.arguments.length; i++) { String uid = command.arguments[i]; - if (!uid.startsWith(Email.LOCAL_UID_PREFIX)) + if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) { messages.add(remoteSrcFolder.getMessage(uid)); } @@ -1917,16 +1917,16 @@ public class MessagingController implements Runnable throw new MessagingException("processingPendingMoveOrCopy: could not open remoteSrcFolder " + srcFolder + " read/write", true); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "processingPendingMoveOrCopy: source folder = " + srcFolder + Log.d(K9.LOG_TAG, "processingPendingMoveOrCopy: source folder = " + srcFolder + ", " + messages.size() + " messages, destination folder = " + destFolder + ", isCopy = " + isCopy); } if (isCopy == false && destFolder.equals(account.getTrashFolderName())) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "processingPendingMoveOrCopy doing special case for deleting message"); + Log.d(K9.LOG_TAG, "processingPendingMoveOrCopy doing special case for deleting message"); } remoteSrcFolder.delete(messages.toArray(new Message[0]), account.getTrashFolderName()); } @@ -2019,7 +2019,7 @@ public class MessagingController implements Runnable for (int i = 3; i < command.arguments.length; i++) { String uid = command.arguments[i]; - if (!uid.startsWith(Email.LOCAL_UID_PREFIX)) + if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) { messages.add(remoteFolder.getMessage(uid)); } @@ -2052,9 +2052,9 @@ public class MessagingController implements Runnable { return; } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "processPendingSetFlagOld: folder = " + folder + ", uid = " + uid); + Log.d(K9.LOG_TAG, "processPendingSetFlagOld: folder = " + folder + ", uid = " + uid); } boolean newState = Boolean.parseBoolean(command.arguments[2]); @@ -2073,7 +2073,7 @@ public class MessagingController implements Runnable return; } Message remoteMessage = null; - if (!uid.startsWith(Email.LOCAL_UID_PREFIX)) + if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) { remoteMessage = remoteFolder.getMessage(uid); } @@ -2121,7 +2121,7 @@ public class MessagingController implements Runnable } Message remoteMessage = null; - if (!uid.startsWith(Email.LOCAL_UID_PREFIX)) + if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) { remoteMessage = remoteSrcFolder.getMessage(uid); } @@ -2130,16 +2130,16 @@ public class MessagingController implements Runnable throw new MessagingException("processPendingMoveOrCopyOld: remoteMessage " + uid + " does not exist", true); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder + Log.d(K9.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder + ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy); } if (isCopy == false && destFolder.equals(account.getTrashFolderName())) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "processPendingMoveOrCopyOld doing special case for deleting message"); + Log.d(K9.LOG_TAG, "processPendingMoveOrCopyOld doing special case for deleting message"); } remoteMessage.delete(account.getTrashFolderName()); remoteSrcFolder.close(true); @@ -2213,7 +2213,7 @@ public class MessagingController implements Runnable } catch (UnsupportedOperationException uoe) { - Log.w(Email.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe); + Log.w(K9.LOG_TAG, "Could not mark all server-side as read because store doesn't support operation", uoe); } finally { @@ -2225,7 +2225,7 @@ public class MessagingController implements Runnable static AtomicBoolean loopCatch = new AtomicBoolean(); public void addErrorMessage(Account account, Throwable t) { - if (Email.ENABLE_ERROR_FOLDER == false) + if (K9.ENABLE_ERROR_FOLDER == false) { return; } @@ -2241,7 +2241,7 @@ public class MessagingController implements Runnable } String rootCauseMessage = getRootCauseMessage(t); - Log.e(Email.LOG_TAG, "Error " + "'" + rootCauseMessage + "'", t); + Log.e(K9.LOG_TAG, "Error " + "'" + rootCauseMessage + "'", t); Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); LocalFolder localFolder = (LocalFolder)localStore.getFolder(account.getErrorFolderName()); @@ -2274,7 +2274,7 @@ public class MessagingController implements Runnable } catch (Throwable it) { - Log.e(Email.LOG_TAG, "Could not save error message to " + account.getErrorFolderName(), it); + Log.e(K9.LOG_TAG, "Could not save error message to " + account.getErrorFolderName(), it); } finally { @@ -2284,7 +2284,7 @@ public class MessagingController implements Runnable public void addErrorMessage(Account account, String subject, String body) { - if (Email.ENABLE_ERROR_FOLDER == false) + if (K9.ENABLE_ERROR_FOLDER == false) { return; } @@ -2323,7 +2323,7 @@ public class MessagingController implements Runnable } catch (Throwable it) { - Log.e(Email.LOG_TAG, "Could not save error message to " + account.getErrorFolderName(), it); + Log.e(K9.LOG_TAG, "Could not save error message to " + account.getErrorFolderName(), it); } finally { @@ -2336,7 +2336,7 @@ public class MessagingController implements Runnable public void markAllMessagesRead(final Account account, final String folder) { - Log.i(Email.LOG_TAG, "Marking all messages in " + account.getDescription() + ":" + folder + " as read"); + Log.i(K9.LOG_TAG, "Marking all messages in " + account.getDescription() + ":" + folder + " as read"); List args = new ArrayList(); args.add(folder); PendingCommand command = new PendingCommand(); @@ -2425,13 +2425,13 @@ public class MessagingController implements Runnable { try { - Log.w(Email.LOG_TAG, "Clearing pending commands!"); + Log.w(K9.LOG_TAG, "Clearing pending commands!"); LocalStore localStore = (LocalStore)Store.getInstance(account.getLocalStoreUri(), mApplication); localStore.removePendingCommands(); } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to clear pending command", me); + Log.e(K9.LOG_TAG, "Unable to clear pending command", me); addErrorMessage(account, me); } } @@ -2714,7 +2714,7 @@ public class MessagingController implements Runnable // localFolder.close(false); // } // catch (MessagingException e) { -// Log.w(Email.LOG_TAG, null, e); +// Log.w(K9.LOG_TAG, null, e); // } // } // @@ -2723,7 +2723,7 @@ public class MessagingController implements Runnable // remoteFolder.close(false); // } // catch (MessagingException e) { -// Log.w(Email.LOG_TAG, null, e); +// Log.w(K9.LOG_TAG, null, e); // } // } // } @@ -2833,9 +2833,9 @@ public class MessagingController implements Runnable } catch (MessagingException me) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "", me); + Log.v(K9.LOG_TAG, "", me); } for (MessagingListener l : getListeners()) { @@ -2933,7 +2933,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while checking for unsent messages", e); + Log.e(K9.LOG_TAG, "Exception while checking for unsent messages", e); } return false; } @@ -2976,7 +2976,7 @@ public class MessagingController implements Runnable LocalFolder localSentFolder = (LocalFolder) localStore.getFolder( account.getSentFolderName()); - Log.i(Email.LOG_TAG, "Scanning folder '" + account.getOutboxFolderName() + "' (" + ((LocalFolder)localFolder).getId() + ") for messages to send"); + Log.i(K9.LOG_TAG, "Scanning folder '" + account.getOutboxFolderName() + "' (" + ((LocalFolder)localFolder).getId() + ") for messages to send"); Transport transport = Transport.getInstance(account.getTransportUri()); for (Message message : localMessages) { @@ -2987,7 +2987,7 @@ public class MessagingController implements Runnable } if (message.isSet(Flag.FLAGGED)) { - Log.i(Email.LOG_TAG, "Skipping sending FLAGGED message " + message.getUid()); + Log.i(K9.LOG_TAG, "Skipping sending FLAGGED message " + message.getUid()); continue; } try @@ -2998,10 +2998,10 @@ public class MessagingController implements Runnable { count = oldCount; } - Log.i(Email.LOG_TAG, "Send count for message " + message.getUid() + " is " + count.get()); - if (count.incrementAndGet() > Email.MAX_SEND_ATTEMPTS) + Log.i(K9.LOG_TAG, "Send count for message " + message.getUid() + " is " + count.get()); + if (count.incrementAndGet() > K9.MAX_SEND_ATTEMPTS) { - Log.e(Email.LOG_TAG, "Send count for message " + message.getUid() + " has exceeded maximum attempt threshold, flagging"); + Log.e(K9.LOG_TAG, "Send count for message " + message.getUid() + " has exceeded maximum attempt threshold, flagging"); message.setFlag(Flag.FLAGGED, true); anyFlagged = true; continue; @@ -3011,16 +3011,16 @@ public class MessagingController implements Runnable try { message.setFlag(Flag.X_SEND_IN_PROGRESS, true); - Log.i(Email.LOG_TAG, "Sending message with UID " + message.getUid()); + Log.i(K9.LOG_TAG, "Sending message with UID " + message.getUid()); transport.sendMessage(message); message.setFlag(Flag.X_SEND_IN_PROGRESS, false); message.setFlag(Flag.SEEN, true); - Log.i(Email.LOG_TAG, "Moving sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); + Log.i(K9.LOG_TAG, "Moving sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); localFolder.moveMessages( new Message[] { message }, localSentFolder); - Log.i(Email.LOG_TAG, "Moved sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); + Log.i(K9.LOG_TAG, "Moved sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") "); PendingCommand command = new PendingCommand(); command.command = PENDING_COMMAND_APPEND; @@ -3042,12 +3042,12 @@ public class MessagingController implements Runnable { // Decrement the counter if the message could not possibly have been sent int newVal = count.decrementAndGet(); - Log.i(Email.LOG_TAG, "Decremented send count for message " + message.getUid() + " to " + newVal + Log.i(K9.LOG_TAG, "Decremented send count for message " + message.getUid() + " to " + newVal + "; no possible send"); } } message.setFlag(Flag.X_SEND_FAILED, true); - Log.e(Email.LOG_TAG, "Failed to send message", e); + Log.e(K9.LOG_TAG, "Failed to send message", e); for (MessagingListener l : getListeners()) { l.synchronizeMailboxFailed( @@ -3061,7 +3061,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Failed to fetch message for sending", e); + Log.e(K9.LOG_TAG, "Failed to fetch message for sending", e); for (MessagingListener l : getListeners()) { l.synchronizeMailboxFailed( @@ -3089,7 +3089,7 @@ public class MessagingController implements Runnable if (anyFlagged) { addErrorMessage(account, mApplication.getString(R.string.send_failure_subject), - mApplication.getString(R.string.send_failure_body_fmt, Email.ERROR_FOLDER_NAME)); + mApplication.getString(R.string.send_failure_body_fmt, K9.ERROR_FOLDER_NAME)); NotificationManager notifMgr = (NotificationManager)mApplication.getSystemService(Context.NOTIFICATION_SERVICE); @@ -3103,12 +3103,12 @@ public class MessagingController implements Runnable PendingIntent pi = PendingIntent.getActivity(mApplication, 0, i, 0); notif.setLatestEventInfo(mApplication, mApplication.getString(R.string.send_failure_subject), - mApplication.getString(R.string.send_failure_body_abbrev, Email.ERROR_FOLDER_NAME), pi); + mApplication.getString(R.string.send_failure_body_abbrev, K9.ERROR_FOLDER_NAME), pi); notif.flags |= Notification.FLAG_SHOW_LIGHTS; - notif.ledARGB = Email.NOTIFICATION_LED_SENDING_FAILURE_COLOR; - notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME; - notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME; + notif.ledARGB = K9.NOTIFICATION_LED_SENDING_FAILURE_COLOR; + notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME; + notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME; notifMgr.notify(-1000 - account.getAccountNumber(), notif); } } @@ -3131,7 +3131,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while closing folder", e); + Log.e(K9.LOG_TAG, "Exception while closing folder", e); } } } @@ -3152,7 +3152,7 @@ public class MessagingController implements Runnable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Count not get unread count for account " + account.getDescription(), + Log.e(K9.LOG_TAG, "Count not get unread count for account " + account.getDescription(), me); } l.accountStatusChanged(account, unreadMessageCount); @@ -3180,7 +3180,7 @@ public class MessagingController implements Runnable public boolean moveMessage(final Account account, final String srcFolder, final Message message, final String destFolder, final MessagingListener listener) { - if (!message.getUid().startsWith(Email.LOCAL_UID_PREFIX)) + if (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX)) { suppressMessage(account, srcFolder, message); put("moveMessage", null, new Runnable() @@ -3200,7 +3200,7 @@ public class MessagingController implements Runnable public boolean isMoveCapable(Message message) { - if (!message.getUid().startsWith(Email.LOCAL_UID_PREFIX)) + if (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX)) { return true; } @@ -3225,7 +3225,7 @@ public class MessagingController implements Runnable catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Exception while ascertaining move capability", me); + Log.e(K9.LOG_TAG, "Exception while ascertaining move capability", me); return false; } } @@ -3239,7 +3239,7 @@ public class MessagingController implements Runnable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Exception while ascertaining copy capability", me); + Log.e(K9.LOG_TAG, "Exception while ascertaining copy capability", me); return false; } } @@ -3260,7 +3260,7 @@ public class MessagingController implements Runnable public boolean copyMessage(final Account account, final String srcFolder, final Message message, final String destFolder, final MessagingListener listener) { - if (!message.getUid().startsWith(Email.LOCAL_UID_PREFIX)) + if (!message.getUid().startsWith(K9.LOCAL_UID_PREFIX)) { put("copyMessage", null, new Runnable() { @@ -3299,7 +3299,7 @@ public class MessagingController implements Runnable String origUid = message.getUid(); if (lMessage != null) { - Log.i(Email.LOG_TAG, "moveOrCopyMessageSynchronous: source folder = " + srcFolder + Log.i(K9.LOG_TAG, "moveOrCopyMessageSynchronous: source folder = " + srcFolder + ", uid = " + origUid + ", destination folder = " + destFolder + ", isCopy = " + isCopy); if (isCopy) @@ -3375,9 +3375,9 @@ public class MessagingController implements Runnable localFolder = localStore.getFolder(folder); if (folder.equals(account.getTrashFolderName())) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Deleting messages in trash folder, not copying"); + Log.d(K9.LOG_TAG, "Deleting messages in trash folder, not copying"); } localFolder.setFlags(messages, new Flag[] { Flag.DELETED }, true); } @@ -3390,9 +3390,9 @@ public class MessagingController implements Runnable } if (localTrashFolder.exists() == true) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Deleting messages in normal folder, moving"); + Log.d(K9.LOG_TAG, "Deleting messages in normal folder, moving"); } localFolder.moveMessages(messages, localTrashFolder); @@ -3405,9 +3405,9 @@ public class MessagingController implements Runnable l.folderStatusChanged(account, account.getTrashFolderName()); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Delete policy for account " + account.getDescription() + " is " + account.getDeletePolicy()); + Log.d(K9.LOG_TAG, "Delete policy for account " + account.getDescription() + " is " + account.getDeletePolicy()); } if (folder.equals(account.getOutboxFolderName())) { @@ -3444,9 +3444,9 @@ public class MessagingController implements Runnable } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Delete policy " + account.getDeletePolicy() + " prevents delete from server"); + Log.d(K9.LOG_TAG, "Delete policy " + account.getDeletePolicy() + " prevents delete from server"); } } } @@ -3519,7 +3519,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "emptyTrash failed", e); + Log.e(K9.LOG_TAG, "emptyTrash failed", e); addErrorMessage(account, e); } @@ -3529,9 +3529,9 @@ public class MessagingController implements Runnable public void sendAlternate(final Context context, Account account, Message message) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "About to load message " + account.getDescription() + ":" + message.getFolder().getName() + Log.d(K9.LOG_TAG, "About to load message " + account.getDescription() + ":" + message.getFolder().getName() + ":" + message.getUid() + " for sendAlternate"); } loadMessageForView(account, message.getFolder().getName(), @@ -3541,9 +3541,9 @@ public class MessagingController implements Runnable public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, Message message) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got message " + account.getDescription() + ":" + folder + Log.d(K9.LOG_TAG, "Got message " + account.getDescription() + ":" + folder + ":" + message.getUid() + " for sendAlternate"); } @@ -3571,7 +3571,7 @@ public class MessagingController implements Runnable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to send email through alternate program", me); + Log.e(K9.LOG_TAG, "Unable to send email through alternate program", me); } } }); @@ -3596,9 +3596,9 @@ public class MessagingController implements Runnable if (useManualWakeLock) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - twakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + twakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); twakeLock.setReferenceCounted(false); - twakeLock.acquire(Email.MANUAL_WAKE_LOCK_TIMEOUT); + twakeLock.acquire(K9.MANUAL_WAKE_LOCK_TIMEOUT); } final WakeLock wakeLock = twakeLock; @@ -3615,7 +3615,7 @@ public class MessagingController implements Runnable .getSystemService(Context.NOTIFICATION_SERVICE); try { - Log.i(Email.LOG_TAG, "Starting mail check"); + Log.i(K9.LOG_TAG, "Starting mail check"); Preferences prefs = Preferences.getPreferences(context); Account[] accounts; @@ -3636,13 +3636,13 @@ public class MessagingController implements Runnable final long accountInterval = account.getAutomaticCheckIntervalMinutes() * 60 * 1000; if (ignoreLastCheckedTime == false && accountInterval <= 0) { - Log.i(Email.LOG_TAG, "Skipping synchronizing account " + account.getDescription()); + Log.i(K9.LOG_TAG, "Skipping synchronizing account " + account.getDescription()); continue; } - Log.i(Email.LOG_TAG, "Synchronizing account " + account.getDescription()); + Log.i(K9.LOG_TAG, "Synchronizing account " + account.getDescription()); putBackground("sendPending " + account.getDescription(), null, new Runnable() { @@ -3655,21 +3655,21 @@ public class MessagingController implements Runnable Notification notif = new Notification(R.drawable.ic_menu_refresh, context.getString(R.string.notification_bg_send_ticker, account.getDescription()), System.currentTimeMillis()); // JRV XXX TODO - do we want to notify MessageList too? - Intent intent = FolderList.actionHandleAccountIntent(context, account, Email.INBOX); + Intent intent = FolderList.actionHandleAccountIntent(context, account, K9.INBOX); PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0); notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_send_title), account.getDescription() , pi); notif.flags = Notification.FLAG_ONGOING_EVENT; - if (Email.NOTIFICATION_LED_WHILE_SYNCING) + if (K9.NOTIFICATION_LED_WHILE_SYNCING) { notif.flags |= Notification.FLAG_SHOW_LIGHTS; - notif.ledARGB = Email.NOTIFICATION_LED_DIM_COLOR; - notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME; - notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME; + notif.ledARGB = K9.NOTIFICATION_LED_DIM_COLOR; + notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME; + notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME; } - notifMgr.notify(Email.FETCHING_EMAIL_NOTIFICATION_ID, notif); + notifMgr.notify(K9.FETCHING_EMAIL_NOTIFICATION_ID, notif); } try { @@ -3679,7 +3679,7 @@ public class MessagingController implements Runnable { if (account.isShowOngoing()) { - notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID); + notifMgr.cancel(K9.FETCHING_EMAIL_NOTIFICATION_ID); } } } @@ -3704,9 +3704,9 @@ public class MessagingController implements Runnable if (modeMismatch(aDisplayMode, fDisplayClass)) { // Never sync a folder that isn't displayed - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Not syncing folder " + folder.getName() + + Log.v(K9.LOG_TAG, "Not syncing folder " + folder.getName() + " which is in display mode " + fDisplayClass + " while account is in display mode " + aDisplayMode); } @@ -3716,9 +3716,9 @@ public class MessagingController implements Runnable if (modeMismatch(aSyncMode, fSyncClass)) { // Do not sync folders in the wrong class - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Not syncing folder " + folder.getName() + + Log.v(K9.LOG_TAG, "Not syncing folder " + folder.getName() + " which is in sync mode " + fSyncClass + " while account is in sync mode " + aSyncMode); } @@ -3727,18 +3727,18 @@ public class MessagingController implements Runnable - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Folder " + folder.getName() + " was last synced @ " + + Log.v(K9.LOG_TAG, "Folder " + folder.getName() + " was last synced @ " + new Date(folder.getLastChecked())); } if (ignoreLastCheckedTime == false && folder.getLastChecked() > (System.currentTimeMillis() - accountInterval)) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Not syncing folder " + folder.getName() + Log.v(K9.LOG_TAG, "Not syncing folder " + folder.getName() + ", previously synced @ " + new Date(folder.getLastChecked()) + " which would be too recent for the account period"); } @@ -3761,9 +3761,9 @@ public class MessagingController implements Runnable if (ignoreLastCheckedTime == false && tLocalFolder.getLastChecked() > (System.currentTimeMillis() - accountInterval)) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Not running Command for folder " + folder.getName() + Log.v(K9.LOG_TAG, "Not running Command for folder " + folder.getName() + ", previously synced @ " + new Date(folder.getLastChecked()) + " which would be too recent for the account period"); } @@ -3775,20 +3775,20 @@ public class MessagingController implements Runnable context.getString(R.string.notification_bg_sync_ticker, account.getDescription(), folder.getName()), System.currentTimeMillis()); // JRV XXX TODO - do we want to notify MessageList too? - Intent intent = FolderList.actionHandleAccountIntent(context, account, Email.INBOX); + Intent intent = FolderList.actionHandleAccountIntent(context, account, K9.INBOX); PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0); notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_sync_title), account.getDescription() + context.getString(R.string.notification_bg_title_separator) + folder.getName(), pi); notif.flags = Notification.FLAG_ONGOING_EVENT; - if (Email.NOTIFICATION_LED_WHILE_SYNCING) + if (K9.NOTIFICATION_LED_WHILE_SYNCING) { notif.flags |= Notification.FLAG_SHOW_LIGHTS; - notif.ledARGB = Email.NOTIFICATION_LED_DIM_COLOR; - notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME; - notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME; + notif.ledARGB = K9.NOTIFICATION_LED_DIM_COLOR; + notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME; + notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME; } - notifMgr.notify(Email.FETCHING_EMAIL_NOTIFICATION_ID, notif); + notifMgr.notify(K9.FETCHING_EMAIL_NOTIFICATION_ID, notif); } try { @@ -3799,14 +3799,14 @@ public class MessagingController implements Runnable { if (account.isShowOngoing()) { - notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID); + notifMgr.cancel(K9.FETCHING_EMAIL_NOTIFICATION_ID); } } } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while processing folder " + + Log.e(K9.LOG_TAG, "Exception while processing folder " + account.getDescription() + ":" + folder.getName(), e); addErrorMessage(account, e); } @@ -3817,14 +3817,14 @@ public class MessagingController implements Runnable } catch (MessagingException e) { - Log.e(Email.LOG_TAG, "Unable to synchronize account " + account.getName(), e); + Log.e(K9.LOG_TAG, "Unable to synchronize account " + account.getName(), e); addErrorMessage(account, e); } } } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to synchronize mail", e); + Log.e(K9.LOG_TAG, "Unable to synchronize mail", e); addErrorMessage(account, e); } putBackground("finalize sync", null, new Runnable() @@ -3832,7 +3832,7 @@ public class MessagingController implements Runnable public void run() { - Log.i(Email.LOG_TAG, "Finished mail sync"); + Log.i(K9.LOG_TAG, "Finished mail sync"); if (wakeLock != null) { wakeLock.release(); @@ -3872,7 +3872,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Failed to compact account " + account.getDescription(), e); + Log.e(K9.LOG_TAG, "Failed to compact account " + account.getDescription(), e); } } }); @@ -3902,7 +3902,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Failed to compact account " + account.getDescription(), e); + Log.e(K9.LOG_TAG, "Failed to compact account " + account.getDescription(), e); } } }); @@ -3917,9 +3917,9 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to get unread message count", e); + Log.e(K9.LOG_TAG, "Unable to get unread message count", e); } - Log.i(Email.LOG_TAG, "notifyAccount Account " + thisAccount.getDescription() + ", newMailCount = " + newMailCount); + Log.i(K9.LOG_TAG, "notifyAccount Account " + thisAccount.getDescription() + ", newMailCount = " + newMailCount); boolean isNotifyAccount = thisAccount.isNotifyNewMail(); if (isNotifyAccount) { @@ -3950,9 +3950,9 @@ public class MessagingController implements Runnable } notif.flags |= Notification.FLAG_SHOW_LIGHTS; - notif.ledARGB = Email.NOTIFICATION_LED_COLOR; - notif.ledOnMS = Email.NOTIFICATION_LED_ON_TIME; - notif.ledOffMS = Email.NOTIFICATION_LED_OFF_TIME; + notif.ledARGB = K9.NOTIFICATION_LED_COLOR; + notif.ledOnMS = K9.NOTIFICATION_LED_ON_TIME; + notif.ledOffMS = K9.NOTIFICATION_LED_OFF_TIME; notifMgr.notify(thisAccount.getAccountNumber(), notif); @@ -3996,7 +3996,7 @@ public class MessagingController implements Runnable } catch (MessagingException e) { - Log.e(Email.LOG_TAG, "Unable to save message as draft.", e); + Log.e(K9.LOG_TAG, "Unable to save message as draft.", e); addErrorMessage(account, e); } } @@ -4131,9 +4131,9 @@ public class MessagingController implements Runnable if (modeMismatch(aDisplayMode, fDisplayClass)) { // Never push a folder that isn't displayed - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Not pushing folder " + folder.getName() + + Log.v(K9.LOG_TAG, "Not pushing folder " + folder.getName() + " which is in display class " + fDisplayClass + " while account is in display mode " + aDisplayMode); } @@ -4143,15 +4143,15 @@ public class MessagingController implements Runnable if (modeMismatch(aPushMode, fPushClass)) { // Do not push folders in the wrong class - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Not pushing folder " + folder.getName() + + Log.v(K9.LOG_TAG, "Not pushing folder " + folder.getName() + " which is in push mode " + fPushClass + " while account is in push mode " + aPushMode); } continue; } - Log.i(Email.LOG_TAG, "Starting pusher for " + account.getDescription() + ":" + folder.getName()); + Log.i(K9.LOG_TAG, "Starting pusher for " + account.getDescription() + ":" + folder.getName()); names.add(folder.getName()); } @@ -4164,7 +4164,7 @@ public class MessagingController implements Runnable Store store = Store.getInstance(account.getStoreUri(), mApplication); if (store.isPushCapable() == false) { - Log.i(Email.LOG_TAG, "Account " + account.getDescription() + " is not push capable, skipping"); + Log.i(K9.LOG_TAG, "Account " + account.getDescription() + " is not push capable, skipping"); return false; } Pusher pusher = store.getPusher(receiver); @@ -4184,7 +4184,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not get remote store", e); + Log.e(K9.LOG_TAG, "Could not get remote store", e); return false; } @@ -4192,21 +4192,21 @@ public class MessagingController implements Runnable } else { - Log.i(Email.LOG_TAG, "No folders are configured for pushing in account " + account.getDescription()); + Log.i(K9.LOG_TAG, "No folders are configured for pushing in account " + account.getDescription()); return false; } } catch (Exception e) { - Log.e(Email.LOG_TAG, "Got exception while setting up pushing", e); + Log.e(K9.LOG_TAG, "Got exception while setting up pushing", e); } return false; } public void stopAllPushing() { - Log.i(Email.LOG_TAG, "Stopping all pushers"); + Log.i(K9.LOG_TAG, "Stopping all pushers"); Iterator iter = pushers.values().iterator(); while (iter.hasNext()) { @@ -4218,7 +4218,7 @@ public class MessagingController implements Runnable public void messagesArrived(final Account account, final Folder remoteFolder, final List messages, final boolean flagSyncOnly) { - Log.i(Email.LOG_TAG, "Got new pushed email messages for account " + account.getDescription() + Log.i(K9.LOG_TAG, "Got new pushed email messages for account " + account.getDescription() + ", folder " + remoteFolder.getName()); final CountDownLatch latch = new CountDownLatch(1); putBackground("Push messageArrived of account " + account.getDescription() @@ -4239,7 +4239,7 @@ public class MessagingController implements Runnable localFolder.setLastPush(System.currentTimeMillis()); localFolder.setStatus(null); - Log.i(Email.LOG_TAG, "messagesArrived newCount = " + newCount); + Log.i(K9.LOG_TAG, "messagesArrived newCount = " + newCount); notifyAccount(mApplication, account, newCount); for (MessagingListener l : getListeners()) @@ -4258,7 +4258,7 @@ public class MessagingController implements Runnable } catch (Exception se) { - Log.e(Email.LOG_TAG, "Unable to set failed status on localFolder", se); + Log.e(K9.LOG_TAG, "Unable to set failed status on localFolder", se); } for (MessagingListener l : getListeners()) { @@ -4276,7 +4276,7 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to close localFolder", e); + Log.e(K9.LOG_TAG, "Unable to close localFolder", e); } } latch.countDown(); @@ -4290,9 +4290,9 @@ public class MessagingController implements Runnable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Interrupted while awaiting latch release", e); + Log.e(K9.LOG_TAG, "Interrupted while awaiting latch release", e); } - Log.i(Email.LOG_TAG, "MessagingController.messagesArrivedLatch released"); + Log.i(K9.LOG_TAG, "MessagingController.messagesArrivedLatch released"); } enum MemorizingState { STARTED, FINISHED, FAILED }; diff --git a/src/com/android/email/MessagingControllerPushReceiver.java b/src/com/fsck/k9/MessagingControllerPushReceiver.java similarity index 72% rename from src/com/android/email/MessagingControllerPushReceiver.java rename to src/com/fsck/k9/MessagingControllerPushReceiver.java index 1994e5bb9..b4d631ee5 100644 --- a/src/com/android/email/MessagingControllerPushReceiver.java +++ b/src/com/fsck/k9/MessagingControllerPushReceiver.java @@ -1,18 +1,18 @@ -package com.android.email; +package com.fsck.k9; import android.app.Application; import android.content.Context; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; -import com.android.email.mail.Folder; -import com.android.email.mail.Folder.OpenMode; -import com.android.email.mail.Message; -import com.android.email.mail.PushReceiver; -import com.android.email.mail.Store; -import com.android.email.mail.store.LocalStore; -import com.android.email.mail.store.LocalStore.LocalFolder; -import com.android.email.service.SleepService; +import com.fsck.k9.mail.Folder; +import com.fsck.k9.mail.Folder.OpenMode; +import com.fsck.k9.mail.Message; +import com.fsck.k9.mail.PushReceiver; +import com.fsck.k9.mail.Store; +import com.fsck.k9.mail.store.LocalStore; +import com.fsck.k9.mail.store.LocalStore.LocalFolder; +import com.fsck.k9.service.SleepService; import java.util.List; @@ -35,36 +35,36 @@ public class MessagingControllerPushReceiver implements PushReceiver if (wakeLock == null) { PowerManager pm = (PowerManager) mApplication.getSystemService(Context.POWER_SERVICE); - wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); wakeLock.setReferenceCounted(false); threadWakeLock.set(wakeLock); } - wakeLock.acquire(Email.PUSH_WAKE_LOCK_TIMEOUT); - if (Email.DEBUG) + wakeLock.acquire(K9.PUSH_WAKE_LOCK_TIMEOUT); + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Acquired WakeLock for Pushing for thread " + Thread.currentThread().getName()); + Log.d(K9.LOG_TAG, "Acquired WakeLock for Pushing for thread " + Thread.currentThread().getName()); } } public void releaseWakeLock() { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Considering releasing WakeLock for Pushing"); + Log.d(K9.LOG_TAG, "Considering releasing WakeLock for Pushing"); } WakeLock wakeLock = threadWakeLock.get(); if (wakeLock != null) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Releasing WakeLock for Pushing for thread " + Thread.currentThread().getName()); + Log.d(K9.LOG_TAG, "Releasing WakeLock for Pushing for thread " + Thread.currentThread().getName()); } wakeLock.release(); } else { - Log.e(Email.LOG_TAG, "No WakeLock waiting to be released for thread " + Thread.currentThread().getName()); + Log.e(K9.LOG_TAG, "No WakeLock waiting to be released for thread " + Thread.currentThread().getName()); } } @@ -81,7 +81,7 @@ public class MessagingControllerPushReceiver implements PushReceiver public void sleep(long millis) { - SleepService.sleep(mApplication, millis, threadWakeLock.get(), Email.PUSH_WAKE_LOCK_TIMEOUT); + SleepService.sleep(mApplication, millis, threadWakeLock.get(), K9.PUSH_WAKE_LOCK_TIMEOUT); } public void pushError(String errorMessage, Exception e) @@ -113,7 +113,7 @@ public class MessagingControllerPushReceiver implements PushReceiver } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to get push state from account " + account.getDescription() + Log.e(K9.LOG_TAG, "Unable to get push state from account " + account.getDescription() + ", folder " + folderName, e); return null; } @@ -127,7 +127,7 @@ public class MessagingControllerPushReceiver implements PushReceiver } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to close folder '" + folderName + "' in account " + account.getDescription(), e); + Log.e(K9.LOG_TAG, "Unable to close folder '" + folderName + "' in account " + account.getDescription(), e); } } } diff --git a/src/com/android/email/MessagingListener.java b/src/com/fsck/k9/MessagingListener.java similarity index 97% rename from src/com/android/email/MessagingListener.java rename to src/com/fsck/k9/MessagingListener.java index a548da20b..98f726cf2 100644 --- a/src/com/android/email/MessagingListener.java +++ b/src/com/fsck/k9/MessagingListener.java @@ -1,10 +1,10 @@ -package com.android.email; +package com.fsck.k9; import android.content.Context; -import com.android.email.mail.Folder; -import com.android.email.mail.Message; -import com.android.email.mail.Part; +import com.fsck.k9.mail.Folder; +import com.fsck.k9.mail.Message; +import com.fsck.k9.mail.Part; import java.util.List; diff --git a/src/com/android/email/PeekableInputStream.java b/src/com/fsck/k9/PeekableInputStream.java similarity index 98% rename from src/com/android/email/PeekableInputStream.java rename to src/com/fsck/k9/PeekableInputStream.java index 4e129ca94..706e995b7 100644 --- a/src/com/android/email/PeekableInputStream.java +++ b/src/com/fsck/k9/PeekableInputStream.java @@ -1,5 +1,5 @@ -package com.android.email; +package com.fsck.k9; import java.io.IOException; import java.io.InputStream; diff --git a/src/com/android/email/Preferences.java b/src/com/fsck/k9/Preferences.java similarity index 91% rename from src/com/android/email/Preferences.java rename to src/com/fsck/k9/Preferences.java index f14c09ed3..e4fd7005b 100644 --- a/src/com/android/email/Preferences.java +++ b/src/com/fsck/k9/Preferences.java @@ -1,13 +1,13 @@ -package com.android.email; +package com.fsck.k9; import android.content.Context; import android.content.SharedPreferences; import android.net.Uri; import android.util.Config; import android.util.Log; -import com.android.email.preferences.Editor; -import com.android.email.preferences.Storage; +import com.fsck.k9.preferences.Editor; +import com.fsck.k9.preferences.Storage; public class Preferences { @@ -20,7 +20,7 @@ public class Preferences mStorage = Storage.getStorage(context); if (mStorage.size() == 0) { - Log.i(Email.LOG_TAG, "Preferences storage is zero-size, importing from Android-style preferences"); + Log.i(K9.LOG_TAG, "Preferences storage is zero-size, importing from Android-style preferences"); Editor editor = mStorage.edit(); editor.copy(context.getSharedPreferences("AndroidMail.Main", Context.MODE_PRIVATE)); editor.commit(); @@ -119,7 +119,7 @@ public class Preferences { for (String key : getPreferences().getAll().keySet()) { - Log.v(Email.LOG_TAG, key + " = " + getPreferences().getAll().get(key)); + Log.v(K9.LOG_TAG, key + " = " + getPreferences().getAll().get(key)); } } } diff --git a/src/com/android/email/Utility.java b/src/com/fsck/k9/Utility.java similarity index 98% rename from src/com/android/email/Utility.java rename to src/com/fsck/k9/Utility.java index f9fd00738..8010216fd 100644 --- a/src/com/android/email/Utility.java +++ b/src/com/fsck/k9/Utility.java @@ -1,10 +1,10 @@ -package com.android.email; +package com.fsck.k9; import android.text.Editable; import android.widget.EditText; import android.widget.TextView; -import com.android.email.codec.binary.Base64; +import com.fsck.k9.codec.binary.Base64; import java.io.IOException; import java.io.InputStream; diff --git a/src/com/android/email/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java similarity index 98% rename from src/com/android/email/activity/Accounts.java rename to src/com/fsck/k9/activity/Accounts.java index 9b107c90e..240636d56 100644 --- a/src/com/android/email/activity/Accounts.java +++ b/src/com/fsck/k9/activity/Accounts.java @@ -1,5 +1,5 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.app.AlertDialog; import android.app.Dialog; @@ -17,12 +17,12 @@ import android.webkit.WebView; import android.widget.*; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; -import com.android.email.*; -import com.android.email.activity.setup.AccountSettings; -import com.android.email.activity.setup.AccountSetupBasics; -import com.android.email.activity.setup.Prefs; -import com.android.email.mail.Store; -import com.android.email.mail.store.LocalStore; +import com.fsck.k9.*; +import com.fsck.k9.activity.setup.AccountSettings; +import com.fsck.k9.activity.setup.AccountSetupBasics; +import com.fsck.k9.activity.setup.Prefs; +import com.fsck.k9.mail.Store; +import com.fsck.k9.mail.store.LocalStore; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -441,7 +441,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC // Ignore } mSelectedContextAccount.delete(Preferences.getPreferences(Accounts.this)); - Email.setServicesEnabled(Accounts.this); + K9.setServicesEnabled(Accounts.this); refresh(); } }) diff --git a/src/com/android/email/activity/ChooseFolder.java b/src/com/fsck/k9/activity/ChooseFolder.java similarity index 84% rename from src/com/android/email/activity/ChooseFolder.java rename to src/com/fsck/k9/activity/ChooseFolder.java index 0491f3d13..512f3055f 100644 --- a/src/com/android/email/activity/ChooseFolder.java +++ b/src/com/fsck/k9/activity/ChooseFolder.java @@ -1,5 +1,5 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Intent; import android.os.Bundle; @@ -11,9 +11,9 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; -import com.android.email.*; -import com.android.email.mail.Folder; -import com.android.email.mail.MessagingException; +import com.fsck.k9.*; +import com.fsck.k9.mail.Folder; +import com.fsck.k9.mail.MessagingException; import java.util.ArrayList; import java.util.Collections; @@ -31,13 +31,13 @@ public class ChooseFolder extends K9ListActivity boolean showOptionNone = false; boolean showDisplayableOnly = false; - public static final String EXTRA_ACCOUNT = "com.android.email.ChooseFolder_account"; - public static final String EXTRA_CUR_FOLDER = "com.android.email.ChooseFolder_curfolder"; - public static final String EXTRA_NEW_FOLDER = "com.android.email.ChooseFolder_newfolder"; - public static final String EXTRA_MESSAGE_UID = "com.android.email.ChooseFolder_messageuid"; - public static final String EXTRA_SHOW_CURRENT = "com.android.email.ChooseFolder_showcurrent"; - public static final String EXTRA_SHOW_FOLDER_NONE = "com.android.email.ChooseFolder_showOptionNone"; - public static final String EXTRA_SHOW_DISPLAYABLE_ONLY = "com.android.email.ChooseFolder_showDisplayableOnly"; + public static final String EXTRA_ACCOUNT = "com.fsck.k9.ChooseFolder_account"; + public static final String EXTRA_CUR_FOLDER = "com.fsck.k9.ChooseFolder_curfolder"; + public static final String EXTRA_NEW_FOLDER = "com.fsck.k9.ChooseFolder_newfolder"; + public static final String EXTRA_MESSAGE_UID = "com.fsck.k9.ChooseFolder_messageuid"; + public static final String EXTRA_SHOW_CURRENT = "com.fsck.k9.ChooseFolder_showcurrent"; + public static final String EXTRA_SHOW_FOLDER_NONE = "com.fsck.k9.ChooseFolder_showOptionNone"; + public static final String EXTRA_SHOW_DISPLAYABLE_ONLY = "com.fsck.k9.ChooseFolder_showDisplayableOnly"; @Override public void onCreate(Bundle savedInstanceState) @@ -199,7 +199,7 @@ public class ChooseFolder extends K9ListActivity String name = folder.getName(); // Inbox needs to be compared case-insensitively - if (hideCurrentFolder && (name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) + if (hideCurrentFolder && (name.equals(mFolder) || (K9.INBOX.equalsIgnoreCase(mFolder) && K9.INBOX.equalsIgnoreCase(name)))) { continue; } @@ -219,7 +219,7 @@ public class ChooseFolder extends K9ListActivity } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me); + Log.e(K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me); } localFolders.add(folder.getName()); @@ -228,26 +228,26 @@ public class ChooseFolder extends K9ListActivity if (showOptionNone) { - localFolders.add(Email.FOLDER_NONE); + localFolders.add(K9.FOLDER_NONE); } Collections.sort(localFolders, new Comparator() { public int compare(String aName, String bName) { - if (Email.FOLDER_NONE.equalsIgnoreCase(aName)) + if (K9.FOLDER_NONE.equalsIgnoreCase(aName)) { return -1; } - if (Email.FOLDER_NONE.equalsIgnoreCase(bName)) + if (K9.FOLDER_NONE.equalsIgnoreCase(bName)) { return 1; } - if (Email.INBOX.equalsIgnoreCase(aName)) + if (K9.INBOX.equalsIgnoreCase(aName)) { return -1; } - if (Email.INBOX.equalsIgnoreCase(bName)) + if (K9.INBOX.equalsIgnoreCase(bName)) { return 1; } @@ -261,7 +261,7 @@ public class ChooseFolder extends K9ListActivity int position = 0; for (String name : localFolders) { - if (Email.INBOX.equalsIgnoreCase(name)) + if (K9.INBOX.equalsIgnoreCase(name)) { adapter.add(getString(R.string.special_mailbox_name_inbox)); heldInbox = name; @@ -271,7 +271,7 @@ public class ChooseFolder extends K9ListActivity adapter.add(name); } - if ((name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) + if ((name.equals(mFolder) || (K9.INBOX.equalsIgnoreCase(mFolder) && K9.INBOX.equalsIgnoreCase(name)))) { selectedFolder = position; } diff --git a/src/com/android/email/activity/ChooseIdentity.java b/src/com/fsck/k9/activity/ChooseIdentity.java similarity index 91% rename from src/com/android/email/activity/ChooseIdentity.java rename to src/com/fsck/k9/activity/ChooseIdentity.java index 072173e6a..28ad0a89a 100644 --- a/src/com/android/email/activity/ChooseIdentity.java +++ b/src/com/fsck/k9/activity/ChooseIdentity.java @@ -1,5 +1,5 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Intent; import android.os.Bundle; @@ -10,9 +10,9 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; -import com.android.email.Account; -import com.android.email.K9ListActivity; -import com.android.email.R; +import com.fsck.k9.Account; +import com.fsck.k9.K9ListActivity; +import com.fsck.k9.R; import java.util.List; @@ -23,8 +23,8 @@ public class ChooseIdentity extends K9ListActivity ArrayAdapter adapter; private ChooseIdentityHandler mHandler = new ChooseIdentityHandler(); - public static final String EXTRA_ACCOUNT = "com.android.email.ChooseIdentity_account"; - public static final String EXTRA_IDENTITY = "com.android.email.ChooseIdentity_identity"; + public static final String EXTRA_ACCOUNT = "com.fsck.k9.ChooseIdentity_account"; + public static final String EXTRA_IDENTITY = "com.fsck.k9.ChooseIdentity_identity"; protected List identities = null; diff --git a/src/com/android/email/activity/DateFormatter.java b/src/com/fsck/k9/activity/DateFormatter.java similarity index 96% rename from src/com/android/email/activity/DateFormatter.java rename to src/com/fsck/k9/activity/DateFormatter.java index 37f1ed4dd..8d3ba545e 100644 --- a/src/com/android/email/activity/DateFormatter.java +++ b/src/com/fsck/k9/activity/DateFormatter.java @@ -1,9 +1,9 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Context; import android.content.SharedPreferences.Editor; -import com.android.email.Preferences; -import com.android.email.R; +import com.fsck.k9.Preferences; +import com.fsck.k9.R; import java.text.DateFormat; import java.text.SimpleDateFormat; diff --git a/src/com/android/email/activity/EditIdentity.java b/src/com/fsck/k9/activity/EditIdentity.java similarity index 87% rename from src/com/android/email/activity/EditIdentity.java rename to src/com/fsck/k9/activity/EditIdentity.java index da9582431..8d037093d 100644 --- a/src/com/android/email/activity/EditIdentity.java +++ b/src/com/fsck/k9/activity/EditIdentity.java @@ -1,21 +1,21 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.os.Bundle; import android.view.KeyEvent; import android.widget.EditText; -import com.android.email.Account; -import com.android.email.K9Activity; -import com.android.email.Preferences; -import com.android.email.R; +import com.fsck.k9.Account; +import com.fsck.k9.K9Activity; +import com.fsck.k9.Preferences; +import com.fsck.k9.R; import java.util.List; public class EditIdentity extends K9Activity { - public static final String EXTRA_IDENTITY = "com.android.email.EditIdentity_identity"; - public static final String EXTRA_IDENTITY_INDEX = "com.android.email.EditIdentity_identity_index"; - public static final String EXTRA_ACCOUNT = "com.android.email.EditIdentity_account"; + public static final String EXTRA_IDENTITY = "com.fsck.k9.EditIdentity_identity"; + public static final String EXTRA_IDENTITY_INDEX = "com.fsck.k9.EditIdentity_identity_index"; + public static final String EXTRA_ACCOUNT = "com.fsck.k9.EditIdentity_account"; private Account mAccount; private Account.Identity mIdentity; diff --git a/src/com/android/email/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java similarity index 95% rename from src/com/android/email/activity/FolderList.java rename to src/com/fsck/k9/activity/FolderList.java index 9e90850da..e454f5f80 100644 --- a/src/com/android/email/activity/FolderList.java +++ b/src/com/fsck/k9/activity/FolderList.java @@ -1,4 +1,4 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.app.AlertDialog; import android.app.Dialog; @@ -18,13 +18,13 @@ import android.view.ContextMenu.ContextMenuInfo; import android.widget.*; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; -import com.android.email.*; -import com.android.email.activity.setup.AccountSettings; -import com.android.email.activity.setup.FolderSettings; -import com.android.email.mail.Folder; -import com.android.email.mail.Message; -import com.android.email.mail.MessagingException; -import com.android.email.mail.Store; +import com.fsck.k9.*; +import com.fsck.k9.activity.setup.AccountSettings; +import com.fsck.k9.activity.setup.FolderSettings; +import com.fsck.k9.mail.Folder; +import com.fsck.k9.mail.Message; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.Store; import java.util.ArrayList; import java.util.Collections; @@ -44,7 +44,7 @@ public class FolderList extends K9ListActivity private static final String EXTRA_INITIAL_FOLDER = "initialFolder"; - private static final String STATE_CURRENT_FOLDER = "com.android.email.activity.folderlist_folder"; + private static final String STATE_CURRENT_FOLDER = "com.fsck.k9.activity.folderlist_folder"; private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification"; @@ -239,7 +239,7 @@ public class FolderList extends K9ListActivity PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email - UpdateWorker"); wakeLock.setReferenceCounted(false); - wakeLock.acquire(Email.WAKE_LOCK_TIMEOUT); + wakeLock.acquire(K9.WAKE_LOCK_TIMEOUT); MessagingListener listener = new MessagingListener() { public void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages) @@ -327,14 +327,14 @@ public class FolderList extends K9ListActivity String savedFolderName = null; Intent intent = getIntent(); mAccount = (Account)intent.getSerializableExtra(EXTRA_ACCOUNT); - Log.v(Email.LOG_TAG, "savedInstanceState: " + (savedInstanceState==null)); + Log.v(K9.LOG_TAG, "savedInstanceState: " + (savedInstanceState==null)); if (savedInstanceState == null) { initialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER); - Log.v(Email.LOG_TAG, "EXTRA_INITIAL_FOLDER: " + initialFolder); + Log.v(K9.LOG_TAG, "EXTRA_INITIAL_FOLDER: " + initialFolder); mStartup = (boolean) intent.getBooleanExtra(EXTRA_STARTUP, false); - Log.v(Email.LOG_TAG, "startup: " + mStartup); + Log.v(K9.LOG_TAG, "startup: " + mStartup); if (initialFolder == null && mStartup) { @@ -348,9 +348,9 @@ public class FolderList extends K9ListActivity savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER); } - Log.v(Email.LOG_TAG, "mInitialFolder: " + initialFolder); + Log.v(K9.LOG_TAG, "mInitialFolder: " + initialFolder); if (initialFolder != null - && !Email.FOLDER_NONE.equals(initialFolder)) + && !K9.FOLDER_NONE.equals(initialFolder)) { onOpenFolder(initialFolder, true); finish(); @@ -368,7 +368,7 @@ public class FolderList extends K9ListActivity { public void onItemClick(AdapterView parent, View v, int itemPosition, long id) { - Log.v(Email.LOG_TAG,"We're clicking "+itemPosition+" -- "+id); + Log.v(K9.LOG_TAG,"We're clicking "+itemPosition+" -- "+id); MessageList.actionHandleFolder(FolderList.this, mAccount, ((FolderInfoHolder)mAdapter.getItem(id)).name, false); } }); @@ -511,7 +511,7 @@ public class FolderList extends K9ListActivity @Override public void controllerCommandCompleted(boolean moreToDo) { - Log.v(Email.LOG_TAG, "Empty Trash background task completed"); + Log.v(K9.LOG_TAG, "Empty Trash background task completed"); } }; @@ -543,7 +543,7 @@ public class FolderList extends K9ListActivity return true; case R.id.send_messages: - Log.i(Email.LOG_TAG, "sending pending messages"); + Log.i(K9.LOG_TAG, "sending pending messages"); MessagingController.getInstance(getApplication()).sendPendingMessages(mAccount, null); return true; @@ -622,26 +622,26 @@ public class FolderList extends K9ListActivity break; case R.id.send_messages: - Log.i(Email.LOG_TAG, "sending pending messages from " + folder.name); + Log.i(K9.LOG_TAG, "sending pending messages from " + folder.name); sendMail(mAccount); break; case R.id.check_mail: - Log.i(Email.LOG_TAG, "refresh folder " + folder.name); + Log.i(K9.LOG_TAG, "refresh folder " + folder.name); checkMail(folder); break; case R.id.folder_settings: - Log.i(Email.LOG_TAG, "edit folder settings for " + folder.name); + Log.i(K9.LOG_TAG, "edit folder settings for " + folder.name); onEditFolder(mAccount, folder.name); break; case R.id.empty_trash: - Log.i(Email.LOG_TAG, "empty trash"); + Log.i(K9.LOG_TAG, "empty trash"); onEmptyTrash(mAccount); @@ -826,7 +826,7 @@ public class FolderList extends K9ListActivity if (Config.LOGV) { - Log.v(Email.LOG_TAG, "listFoldersFailed " + message); + Log.v(K9.LOG_TAG, "listFoldersFailed " + message); } } @@ -875,7 +875,7 @@ public class FolderList extends K9ListActivity } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me); + Log.e(K9.LOG_TAG, "Couldn't get prefs to check for displayability of folder " + folder.getName(), me); } FolderInfoHolder holder = null; @@ -953,7 +953,7 @@ public class FolderList extends K9ListActivity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while populating folder", e); + Log.e(K9.LOG_TAG, "Exception while populating folder", e); } } @@ -1255,15 +1255,15 @@ public class FolderList extends K9ListActivity String s1 = this.name; String s2 = o.name; - if (Email.INBOX.equalsIgnoreCase(s1) && Email.INBOX.equalsIgnoreCase(s2)) + if (K9.INBOX.equalsIgnoreCase(s1) && K9.INBOX.equalsIgnoreCase(s2)) { return 0; } - else if (Email.INBOX.equalsIgnoreCase(s1)) + else if (K9.INBOX.equalsIgnoreCase(s1)) { return -1; } - else if (Email.INBOX.equalsIgnoreCase(s2)) + else if (K9.INBOX.equalsIgnoreCase(s2)) { return 1; } @@ -1302,12 +1302,12 @@ public class FolderList extends K9ListActivity } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Folder.getUnreadMessageCount() failed", me); + Log.e(K9.LOG_TAG, "Folder.getUnreadMessageCount() failed", me); } this.name = folder.getName(); - if (this.name.equalsIgnoreCase(Email.INBOX)) + if (this.name.equalsIgnoreCase(K9.INBOX)) { this.displayName = getString(R.string.special_mailbox_name_inbox); } diff --git a/src/com/android/email/activity/ManageIdentities.java b/src/com/fsck/k9/activity/ManageIdentities.java similarity index 95% rename from src/com/android/email/activity/ManageIdentities.java rename to src/com/fsck/k9/activity/ManageIdentities.java index 6368d19d8..ad45c3411 100644 --- a/src/com/android/email/activity/ManageIdentities.java +++ b/src/com/fsck/k9/activity/ManageIdentities.java @@ -1,4 +1,4 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Intent; import android.view.*; @@ -7,14 +7,14 @@ import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.ListView; import android.widget.Toast; -import com.android.email.Account; -import com.android.email.Preferences; -import com.android.email.R; +import com.fsck.k9.Account; +import com.fsck.k9.Preferences; +import com.fsck.k9.R; public class ManageIdentities extends ChooseIdentity { private boolean mIdentitiesChanged = false; - public static final String EXTRA_IDENTITIES = "com.android.email.EditIdentity_identities"; + public static final String EXTRA_IDENTITIES = "com.fsck.k9.EditIdentity_identities"; private static final int ACTIVITY_EDIT_IDENTITY = 1; protected void setupClickListeners() diff --git a/src/com/android/email/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java similarity index 95% rename from src/com/android/email/activity/MessageCompose.java rename to src/com/fsck/k9/activity/MessageCompose.java index 1bedcae13..6d679fea4 100644 --- a/src/com/android/email/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -1,5 +1,5 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.ContentResolver; import android.content.Context; @@ -22,12 +22,12 @@ import android.view.View.OnFocusChangeListener; import android.view.Window; import android.widget.AutoCompleteTextView.Validator; import android.widget.*; -import com.android.email.*; -import com.android.email.mail.*; -import com.android.email.mail.Message.RecipientType; -import com.android.email.mail.internet.*; -import com.android.email.mail.store.LocalStore; -import com.android.email.mail.store.LocalStore.LocalAttachmentBody; +import com.fsck.k9.*; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Message.RecipientType; +import com.fsck.k9.mail.internet.*; +import com.fsck.k9.mail.store.LocalStore; +import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBody; import java.io.Serializable; import java.util.ArrayList; @@ -36,10 +36,10 @@ import java.util.StringTokenizer; public class MessageCompose extends K9Activity implements OnClickListener, OnFocusChangeListener { - private static final String ACTION_REPLY = "com.android.email.intent.action.REPLY"; - private static final String ACTION_REPLY_ALL = "com.android.email.intent.action.REPLY_ALL"; - private static final String ACTION_FORWARD = "com.android.email.intent.action.FORWARD"; - private static final String ACTION_EDIT_DRAFT = "com.android.email.intent.action.EDIT_DRAFT"; + private static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY"; + private static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL"; + private static final String ACTION_FORWARD = "com.fsck.k9.intent.action.FORWARD"; + private static final String ACTION_EDIT_DRAFT = "com.fsck.k9.intent.action.EDIT_DRAFT"; private static final String EXTRA_ACCOUNT = "account"; @@ -47,21 +47,21 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private static final String EXTRA_MESSAGE = "message"; private static final String STATE_KEY_ATTACHMENTS = - "com.android.email.activity.MessageCompose.attachments"; + "com.fsck.k9.activity.MessageCompose.attachments"; private static final String STATE_KEY_CC_SHOWN = - "com.android.email.activity.MessageCompose.ccShown"; + "com.fsck.k9.activity.MessageCompose.ccShown"; private static final String STATE_KEY_BCC_SHOWN = - "com.android.email.activity.MessageCompose.bccShown"; + "com.fsck.k9.activity.MessageCompose.bccShown"; private static final String STATE_KEY_QUOTED_TEXT_SHOWN = - "com.android.email.activity.MessageCompose.quotedTextShown"; + "com.fsck.k9.activity.MessageCompose.quotedTextShown"; private static final String STATE_KEY_SOURCE_MESSAGE_PROCED = - "com.android.email.activity.MessageCompose.stateKeySourceMessageProced"; + "com.fsck.k9.activity.MessageCompose.stateKeySourceMessageProced"; private static final String STATE_KEY_DRAFT_UID = - "com.android.email.activity.MessageCompose.draftUid"; + "com.fsck.k9.activity.MessageCompose.draftUid"; private static final String STATE_IDENTITY_CHANGED = - "com.android.email.activity.MessageCompose.identityChanged"; + "com.fsck.k9.activity.MessageCompose.identityChanged"; private static final String STATE_IDENTITY = - "com.android.email.activity.MessageCompose.identity"; + "com.fsck.k9.activity.MessageCompose.identity"; private static final int MSG_PROGRESS_ON = 1; private static final int MSG_PROGRESS_OFF = 2; @@ -417,7 +417,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); if (stream != null && type != null) { - if (MimeUtility.mimeTypeMatches(type, Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) + if (MimeUtility.mimeTypeMatches(type, K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) { addAttachment(stream); } @@ -527,10 +527,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } } - Log.d(Email.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid); + Log.d(K9.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid); if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null) { - Log.d(Email.LOG_TAG, "Setting message ANSWERED flag to true"); + Log.d(K9.LOG_TAG, "Setting message ANSWERED flag to true"); // TODO: Really, we should wait until we send the message, but that would require saving the original // message info along with a Draft copy, in case it is left in Drafts for a while before being sent MessagingController.getInstance(getApplication()).setFlag(mAccount, mFolder, new String[] { mSourceMessageUid }, Flag.ANSWERED, true); @@ -766,7 +766,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Failed to create new message for send or save.", me); + Log.e(K9.LOG_TAG, "Failed to create new message for send or save.", me); throw new RuntimeException("Failed to create a new message for send or save.", me); } @@ -804,8 +804,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } } - Log.d(Email.LOG_TAG, "Saving identity: " + k9identity); - message.addHeader(Email.K9MAIL_IDENTITY, k9identity); + Log.d(K9.LOG_TAG, "Saving identity: " + k9identity); + message.addHeader(K9.K9MAIL_IDENTITY, k9identity); MessagingController.getInstance(getApplication()).saveDraft(mAccount, message); mDraftUid = message.getUid(); @@ -905,7 +905,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType(Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES[0]); + i.setType(K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES[0]); startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_ATTACHMENT); } @@ -965,11 +965,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc if (index!=-1) { String extension = attachment.name.substring(index+1).toLowerCase(); - for (int i=0; i 0) { String k9identity = k9identities[0]; if (k9identity != null) { - Log.d(Email.LOG_TAG, "Got a saved identity: " + k9identity); + Log.d(K9.LOG_TAG, "Got a saved identity: " + k9identity); StringTokenizer tokens = new StringTokenizer(k9identity, ":", false); String bodyLengthS = null; @@ -1403,7 +1403,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to parse bodyLength '" + bodyLengthS + "'"); + Log.e(K9.LOG_TAG, "Unable to parse bodyLength '" + bodyLengthS + "'"); } } if (tokens.hasMoreTokens()) diff --git a/src/com/android/email/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java similarity index 98% rename from src/com/android/email/activity/MessageList.java rename to src/com/fsck/k9/activity/MessageList.java index 9f0bc569d..49507be68 100644 --- a/src/com/android/email/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -1,4 +1,4 @@ -package com.android.email.activity; +package com.fsck.k9.activity; //import android.os.Debug; import android.app.AlertDialog; @@ -19,15 +19,15 @@ import android.view.View.OnClickListener; import android.widget.*; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.CompoundButton.OnCheckedChangeListener; -import com.android.email.*; -import com.android.email.MessagingController.SORT_TYPE; -import com.android.email.activity.setup.AccountSettings; -import com.android.email.activity.setup.FolderSettings; -import com.android.email.mail.*; -import com.android.email.mail.Message.RecipientType; -import com.android.email.mail.store.LocalStore; -import com.android.email.mail.store.LocalStore.LocalFolder; -import com.android.email.mail.store.LocalStore.LocalMessage; +import com.fsck.k9.*; +import com.fsck.k9.MessagingController.SORT_TYPE; +import com.fsck.k9.activity.setup.AccountSettings; +import com.fsck.k9.activity.setup.FolderSettings; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Message.RecipientType; +import com.fsck.k9.mail.store.LocalStore; +import com.fsck.k9.mail.store.LocalStore.LocalFolder; +import com.fsck.k9.mail.store.LocalStore.LocalMessage; import java.util.ArrayList; import java.util.Collections; @@ -60,10 +60,10 @@ public class MessageList private static final String EXTRA_STARTUP = "startup"; private static final String EXTRA_FOLDER = "folder"; - private static final String STATE_KEY_LIST = "com.android.email.activity.messagelist_state"; - private static final String STATE_CURRENT_FOLDER = "com.android.email.activity.messagelist_folder"; - private static final String STATE_KEY_SELECTION = "com.android.email.activity.messagelist_selection"; - private static final String STATE_KEY_SELECTED_COUNT = "com.android.email.activity.messagelist_selected_count"; + private static final String STATE_KEY_LIST = "com.fsck.k9.activity.messagelist_state"; + private static final String STATE_CURRENT_FOLDER = "com.fsck.k9.activity.messagelist_folder"; + private static final String STATE_KEY_SELECTION = "com.fsck.k9.activity.messagelist_selection"; + private static final String STATE_KEY_SELECTED_COUNT = "com.fsck.k9.activity.messagelist_selected_count"; private static final int WIDGET_NONE = 1; private static final int WIDGET_FLAG = 2; @@ -1770,7 +1770,7 @@ public class MessageList } catch (Exception e) { - Log.e(Email.LOG_TAG, "getFolder(" + folder + ") goes boom: ",e); + Log.e(K9.LOG_TAG, "getFolder(" + folder + ") goes boom: ",e); return null; } finally @@ -1805,7 +1805,7 @@ public class MessageList } catch (Exception e) { - Log.i(Email.LOG_TAG,"getItemId("+position+") ",e); + Log.i(K9.LOG_TAG,"getItemId("+position+") ",e); } return -1; } @@ -1826,7 +1826,7 @@ public class MessageList } catch (Exception e) { - Log.e(Email.LOG_TAG, "getItem(" + position + "), but folder.messages.size() = " + mAdapter.messages.size(), e); + Log.e(K9.LOG_TAG, "getItem(" + position + "), but folder.messages.size() = " + mAdapter.messages.size(), e); } return null; } @@ -2116,7 +2116,7 @@ public class MessageList { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "Unable to load message info", me); + Log.v(K9.LOG_TAG, "Unable to load message info", me); } } } @@ -2322,7 +2322,7 @@ public class MessageList { this.name = folder.getName(); - if (this.name.equalsIgnoreCase(Email.INBOX)) + if (this.name.equalsIgnoreCase(K9.INBOX)) { this.displayName = getString(R.string.special_mailbox_name_inbox); } diff --git a/src/com/android/email/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java similarity index 95% rename from src/com/android/email/activity/MessageView.java rename to src/com/fsck/k9/activity/MessageView.java index 65d91f736..992b05e51 100644 --- a/src/com/android/email/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -1,5 +1,5 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Context; import android.content.Intent; @@ -26,14 +26,14 @@ import android.view.animation.TranslateAnimation; import android.webkit.*; import android.webkit.CacheManager.CacheResult; import android.widget.*; -import com.android.email.*; -import com.android.email.mail.*; -import com.android.email.mail.Message.RecipientType; -import com.android.email.mail.internet.MimeUtility; -import com.android.email.mail.store.LocalStore.LocalAttachmentBodyPart; -import com.android.email.mail.store.LocalStore.LocalMessage; -import com.android.email.mail.store.LocalStore.LocalTextBody; -import com.android.email.provider.AttachmentProvider; +import com.fsck.k9.*; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Message.RecipientType; +import com.fsck.k9.mail.internet.MimeUtility; +import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBodyPart; +import com.fsck.k9.mail.store.LocalStore.LocalMessage; +import com.fsck.k9.mail.store.LocalStore.LocalTextBody; +import com.fsck.k9.provider.AttachmentProvider; import org.apache.commons.io.IOUtils; import java.io.*; @@ -46,11 +46,11 @@ import java.util.Map; public class MessageView extends K9Activity implements UrlInterceptHandler, OnClickListener { - private static final String EXTRA_ACCOUNT = "com.android.email.MessageView_account"; - private static final String EXTRA_FOLDER = "com.android.email.MessageView_folder"; - private static final String EXTRA_MESSAGE = "com.android.email.MessageView_message"; - private static final String EXTRA_MESSAGE_UIDS = "com.android.email.MessageView_messageUids"; - private static final String EXTRA_NEXT = "com.android.email.MessageView_next"; + private static final String EXTRA_ACCOUNT = "com.fsck.k9.MessageView_account"; + private static final String EXTRA_FOLDER = "com.fsck.k9.MessageView_folder"; + private static final String EXTRA_MESSAGE = "com.fsck.k9.MessageView_message"; + private static final String EXTRA_MESSAGE_UIDS = "com.fsck.k9.MessageView_messageUids"; + private static final String EXTRA_NEXT = "com.fsck.k9.MessageView_next"; private static final String CID_PREFIX = "http://cid/"; @@ -532,24 +532,24 @@ public class MessageView extends K9Activity mMessageUid = intent.getStringExtra(EXTRA_MESSAGE); mMessageUids = intent.getStringArrayListExtra(EXTRA_MESSAGE_UIDS); - Log.v(Email.LOG_TAG, "mAccount number: " + mAccount.getAccountNumber()); - Log.v(Email.LOG_TAG, "mFolder: " + mFolder); - Log.v(Email.LOG_TAG, "mMessageUid: " + mMessageUid); + Log.v(K9.LOG_TAG, "mAccount number: " + mAccount.getAccountNumber()); + Log.v(K9.LOG_TAG, "mFolder: " + mFolder); + Log.v(K9.LOG_TAG, "mMessageUid: " + mMessageUid); } else { - Log.v(Email.LOG_TAG, "uri: " + uri.toString()); + Log.v(K9.LOG_TAG, "uri: " + uri.toString()); List segmentList = uri.getPathSegments(); - Log.v(Email.LOG_TAG, "segmentList size: " + segmentList.size()); + Log.v(K9.LOG_TAG, "segmentList size: " + segmentList.size()); if (segmentList.size()==3) { String accountId = segmentList.get(0); Account[] accounts = Preferences.getPreferences(this).getAccounts(); - Log.v(Email.LOG_TAG, "account.length: " + accounts.length); + Log.v(K9.LOG_TAG, "account.length: " + accounts.length); boolean found = false; for (Account account : accounts) { - Log.v(Email.LOG_TAG, "account: name=" + account.getDescription() + " number=" + account.getAccountNumber()); + Log.v(K9.LOG_TAG, "account: name=" + account.getDescription() + " number=" + account.getAccountNumber()); if (String.valueOf(account.getAccountNumber()).equals(accountId)) { mAccount = account; @@ -571,7 +571,7 @@ public class MessageView extends K9Activity { for (String segment : segmentList) { - Log.v(Email.LOG_TAG, "segment: " + segment); + Log.v(K9.LOG_TAG, "segment: " + segment); } //TODO: Use ressource to externalize message Toast.makeText(this, "Invalid intent uri: " + uri.toString(), Toast.LENGTH_LONG).show(); @@ -779,7 +779,7 @@ public class MessageView extends K9Activity { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "loadMessageForViewHeadersAvailable", me); + Log.v(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me); } } } @@ -826,7 +826,7 @@ public class MessageView extends K9Activity } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Could not set flag on local message", me); + Log.e(K9.LOG_TAG, "Could not set flag on local message", me); } } } @@ -1299,21 +1299,21 @@ public class MessageView extends K9Activity Button attachmentDownload = (Button)view.findViewById(R.id.download); if ((!MimeUtility.mimeTypeMatches(attachment.contentType, - Email.ACCEPTABLE_ATTACHMENT_VIEW_TYPES)) + K9.ACCEPTABLE_ATTACHMENT_VIEW_TYPES)) || (MimeUtility.mimeTypeMatches(attachment.contentType, - Email.UNACCEPTABLE_ATTACHMENT_VIEW_TYPES))) + K9.UNACCEPTABLE_ATTACHMENT_VIEW_TYPES))) { attachmentView.setVisibility(View.GONE); } if ((!MimeUtility.mimeTypeMatches(attachment.contentType, - Email.ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES)) + K9.ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES)) || (MimeUtility.mimeTypeMatches(attachment.contentType, - Email.UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES))) + K9.UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES))) { attachmentDownload.setVisibility(View.GONE); } - if (attachment.size > Email.MAX_ATTACHMENT_DOWNLOAD_SIZE) + if (attachment.size > K9.MAX_ATTACHMENT_DOWNLOAD_SIZE) { attachmentView.setVisibility(View.GONE); attachmentDownload.setVisibility(View.GONE); @@ -1362,7 +1362,7 @@ public class MessageView extends K9Activity String timeText = getTimeFormat().format(message.getSentDate()); String toText = Address.toFriendly(message.getRecipients(RecipientType.TO)); String ccText = Address.toFriendly(message.getRecipients(RecipientType.CC)); - Log.d(Email.LOG_TAG, ccText); + Log.d(K9.LOG_TAG, ccText); boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0; mHandler.setHeaders(subjectText, fromText, @@ -1406,7 +1406,7 @@ public class MessageView extends K9Activity { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "loadMessageForViewHeadersAvailable", me); + Log.v(K9.LOG_TAG, "loadMessageForViewHeadersAvailable", me); } } } @@ -1483,7 +1483,7 @@ public class MessageView extends K9Activity { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "loadMessageForViewBodyAvailable", e); + Log.v(K9.LOG_TAG, "loadMessageForViewBodyAvailable", e); } } }//loadMessageForViewBodyAvailable @@ -1622,7 +1622,7 @@ public class MessageView extends K9Activity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not display attachment of type " + attachment.contentType, e); + Log.e(K9.LOG_TAG, "Could not display attachment of type " + attachment.contentType, e); Toast toast = Toast.makeText(MessageView.this, getString(R.string.message_view_no_viewer, attachment.contentType), Toast.LENGTH_LONG); toast.show(); } diff --git a/src/com/android/email/activity/ProgressListener.java b/src/com/fsck/k9/activity/ProgressListener.java similarity index 96% rename from src/com/android/email/activity/ProgressListener.java rename to src/com/fsck/k9/activity/ProgressListener.java index e4356675c..6d8f6fdc3 100644 --- a/src/com/android/email/activity/ProgressListener.java +++ b/src/com/fsck/k9/activity/ProgressListener.java @@ -1,5 +1,5 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Context; diff --git a/src/com/android/email/activity/SizeFormatter.java b/src/com/fsck/k9/activity/SizeFormatter.java similarity index 90% rename from src/com/android/email/activity/SizeFormatter.java rename to src/com/fsck/k9/activity/SizeFormatter.java index 9ce691934..badc2d102 100644 --- a/src/com/android/email/activity/SizeFormatter.java +++ b/src/com/fsck/k9/activity/SizeFormatter.java @@ -1,7 +1,7 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.content.Context; -import com.android.email.R; +import com.fsck.k9.R; public class SizeFormatter { diff --git a/src/com/android/email/activity/Welcome.java b/src/com/fsck/k9/activity/Welcome.java similarity index 90% rename from src/com/android/email/activity/Welcome.java rename to src/com/fsck/k9/activity/Welcome.java index 09c052d8c..b0d7632db 100644 --- a/src/com/android/email/activity/Welcome.java +++ b/src/com/fsck/k9/activity/Welcome.java @@ -1,7 +1,7 @@ -package com.android.email.activity; +package com.fsck.k9.activity; import android.os.Bundle; -import com.android.email.K9Activity; +import com.fsck.k9.K9Activity; /** * The Welcome activity initializes the application and decides what Activity diff --git a/src/com/android/email/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java similarity index 97% rename from src/com/android/email/activity/setup/AccountSettings.java rename to src/com/fsck/k9/activity/setup/AccountSettings.java index 46abce17d..a22d0d797 100644 --- a/src/com/android/email/activity/setup/AccountSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSettings.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -8,11 +8,11 @@ import android.os.Bundle; import android.preference.*; import android.util.Log; import android.view.KeyEvent; -import com.android.email.*; -import com.android.email.activity.ChooseFolder; -import com.android.email.activity.ChooseIdentity; -import com.android.email.activity.ManageIdentities; -import com.android.email.mail.Store; +import com.fsck.k9.*; +import com.fsck.k9.activity.ChooseFolder; +import com.fsck.k9.activity.ChooseIdentity; +import com.fsck.k9.activity.ManageIdentities; +import com.fsck.k9.mail.Store; public class AccountSettings extends K9PreferenceActivity { @@ -91,7 +91,7 @@ public class AccountSettings extends K9PreferenceActivity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not get remote store", e); + Log.e(K9.LOG_TAG, "Could not get remote store", e); } addPreferencesFromResource(R.xml.account_settings_preferences); @@ -348,7 +348,7 @@ public class AccountSettings extends K9PreferenceActivity mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString())); mAccount.setLeftHanded(mLeftHanded.isChecked()); mAccount.save(Preferences.getPreferences(this)); - Email.setServicesEnabled(this); + K9.setServicesEnabled(this); // TODO: refresh folder list here } @@ -415,7 +415,7 @@ public class AccountSettings extends K9PreferenceActivity private String translateFolder(String in) { - if (Email.INBOX.equalsIgnoreCase(in)) + if (K9.INBOX.equalsIgnoreCase(in)) { return getString(R.string.special_mailbox_name_inbox); } @@ -430,7 +430,7 @@ public class AccountSettings extends K9PreferenceActivity if (getString(R.string.special_mailbox_name_inbox).equals(in)) { - return Email.INBOX; + return K9.INBOX; } else { diff --git a/src/com/android/email/activity/setup/AccountSetupAccountType.java b/src/com/fsck/k9/activity/setup/AccountSetupAccountType.java similarity index 94% rename from src/com/android/email/activity/setup/AccountSetupAccountType.java rename to src/com/fsck/k9/activity/setup/AccountSetupAccountType.java index e1e4ff410..4a3ad66fe 100644 --- a/src/com/android/email/activity/setup/AccountSetupAccountType.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupAccountType.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -9,10 +9,10 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; -import com.android.email.Account; -import com.android.email.Email; -import com.android.email.K9Activity; -import com.android.email.R; +import com.fsck.k9.Account; +import com.fsck.k9.K9; +import com.fsck.k9.K9Activity; +import com.fsck.k9.R; import java.net.URI; @@ -120,7 +120,7 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen } private void failure(Exception use) { - Log.e(Email.LOG_TAG, "Failure", use); + Log.e(K9.LOG_TAG, "Failure", use); String toastText = getString(R.string.account_setup_bad_uri, use.getMessage()); Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); diff --git a/src/com/android/email/activity/setup/AccountSetupBasics.java b/src/com/fsck/k9/activity/setup/AccountSetupBasics.java similarity index 96% rename from src/com/android/email/activity/setup/AccountSetupBasics.java rename to src/com/fsck/k9/activity/setup/AccountSetupBasics.java index 853fb2d3a..66247260e 100644 --- a/src/com/android/email/activity/setup/AccountSetupBasics.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupBasics.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.app.AlertDialog; import android.app.Dialog; @@ -20,7 +20,7 @@ import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; -import com.android.email.*; +import com.fsck.k9.*; import java.io.Serializable; import java.net.URI; @@ -37,10 +37,10 @@ import java.net.URISyntaxException; public class AccountSetupBasics extends K9Activity implements OnClickListener, TextWatcher { - private final static String EXTRA_ACCOUNT = "com.android.email.AccountSetupBasics.account"; + private final static String EXTRA_ACCOUNT = "com.fsck.k9.AccountSetupBasics.account"; private final static int DIALOG_NOTE = 1; private final static String STATE_KEY_PROVIDER = - "com.android.email.AccountSetupBasics.provider"; + "com.fsck.k9.AccountSetupBasics.provider"; private Preferences mPrefs; private EditText mEmailView; @@ -163,7 +163,7 @@ public class AccountSetupBasics extends K9Activity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not get owner name, using default account name", e); + Log.e(K9.LOG_TAG, "Could not get owner name, using default account name", e); } if (name == null || name.length() == 0) { @@ -173,7 +173,7 @@ public class AccountSetupBasics extends K9Activity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not get default account name", e); + Log.e(K9.LOG_TAG, "Could not get default account name", e); } } if (name == null) @@ -313,7 +313,7 @@ public class AccountSetupBasics extends K9Activity { Preferences.getPreferences(this).setDefaultAccount(mAccount); } - Email.setServicesEnabled(this); + K9.setServicesEnabled(this); AccountSetupNames.actionSetNames(this, mAccount); finish(); } @@ -429,7 +429,7 @@ public class AccountSetupBasics extends K9Activity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Error while trying to load provider settings.", e); + Log.e(K9.LOG_TAG, "Error while trying to load provider settings.", e); } return null; } diff --git a/src/com/android/email/activity/setup/AccountSetupCheckSettings.java b/src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java similarity index 94% rename from src/com/android/email/activity/setup/AccountSetupCheckSettings.java rename to src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java index cfd358aba..fef2eca9c 100644 --- a/src/com/android/email/activity/setup/AccountSetupCheckSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupCheckSettings.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.app.Activity; import android.app.AlertDialog; @@ -14,12 +14,12 @@ import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; -import com.android.email.*; -import com.android.email.mail.AuthenticationFailedException; -import com.android.email.mail.CertificateValidationException; -import com.android.email.mail.Store; -import com.android.email.mail.Transport; -import com.android.email.mail.store.TrustManagerFactory; +import com.fsck.k9.*; +import com.fsck.k9.mail.AuthenticationFailedException; +import com.fsck.k9.mail.CertificateValidationException; +import com.fsck.k9.mail.Store; +import com.fsck.k9.mail.Transport; +import com.fsck.k9.mail.store.TrustManagerFactory; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; @@ -108,7 +108,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList store.checkSettings(); MessagingController.getInstance(getApplication()).listFolders(mAccount, true, null); - MessagingController.getInstance(getApplication()).synchronizeMailbox(mAccount, Email.INBOX , null); + MessagingController.getInstance(getApplication()).synchronizeMailbox(mAccount, K9.INBOX , null); } if (mDestroyed) @@ -142,21 +142,21 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList } catch (final AuthenticationFailedException afe) { - Log.e(Email.LOG_TAG, "Error while testing settings", afe); + Log.e(K9.LOG_TAG, "Error while testing settings", afe); showErrorDialog( R.string.account_setup_failed_dlg_auth_message_fmt, afe.getMessage() == null ? "" : afe.getMessage()); } catch (final CertificateValidationException cve) { - Log.e(Email.LOG_TAG, "Error while testing settings", cve); + Log.e(K9.LOG_TAG, "Error while testing settings", cve); acceptKeyDialog( R.string.account_setup_failed_dlg_certificate_message_fmt, cve); } catch (final Throwable t) { - Log.e(Email.LOG_TAG, "Error while testing settings", t); + Log.e(K9.LOG_TAG, "Error while testing settings", t); showErrorDialog( R.string.account_setup_failed_dlg_server_message_fmt, (t.getMessage() == null ? "" : t.getMessage())); diff --git a/src/com/android/email/activity/setup/AccountSetupComposition.java b/src/com/fsck/k9/activity/setup/AccountSetupComposition.java similarity index 95% rename from src/com/android/email/activity/setup/AccountSetupComposition.java rename to src/com/fsck/k9/activity/setup/AccountSetupComposition.java index d21b62575..33094e48e 100644 --- a/src/com/android/email/activity/setup/AccountSetupComposition.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupComposition.java @@ -1,4 +1,4 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.app.Activity; import android.content.Intent; @@ -6,10 +6,10 @@ import android.os.Bundle; import android.view.KeyEvent; import android.widget.EditText; import android.widget.RadioButton; -import com.android.email.Account; -import com.android.email.K9Activity; -import com.android.email.Preferences; -import com.android.email.R; +import com.fsck.k9.Account; +import com.fsck.k9.K9Activity; +import com.fsck.k9.Preferences; +import com.fsck.k9.R; public class AccountSetupComposition extends K9Activity { diff --git a/src/com/android/email/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java similarity index 99% rename from src/com/android/email/activity/setup/AccountSetupIncoming.java rename to src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index a868dca04..9e7ad12d0 100644 --- a/src/com/android/email/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.app.Activity; import android.content.Intent; @@ -11,8 +11,8 @@ import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.*; -import com.android.email.*; -import com.android.email.activity.ChooseFolder; +import com.fsck.k9.*; +import com.fsck.k9.activity.ChooseFolder; import java.net.URI; import java.net.URISyntaxException; @@ -517,7 +517,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener private void failure(Exception use) { - Log.e(Email.LOG_TAG, "Failure", use); + Log.e(K9.LOG_TAG, "Failure", use); String toastText = getString(R.string.account_setup_bad_uri, use.getMessage()); Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); diff --git a/src/com/android/email/activity/setup/AccountSetupNames.java b/src/com/fsck/k9/activity/setup/AccountSetupNames.java similarity index 94% rename from src/com/android/email/activity/setup/AccountSetupNames.java rename to src/com/fsck/k9/activity/setup/AccountSetupNames.java index dca8d2833..d779faa0a 100644 --- a/src/com/android/email/activity/setup/AccountSetupNames.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupNames.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -12,8 +12,8 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; -import com.android.email.*; -import com.android.email.activity.FolderList; +import com.fsck.k9.*; +import com.fsck.k9.activity.FolderList; public class AccountSetupNames extends K9Activity implements OnClickListener { @@ -95,7 +95,7 @@ public class AccountSetupNames extends K9Activity implements OnClickListener } mAccount.setName(mName.getText().toString()); mAccount.save(Preferences.getPreferences(this)); - FolderList.actionHandleAccount(this, mAccount, Email.INBOX); + FolderList.actionHandleAccount(this, mAccount, K9.INBOX); finish(); } diff --git a/src/com/android/email/activity/setup/AccountSetupOptions.java b/src/com/fsck/k9/activity/setup/AccountSetupOptions.java similarity index 96% rename from src/com/android/email/activity/setup/AccountSetupOptions.java rename to src/com/fsck/k9/activity/setup/AccountSetupOptions.java index 45b56a70c..d283281eb 100644 --- a/src/com/android/email/activity/setup/AccountSetupOptions.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupOptions.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -10,8 +10,8 @@ import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.Spinner; -import com.android.email.*; -import com.android.email.mail.Store; +import com.fsck.k9.*; +import com.fsck.k9.mail.Store; public class AccountSetupOptions extends K9Activity implements OnClickListener { @@ -122,7 +122,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not get remote store", e); + Log.e(K9.LOG_TAG, "Could not get remote store", e); } @@ -163,7 +163,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener { Preferences.getPreferences(this).setDefaultAccount(mAccount); } - Email.setServicesEnabled(this); + K9.setServicesEnabled(this); AccountSetupNames.actionSetNames(this, mAccount); finish(); } diff --git a/src/com/android/email/activity/setup/AccountSetupOutgoing.java b/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java similarity index 98% rename from src/com/android/email/activity/setup/AccountSetupOutgoing.java rename to src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java index d2b5a87d2..76fb4493d 100644 --- a/src/com/android/email/activity/setup/AccountSetupOutgoing.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -13,7 +13,7 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.*; import android.widget.CompoundButton.OnCheckedChangeListener; -import com.android.email.*; +import com.fsck.k9.*; import java.net.URI; import java.net.URISyntaxException; @@ -326,7 +326,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, } private void failure(Exception use) { - Log.e(Email.LOG_TAG, "Failure", use); + Log.e(K9.LOG_TAG, "Failure", use); String toastText = getString(R.string.account_setup_bad_uri, use.getMessage()); Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); diff --git a/src/com/android/email/activity/setup/FolderSettings.java b/src/com/fsck/k9/activity/setup/FolderSettings.java similarity index 86% rename from src/com/android/email/activity/setup/FolderSettings.java rename to src/com/fsck/k9/activity/setup/FolderSettings.java index 53c5cd236..8dfc7c219 100644 --- a/src/com/android/email/activity/setup/FolderSettings.java +++ b/src/com/fsck/k9/activity/setup/FolderSettings.java @@ -1,5 +1,5 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -8,17 +8,17 @@ import android.preference.ListPreference; import android.preference.Preference; import android.util.Log; import android.view.KeyEvent; -import com.android.email.*; -import com.android.email.mail.Folder.FolderClass; -import com.android.email.mail.MessagingException; -import com.android.email.mail.Store; -import com.android.email.mail.store.LocalStore.LocalFolder; +import com.fsck.k9.*; +import com.fsck.k9.mail.Folder.FolderClass; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.Store; +import com.fsck.k9.mail.store.LocalStore.LocalFolder; public class FolderSettings extends K9PreferenceActivity { - private static final String EXTRA_FOLDER_NAME = "com.android.email.folderName"; - private static final String EXTRA_ACCOUNT = "com.android.email.account"; + private static final String EXTRA_FOLDER_NAME = "com.fsck.k9.folderName"; + private static final String EXTRA_ACCOUNT = "com.fsck.k9.account"; private static final String PREFERENCE_TOP_CATERGORY = "folder_settings"; private static final String PREFERENCE_DISPLAY_CLASS = "folder_settings_folder_display_mode"; @@ -56,7 +56,7 @@ public class FolderSettings extends K9PreferenceActivity } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to edit folder " + folderName + " preferences", me); + Log.e(K9.LOG_TAG, "Unable to edit folder " + folderName + " preferences", me); return; } @@ -69,7 +69,7 @@ public class FolderSettings extends K9PreferenceActivity } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not get remote store", e); + Log.e(K9.LOG_TAG, "Could not get remote store", e); } addPreferencesFromResource(R.xml.folder_settings_preferences); @@ -134,7 +134,7 @@ public class FolderSettings extends K9PreferenceActivity } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Could not refresh folder preferences for folder " + mFolder.getName(), me); + Log.e(K9.LOG_TAG, "Could not refresh folder preferences for folder " + mFolder.getName(), me); } } @@ -147,11 +147,11 @@ public class FolderSettings extends K9PreferenceActivity try { mFolder.save(Preferences.getPreferences(this)); - Email.setServicesEnabled(this); + K9.setServicesEnabled(this); } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Could not refresh folder preferences for folder " + mFolder.getName(), me); + Log.e(K9.LOG_TAG, "Could not refresh folder preferences for folder " + mFolder.getName(), me); } } diff --git a/src/com/android/email/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java similarity index 84% rename from src/com/android/email/activity/setup/Prefs.java rename to src/com/fsck/k9/activity/setup/Prefs.java index ce2de6f41..f19b563f2 100644 --- a/src/com/android/email/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -1,4 +1,4 @@ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.content.Context; import android.content.Intent; @@ -9,12 +9,12 @@ import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.view.KeyEvent; -import com.android.email.Email; -import com.android.email.K9PreferenceActivity; -import com.android.email.Preferences; -import com.android.email.R; -import com.android.email.activity.DateFormatter; -import com.android.email.service.MailService; +import com.fsck.k9.K9; +import com.fsck.k9.K9PreferenceActivity; +import com.fsck.k9.Preferences; +import com.fsck.k9.R; +import com.fsck.k9.activity.DateFormatter; +import com.fsck.k9.service.MailService; public class Prefs extends K9PreferenceActivity { @@ -49,7 +49,7 @@ public class Prefs extends K9PreferenceActivity addPreferencesFromResource(R.xml.global_preferences); mTheme = (ListPreference) findPreference(PREFERENCE_THEME); - mTheme.setValue(String.valueOf(Email.getK9Theme() == android.R.style.Theme ? "dark" : "light")); + mTheme.setValue(String.valueOf(K9.getK9Theme() == android.R.style.Theme ? "dark" : "light")); mTheme.setSummary(mTheme.getEntry()); mTheme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -91,7 +91,7 @@ public class Prefs extends K9PreferenceActivity }); mBackgroundOps = (ListPreference) findPreference(PREFERENCE_BACKGROUND_OPS); - initBackgroundOps = Email.getBackgroundOps().toString(); + initBackgroundOps = K9.getBackgroundOps().toString(); mBackgroundOps.setValue(initBackgroundOps); mBackgroundOps.setSummary(mBackgroundOps.getEntry()); mBackgroundOps.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() @@ -109,8 +109,8 @@ public class Prefs extends K9PreferenceActivity mDebugLogging = (CheckBoxPreference)findPreference(PREFERENCE_DEBUG_LOGGING); mSensitiveLogging = (CheckBoxPreference)findPreference(PREFERENCE_SENSITIVE_LOGGING); - mDebugLogging.setChecked(Email.DEBUG); - mSensitiveLogging.setChecked(Email.DEBUG_SENSITIVE); + mDebugLogging.setChecked(K9.DEBUG); + mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE); } @@ -123,13 +123,13 @@ public class Prefs extends K9PreferenceActivity private void saveSettings() { SharedPreferences preferences = Preferences.getPreferences(this).getPreferences(); - Email.setK9Theme(mTheme.getValue().equals("dark") ? android.R.style.Theme : android.R.style.Theme_Light); - Email.DEBUG = mDebugLogging.isChecked(); - Email.DEBUG_SENSITIVE = mSensitiveLogging.isChecked(); + K9.setK9Theme(mTheme.getValue().equals("dark") ? android.R.style.Theme : android.R.style.Theme_Light); + K9.DEBUG = mDebugLogging.isChecked(); + K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked(); String newBackgroundOps = mBackgroundOps.getValue(); - Email.setBackgroundOps(newBackgroundOps); + K9.setBackgroundOps(newBackgroundOps); Editor editor = preferences.edit(); - Email.save(editor); + K9.save(editor); DateFormatter.setDateFormat(editor, mDateFormat.getValue()); editor.commit(); if (newBackgroundOps.equals(initBackgroundOps) == false) diff --git a/src/com/android/email/activity/setup/SpinnerOption.java b/src/com/fsck/k9/activity/setup/SpinnerOption.java similarity index 94% rename from src/com/android/email/activity/setup/SpinnerOption.java rename to src/com/fsck/k9/activity/setup/SpinnerOption.java index 5871707ec..10a6c04c6 100644 --- a/src/com/android/email/activity/setup/SpinnerOption.java +++ b/src/com/fsck/k9/activity/setup/SpinnerOption.java @@ -2,7 +2,7 @@ * */ -package com.android.email.activity.setup; +package com.fsck.k9.activity.setup; import android.widget.Spinner; diff --git a/src/com/android/email/codec/binary/Base64.java b/src/com/fsck/k9/codec/binary/Base64.java similarity index 99% rename from src/com/android/email/codec/binary/Base64.java rename to src/com/fsck/k9/codec/binary/Base64.java index 50ebbc0d2..36b6d087e 100644 --- a/src/com/android/email/codec/binary/Base64.java +++ b/src/com/fsck/k9/codec/binary/Base64.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.email.codec.binary; +package com.fsck.k9.codec.binary; import org.apache.commons.codec.BinaryDecoder; import org.apache.commons.codec.BinaryEncoder; diff --git a/src/com/android/email/codec/binary/Base64OutputStream.java b/src/com/fsck/k9/codec/binary/Base64OutputStream.java similarity index 99% rename from src/com/android/email/codec/binary/Base64OutputStream.java rename to src/com/fsck/k9/codec/binary/Base64OutputStream.java index 3145e4dd9..7a91ee782 100644 --- a/src/com/android/email/codec/binary/Base64OutputStream.java +++ b/src/com/fsck/k9/codec/binary/Base64OutputStream.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.android.email.codec.binary; +package com.fsck.k9.codec.binary; import java.io.FilterOutputStream; import java.io.IOException; diff --git a/src/com/android/email/mail/Address.java b/src/com/fsck/k9/mail/Address.java similarity index 98% rename from src/com/android/email/mail/Address.java rename to src/com/fsck/k9/mail/Address.java index 8ee5d91c9..7ef933767 100644 --- a/src/com/android/email/mail/Address.java +++ b/src/com/fsck/k9/mail/Address.java @@ -1,11 +1,11 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import android.text.util.Rfc822Token; import android.text.util.Rfc822Tokenizer; import android.util.Log; -import com.android.email.Email; -import com.android.email.Utility; +import com.fsck.k9.K9; +import com.fsck.k9.Utility; import org.apache.james.mime4j.codec.EncoderUtil; import org.apache.james.mime4j.field.address.AddressList; import org.apache.james.mime4j.field.address.Mailbox; @@ -130,7 +130,7 @@ public class Address } else { - Log.e(Email.LOG_TAG, "Unknown address type from Mime4J: " + Log.e(K9.LOG_TAG, "Unknown address type from Mime4J: " + address.getClass().toString()); } diff --git a/src/com/android/email/mail/AuthenticationFailedException.java b/src/com/fsck/k9/mail/AuthenticationFailedException.java similarity index 91% rename from src/com/android/email/mail/AuthenticationFailedException.java rename to src/com/fsck/k9/mail/AuthenticationFailedException.java index bf65bf20c..1df57277d 100644 --- a/src/com/android/email/mail/AuthenticationFailedException.java +++ b/src/com/fsck/k9/mail/AuthenticationFailedException.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public class AuthenticationFailedException extends MessagingException { diff --git a/src/com/android/email/mail/Body.java b/src/com/fsck/k9/mail/Body.java similarity index 89% rename from src/com/android/email/mail/Body.java rename to src/com/fsck/k9/mail/Body.java index 920ed1ac5..21d671d99 100644 --- a/src/com/android/email/mail/Body.java +++ b/src/com/fsck/k9/mail/Body.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.io.IOException; import java.io.InputStream; diff --git a/src/com/android/email/mail/BodyPart.java b/src/com/fsck/k9/mail/BodyPart.java similarity index 78% rename from src/com/android/email/mail/BodyPart.java rename to src/com/fsck/k9/mail/BodyPart.java index 87c738dbc..0e43f7117 100644 --- a/src/com/android/email/mail/BodyPart.java +++ b/src/com/fsck/k9/mail/BodyPart.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public abstract class BodyPart implements Part { diff --git a/src/com/android/email/mail/CertificateValidationException.java b/src/com/fsck/k9/mail/CertificateValidationException.java similarity index 91% rename from src/com/android/email/mail/CertificateValidationException.java rename to src/com/fsck/k9/mail/CertificateValidationException.java index 9e7773e15..983010953 100644 --- a/src/com/android/email/mail/CertificateValidationException.java +++ b/src/com/fsck/k9/mail/CertificateValidationException.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public class CertificateValidationException extends MessagingException { diff --git a/src/com/android/email/mail/FetchProfile.java b/src/com/fsck/k9/mail/FetchProfile.java similarity index 95% rename from src/com/android/email/mail/FetchProfile.java rename to src/com/fsck/k9/mail/FetchProfile.java index 66b173765..b579b0052 100644 --- a/src/com/android/email/mail/FetchProfile.java +++ b/src/com/fsck/k9/mail/FetchProfile.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.util.ArrayList; diff --git a/src/com/android/email/mail/Flag.java b/src/com/fsck/k9/mail/Flag.java similarity index 97% rename from src/com/android/email/mail/Flag.java rename to src/com/fsck/k9/mail/Flag.java index 081fdf8f6..d29325039 100644 --- a/src/com/android/email/mail/Flag.java +++ b/src/com/fsck/k9/mail/Flag.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; /** * Flags that can be applied to Messages. diff --git a/src/com/android/email/mail/Folder.java b/src/com/fsck/k9/mail/Folder.java similarity index 98% rename from src/com/android/email/mail/Folder.java rename to src/com/fsck/k9/mail/Folder.java index dce84cedd..2bffa3d54 100644 --- a/src/com/android/email/mail/Folder.java +++ b/src/com/fsck/k9/mail/Folder.java @@ -1,6 +1,6 @@ -package com.android.email.mail; +package com.fsck.k9.mail; -import com.android.email.Preferences; +import com.fsck.k9.Preferences; public abstract class Folder diff --git a/src/com/android/email/mail/Message.java b/src/com/fsck/k9/mail/Message.java similarity index 99% rename from src/com/android/email/mail/Message.java rename to src/com/fsck/k9/mail/Message.java index 84b9dee1a..5344b9909 100644 --- a/src/com/android/email/mail/Message.java +++ b/src/com/fsck/k9/mail/Message.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.util.Date; import java.util.HashSet; diff --git a/src/com/android/email/mail/MessageDateComparator.java b/src/com/fsck/k9/mail/MessageDateComparator.java similarity index 94% rename from src/com/android/email/mail/MessageDateComparator.java rename to src/com/fsck/k9/mail/MessageDateComparator.java index cc6114b8e..c6adcc25b 100644 --- a/src/com/android/email/mail/MessageDateComparator.java +++ b/src/com/fsck/k9/mail/MessageDateComparator.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.util.Comparator; diff --git a/src/com/android/email/mail/MessageRemovalListener.java b/src/com/fsck/k9/mail/MessageRemovalListener.java similarity index 74% rename from src/com/android/email/mail/MessageRemovalListener.java rename to src/com/fsck/k9/mail/MessageRemovalListener.java index b07ca4f57..39744a605 100644 --- a/src/com/android/email/mail/MessageRemovalListener.java +++ b/src/com/fsck/k9/mail/MessageRemovalListener.java @@ -1,4 +1,4 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public interface MessageRemovalListener { diff --git a/src/com/android/email/mail/MessageRetrievalListener.java b/src/com/fsck/k9/mail/MessageRetrievalListener.java similarity index 88% rename from src/com/android/email/mail/MessageRetrievalListener.java rename to src/com/fsck/k9/mail/MessageRetrievalListener.java index 7ab0c5890..1dd332398 100644 --- a/src/com/android/email/mail/MessageRetrievalListener.java +++ b/src/com/fsck/k9/mail/MessageRetrievalListener.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public interface MessageRetrievalListener { diff --git a/src/com/android/email/mail/MessagingException.java b/src/com/fsck/k9/mail/MessagingException.java similarity index 96% rename from src/com/android/email/mail/MessagingException.java rename to src/com/fsck/k9/mail/MessagingException.java index b60e175ee..7654f9155 100644 --- a/src/com/android/email/mail/MessagingException.java +++ b/src/com/fsck/k9/mail/MessagingException.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public class MessagingException extends Exception { diff --git a/src/com/android/email/mail/Multipart.java b/src/com/fsck/k9/mail/Multipart.java similarity index 93% rename from src/com/android/email/mail/Multipart.java rename to src/com/fsck/k9/mail/Multipart.java index 389bbb76e..ad2446b17 100644 --- a/src/com/android/email/mail/Multipart.java +++ b/src/com/fsck/k9/mail/Multipart.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.util.ArrayList; diff --git a/src/com/android/email/mail/NoSuchProviderException.java b/src/com/fsck/k9/mail/NoSuchProviderException.java similarity index 91% rename from src/com/android/email/mail/NoSuchProviderException.java rename to src/com/fsck/k9/mail/NoSuchProviderException.java index f3407153a..54f0c7ef7 100644 --- a/src/com/android/email/mail/NoSuchProviderException.java +++ b/src/com/fsck/k9/mail/NoSuchProviderException.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; public class NoSuchProviderException extends MessagingException { diff --git a/src/com/android/email/mail/Part.java b/src/com/fsck/k9/mail/Part.java similarity index 96% rename from src/com/android/email/mail/Part.java rename to src/com/fsck/k9/mail/Part.java index b56bf6c21..74eb99188 100644 --- a/src/com/android/email/mail/Part.java +++ b/src/com/fsck/k9/mail/Part.java @@ -1,5 +1,5 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.io.IOException; import java.io.OutputStream; diff --git a/src/com/android/email/mail/PushReceiver.java b/src/com/fsck/k9/mail/PushReceiver.java similarity index 93% rename from src/com/android/email/mail/PushReceiver.java rename to src/com/fsck/k9/mail/PushReceiver.java index 904b28586..75af7b02c 100644 --- a/src/com/android/email/mail/PushReceiver.java +++ b/src/com/fsck/k9/mail/PushReceiver.java @@ -1,4 +1,4 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.util.List; diff --git a/src/com/android/email/mail/Pusher.java b/src/com/fsck/k9/mail/Pusher.java similarity index 89% rename from src/com/android/email/mail/Pusher.java rename to src/com/fsck/k9/mail/Pusher.java index 37d095b88..44cf5254c 100644 --- a/src/com/android/email/mail/Pusher.java +++ b/src/com/fsck/k9/mail/Pusher.java @@ -1,4 +1,4 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import java.util.List; diff --git a/src/com/android/email/mail/Store.java b/src/com/fsck/k9/mail/Store.java similarity index 93% rename from src/com/android/email/mail/Store.java rename to src/com/fsck/k9/mail/Store.java index a0277981d..2af41fede 100644 --- a/src/com/android/email/mail/Store.java +++ b/src/com/fsck/k9/mail/Store.java @@ -1,11 +1,11 @@ -package com.android.email.mail; +package com.fsck.k9.mail; import android.app.Application; -import com.android.email.mail.store.ImapStore; -import com.android.email.mail.store.LocalStore; -import com.android.email.mail.store.Pop3Store; -import com.android.email.mail.store.WebDavStore; +import com.fsck.k9.mail.store.ImapStore; +import com.fsck.k9.mail.store.LocalStore; +import com.fsck.k9.mail.store.Pop3Store; +import com.fsck.k9.mail.store.WebDavStore; import java.util.HashMap; diff --git a/src/com/android/email/mail/Transport.java b/src/com/fsck/k9/mail/Transport.java similarity index 85% rename from src/com/android/email/mail/Transport.java rename to src/com/fsck/k9/mail/Transport.java index d925e1cbf..66d99fc27 100644 --- a/src/com/android/email/mail/Transport.java +++ b/src/com/fsck/k9/mail/Transport.java @@ -1,8 +1,8 @@ -package com.android.email.mail; +package com.fsck.k9.mail; -import com.android.email.mail.transport.SmtpTransport; -import com.android.email.mail.transport.WebDavTransport; +import com.fsck.k9.mail.transport.SmtpTransport; +import com.fsck.k9.mail.transport.WebDavTransport; public abstract class Transport { diff --git a/src/com/android/email/mail/internet/BinaryTempFileBody.java b/src/com/fsck/k9/mail/internet/BinaryTempFileBody.java similarity index 91% rename from src/com/android/email/mail/internet/BinaryTempFileBody.java rename to src/com/fsck/k9/mail/internet/BinaryTempFileBody.java index 31b84ea62..e2c52bc58 100644 --- a/src/com/android/email/mail/internet/BinaryTempFileBody.java +++ b/src/com/fsck/k9/mail/internet/BinaryTempFileBody.java @@ -1,8 +1,8 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; -import com.android.email.codec.binary.Base64OutputStream; -import com.android.email.mail.Body; -import com.android.email.mail.MessagingException; +import com.fsck.k9.codec.binary.Base64OutputStream; +import com.fsck.k9.mail.Body; +import com.fsck.k9.mail.MessagingException; import org.apache.commons.io.IOUtils; import java.io.*; diff --git a/src/com/android/email/mail/internet/MimeBodyPart.java b/src/com/fsck/k9/mail/internet/MimeBodyPart.java similarity index 92% rename from src/com/android/email/mail/internet/MimeBodyPart.java rename to src/com/fsck/k9/mail/internet/MimeBodyPart.java index 48a2d1ad1..dfb39e366 100644 --- a/src/com/android/email/mail/internet/MimeBodyPart.java +++ b/src/com/fsck/k9/mail/internet/MimeBodyPart.java @@ -1,9 +1,9 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; -import com.android.email.mail.Body; -import com.android.email.mail.BodyPart; -import com.android.email.mail.MessagingException; +import com.fsck.k9.mail.Body; +import com.fsck.k9.mail.BodyPart; +import com.fsck.k9.mail.MessagingException; import java.io.BufferedWriter; import java.io.IOException; @@ -72,9 +72,9 @@ public class MimeBodyPart extends BodyPart public void setBody(Body body) throws MessagingException { this.mBody = body; - if (body instanceof com.android.email.mail.Multipart) + if (body instanceof com.fsck.k9.mail.Multipart) { - com.android.email.mail.Multipart multipart = ((com.android.email.mail.Multipart)body); + com.fsck.k9.mail.Multipart multipart = ((com.fsck.k9.mail.Multipart)body); multipart.setParent(this); setHeader(MimeHeader.HEADER_CONTENT_TYPE, multipart.getContentType()); } diff --git a/src/com/android/email/mail/internet/MimeHeader.java b/src/com/fsck/k9/mail/internet/MimeHeader.java similarity index 97% rename from src/com/android/email/mail/internet/MimeHeader.java rename to src/com/fsck/k9/mail/internet/MimeHeader.java index b061324de..8537f66fc 100644 --- a/src/com/android/email/mail/internet/MimeHeader.java +++ b/src/com/fsck/k9/mail/internet/MimeHeader.java @@ -1,8 +1,8 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; -import com.android.email.Utility; -import com.android.email.mail.MessagingException; +import com.fsck.k9.Utility; +import com.fsck.k9.mail.MessagingException; import org.apache.james.mime4j.codec.EncoderUtil; import java.io.BufferedWriter; diff --git a/src/com/android/email/mail/internet/MimeMessage.java b/src/com/fsck/k9/mail/internet/MimeMessage.java similarity index 98% rename from src/com/android/email/mail/internet/MimeMessage.java rename to src/com/fsck/k9/mail/internet/MimeMessage.java index 093e1f606..e4c1009a0 100644 --- a/src/com/android/email/mail/internet/MimeMessage.java +++ b/src/com/fsck/k9/mail/internet/MimeMessage.java @@ -1,7 +1,7 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; -import com.android.email.mail.*; +import com.fsck.k9.mail.*; import org.apache.james.mime4j.BodyDescriptor; import org.apache.james.mime4j.ContentHandler; import org.apache.james.mime4j.EOLConvertingInputStream; @@ -104,7 +104,7 @@ public class MimeMessage extends Message * * @see #mSentDate * @param sentDate - * @throws com.android.email.mail.MessagingException + * @throws com.fsck.k9.mail.MessagingException */ public void addSentDate(Date sentDate) throws MessagingException { @@ -368,9 +368,9 @@ public class MimeMessage extends Message public void setBody(Body body) throws MessagingException { this.mBody = body; - if (body instanceof com.android.email.mail.Multipart) + if (body instanceof com.fsck.k9.mail.Multipart) { - com.android.email.mail.Multipart multipart = ((com.android.email.mail.Multipart)body); + com.fsck.k9.mail.Multipart multipart = ((com.fsck.k9.mail.Multipart)body); multipart.setParent(this); setHeader(MimeHeader.HEADER_CONTENT_TYPE, multipart.getContentType()); setHeader("MIME-Version", "1.0"); diff --git a/src/com/android/email/mail/internet/MimeMultipart.java b/src/com/fsck/k9/mail/internet/MimeMultipart.java similarity index 94% rename from src/com/android/email/mail/internet/MimeMultipart.java rename to src/com/fsck/k9/mail/internet/MimeMultipart.java index 0443ee617..29f274228 100644 --- a/src/com/android/email/mail/internet/MimeMultipart.java +++ b/src/com/fsck/k9/mail/internet/MimeMultipart.java @@ -1,9 +1,9 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; -import com.android.email.mail.BodyPart; -import com.android.email.mail.MessagingException; -import com.android.email.mail.Multipart; +import com.fsck.k9.mail.BodyPart; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.Multipart; import java.io.*; diff --git a/src/com/android/email/mail/internet/MimeUtility.java b/src/com/fsck/k9/mail/internet/MimeUtility.java similarity index 98% rename from src/com/android/email/mail/internet/MimeUtility.java rename to src/com/fsck/k9/mail/internet/MimeUtility.java index 5ccfae0f9..eec09711e 100644 --- a/src/com/android/email/mail/internet/MimeUtility.java +++ b/src/com/fsck/k9/mail/internet/MimeUtility.java @@ -1,9 +1,9 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; import android.util.Log; -import com.android.email.Email; -import com.android.email.mail.*; +import com.fsck.k9.K9; +import com.fsck.k9.mail.*; import org.apache.commons.io.IOUtils; import org.apache.james.mime4j.decoder.Base64InputStream; import org.apache.james.mime4j.decoder.DecoderUtil; @@ -216,7 +216,7 @@ public class MimeUtility * 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. */ - Log.e(Email.LOG_TAG, "Unable to getTextFromPart", e); + Log.e(K9.LOG_TAG, "Unable to getTextFromPart", e); } return null; } diff --git a/src/com/android/email/mail/internet/TextBody.java b/src/com/fsck/k9/mail/internet/TextBody.java similarity index 86% rename from src/com/android/email/mail/internet/TextBody.java rename to src/com/fsck/k9/mail/internet/TextBody.java index 75aa97b1e..a2e2e673f 100644 --- a/src/com/android/email/mail/internet/TextBody.java +++ b/src/com/fsck/k9/mail/internet/TextBody.java @@ -1,9 +1,9 @@ -package com.android.email.mail.internet; +package com.fsck.k9.mail.internet; -import com.android.email.codec.binary.Base64; -import com.android.email.mail.Body; -import com.android.email.mail.MessagingException; +import com.fsck.k9.codec.binary.Base64; +import com.fsck.k9.mail.Body; +import com.fsck.k9.mail.MessagingException; import java.io.*; diff --git a/src/com/android/email/mail/store/ImapResponseParser.java b/src/com/fsck/k9/mail/store/ImapResponseParser.java similarity index 97% rename from src/com/android/email/mail/store/ImapResponseParser.java rename to src/com/fsck/k9/mail/store/ImapResponseParser.java index b5dea3874..f2f7c6b6f 100644 --- a/src/com/android/email/mail/store/ImapResponseParser.java +++ b/src/com/fsck/k9/mail/store/ImapResponseParser.java @@ -2,13 +2,13 @@ * */ -package com.android.email.mail.store; +package com.fsck.k9.mail.store; import android.util.Log; -import com.android.email.Email; -import com.android.email.FixedLengthInputStream; -import com.android.email.PeekableInputStream; -import com.android.email.mail.MessagingException; +import com.fsck.k9.K9; +import com.fsck.k9.FixedLengthInputStream; +import com.fsck.k9.PeekableInputStream; +import com.fsck.k9.mail.MessagingException; import java.io.IOException; import java.io.InputStream; @@ -65,9 +65,9 @@ public class ImapResponseParser response.mTag = parseTaggedResponse(); readTokens(response); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "<<< " + response.toString()); + Log.v(K9.LOG_TAG, "<<< " + response.toString()); } return response; } diff --git a/src/com/android/email/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java similarity index 90% rename from src/com/android/email/mail/store/ImapStore.java rename to src/com/fsck/k9/mail/store/ImapStore.java index bce5f2563..9eb80e50b 100644 --- a/src/com/android/email/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -1,16 +1,16 @@ -package com.android.email.mail.store; +package com.fsck.k9.mail.store; import android.util.Log; -import com.android.email.Email; -import com.android.email.PeekableInputStream; -import com.android.email.Utility; -import com.android.email.mail.*; -import com.android.email.mail.internet.*; -import com.android.email.mail.store.ImapResponseParser.ImapList; -import com.android.email.mail.store.ImapResponseParser.ImapResponse; -import com.android.email.mail.transport.CountingOutputStream; -import com.android.email.mail.transport.EOLConvertingOutputStream; +import com.fsck.k9.K9; +import com.fsck.k9.PeekableInputStream; +import com.fsck.k9.Utility; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.internet.*; +import com.fsck.k9.mail.store.ImapResponseParser.ImapList; +import com.fsck.k9.mail.store.ImapResponseParser.ImapResponse; +import com.fsck.k9.mail.transport.CountingOutputStream; +import com.fsck.k9.mail.transport.EOLConvertingOutputStream; import com.beetstra.jutf7.CharsetProvider; import javax.net.ssl.SSLContext; @@ -237,7 +237,7 @@ public class ImapStore extends Store mCombinedPrefix = null; } - if (folder.equalsIgnoreCase(Email.INBOX)) + if (folder.equalsIgnoreCase(K9.INBOX)) { continue; } @@ -419,7 +419,7 @@ public class ImapStore extends Store public String getPrefixedName() { String prefixedName = ""; - if (!Email.INBOX.equalsIgnoreCase(mName)) + if (!K9.INBOX.equalsIgnoreCase(mName)) { prefixedName = getCombinedPrefix(); } @@ -490,9 +490,9 @@ public class ImapStore extends Store if (response.get(0).equals("LIST")) { mPathDelimeter = response.getString(2); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got path delimeter '" + mPathDelimeter + "' for " + getLogId()); + Log.d(K9.LOG_TAG, "Got path delimeter '" + mPathDelimeter + "' for " + getLogId()); } } } @@ -551,7 +551,7 @@ public class ImapStore extends Store } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to open connection for " + getLogId(), me); + Log.e(K9.LOG_TAG, "Unable to open connection for " + getLogId(), me); throw me; } @@ -588,7 +588,7 @@ public class ImapStore extends Store } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to expunge remote folder " + getName(), me); + Log.e(K9.LOG_TAG, "Unable to expunge remote folder " + getName(), me); } synchronized (this) { @@ -743,15 +743,15 @@ public class ImapStore extends Store /* * If the remote trash folder doesn't exist we try to create it. */ - Log.i(Email.LOG_TAG, "IMAPMessage.delete: attempting to create remote '" + trashFolderName + "' folder for " + getLogId()); + Log.i(K9.LOG_TAG, "IMAPMessage.delete: attempting to create remote '" + trashFolderName + "' folder for " + getLogId()); remoteTrashFolder.create(FolderType.HOLDS_MESSAGES); } if (remoteTrashFolder.exists()) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "IMAPMessage.delete: copying remote " + messages.length + " messages to '" + trashFolderName + "' for " + getLogId()); + Log.d(K9.LOG_TAG, "IMAPMessage.delete: copying remote " + messages.length + " messages to '" + trashFolderName + "' for " + getLogId()); } moveMessages(messages, remoteTrashFolder); expunge(); @@ -863,13 +863,13 @@ public class ImapStore extends Store List responses = searcher.search(); // for (ImapResponse response : responses) { - // Log.d(Email.LOG_TAG, "Got search response: " + response.get(0) + ", size " + response.size()); + // Log.d(K9.LOG_TAG, "Got search response: " + response.get(0) + ", size " + response.size()); if (response.get(0).equals("SEARCH")) { gotSearchValues = true; for (int i = 1, count = response.size(); i < count; i++) { - // Log.d(Email.LOG_TAG, "Got search response UID: " + response.getString(i)); + // Log.d(K9.LOG_TAG, "Got search response UID: " + response.getString(i)); uids.add(Integer.parseInt(response.getString(i))); } @@ -985,7 +985,7 @@ public class ImapStore extends Store fetchFields.add("INTERNALDATE"); fetchFields.add("RFC822.SIZE"); fetchFields.add("BODY.PEEK[HEADER.FIELDS (date subject from content-type to cc reply-to " - + Email.K9MAIL_IDENTITY + ")]"); + + K9.K9MAIL_IDENTITY + ")]"); } if (fp.contains(FetchProfile.Item.STRUCTURE)) { @@ -1027,9 +1027,9 @@ public class ImapStore extends Store do { response = mConnection.readResponse(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "response for fetch: " + response + " for " + getLogId()); + Log.v(K9.LOG_TAG, "response for fetch: " + response + " for " + getLogId()); } if (response.mTag == null && response.get(1).equals("FETCH")) { @@ -1039,7 +1039,7 @@ public class ImapStore extends Store Message message = messageMap.get(uid); if (message == null) { - Log.d(Email.LOG_TAG, "Do not have message in messageMap for UID " + uid + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Do not have message in messageMap for UID " + uid + " for " + getLogId()); handleUntaggedResponse(response); continue; } @@ -1099,9 +1099,9 @@ public class ImapStore extends Store } catch (MessagingException e) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Error handling message for " + getLogId(), e); + Log.d(K9.LOG_TAG, "Error handling message for " + getLogId(), e); } message.setBody(null); } @@ -1127,7 +1127,7 @@ public class ImapStore extends Store Object literal = fetchList.getObject(fetchList.size() - 1); if (literal instanceof InputStream) { - //Log.i(Email.LOG_TAG, "Part is an InputStream/Literal"); + //Log.i(K9.LOG_TAG, "Part is an InputStream/Literal"); InputStream bodyStream = (InputStream)literal; String contentType = part.getContentType(); String contentTransferEncoding = part.getHeader( @@ -1140,9 +1140,9 @@ public class ImapStore extends Store { String bodyString = (String)literal; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Part is a String: '" + bodyString + "' for " + getLogId()); + Log.v(K9.LOG_TAG, "Part is a String: '" + bodyString + "' for " + getLogId()); } InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes()); String contentTransferEncoding = part.getHeader( @@ -1212,9 +1212,9 @@ public class ImapStore extends Store if ("UIDNEXT".equals(key)) { uidNext = bracketed.getNumber(1); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got UidNext = " + uidNext + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Got UidNext = " + uidNext + " for " + getLogId()); } } } @@ -1231,15 +1231,15 @@ public class ImapStore extends Store */ protected void handleUntaggedResponse(ImapResponse response) { - //Log.i(Email.LOG_TAG, "Got response with size " + response.size() + ": " + response); + //Log.i(K9.LOG_TAG, "Got response with size " + response.size() + ": " + response); if (response.mTag == null && response.size() > 1) { if (response.get(1).equals("EXISTS")) { mMessageCount = response.getNumber(0); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got untagged EXISTS with value " + mMessageCount + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Got untagged EXISTS with value " + mMessageCount + " for " + getLogId()); } } handlePossibleUidNext(response); @@ -1247,9 +1247,9 @@ public class ImapStore extends Store if (response.get(1).equals("EXPUNGE") && mMessageCount > 0) { mMessageCount--; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got untagged EXPUNGE with value " + mMessageCount + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Got untagged EXPUNGE with value " + mMessageCount + " for " + getLogId()); } } // if (response.size() > 1) { @@ -1272,7 +1272,7 @@ public class ImapStore extends Store // sb.append(' '); // } // -// Log.w(Email.LOG_TAG, "ALERT: " + sb.toString() + " for " + getLogId()); +// Log.w(K9.LOG_TAG, "ALERT: " + sb.toString() + " for " + getLogId()); // } // } // } @@ -1281,7 +1281,7 @@ public class ImapStore extends Store // } // } } - //Log.i(Email.LOG_TAG, "mMessageCount = " + mMessageCount + " for " + getLogId()); + //Log.i(K9.LOG_TAG, "mMessageCount = " + mMessageCount + " for " + getLogId()); } private void parseBodyStructure(ImapList bs, Part part, String id) @@ -1505,9 +1505,9 @@ public class ImapStore extends Store while (response.mTag == null); String newUid = getUidFromMessageId(message); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got UID " + newUid + " for message for " + getLogId()); + Log.d(K9.LOG_TAG, "Got UID " + newUid + " for message for " + getLogId()); } if (newUid != null) @@ -1536,16 +1536,16 @@ public class ImapStore extends Store if (messageIdHeader == null || messageIdHeader.length == 0) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Did not get a message-id in order to search for UID for " + getLogId()); + Log.d(K9.LOG_TAG, "Did not get a message-id in order to search for UID for " + getLogId()); } return null; } String messageId = messageIdHeader[0]; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Looking for UID for message with message-id " + messageId + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Looking for UID for message with message-id " + messageId + " for " + getLogId()); } List responses = @@ -1648,13 +1648,13 @@ public class ImapStore extends Store String messageUidS = message.getUid(); int messageUid = Integer.parseInt(messageUidS); ImapPushState oldPushState = ImapPushState.parse(oldPushStateS); -// Log.d(Email.LOG_TAG, "getNewPushState comparing oldUidNext " + oldPushState.uidNext +// Log.d(K9.LOG_TAG, "getNewPushState comparing oldUidNext " + oldPushState.uidNext // + " to message uid " + messageUid + " for " + getLogId()); if (messageUid >= oldPushState.uidNext) { int uidNext = messageUid + 1; ImapPushState newPushState = new ImapPushState(uidNext); - //Log.d(Email.LOG_TAG, "newPushState = " + newPushState + " for " + getLogId()); + //Log.d(K9.LOG_TAG, "newPushState = " + newPushState + " for " + getLogId()); return newPushState.toString(); } else @@ -1664,7 +1664,7 @@ public class ImapStore extends Store } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while updated push state for " + getLogId(), e); + Log.e(K9.LOG_TAG, "Exception while updated push state for " + getLogId(), e); return null; } } @@ -1724,7 +1724,7 @@ public class ImapStore extends Store private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) throws MessagingException { - Log.e(Email.LOG_TAG, "IOException for " + getLogId(), ioe); + Log.e(K9.LOG_TAG, "IOException for " + getLogId(), ioe); connection.close(); close(false); return new MessagingException("IO Error", ioe); @@ -1789,7 +1789,7 @@ public class ImapStore extends Store } catch (Exception e) { - Log.w(Email.LOG_TAG, "Could not set DNS ttl to 0 for " + getLogId(), e); + Log.w(K9.LOG_TAG, "Could not set DNS ttl to 0 for " + getLogId(), e); } try @@ -1797,7 +1797,7 @@ public class ImapStore extends Store SocketAddress socketAddress = new InetSocketAddress(mHost, mPort); - Log.i(Email.LOG_TAG, "Connection " + getLogId() + " connecting to " + mHost + " @ IP addr " + socketAddress); + Log.i(K9.LOG_TAG, "Connection " + getLogId() + " connecting to " + mHost + " @ IP addr " + socketAddress); if (mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED || mConnectionSecurity == CONNECTION_SECURITY_SSL_OPTIONAL) @@ -1825,9 +1825,9 @@ public class ImapStore extends Store mOut = mSocket.getOutputStream(); ImapResponse nullResponse = mParser.readResponse(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, getLogId() + "<<<" + nullResponse); + Log.v(K9.LOG_TAG, getLogId() + "<<<" + nullResponse); } List responses = executeSimpleCommand("CAPABILITY"); if (responses.size() != 2) @@ -1845,9 +1845,9 @@ public class ImapStore extends Store { if (capability instanceof String) { -// if (Email.DEBUG) +// if (K9.DEBUG) // { -// Log.v(Email.LOG_TAG, "Saving capability '" + capability + "' for " + getLogId()); +// Log.v(K9.LOG_TAG, "Saving capability '" + capability + "' for " + getLogId()); // } capabilities.add((String)capability); } @@ -1904,49 +1904,49 @@ public class ImapStore extends Store { throw new AuthenticationFailedException(null, me); } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE) + Log.d(K9.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE) + ", mPathPrefix = " + mPathPrefix); } if (mPathPrefix == null) { if (hasCapability(CAPABILITY_NAMESPACE)) { - Log.i(Email.LOG_TAG, "mPathPrefix is unset and server has NAMESPACE capability"); + Log.i(K9.LOG_TAG, "mPathPrefix is unset and server has NAMESPACE capability"); List namespaceResponses = executeSimpleCommand(COMMAND_NAMESPACE); for (ImapResponse response : namespaceResponses) { if (response.get(0).equals(COMMAND_NAMESPACE)) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId()); + Log.d(K9.LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId()); } Object personalNamespaces = response.get(1); if (personalNamespaces != null && personalNamespaces instanceof ImapList) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got personal namespaces: " + personalNamespaces); + Log.d(K9.LOG_TAG, "Got personal namespaces: " + personalNamespaces); } ImapList bracketed = (ImapList)personalNamespaces; Object firstNamespace = bracketed.get(0); if (firstNamespace != null && firstNamespace instanceof ImapList) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got first personal namespaces: " + firstNamespace); + Log.d(K9.LOG_TAG, "Got first personal namespaces: " + firstNamespace); } bracketed = (ImapList)firstNamespace; mPathPrefix = bracketed.getString(0); mPathDelimeter = bracketed.getString(1); mCombinedPrefix = null; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got path '" + mPathPrefix + "' and separator '" + mPathDelimeter + "'"); + Log.d(K9.LOG_TAG, "Got path '" + mPathPrefix + "' and separator '" + mPathDelimeter + "'"); } } } @@ -1955,7 +1955,7 @@ public class ImapStore extends Store } else { - Log.i(Email.LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability"); + Log.i(K9.LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability"); mPathPrefix = ""; } } @@ -1975,7 +1975,7 @@ public class ImapStore extends Store String[] tokens = ceMess.split("-"); if (tokens != null && tokens.length > 1 && tokens[1] != null) { - Log.e(Email.LOG_TAG, "Stripping host/port from ConnectionException for " + getLogId(), ce); + Log.e(K9.LOG_TAG, "Stripping host/port from ConnectionException for " + getLogId(), ce); throw new ConnectException(tokens[1].trim()); } else @@ -1987,7 +1987,7 @@ public class ImapStore extends Store { if (authSuccess == false) { - Log.e(Email.LOG_TAG, "Failed to login, closing connection for " + getLogId()); + Log.e(K9.LOG_TAG, "Failed to login, closing connection for " + getLogId()); close(); } } @@ -2000,12 +2000,12 @@ public class ImapStore extends Store protected boolean isIdleCapable() { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Connection " + getLogId() + " has " + capabilities.size() + " capabilities"); + Log.v(K9.LOG_TAG, "Connection " + getLogId() + " has " + capabilities.size() + " capabilities"); // for (String capability : capabilities) // { -// Log.v(Email.LOG_TAG, "Have capability '" + capability + "' for " + getLogId()); +// Log.v(K9.LOG_TAG, "Have capability '" + capability + "' for " + getLogId()); // } } return capabilities.contains(CAPABILITY_IDLE); @@ -2064,9 +2064,9 @@ public class ImapStore extends Store try { ImapResponse response = mParser.readResponse(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, getLogId() + "<<<" + response); + Log.v(K9.LOG_TAG, getLogId() + "<<<" + response); } return response; } @@ -2095,9 +2095,9 @@ public class ImapStore extends Store mOut.write('\n'); mOut.flush(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, getLogId() + ">>> " + continuation); + Log.v(K9.LOG_TAG, getLogId() + ">>> " + continuation); } } @@ -2115,16 +2115,16 @@ public class ImapStore extends Store mOut.write('\n'); mOut.flush(); - if (Email.DEBUG) + if (K9.DEBUG) { - if (sensitive && !Email.DEBUG_SENSITIVE) + if (sensitive && !K9.DEBUG_SENSITIVE) { - Log.v(Email.LOG_TAG, getLogId() + ">>> " + Log.v(K9.LOG_TAG, getLogId() + ">>> " + "[Command Hidden, Enable Sensitive Debug Logging To Show]"); } else { - Log.v(Email.LOG_TAG, getLogId() + ">>> " + commandToSend); + Log.v(K9.LOG_TAG, getLogId() + ">>> " + commandToSend); } } @@ -2163,33 +2163,33 @@ public class ImapStore extends Store throws IOException, ImapException, MessagingException { String commandToLog = command; - if (sensitive && !Email.DEBUG_SENSITIVE) + if (sensitive && !K9.DEBUG_SENSITIVE) { commandToLog = "*sensitive*"; } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Sending IMAP command " + commandToLog + " on connection " + getLogId()); + Log.v(K9.LOG_TAG, "Sending IMAP command " + commandToLog + " on connection " + getLogId()); } String tag = sendCommand(command, sensitive); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Sent IMAP command " + commandToLog + " with tag " + tag + " for " + getLogId()); + Log.v(K9.LOG_TAG, "Sent IMAP command " + commandToLog + " with tag " + tag + " for " + getLogId()); } ArrayList responses = new ArrayList(); ImapResponse response; do { response = mParser.readResponse(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, getLogId() + "<<<" + response); + Log.v(K9.LOG_TAG, getLogId() + "<<<" + response); } if (response.mTag != null && response.mTag.equals(tag) == false) { - Log.w(Email.LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " + response + " for " + getLogId()); + Log.w(K9.LOG_TAG, "After sending tag " + tag + ", got tag response from previous command " + response + " for " + getLogId()); Iterator iter = responses.iterator(); while (iter.hasNext()) { @@ -2347,7 +2347,7 @@ public class ImapStore extends Store public void run() { receiver.acquireWakeLock(); - Log.i(Email.LOG_TAG, "Pusher starting for " + getLogId()); + Log.i(K9.LOG_TAG, "Pusher starting for " + getLogId()); while (stop.get() != true) { try @@ -2358,11 +2358,11 @@ public class ImapStore extends Store String pushStateS = receiver.getPushState(getName()); ImapPushState pushState = ImapPushState.parse(pushStateS); oldUidNext = pushState.uidNext; - Log.i(Email.LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId()); + Log.i(K9.LOG_TAG, "Got oldUidNext " + oldUidNext + " for " + getLogId()); } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e); + Log.e(K9.LOG_TAG, "Unable to get oldUidNext for " + getLogId(), e); } List responses = internalOpen(OpenMode.READ_WRITE); @@ -2396,7 +2396,7 @@ public class ImapStore extends Store if (uidNext > startUid) { - Log.i(Email.LOG_TAG, "Needs sync from uid " + startUid + " to " + uidNext + " for " + getLogId()); + Log.i(K9.LOG_TAG, "Needs sync from uid " + startUid + " to " + uidNext + " for " + getLogId()); List messages = new ArrayList(); for (int uid = startUid; uid < uidNext; uid++) { @@ -2416,12 +2416,12 @@ public class ImapStore extends Store List untaggedResponses = null; if (storedUntaggedResponses.size() > 0) { - Log.i(Email.LOG_TAG, "Processing " + storedUntaggedResponses.size() + " from previous commands for " + getLogId()); + Log.i(K9.LOG_TAG, "Processing " + storedUntaggedResponses.size() + " from previous commands for " + getLogId()); untaggedResponses = new ArrayList(storedUntaggedResponses); } else { - Log.i(Email.LOG_TAG, "About to IDLE for " + getLogId()); + Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId()); receiver.setPushActive(getName(), true); idling.set(true); @@ -2451,16 +2451,16 @@ public class ImapStore extends Store } catch (Exception me) { - Log.e(Email.LOG_TAG, "Got exception while closing for exception for " + getLogId(), me); + Log.e(K9.LOG_TAG, "Got exception while closing for exception for " + getLogId(), me); } if (stop.get() == true) { - Log.i(Email.LOG_TAG, "Got exception while idling, but stop is set for " + getLogId()); + Log.i(K9.LOG_TAG, "Got exception while idling, but stop is set for " + getLogId()); } else { receiver.pushError("Push error: " + e.getMessage(), null); - Log.e(Email.LOG_TAG, "Got exception while idling for " + getLogId(), e); + Log.e(K9.LOG_TAG, "Got exception while idling for " + getLogId(), e); int delayTimeInt = delayTime.get(); receiver.sleep(delayTimeInt); delayTimeInt *= 2; @@ -2476,12 +2476,12 @@ public class ImapStore extends Store receiver.setPushActive(getName(), false); try { - Log.i(Email.LOG_TAG, "Pusher for " + getLogId() + " is exiting"); + Log.i(K9.LOG_TAG, "Pusher for " + getLogId() + " is exiting"); close(false); } catch (Exception me) { - Log.e(Email.LOG_TAG, "Got exception while closing for " + getLogId(), me); + Log.e(K9.LOG_TAG, "Got exception while closing for " + getLogId(), me); } finally { @@ -2503,9 +2503,9 @@ public class ImapStore extends Store || "EXPUNGE".equals(responseType) || "EXISTS".equals(responseType)) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Storing response " + response + " for later processing"); + Log.d(K9.LOG_TAG, "Storing response " + response + " for later processing"); } storedUntaggedResponses.add(response); } @@ -2538,9 +2538,9 @@ public class ImapStore extends Store syncMessages(oldMessageCount + 1, mMessageCount, true); } } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "There are " + flagSyncMsgSeqs + " messages needing flag sync for " + getLogId()); + Log.d(K9.LOG_TAG, "There are " + flagSyncMsgSeqs + " messages needing flag sync for " + getLogId()); } if (flagSyncMsgSeqs.size() > 0) { @@ -2604,9 +2604,9 @@ public class ImapStore extends Store if ("FETCH".equals(responseType)) { int msgSeq = response.getNumber(0); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Got untagged FETCH for msgseq " + msgSeq + " for " + getLogId()); } if (flagSyncMsgSeqs.contains(msgSeq) == false) { @@ -2620,9 +2620,9 @@ public class ImapStore extends Store { messageCountDelta = -1; } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got untagged EXPUNGE for msgseq " + msgSeq + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Got untagged EXPUNGE for msgseq " + msgSeq + " for " + getLogId()); } List newSeqs = new ArrayList(); Iterator flagIter = flagSyncMsgSeqs.iterator(); @@ -2643,7 +2643,7 @@ public class ImapStore extends Store } catch (Exception e) { - Log.e(Email.LOG_TAG, "Could not handle untagged FETCH for " + getLogId(), e); + Log.e(K9.LOG_TAG, "Could not handle untagged FETCH for " + getLogId(), e); } } return messageCountDelta; @@ -2684,29 +2684,29 @@ public class ImapStore extends Store } if (mConnection != null) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Closing mConnection to stop pushing for " + getLogId()); + Log.v(K9.LOG_TAG, "Closing mConnection to stop pushing for " + getLogId()); } mConnection.close(); } else { - Log.w(Email.LOG_TAG, "Attempt to interrupt null mConnection to stop pushing on folderPusher for " + getLogId()); + Log.w(K9.LOG_TAG, "Attempt to interrupt null mConnection to stop pushing on folderPusher for " + getLogId()); } } public void handleAsyncUntaggedResponse(ImapResponse response) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Got async response: " + response); + Log.v(K9.LOG_TAG, "Got async response: " + response); } if (stop.get() == true) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got async untagged response: " + response + ", but stop is set for " + getLogId()); + Log.d(K9.LOG_TAG, "Got async untagged response: " + response + ", but stop is set for " + getLogId()); } try { @@ -2714,7 +2714,7 @@ public class ImapStore extends Store } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while sending DONE for " + getLogId(), e); + Log.e(K9.LOG_TAG, "Exception while sending DONE for " + getLogId(), e); } } else @@ -2733,9 +2733,9 @@ public class ImapStore extends Store receiver.acquireWakeLock(); started = true; } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Got useful async untagged response: " + response + " for " + getLogId()); + Log.d(K9.LOG_TAG, "Got useful async untagged response: " + response + " for " + getLogId()); } try { @@ -2743,7 +2743,7 @@ public class ImapStore extends Store } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while sending DONE for " + getLogId(), e); + Log.e(K9.LOG_TAG, "Exception while sending DONE for " + getLogId(), e); } } } @@ -2751,9 +2751,9 @@ public class ImapStore extends Store { if ("idling".equals(response.get(0))) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Idling " + getLogId()); + Log.d(K9.LOG_TAG, "Idling " + getLogId()); } receiver.releaseWakeLock(); } @@ -2811,7 +2811,7 @@ public class ImapStore extends Store } catch (Exception e) { - Log.e(Email.LOG_TAG, "Got exception while refreshing for " + folderPusher.getName(), e); + Log.e(K9.LOG_TAG, "Got exception while refreshing for " + folderPusher.getName(), e); } } } @@ -2819,19 +2819,19 @@ public class ImapStore extends Store public void stop() { - Log.i(Email.LOG_TAG, "Requested stop of IMAP pusher"); + Log.i(K9.LOG_TAG, "Requested stop of IMAP pusher"); synchronized (folderPushers) { for (ImapFolderPusher folderPusher : folderPushers.values()) { try { - Log.i(Email.LOG_TAG, "Requesting stop of IMAP folderPusher " + folderPusher.getName()); + Log.i(K9.LOG_TAG, "Requesting stop of IMAP folderPusher " + folderPusher.getName()); folderPusher.stop(); } catch (Exception e) { - Log.e(Email.LOG_TAG, "Got exception while stopping " + folderPusher.getName(), e); + Log.e(K9.LOG_TAG, "Got exception while stopping " + folderPusher.getName(), e); } } folderPushers.clear(); @@ -2875,11 +2875,11 @@ public class ImapStore extends Store try { newUidNext = Integer.parseInt(value); - // Log.i(Email.LOG_TAG, "Parsed uidNext " + newUidNext); + // Log.i(K9.LOG_TAG, "Parsed uidNext " + newUidNext); } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to part uidNext value " + value, e); + Log.e(K9.LOG_TAG, "Unable to part uidNext value " + value, e); } } diff --git a/src/com/android/email/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java similarity index 95% rename from src/com/android/email/mail/store/LocalStore.java rename to src/com/fsck/k9/mail/store/LocalStore.java index 1dc4bb8b2..13ef04c53 100644 --- a/src/com/android/email/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -1,5 +1,5 @@ -package com.android.email.mail.store; +package com.fsck.k9.mail.store; import android.app.Application; import android.content.ContentValues; @@ -9,14 +9,14 @@ import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.text.util.Regex; import android.util.Log; -import com.android.email.Email; -import com.android.email.Preferences; -import com.android.email.Utility; -import com.android.email.codec.binary.Base64OutputStream; -import com.android.email.mail.*; -import com.android.email.mail.Message.RecipientType; -import com.android.email.mail.internet.*; -import com.android.email.provider.AttachmentProvider; +import com.fsck.k9.K9; +import com.fsck.k9.Preferences; +import com.fsck.k9.Utility; +import com.fsck.k9.codec.binary.Base64OutputStream; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Message.RecipientType; +import com.fsck.k9.mail.internet.*; +import com.fsck.k9.provider.AttachmentProvider; import org.apache.commons.io.IOUtils; import java.io.*; @@ -44,7 +44,7 @@ public class LocalStore extends Store implements Serializable private static Set HEADERS_TO_SAVE = new HashSet(); static { - HEADERS_TO_SAVE.add(Email.K9MAIL_IDENTITY); + HEADERS_TO_SAVE.add(K9.K9MAIL_IDENTITY); HEADERS_TO_SAVE.add("In-Reply-To"); HEADERS_TO_SAVE.add("References"); HEADERS_TO_SAVE.add("X-User-Agent"); @@ -102,7 +102,7 @@ public class LocalStore extends Store implements Serializable private void doDbUpgrade(SQLiteDatabase mDb, Application application) { - Log.i(Email.LOG_TAG, String.format("Upgrading database from version %d to version %d", + Log.i(K9.LOG_TAG, String.format("Upgrading database from version %d to version %d", mDb.getVersion(), DB_VERSION)); @@ -182,7 +182,7 @@ public class LocalStore extends Store implements Serializable } catch (Exception me) { - Log.e(Email.LOG_TAG, "Exception while force pruning attachments during DB update", me); + Log.e(K9.LOG_TAG, "Exception while force pruning attachments during DB update", me); } } @@ -206,37 +206,37 @@ public class LocalStore extends Store implements Serializable public void compact() throws MessagingException { - Log.i(Email.LOG_TAG, "Before prune size = " + getSize()); + Log.i(K9.LOG_TAG, "Before prune size = " + getSize()); pruneCachedAttachments(); - Log.i(Email.LOG_TAG, "After prune / before compaction size = " + getSize()); + Log.i(K9.LOG_TAG, "After prune / before compaction size = " + getSize()); mDb.execSQL("VACUUM"); - Log.i(Email.LOG_TAG, "After compaction size = " + getSize()); + Log.i(K9.LOG_TAG, "After compaction size = " + getSize()); } public void clear() throws MessagingException { - Log.i(Email.LOG_TAG, "Before prune size = " + getSize()); + Log.i(K9.LOG_TAG, "Before prune size = " + getSize()); pruneCachedAttachments(true); - Log.i(Email.LOG_TAG, "After prune / before compaction size = " + getSize()); + Log.i(K9.LOG_TAG, "After prune / before compaction size = " + getSize()); - Log.i(Email.LOG_TAG, "Before clear folder count = " + getFolderCount()); - Log.i(Email.LOG_TAG, "Before clear message count = " + getMessageCount()); + Log.i(K9.LOG_TAG, "Before clear folder count = " + getFolderCount()); + Log.i(K9.LOG_TAG, "Before clear message count = " + getMessageCount()); - Log.i(Email.LOG_TAG, "After prune / before clear size = " + getSize()); + Log.i(K9.LOG_TAG, "After prune / before clear size = " + getSize()); // don't delete messages that are Local, since there is no copy on the server. // Don't delete deleted messages. They are essentially placeholders for UIDs of messages that have // been deleted locally. They take up insignificant space mDb.execSQL("DELETE FROM messages WHERE deleted = 0 and uid not like 'Local%'"); compact(); - Log.i(Email.LOG_TAG, "After clear message count = " + getMessageCount()); + Log.i(K9.LOG_TAG, "After clear message count = " + getMessageCount()); - Log.i(Email.LOG_TAG, "After clear size = " + getSize()); + Log.i(K9.LOG_TAG, "After clear size = " + getSize()); } public int getMessageCount() throws MessagingException @@ -397,7 +397,7 @@ public class LocalStore extends Store implements Serializable { if (cursor.getString(0) == null) { - Log.d(Email.LOG_TAG, "Attachment " + file.getAbsolutePath() + " has no store data, not deleting"); + Log.d(K9.LOG_TAG, "Attachment " + file.getAbsolutePath() + " has no store data, not deleting"); /* * If the attachment has no store data it is not recoverable, so * we won't delete it. @@ -430,7 +430,7 @@ public class LocalStore extends Store implements Serializable */ } } - Log.d(Email.LOG_TAG, "Deleting attachment " + file.getAbsolutePath() + ", which is of size " + file.length()); + Log.d(K9.LOG_TAG, "Deleting attachment " + file.getAbsolutePath() + ", which is of size " + file.length()); if (!file.delete()) { file.deleteOnExit(); @@ -441,7 +441,7 @@ public class LocalStore extends Store implements Serializable public void resetVisibleLimits() { - resetVisibleLimits(Email.DEFAULT_VISIBLE_LIMIT); + resetVisibleLimits(K9.DEFAULT_VISIBLE_LIMIT); } public void resetVisibleLimits(int visibleLimit) @@ -566,7 +566,7 @@ public class LocalStore extends Store implements Serializable { this.mName = name; - if (Email.INBOX.equals(getName())) + if (K9.INBOX.equals(getName())) { syncClass = FolderClass.FIRST_CLASS; pushClass = FolderClass.FIRST_CLASS; @@ -690,7 +690,7 @@ public class LocalStore extends Store implements Serializable mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[] { mName, - Email.DEFAULT_VISIBLE_LIMIT + K9.DEFAULT_VISIBLE_LIMIT }); return true; } @@ -721,7 +721,7 @@ public class LocalStore extends Store implements Serializable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to close LocalFolder " + getName(), me); + Log.e(K9.LOG_TAG, "Unable to close LocalFolder " + getName(), me); } mFolderId = -1; } @@ -918,7 +918,7 @@ public class LocalStore extends Store implements Serializable SharedPreferences.Editor editor = preferences.getPreferences().edit(); // there can be a lot of folders. For the defaults, let's not save prefs, saving space, except for INBOX - if (displayClass == FolderClass.NO_CLASS && !Email.INBOX.equals(getName())) + if (displayClass == FolderClass.NO_CLASS && !K9.INBOX.equals(getName())) { editor.remove(id + ".displayMode"); } @@ -927,7 +927,7 @@ public class LocalStore extends Store implements Serializable editor.putString(id + ".displayMode", displayClass.name()); } - if (syncClass == FolderClass.INHERITED && !Email.INBOX.equals(getName())) + if (syncClass == FolderClass.INHERITED && !K9.INBOX.equals(getName())) { editor.remove(id + ".syncMode"); } @@ -936,7 +936,7 @@ public class LocalStore extends Store implements Serializable editor.putString(id + ".syncMode", syncClass.name()); } - if (pushClass == FolderClass.SECOND_CLASS && !Email.INBOX.equals(getName())) + if (pushClass == FolderClass.SECOND_CLASS && !K9.INBOX.equals(getName())) { editor.remove(id + ".pushMode"); } @@ -959,7 +959,7 @@ public class LocalStore extends Store implements Serializable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to load displayMode for " + getName(), e); + Log.e(K9.LOG_TAG, "Unable to load displayMode for " + getName(), e); displayClass = FolderClass.NO_CLASS; } @@ -970,7 +970,7 @@ public class LocalStore extends Store implements Serializable FolderClass defSyncClass = FolderClass.INHERITED; - if (Email.INBOX.equals(getName())) + if (K9.INBOX.equals(getName())) { defSyncClass = FolderClass.FIRST_CLASS; } @@ -982,7 +982,7 @@ public class LocalStore extends Store implements Serializable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to load syncMode for " + getName(), e); + Log.e(K9.LOG_TAG, "Unable to load syncMode for " + getName(), e); syncClass = defSyncClass; } @@ -992,7 +992,7 @@ public class LocalStore extends Store implements Serializable } FolderClass defPushClass = FolderClass.SECOND_CLASS; - if (Email.INBOX.equals(getName())) + if (K9.INBOX.equals(getName())) { defPushClass = FolderClass.FIRST_CLASS; } @@ -1004,7 +1004,7 @@ public class LocalStore extends Store implements Serializable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to load pushMode for " + getName(), e); + Log.e(K9.LOG_TAG, "Unable to load pushMode for " + getName(), e); pushClass = defPushClass; } @@ -1206,7 +1206,7 @@ public class LocalStore extends Store implements Serializable Long id = cursor.getLong(0); String name = cursor.getString(1); String value = cursor.getString(2); - //Log.i(Email.LOG_TAG, "Retrieved header name= " + name + ", value = " + value + " for message " + id); + //Log.i(K9.LOG_TAG, "Retrieved header name= " + name + ", value = " + value + " for message " + id); popMessages.get(id).addHeader(name, value); } } @@ -1369,10 +1369,10 @@ public class LocalStore extends Store implements Serializable String oldUID = message.getUid(); - Log.d(Email.LOG_TAG, "Updating folder_id to " + lDestFolder.getId() + " for message with UID " + Log.d(K9.LOG_TAG, "Updating folder_id to " + lDestFolder.getId() + " for message with UID " + message.getUid() + ", id " + lMessage.getId() + " currently in folder " + getName()); - message.setUid(Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString()); + message.setUid(K9.LOCAL_UID_PREFIX + UUID.randomUUID().toString()); mDb.execSQL("UPDATE messages " + "SET folder_id = ?, uid = ? " + "WHERE id = ?", new Object[] { @@ -1420,7 +1420,7 @@ public class LocalStore extends Store implements Serializable String uid = message.getUid(); if (uid == null) { - uid = Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString(); + uid = K9.LOCAL_UID_PREFIX + UUID.randomUUID().toString(); message.setUid(uid); } else @@ -1492,10 +1492,10 @@ public class LocalStore extends Store implements Serializable cv.put("internal_date", message.getInternalDate() == null ? System.currentTimeMillis() : message.getInternalDate().getTime()); String messageId = message.getMessageId(); - Log.e(Email.LOG_TAG, "saving a messag"); + Log.e(K9.LOG_TAG, "saving a messag"); if (messageId != null ) { - Log.e(Email.LOG_TAG, "saving a message messasgeid is "+messageId); + Log.e(K9.LOG_TAG, "saving a message messasgeid is "+messageId); cv.put("message_id", messageId); } long messageUid = mDb.insert("messages", "uid", cv); @@ -1623,7 +1623,7 @@ public class LocalStore extends Store implements Serializable cv.put("message_id", id); cv.put("name", name); cv.put("value", value); - //Log.i(Email.LOG_TAG, "Saving header name = " + name + ", value = " + value); + //Log.i(K9.LOG_TAG, "Saving header name = " + name + ", value = " + value); mDb.insert("headers", "name", cv); } } @@ -1838,7 +1838,7 @@ public class LocalStore extends Store implements Serializable } catch (Exception e) { - Log.e(Email.LOG_TAG, "Unable to fetch all messages from LocalStore", e); + Log.e(K9.LOG_TAG, "Unable to fetch all messages from LocalStore", e); } } @@ -1985,7 +1985,7 @@ public class LocalStore extends Store implements Serializable catch (IOException e) { //Should never happen - Log.e(Email.LOG_TAG, null, e); + Log.e(K9.LOG_TAG, null, e); } text = buff.toString(); text = text.replaceAll("\\s*([-=_]{30,}+)\\s*","
"); @@ -2282,7 +2282,7 @@ public class LocalStore extends Store implements Serializable } catch (MessagingException me) { - Log.e(Email.LOG_TAG, "Unable to update LocalStore unread message count", + Log.e(K9.LOG_TAG, "Unable to update LocalStore unread message count", me); throw new RuntimeException(me); } diff --git a/src/com/android/email/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java similarity index 97% rename from src/com/android/email/mail/store/Pop3Store.java rename to src/com/fsck/k9/mail/store/Pop3Store.java index ec91706ac..fdde01bd2 100644 --- a/src/com/android/email/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -1,13 +1,13 @@ -package com.android.email.mail.store; +package com.fsck.k9.mail.store; import android.util.Config; import android.util.Log; -import com.android.email.Email; -import com.android.email.Utility; -import com.android.email.mail.*; -import com.android.email.mail.Folder.OpenMode; -import com.android.email.mail.internet.MimeMessage; +import com.fsck.k9.K9; +import com.fsck.k9.Utility; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Folder.OpenMode; +import com.fsck.k9.mail.internet.MimeMessage; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; @@ -527,7 +527,7 @@ public class Pop3Store extends Store { if (Config.LOGD) { - Log.d(Email.LOG_TAG, "Need to index UID " + uid); + Log.d(K9.LOG_TAG, "Need to index UID " + uid); } unindexedUids.add(uid); } @@ -555,7 +555,7 @@ public class Pop3Store extends Store { if (Config.LOGD) { - Log.d(Email.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid); + Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid); } Pop3Message message = mUidToMsgMap.get(msgUid); @@ -572,7 +572,7 @@ public class Pop3Store extends Store { if (Config.LOGD) { - Log.d(Email.LOG_TAG, "Adding index for UID " + message.getUid() + " to msgNum " + msgNum); + Log.d(K9.LOG_TAG, "Adding index for UID " + message.getUid() + " to msgNum " + msgNum); } mMsgNumToMsgMap.put(msgNum, message); mUidToMsgMap.put(message.getUid(), message); @@ -925,9 +925,9 @@ public class Pop3Store extends Store String ret = sb.toString(); if (Config.LOGD) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "<<< " + ret); + Log.d(K9.LOG_TAG, "<<< " + ret); } } return ret; @@ -937,9 +937,9 @@ public class Pop3Store extends Store { if (Config.LOGD) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, ">>> " + s); + Log.d(K9.LOG_TAG, ">>> " + s); } } mOut.write(s.getBytes()); @@ -999,7 +999,7 @@ public class Pop3Store extends Store open(OpenMode.READ_WRITE); if (Config.LOGV) { - Log.v(Email.LOG_TAG, "POP3: command '" + command + "'"); + Log.v(K9.LOG_TAG, "POP3: command '" + command + "'"); } if (command != null) { @@ -1009,7 +1009,7 @@ public class Pop3Store extends Store String response = readLine(); if (Config.LOGV) { - Log.v(Email.LOG_TAG, "POP3: response '" + command + "'"); + Log.v(K9.LOG_TAG, "POP3: response '" + command + "'"); } if (response.length() > 1 && response.charAt(0) == '-') @@ -1085,7 +1085,7 @@ public class Pop3Store extends Store // } // catch (MessagingException me) // { -// Log.w(Email.LOG_TAG, "Could not delete non-existant message", me); +// Log.w(K9.LOG_TAG, "Could not delete non-existant message", me); // } } } diff --git a/src/com/android/email/mail/store/TrustManagerFactory.java b/src/com/fsck/k9/mail/store/TrustManagerFactory.java similarity index 98% rename from src/com/android/email/mail/store/TrustManagerFactory.java rename to src/com/fsck/k9/mail/store/TrustManagerFactory.java index a7ab489e6..44a9a8cb7 100644 --- a/src/com/android/email/mail/store/TrustManagerFactory.java +++ b/src/com/fsck/k9/mail/store/TrustManagerFactory.java @@ -1,11 +1,11 @@ -package com.android.email.mail.store; +package com.fsck.k9.mail.store; import android.app.Application; import android.content.Context; import android.net.http.DomainNameChecker; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; @@ -123,7 +123,7 @@ public final class TrustManagerFactory try { javax.net.ssl.TrustManagerFactory tmf = javax.net.ssl.TrustManagerFactory.getInstance("X509"); - Application app = Email.app; + Application app = K9.app; keyStoreFile = new File(app.getDir("KeyStore", Context.MODE_PRIVATE) + File.separator + "KeyStore.bks"); keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); java.io.FileInputStream fis; diff --git a/src/com/android/email/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java similarity index 94% rename from src/com/android/email/mail/store/WebDavStore.java rename to src/com/fsck/k9/mail/store/WebDavStore.java index 00dae30f3..4b8afec56 100644 --- a/src/com/android/email/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -1,13 +1,13 @@ -package com.android.email.mail.store; +package com.fsck.k9.mail.store; import android.util.Log; -import com.android.email.Email; -import com.android.email.Utility; -import com.android.email.mail.*; -import com.android.email.mail.Folder.OpenMode; -import com.android.email.mail.internet.MimeMessage; -import com.android.email.mail.transport.EOLConvertingOutputStream; -import com.android.email.mail.transport.TrustedSocketFactory; +import com.fsck.k9.K9; +import com.fsck.k9.Utility; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Folder.OpenMode; +import com.fsck.k9.mail.internet.MimeMessage; +import com.fsck.k9.mail.transport.EOLConvertingOutputStream; +import com.fsck.k9.mail.transport.TrustedSocketFactory; import org.apache.http.*; import org.apache.http.auth.AuthScope; import org.apache.http.auth.Credentials; @@ -245,7 +245,7 @@ public class WebDavStore extends Store @Override public void checkSettings() throws MessagingException { - Log.e(Email.LOG_TAG, "WebDavStore.checkSettings() not implemented"); + Log.e(K9.LOG_TAG, "WebDavStore.checkSettings() not implemented"); } @Override @@ -271,14 +271,14 @@ public class WebDavStore extends Store for (int i = 0; i < urlLength; i++) { -// Log.i(Email.LOG_TAG, "folderUrls[" + i + "] = '" + folderUrls[i]); +// Log.i(K9.LOG_TAG, "folderUrls[" + i + "] = '" + folderUrls[i]); String[] urlParts = folderUrls[i].split("/"); -// Log.i(Email.LOG_TAG, "urlParts = " + urlParts); +// Log.i(K9.LOG_TAG, "urlParts = " + urlParts); String folderName = urlParts[urlParts.length - 1]; String fullPathName = ""; WebDavFolder wdFolder; - if (folderName.equalsIgnoreCase(Email.INBOX)) + if (folderName.equalsIgnoreCase(K9.INBOX)) { folderName = "INBOX"; } @@ -529,7 +529,7 @@ public class WebDavStore extends Store } catch (IOException ioe) { - Log.e(Email.LOG_TAG, "Error during authentication: " + ioe + "\nStack: " + processException(ioe)); + Log.e(K9.LOG_TAG, "Error during authentication: " + ioe + "\nStack: " + processException(ioe)); throw new MessagingException("Error during authentication", ioe); } @@ -778,7 +778,7 @@ public class WebDavStore extends Store } catch (UnsupportedEncodingException uee) { - Log.e(Email.LOG_TAG, "Error encoding POST data for authentication: " + uee + "\nTrace: " + processException(uee)); + Log.e(K9.LOG_TAG, "Error encoding POST data for authentication: " + uee + "\nTrace: " + processException(uee)); throw new MessagingException("Error encoding POST data for authentication", uee); } } @@ -820,17 +820,17 @@ public class WebDavStore extends Store reg = mHttpClient.getConnectionManager().getSchemeRegistry(); try { - // Log.i(Email.LOG_TAG, "getHttpClient mHost = " + mHost); + // Log.i(K9.LOG_TAG, "getHttpClient mHost = " + mHost); s = new Scheme("https", new TrustedSocketFactory(mHost, mSecure), 443); } catch (NoSuchAlgorithmException nsa) { - Log.e(Email.LOG_TAG, "NoSuchAlgorithmException in getHttpClient: " + nsa); + Log.e(K9.LOG_TAG, "NoSuchAlgorithmException in getHttpClient: " + nsa); throw new MessagingException("NoSuchAlgorithmException in getHttpClient: " + nsa); } catch (KeyManagementException kme) { - Log.e(Email.LOG_TAG, "KeyManagementException in getHttpClient: " + kme); + Log.e(K9.LOG_TAG, "KeyManagementException in getHttpClient: " + kme); throw new MessagingException("KeyManagementException in getHttpClient: " + kme); } reg.register(s); @@ -855,7 +855,7 @@ public class WebDavStore extends Store } mHttpClient.setCookieStore(cookies); } catch (IOException ioe) { - Log.e(Email.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe)); + Log.e(K9.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe)); } } else { Credentials creds = new UsernamePasswordCredentials(mUsername, mPassword); @@ -988,12 +988,12 @@ public class WebDavStore extends Store } catch (UnsupportedEncodingException uee) { - Log.e(Email.LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee)); + Log.e(K9.LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee)); throw new MessagingException("UnsupportedEncodingException", uee); } catch (IOException ioe) { - Log.e(Email.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe)); + Log.e(K9.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe)); throw new MessagingException("IOException", ioe); } @@ -1020,9 +1020,9 @@ public class WebDavStore extends Store throws MessagingException { DataSet dataset = new DataSet(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '" + messageBody + "'"); + Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '" + messageBody + "'"); } if (url == null || @@ -1061,12 +1061,12 @@ public class WebDavStore extends Store } catch (SAXException se) { - Log.e(Email.LOG_TAG, "SAXException in processRequest() " + se + "\nTrace: " + processException(se)); + Log.e(K9.LOG_TAG, "SAXException in processRequest() " + se + "\nTrace: " + processException(se)); throw new MessagingException("SAXException in processRequest() ", se); } catch (ParserConfigurationException pce) { - Log.e(Email.LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: " + processException(pce)); + Log.e(K9.LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: " + processException(pce)); throw new MessagingException("ParserConfigurationException in processRequest() ", pce); } @@ -1075,12 +1075,12 @@ public class WebDavStore extends Store } catch (UnsupportedEncodingException uee) { - Log.e(Email.LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee)); + Log.e(K9.LOG_TAG, "UnsupportedEncodingException: " + uee + "\nTrace: " + processException(uee)); throw new MessagingException("UnsupportedEncodingException in processRequest() ", uee); } catch (IOException ioe) { - Log.e(Email.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe)); + Log.e(K9.LOG_TAG, "IOException: " + ioe + "\nTrace: " + processException(ioe)); throw new MessagingException("IOException in processRequest() ", ioe); } @@ -1181,7 +1181,7 @@ public class WebDavStore extends Store } catch (UnsupportedEncodingException uee) { - Log.e(Email.LOG_TAG, "UnsupportedEncodingException URLEncoding folder name, skipping encoded"); + Log.e(K9.LOG_TAG, "UnsupportedEncodingException URLEncoding folder name, skipping encoded"); encodedName = name; } @@ -1270,7 +1270,7 @@ public class WebDavStore extends Store headers.put("Brief", "t"); headers.put("If-Match", "*"); String action = (isMove ? "BMOVE" : "BCOPY"); - Log.i(Email.LOG_TAG, "Moving " + messages.length + " messages to " + destFolder.mFolderUrl); + Log.i(K9.LOG_TAG, "Moving " + messages.length + " messages to " + destFolder.mFolderUrl); processRequest(mFolderUrl, action, messageBody, headers, false); @@ -1582,7 +1582,7 @@ public class WebDavStore extends Store if (wdMessage.getUrl().equals("")) { wdMessage.setUrl(getMessageUrls(new String[] {wdMessage.getUid()}).get(wdMessage.getUid())); - Log.i(Email.LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '" + wdMessage.getUrl() + "'"); + Log.i(K9.LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '" + wdMessage.getUrl() + "'"); if (wdMessage.getUrl().equals("")) { throw new MessagingException("Unable to get URL for message"); @@ -1591,7 +1591,7 @@ public class WebDavStore extends Store try { - Log.i(Email.LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '" + wdMessage.getUrl() + "'"); + Log.i(K9.LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '" + wdMessage.getUrl() + "'"); HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl())); HttpResponse response; HttpEntity entity; @@ -1648,17 +1648,17 @@ public class WebDavStore extends Store } catch (IllegalArgumentException iae) { - Log.e(Email.LOG_TAG, "IllegalArgumentException caught " + iae + "\nTrace: " + processException(iae)); + Log.e(K9.LOG_TAG, "IllegalArgumentException caught " + iae + "\nTrace: " + processException(iae)); throw new MessagingException("IllegalArgumentException caught", iae); } catch (URISyntaxException use) { - Log.e(Email.LOG_TAG, "URISyntaxException caught " + use + "\nTrace: " + processException(use)); + Log.e(K9.LOG_TAG, "URISyntaxException caught " + use + "\nTrace: " + processException(use)); throw new MessagingException("URISyntaxException caught", use); } catch (IOException ioe) { - Log.e(Email.LOG_TAG, "Non-success response code loading message, response code was " + statusCode + "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: " + processException(ioe)); + Log.e(K9.LOG_TAG, "Non-success response code loading message, response code was " + statusCode + "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: " + processException(ioe)); throw new MessagingException("Failure code " + statusCode, ioe); } @@ -1953,7 +1953,7 @@ public class WebDavStore extends Store } catch (MessagingException e) { - Log.e(Email.LOG_TAG, "MessagingException while retrieving Subject: " + e); + Log.e(K9.LOG_TAG, "MessagingException while retrieving Subject: " + e); subject = ""; } ByteArrayOutputStream out; @@ -1963,7 +1963,7 @@ public class WebDavStore extends Store } catch (MessagingException e) { - Log.e(Email.LOG_TAG, "MessagingException while getting size of message: " + e); + Log.e(K9.LOG_TAG, "MessagingException while getting size of message: " + e); out = new ByteArrayOutputStream(); } open(OpenMode.READ_WRITE); @@ -1981,7 +1981,7 @@ public class WebDavStore extends Store } messageURL += URLEncoder.encode(subject + ".eml"); - Log.i(Email.LOG_TAG, "Uploading message to " + mFolderUrl); + Log.i(K9.LOG_TAG, "Uploading message to " + mFolderUrl); httpmethod = new HttpGeneric(messageURL); httpmethod.setMethod("PUT"); @@ -2033,14 +2033,14 @@ public class WebDavStore extends Store public String getUidFromMessageId(Message message) throws MessagingException { - Log.e(Email.LOG_TAG, "Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages " + Log.e(K9.LOG_TAG, "Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages " + " being uploaded to the Sent folder"); return null; } public void setFlags(Flag[] flags, boolean value) throws MessagingException { - Log.e(Email.LOG_TAG, "Unimplemented method setFlags(Flag[], boolean) breaks markAllMessagesAsRead and EmptyTrash"); + Log.e(K9.LOG_TAG, "Unimplemented method setFlags(Flag[], boolean) breaks markAllMessagesAsRead and EmptyTrash"); // Try to make this efficient by not retrieving all of the messages return; } @@ -2092,11 +2092,11 @@ public class WebDavStore extends Store } catch (UnsupportedEncodingException uee) { - Log.e(Email.LOG_TAG, "UnsupportedEncodingException caught in setUrl: " + uee + "\nTrace: " + processException(uee)); + Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in setUrl: " + uee + "\nTrace: " + processException(uee)); } catch (IllegalArgumentException iae) { - Log.e(Email.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: " + processException(iae)); + Log.e(K9.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: " + processException(iae)); } for (int i = 0; i < length - 1; i++) @@ -2163,7 +2163,7 @@ public class WebDavStore extends Store public void delete(String trashFolderName) throws MessagingException { WebDavFolder wdFolder = (WebDavFolder)getFolder(); - Log.i(Email.LOG_TAG, "Deleting message by moving to " + trashFolderName); + Log.i(K9.LOG_TAG, "Deleting message by moving to " + trashFolderName); wdFolder.moveMessages(new Message[] { this }, wdFolder.getStore().getFolder(trashFolderName)); } @@ -2265,7 +2265,7 @@ public class WebDavStore extends Store public void addHeader(String field, String value) { String headerName = mHeaderMappings.get(field); - //Log.i(Email.LOG_TAG, "header " + headerName + " = '" + value + "'"); + //Log.i(K9.LOG_TAG, "header " + headerName + " = '" + value + "'"); if (headerName != null) { @@ -2497,7 +2497,7 @@ public class WebDavStore extends Store } catch (java.text.ParseException pe) { - Log.e(Email.LOG_TAG, "Error parsing date: "+ pe + "\nTrace: " + processException(pe)); + Log.e(K9.LOG_TAG, "Error parsing date: "+ pe + "\nTrace: " + processException(pe)); } envelope.addHeader(header, tempDate); } @@ -2544,9 +2544,9 @@ public class WebDavStore extends Store { super(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Starting uri = '" + uri + "'"); + Log.v(K9.LOG_TAG, "Starting uri = '" + uri + "'"); } String[] urlParts = uri.split("/"); @@ -2569,11 +2569,11 @@ public class WebDavStore extends Store } catch (UnsupportedEncodingException uee) { - Log.e(Email.LOG_TAG, "UnsupportedEncodingException caught in HttpGeneric(String uri): " + uee + "\nTrace: " + processException(uee)); + Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in HttpGeneric(String uri): " + uee + "\nTrace: " + processException(uee)); } catch (IllegalArgumentException iae) { - Log.e(Email.LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: " + processException(iae)); + Log.e(K9.LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: " + processException(iae)); } for (int i = 0; i < length - 1; i++) @@ -2587,14 +2587,14 @@ public class WebDavStore extends Store url = urlParts[i]; } } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "url = '" + url + "' length = " + url.length() + Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length() + ", end = '" + end + "' length = " + end.length()); } url = url + "/" + end; - Log.i(Email.LOG_TAG, "url = " + url); + Log.i(K9.LOG_TAG, "url = " + url); setURI(URI.create(url)); } @@ -2631,7 +2631,7 @@ public class WebDavStore extends Store */ public static void modifyRequestToAcceptGzipResponse(HttpRequest request) { - Log.i(Email.LOG_TAG, "Requesting gzipped data"); + Log.i(K9.LOG_TAG, "Requesting gzipped data"); request.addHeader("Accept-Encoding", "gzip"); } public static InputStream getUngzippedContent(HttpEntity entity) @@ -2645,7 +2645,7 @@ public class WebDavStore extends Store if (contentEncoding == null) return responseStream; if (contentEncoding.contains("gzip")) { - Log.i(Email.LOG_TAG, "Response is gzipped"); + Log.i(K9.LOG_TAG, "Response is gzipped"); responseStream = new GZIPInputStream(responseStream); } return responseStream; diff --git a/src/com/android/email/mail/transport/CountingOutputStream.java b/src/com/fsck/k9/mail/transport/CountingOutputStream.java similarity index 92% rename from src/com/android/email/mail/transport/CountingOutputStream.java rename to src/com/fsck/k9/mail/transport/CountingOutputStream.java index 819a3b169..c81d3be7d 100644 --- a/src/com/android/email/mail/transport/CountingOutputStream.java +++ b/src/com/fsck/k9/mail/transport/CountingOutputStream.java @@ -1,4 +1,4 @@ -package com.android.email.mail.transport; +package com.fsck.k9.mail.transport; import java.io.IOException; import java.io.OutputStream; diff --git a/src/com/android/email/mail/transport/EOLConvertingOutputStream.java b/src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java similarity index 94% rename from src/com/android/email/mail/transport/EOLConvertingOutputStream.java rename to src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java index 9ba2ab53e..43d9dd63a 100644 --- a/src/com/android/email/mail/transport/EOLConvertingOutputStream.java +++ b/src/com/fsck/k9/mail/transport/EOLConvertingOutputStream.java @@ -1,4 +1,4 @@ -package com.android.email.mail.transport; +package com.fsck.k9.mail.transport; import java.io.FilterOutputStream; import java.io.IOException; diff --git a/src/com/android/email/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java similarity index 96% rename from src/com/android/email/mail/transport/SmtpTransport.java rename to src/com/fsck/k9/mail/transport/SmtpTransport.java index f7e93ef1a..4c0d45bee 100644 --- a/src/com/android/email/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -1,13 +1,13 @@ -package com.android.email.mail.transport; +package com.fsck.k9.mail.transport; import android.util.Log; -import com.android.email.Email; -import com.android.email.PeekableInputStream; -import com.android.email.codec.binary.Base64; -import com.android.email.mail.*; -import com.android.email.mail.Message.RecipientType; -import com.android.email.mail.store.TrustManagerFactory; +import com.fsck.k9.K9; +import com.fsck.k9.PeekableInputStream; +import com.fsck.k9.codec.binary.Base64; +import com.fsck.k9.mail.*; +import com.fsck.k9.mail.Message.RecipientType; +import com.fsck.k9.mail.store.TrustManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; @@ -170,9 +170,9 @@ public class SmtpTransport extends Transport } catch (Exception e) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Unable to look up localhost"); + Log.d(K9.LOG_TAG, "Unable to look up localhost"); } } @@ -363,9 +363,9 @@ public class SmtpTransport extends Transport } } String ret = sb.toString(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SMTP <<< " + ret); + Log.d(K9.LOG_TAG, "SMTP <<< " + ret); } return ret; @@ -373,9 +373,9 @@ public class SmtpTransport extends Transport private void writeLine(String s) throws IOException { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SMTP >>> " + s); + Log.d(K9.LOG_TAG, "SMTP >>> " + s); } mOut.write(s.getBytes()); mOut.write('\r'); diff --git a/src/com/android/email/mail/transport/StatusOutputStream.java b/src/com/fsck/k9/mail/transport/StatusOutputStream.java similarity index 81% rename from src/com/android/email/mail/transport/StatusOutputStream.java rename to src/com/fsck/k9/mail/transport/StatusOutputStream.java index 032831621..7e384eecc 100644 --- a/src/com/android/email/mail/transport/StatusOutputStream.java +++ b/src/com/fsck/k9/mail/transport/StatusOutputStream.java @@ -1,8 +1,8 @@ -package com.android.email.mail.transport; +package com.fsck.k9.mail.transport; import android.util.Config; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; import java.io.FilterOutputStream; import java.io.IOException; @@ -26,7 +26,7 @@ public class StatusOutputStream extends FilterOutputStream { if (mCount % 1024 == 0) { - Log.v(Email.LOG_TAG, "# " + mCount); + Log.v(K9.LOG_TAG, "# " + mCount); } } } diff --git a/src/com/android/email/mail/transport/TrustedSocketFactory.java b/src/com/fsck/k9/mail/transport/TrustedSocketFactory.java similarity index 93% rename from src/com/android/email/mail/transport/TrustedSocketFactory.java rename to src/com/fsck/k9/mail/transport/TrustedSocketFactory.java index 78955211d..4fc3a9ad3 100644 --- a/src/com/android/email/mail/transport/TrustedSocketFactory.java +++ b/src/com/fsck/k9/mail/transport/TrustedSocketFactory.java @@ -1,6 +1,6 @@ -package com.android.email.mail.transport; +package com.fsck.k9.mail.transport; -import com.android.email.mail.store.TrustManagerFactory; +import com.fsck.k9.mail.store.TrustManagerFactory; import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.conn.scheme.LayeredSocketFactory; import org.apache.http.params.HttpParams; diff --git a/src/com/android/email/mail/transport/WebDavTransport.java b/src/com/fsck/k9/mail/transport/WebDavTransport.java similarity index 79% rename from src/com/android/email/mail/transport/WebDavTransport.java rename to src/com/fsck/k9/mail/transport/WebDavTransport.java index e37f8c5a7..da2fc16c6 100644 --- a/src/com/android/email/mail/transport/WebDavTransport.java +++ b/src/com/fsck/k9/mail/transport/WebDavTransport.java @@ -1,13 +1,13 @@ -package com.android.email.mail.transport; +package com.fsck.k9.mail.transport; import android.util.Log; -import com.android.email.Email; -import com.android.email.PeekableInputStream; -import com.android.email.mail.Message; -import com.android.email.mail.MessagingException; -import com.android.email.mail.Transport; -import com.android.email.mail.store.WebDavStore; +import com.fsck.k9.K9; +import com.fsck.k9.PeekableInputStream; +import com.fsck.k9.mail.Message; +import com.fsck.k9.mail.MessagingException; +import com.fsck.k9.mail.Transport; +import com.fsck.k9.mail.store.WebDavStore; import java.io.OutputStream; import java.net.Socket; @@ -45,12 +45,12 @@ public class WebDavTransport extends Transport public WebDavTransport(String _uri) throws MessagingException { store = new WebDavStore(_uri); - Log.d(Email.LOG_TAG, ">>> New WebDavTransport creation complete"); + Log.d(K9.LOG_TAG, ">>> New WebDavTransport creation complete"); } public void open() throws MessagingException { - Log.d(Email.LOG_TAG, ">>> open called on WebDavTransport "); + Log.d(K9.LOG_TAG, ">>> open called on WebDavTransport "); store.getHttpClient(); } diff --git a/src/com/android/email/preferences/Editor.java b/src/com/fsck/k9/preferences/Editor.java similarity index 87% rename from src/com/android/email/preferences/Editor.java rename to src/com/fsck/k9/preferences/Editor.java index 176d9a907..bc8b7b16c 100644 --- a/src/com/android/email/preferences/Editor.java +++ b/src/com/fsck/k9/preferences/Editor.java @@ -1,7 +1,7 @@ -package com.android.email.preferences; +package com.fsck.k9.preferences; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; import java.util.ArrayList; import java.util.HashMap; @@ -33,17 +33,17 @@ public class Editor implements android.content.SharedPreferences.Editor Object value = entry.getValue(); if (key != null && value != null) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Copying key '" + key + "', value '" + value + "'"); + Log.d(K9.LOG_TAG, "Copying key '" + key + "', value '" + value + "'"); } changes.put(key, "" + value); } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Skipping copying key '" + key + "', value '" + value + "'"); + Log.d(K9.LOG_TAG, "Skipping copying key '" + key + "', value '" + value + "'"); } } } @@ -67,7 +67,7 @@ public class Editor implements android.content.SharedPreferences.Editor } catch (Exception e) { - Log.e(Email.LOG_TAG, "Failed to save preferences", e); + Log.e(K9.LOG_TAG, "Failed to save preferences", e); return false; } } @@ -75,7 +75,7 @@ public class Editor implements android.content.SharedPreferences.Editor public void commitChanges() throws Exception { long startTime = System.currentTimeMillis(); - Log.i(Email.LOG_TAG, "Committing preference changes"); + Log.i(K9.LOG_TAG, "Committing preference changes"); Runnable committer = new Runnable() { public void run() @@ -102,7 +102,7 @@ public class Editor implements android.content.SharedPreferences.Editor }; storage.doInTransaction(committer); long endTime = System.currentTimeMillis(); - Log.i(Email.LOG_TAG, "Preferences commit took " + (endTime - startTime) + "ms"); + Log.i(K9.LOG_TAG, "Preferences commit took " + (endTime - startTime) + "ms"); } diff --git a/src/com/android/email/preferences/Storage.java b/src/com/fsck/k9/preferences/Storage.java similarity index 87% rename from src/com/android/email/preferences/Storage.java rename to src/com/fsck/k9/preferences/Storage.java index 58d5929e0..e293855ca 100644 --- a/src/com/android/email/preferences/Storage.java +++ b/src/com/fsck/k9/preferences/Storage.java @@ -1,4 +1,4 @@ -package com.android.email.preferences; +package com.fsck.k9.preferences; import android.content.ContentValues; import android.content.Context; @@ -6,7 +6,7 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; import java.util.ArrayList; import java.util.Map; @@ -40,7 +40,7 @@ public class Storage implements SharedPreferences SQLiteDatabase mDb = context.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null); if (mDb.getVersion() != DB_VERSION) { - Log.i(Email.LOG_TAG, "Creating Storage database"); + Log.i(K9.LOG_TAG, "Creating Storage database"); mDb.execSQL("DROP TABLE IF EXISTS preferences_storage"); mDb.execSQL("CREATE TABLE preferences_storage " + "(primkey TEXT PRIMARY KEY ON CONFLICT REPLACE, value TEXT)"); @@ -55,33 +55,33 @@ public class Storage implements SharedPreferences Storage tmpStorage = storages.get(context); if (tmpStorage != null) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Returning already existing Storage"); + Log.d(K9.LOG_TAG, "Returning already existing Storage"); } return tmpStorage; } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Creating provisional storage"); + Log.d(K9.LOG_TAG, "Creating provisional storage"); } tmpStorage = new Storage(context); Storage oldStorage = storages.putIfAbsent(context, tmpStorage); if (oldStorage != null) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Another thread beat us to creating the Storage, returning that one"); + Log.d(K9.LOG_TAG, "Another thread beat us to creating the Storage, returning that one"); } return oldStorage; } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Returning the Storage we created"); + Log.d(K9.LOG_TAG, "Returning the Storage we created"); } return tmpStorage; } @@ -91,7 +91,7 @@ public class Storage implements SharedPreferences private void loadValues() { long startTime = System.currentTimeMillis(); - Log.i(Email.LOG_TAG, "Loading preferences from DB into Storage"); + Log.i(K9.LOG_TAG, "Loading preferences from DB into Storage"); Cursor cursor = null; SQLiteDatabase mDb = null; try @@ -103,9 +103,9 @@ public class Storage implements SharedPreferences { String key = cursor.getString(0); String value = cursor.getString(1); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "Loading key '" + key + "', value = '" + value + "'"); + Log.d(K9.LOG_TAG, "Loading key '" + key + "', value = '" + value + "'"); } storage.put(key, value); } @@ -121,7 +121,7 @@ public class Storage implements SharedPreferences mDb.close(); } long endTime = System.currentTimeMillis(); - Log.i(Email.LOG_TAG, "Preferences load took " + (endTime - startTime) + "ms"); + Log.i(K9.LOG_TAG, "Preferences load took " + (endTime - startTime) + "ms"); } } @@ -220,9 +220,9 @@ public class Storage implements SharedPreferences } //@Override - public com.android.email.preferences.Editor edit() + public com.fsck.k9.preferences.Editor edit() { - return new com.android.email.preferences.Editor(this); + return new com.fsck.k9.preferences.Editor(this); } //@Override diff --git a/src/com/android/email/provider/AttachmentProvider.java b/src/com/fsck/k9/provider/AttachmentProvider.java similarity index 97% rename from src/com/android/email/provider/AttachmentProvider.java rename to src/com/fsck/k9/provider/AttachmentProvider.java index f867fc27f..1867470ad 100644 --- a/src/com/android/email/provider/AttachmentProvider.java +++ b/src/com/fsck/k9/provider/AttachmentProvider.java @@ -1,4 +1,4 @@ -package com.android.email.provider; +package com.fsck.k9.provider; import android.content.ContentProvider; import android.content.ContentValues; @@ -11,9 +11,9 @@ import android.graphics.BitmapFactory; import android.net.Uri; import android.os.ParcelFileDescriptor; import android.util.Log; -import com.android.email.Account; -import com.android.email.Email; -import com.android.email.mail.internet.MimeUtility; +import com.fsck.k9.Account; +import com.fsck.k9.K9; +import com.fsck.k9.mail.internet.MimeUtility; import java.io.*; import java.util.List; @@ -94,7 +94,7 @@ public class AttachmentProvider extends ContentProvider { try { - Log.d(Email.LOG_TAG, "Deleting file " + file.getCanonicalPath()); + Log.d(K9.LOG_TAG, "Deleting file " + file.getCanonicalPath()); } catch (IOException ioe) {} // No need to log failure to log file.delete(); diff --git a/src/com/android/email/service/BootReceiver.java b/src/com/fsck/k9/service/BootReceiver.java similarity index 77% rename from src/com/android/email/service/BootReceiver.java rename to src/com/fsck/k9/service/BootReceiver.java index 3ea08712b..2060c60f8 100644 --- a/src/com/android/email/service/BootReceiver.java +++ b/src/com/fsck/k9/service/BootReceiver.java @@ -1,5 +1,5 @@ -package com.android.email.service; +package com.fsck.k9.service; import android.app.AlarmManager; import android.app.PendingIntent; @@ -11,7 +11,7 @@ import android.net.Uri; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; import java.util.Date; import java.util.concurrent.ConcurrentHashMap; @@ -20,14 +20,14 @@ import java.util.concurrent.atomic.AtomicInteger; public class BootReceiver extends BroadcastReceiver { - public static String WAKE_LOCK_RELEASE = "com.android.email.service.BroadcastReceiver.wakeLockRelease"; - public static String FIRE_INTENT = "com.android.email.service.BroadcastReceiver.fireIntent"; - public static String SCHEDULE_INTENT = "com.android.email.service.BroadcastReceiver.scheduleIntent"; - public static String CANCEL_INTENT = "com.android.email.service.BroadcastReceiver.cancelIntent"; + public static String WAKE_LOCK_RELEASE = "com.fsck.k9.service.BroadcastReceiver.wakeLockRelease"; + public static String FIRE_INTENT = "com.fsck.k9.service.BroadcastReceiver.fireIntent"; + public static String SCHEDULE_INTENT = "com.fsck.k9.service.BroadcastReceiver.scheduleIntent"; + public static String CANCEL_INTENT = "com.fsck.k9.service.BroadcastReceiver.cancelIntent"; - public static String WAKE_LOCK_ID = "com.android.email.service.BroadcastReceiver.wakeLockId"; - public static String ALARMED_INTENT = "com.android.email.service.BroadcastReceiver.pendingIntent"; - public static String AT_TIME = "com.android.email.service.BroadcastReceiver.atTime"; + public static String WAKE_LOCK_ID = "com.fsck.k9.service.BroadcastReceiver.wakeLockId"; + public static String ALARMED_INTENT = "com.fsck.k9.service.BroadcastReceiver.pendingIntent"; + public static String AT_TIME = "com.fsck.k9.service.BroadcastReceiver.atTime"; private static ConcurrentHashMap wakeLocks = new ConcurrentHashMap(); private static AtomicInteger wakeLockSeq = new AtomicInteger(0); @@ -35,9 +35,9 @@ public class BootReceiver extends BroadcastReceiver private Integer getWakeLock(Context context) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); wakeLock.setReferenceCounted(false); - wakeLock.acquire(Email.BOOT_RECEIVER_WAKE_LOCK_TIMEOUT); + wakeLock.acquire(K9.BOOT_RECEIVER_WAKE_LOCK_TIMEOUT); Integer tmpWakeLockId = wakeLockSeq.getAndIncrement(); wakeLocks.put(tmpWakeLockId, wakeLock); return tmpWakeLockId; @@ -54,7 +54,7 @@ public class BootReceiver extends BroadcastReceiver } else { - Log.w(Email.LOG_TAG, "BootReceiver WakeLock " + wakeLockId + " doesn't exist"); + Log.w(K9.LOG_TAG, "BootReceiver WakeLock " + wakeLockId + " doesn't exist"); } } } @@ -64,11 +64,11 @@ public class BootReceiver extends BroadcastReceiver Integer tmpWakeLockId = getWakeLock(context); try { - Log.i(Email.LOG_TAG, "BootReceiver.onReceive" + intent); + Log.i(K9.LOG_TAG, "BootReceiver.onReceive" + intent); if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { - //Email.setServicesEnabled(context, tmpWakeLockId); + //K9.setServicesEnabled(context, tmpWakeLockId); //tmpWakeLockId = null; } else if (Intent.ACTION_DEVICE_STORAGE_LOW.equals(intent.getAction())) @@ -97,7 +97,7 @@ public class BootReceiver extends BroadcastReceiver Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT); String alarmedAction = alarmedIntent.getAction(); - Log.i(Email.LOG_TAG, "BootReceiver Got alarm to fire alarmedIntent " + alarmedAction); + Log.i(K9.LOG_TAG, "BootReceiver Got alarm to fire alarmedIntent " + alarmedAction); alarmedIntent.putExtra(WAKE_LOCK_ID, tmpWakeLockId); tmpWakeLockId = null; if (alarmedIntent != null) @@ -109,7 +109,7 @@ public class BootReceiver extends BroadcastReceiver { long atTime = intent.getLongExtra(AT_TIME, -1); Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT); - Log.i(Email.LOG_TAG,"BootReceiver Scheduling intent " + alarmedIntent + " for " + new Date(atTime)); + Log.i(K9.LOG_TAG,"BootReceiver Scheduling intent " + alarmedIntent + " for " + new Date(atTime)); PendingIntent pi = buildPendingIntent(context, intent); AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); @@ -119,7 +119,7 @@ public class BootReceiver extends BroadcastReceiver else if (CANCEL_INTENT.equals(intent.getAction())) { Intent alarmedIntent = intent.getParcelableExtra(ALARMED_INTENT); - Log.i(Email.LOG_TAG, "BootReceiver Canceling alarmedIntent " + alarmedIntent); + Log.i(K9.LOG_TAG, "BootReceiver Canceling alarmedIntent " + alarmedIntent); PendingIntent pi = buildPendingIntent(context, intent); @@ -131,7 +131,7 @@ public class BootReceiver extends BroadcastReceiver Integer wakeLockId = intent.getIntExtra(WAKE_LOCK_ID, -1); if (wakeLockId != -1) { - Log.i(Email.LOG_TAG, "BootReceiver Release wakeLock " + wakeLockId); + Log.i(K9.LOG_TAG, "BootReceiver Release wakeLock " + wakeLockId); releaseWakeLock(wakeLockId); } } @@ -158,7 +158,7 @@ public class BootReceiver extends BroadcastReceiver public static void scheduleIntent(Context context, long atTime, Intent alarmedIntent) { - Log.i(Email.LOG_TAG, "BootReceiver Got request to schedule alarmedIntent " + alarmedIntent.getAction()); + Log.i(K9.LOG_TAG, "BootReceiver Got request to schedule alarmedIntent " + alarmedIntent.getAction()); Intent i = new Intent(); i.setClass(context, BootReceiver.class); i.setAction(SCHEDULE_INTENT); @@ -169,7 +169,7 @@ public class BootReceiver extends BroadcastReceiver public static void cancelIntent(Context context, Intent alarmedIntent) { - Log.i(Email.LOG_TAG, "BootReceiver Got request to cancel alarmedIntent " + alarmedIntent.getAction()); + Log.i(K9.LOG_TAG, "BootReceiver Got request to cancel alarmedIntent " + alarmedIntent.getAction()); Intent i = new Intent(); i.setClass(context, BootReceiver.class); i.setAction(CANCEL_INTENT); @@ -179,7 +179,7 @@ public class BootReceiver extends BroadcastReceiver public static void releaseWakeLock(Context context, int wakeLockId) { - Log.i(Email.LOG_TAG, "BootReceiver Got request to release wakeLock " + wakeLockId); + Log.i(K9.LOG_TAG, "BootReceiver Got request to release wakeLock " + wakeLockId); Intent i = new Intent(); i.setClass(context, BootReceiver.class); i.setAction(WAKE_LOCK_RELEASE); diff --git a/src/com/android/email/service/CoreService.java b/src/com/fsck/k9/service/CoreService.java similarity index 81% rename from src/com/android/email/service/CoreService.java rename to src/com/fsck/k9/service/CoreService.java index f0bf6ad7e..4bcc28ae7 100644 --- a/src/com/android/email/service/CoreService.java +++ b/src/com/fsck/k9/service/CoreService.java @@ -1,4 +1,4 @@ -package com.android.email.service; +package com.fsck.k9.service; import android.app.Service; import android.content.Context; @@ -7,7 +7,7 @@ import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; public abstract class CoreService extends Service { @@ -25,11 +25,11 @@ public abstract class CoreService extends Service { PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); wakeLock.setReferenceCounted(false); - wakeLock.acquire(Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT); + wakeLock.acquire(K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT); - Log.i(Email.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onStart(" + intent + ", " + startId); + Log.i(K9.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onStart(" + intent + ", " + startId); int wakeLockId = intent.getIntExtra(BootReceiver.WAKE_LOCK_ID, -1); if (wakeLockId != -1) @@ -65,7 +65,7 @@ public abstract class CoreService extends Service @Override public void onDestroy() { - Log.i(Email.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onDestroy()"); + Log.i(K9.LOG_TAG, "CoreService: " + this.getClass().getName() + ".onDestroy()"); super.onDestroy(); // MessagingController.getInstance(getApplication()).removeListener(mListener); } diff --git a/src/com/android/email/service/MailService.java b/src/com/fsck/k9/service/MailService.java similarity index 75% rename from src/com/android/email/service/MailService.java rename to src/com/fsck/k9/service/MailService.java index abb5b587c..76fda66de 100644 --- a/src/com/android/email/service/MailService.java +++ b/src/com/fsck/k9/service/MailService.java @@ -1,5 +1,5 @@ -package com.android.email.service; +package com.fsck.k9.service; import android.app.Notification; import android.app.NotificationManager; @@ -14,8 +14,8 @@ import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Config; import android.util.Log; -import com.android.email.*; -import com.android.email.mail.Pusher; +import com.fsck.k9.*; +import com.fsck.k9.mail.Pusher; import java.util.Collection; import java.util.Date; @@ -26,16 +26,16 @@ import java.util.concurrent.Executors; */ public class MailService extends CoreService { - private static final String ACTION_CHECK_MAIL = "com.android.email.intent.action.MAIL_SERVICE_WAKEUP"; - private static final String ACTION_RESCHEDULE = "com.android.email.intent.action.MAIL_SERVICE_RESCHEDULE"; - private static final String ACTION_RESCHEDULE_CHECK = "com.android.email.intent.action.MAIL_SERVICE_RESCHEDULE_CHECK"; - private static final String ACTION_CANCEL = "com.android.email.intent.action.MAIL_SERVICE_CANCEL"; - private static final String ACTION_REFRESH_PUSHERS = "com.android.email.intent.action.MAIL_SERVICE_REFRESH_PUSHERS"; - private static final String CONNECTIVITY_CHANGE = "com.android.email.intent.action.MAIL_SERVICE_CONNECTIVITY_CHANGE"; - private static final String BACKGROUND_DATA_CHANGED = "com.android.email.intent.action.MAIL_SERVICE_BACKGROUND_DATA_CHANGED"; - private static final String CANCEL_CONNECTIVITY_NOTICE = "com.android.email.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE"; + private static final String ACTION_CHECK_MAIL = "com.fsck.k9.intent.action.MAIL_SERVICE_WAKEUP"; + private static final String ACTION_RESCHEDULE = "com.fsck.k9.intent.action.MAIL_SERVICE_RESCHEDULE"; + private static final String ACTION_RESCHEDULE_CHECK = "com.fsck.k9.intent.action.MAIL_SERVICE_RESCHEDULE_CHECK"; + private static final String ACTION_CANCEL = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL"; + private static final String ACTION_REFRESH_PUSHERS = "com.fsck.k9.intent.action.MAIL_SERVICE_REFRESH_PUSHERS"; + private static final String CONNECTIVITY_CHANGE = "com.fsck.k9.intent.action.MAIL_SERVICE_CONNECTIVITY_CHANGE"; + private static final String BACKGROUND_DATA_CHANGED = "com.fsck.k9.intent.action.MAIL_SERVICE_BACKGROUND_DATA_CHANGED"; + private static final String CANCEL_CONNECTIVITY_NOTICE = "com.fsck.k9.intent.action.MAIL_SERVICE_CANCEL_CONNECTIVITY_NOTICE"; - private static final String HAS_CONNECTIVITY = "com.android.email.intent.action.MAIL_SERVICE_HAS_CONNECTIVITY"; + private static final String HAS_CONNECTIVITY = "com.fsck.k9.intent.action.MAIL_SERVICE_HAS_CONNECTIVITY"; private final ExecutorService threadPool = Executors.newFixedThreadPool(1); // Must be single threaded @@ -90,7 +90,7 @@ public class MailService extends CoreService public void onCreate() { super.onCreate(); - Log.v(Email.LOG_TAG, "***** MailService *****: onCreate"); + Log.v(K9.LOG_TAG, "***** MailService *****: onCreate"); } @Override @@ -114,20 +114,20 @@ public class MailService extends CoreService } boolean backgroundData = connectivityManager.getBackgroundDataSetting(); - Email.BACKGROUND_OPS bOps = Email.getBackgroundOps(); - doBackground = (backgroundData == true && bOps != Email.BACKGROUND_OPS.NEVER) - | (backgroundData == false && bOps == Email.BACKGROUND_OPS.ALWAYS); + K9.BACKGROUND_OPS bOps = K9.getBackgroundOps(); + doBackground = (backgroundData == true && bOps != K9.BACKGROUND_OPS.NEVER) + | (backgroundData == false && bOps == K9.BACKGROUND_OPS.ALWAYS); } setForeground(true); // if it gets killed once, it'll never restart - Log.i(Email.LOG_TAG, "MailService.onStart(" + intent + ", " + startId + Log.i(K9.LOG_TAG, "MailService.onStart(" + intent + ", " + startId + "), hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground); // MessagingController.getInstance(getApplication()).addListener(mListener); if (ACTION_CHECK_MAIL.equals(intent.getAction())) { - Log.i(Email.LOG_TAG, "***** MailService *****: checking mail"); + Log.i(K9.LOG_TAG, "***** MailService *****: checking mail"); if (hasConnectivity && doBackground) { @@ -141,7 +141,7 @@ public class MailService extends CoreService { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "***** MailService *****: cancel"); + Log.v(K9.LOG_TAG, "***** MailService *****: cancel"); } MessagingController.getInstance(getApplication()).log("***** MailService *****: cancel"); @@ -151,7 +151,7 @@ public class MailService extends CoreService { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "***** MailService *****: reschedule"); + Log.v(K9.LOG_TAG, "***** MailService *****: reschedule"); } rescheduleAll(hasConnectivity, doBackground, startIdObj); startIdObj = null; @@ -162,7 +162,7 @@ public class MailService extends CoreService { if (Config.LOGV) { - Log.v(Email.LOG_TAG, "***** MailService *****: reschedule check"); + Log.v(K9.LOG_TAG, "***** MailService *****: reschedule check"); } reschedule(startIdObj); startIdObj = null; @@ -184,7 +184,7 @@ public class MailService extends CoreService notifyConnectionStatus(hasConnectivity); rescheduleAll(hasConnectivity, doBackground, startIdObj); startIdObj = null; - Log.i(Email.LOG_TAG, "Got connectivity action with hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground); + Log.i(K9.LOG_TAG, "Got connectivity action with hasConnectivity = " + hasConnectivity + ", doBackground = " + doBackground); } else if (CANCEL_CONNECTIVITY_NOTICE.equals(intent.getAction())) { @@ -199,7 +199,7 @@ public class MailService extends CoreService } } long endTime = System.currentTimeMillis(); - Log.i(Email.LOG_TAG, "MailService.onStart took " + (endTime - startTime) + "ms"); + Log.i(K9.LOG_TAG, "MailService.onStart took " + (endTime - startTime) + "ms"); } private void rescheduleAll(final boolean hasConnectivity, final boolean doBackground, final Integer startId) @@ -230,7 +230,7 @@ public class MailService extends CoreService header, System.currentTimeMillis()); Intent i = new Intent(); - i.setClassName(getApplication().getPackageName(), "com.android.email.service.MailService"); + i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService"); i.setAction(MailService.CANCEL_CONNECTIVITY_NOTICE); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); @@ -238,18 +238,18 @@ public class MailService extends CoreService notif.setLatestEventInfo(getApplication(), header, notice, pi); notif.flags = Notification.FLAG_ONGOING_EVENT; - notifMgr.notify(Email.CONNECTIVITY_ID, notif); + notifMgr.notify(K9.CONNECTIVITY_ID, notif); } else { - notifMgr.cancel(Email.CONNECTIVITY_ID); + notifMgr.cancel(K9.CONNECTIVITY_ID); } } @Override public void onDestroy() { - Log.v(Email.LOG_TAG, "***** MailService *****: onDestroy()"); + Log.v(K9.LOG_TAG, "***** MailService *****: onDestroy()"); super.onDestroy(); // MessagingController.getInstance(getApplication()).removeListener(mListener); } @@ -257,7 +257,7 @@ public class MailService extends CoreService private void cancel() { Intent i = new Intent(); - i.setClassName(getApplication().getPackageName(), "com.android.email.service.MailService"); + i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService"); i.setAction(ACTION_CHECK_MAIL); BootReceiver.cancelIntent(this, i); } @@ -281,7 +281,7 @@ public class MailService extends CoreService if (shortestInterval == -1) { - Log.v(Email.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName()); + Log.v(K9.LOG_TAG, "No next check scheduled for package " + getApplication().getPackageName()); cancel(); } else @@ -292,24 +292,24 @@ public class MailService extends CoreService try { String checkString = "Next check for package " + getApplication().getPackageName() + " scheduled for " + new Date(nextTime); - Log.i(Email.LOG_TAG, checkString); + Log.i(K9.LOG_TAG, checkString); MessagingController.getInstance(getApplication()).log(checkString); } catch (Exception e) { // I once got a NullPointerException deep in new Date(); - Log.e(Email.LOG_TAG, "Exception while logging", e); + Log.e(K9.LOG_TAG, "Exception while logging", e); } Intent i = new Intent(); - i.setClassName(getApplication().getPackageName(), "com.android.email.service.MailService"); + i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService"); i.setAction(ACTION_CHECK_MAIL); BootReceiver.scheduleIntent(MailService.this, nextTime, i); } } } - , Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); + , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); } private void stopPushers(final Integer startId) @@ -322,7 +322,7 @@ public class MailService extends CoreService PushService.stopService(MailService.this); } } - , Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); + , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); } private void reschedulePushers(final Integer startId) @@ -332,14 +332,14 @@ public class MailService extends CoreService public void run() { - Log.i(Email.LOG_TAG, "Rescheduling pushers"); + Log.i(K9.LOG_TAG, "Rescheduling pushers"); stopPushers(null); setupPushers(null); schedulePushers(startId); } } - , Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, null); + , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, null); } private void setupPushers(final Integer startId) @@ -351,7 +351,7 @@ public class MailService extends CoreService boolean pushing = false; for (Account account : Preferences.getPreferences(MailService.this).getAccounts()) { - Log.i(Email.LOG_TAG, "Setting up pushers for account " + account.getDescription()); + Log.i(K9.LOG_TAG, "Setting up pushers for account " + account.getDescription()); pushing |= MessagingController.getInstance(getApplication()).setupPushing(account); } if (pushing) @@ -360,7 +360,7 @@ public class MailService extends CoreService } } } - , Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); + , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); } private void refreshPushers(final Integer startId) @@ -371,7 +371,7 @@ public class MailService extends CoreService { try { - Log.i(Email.LOG_TAG, "Refreshing pushers"); + Log.i(K9.LOG_TAG, "Refreshing pushers"); Collection pushers = MessagingController.getInstance(getApplication()).getPushers(); for (Pusher pusher : pushers) { @@ -380,11 +380,11 @@ public class MailService extends CoreService } catch (Exception e) { - Log.e(Email.LOG_TAG, "Exception while refreshing pushers", e); + Log.e(K9.LOG_TAG, "Exception while refreshing pushers", e); } } } - , Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); + , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); } private void schedulePushers(final Integer startId) @@ -404,35 +404,35 @@ public class MailService extends CoreService minInterval = interval; } } - if (Email.DEBUG) + if (K9.DEBUG) { - Log.v(Email.LOG_TAG, "Pusher refresh interval = " + minInterval); + Log.v(K9.LOG_TAG, "Pusher refresh interval = " + minInterval); } if (minInterval != -1) { long nextTime = System.currentTimeMillis() + minInterval; String checkString = "Next pusher refresh scheduled for " + new Date(nextTime); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, checkString); + Log.d(K9.LOG_TAG, checkString); } Intent i = new Intent(); - i.setClassName(getApplication().getPackageName(), "com.android.email.service.MailService"); + i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService"); i.setAction(ACTION_REFRESH_PUSHERS); BootReceiver.scheduleIntent(MailService.this, nextTime, i); } } } - , Email.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); + , K9.MAIL_SERVICE_WAKE_LOCK_TIMEOUT, startId); } public void execute(Context context, final Runnable runner, int wakeLockTime, final Integer startId) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + final WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); wakeLock.setReferenceCounted(false); wakeLock.acquire(wakeLockTime); - Log.i(Email.LOG_TAG, "MailService queueing Runnable " + runner.hashCode() + " with startId " + startId); + Log.i(K9.LOG_TAG, "MailService queueing Runnable " + runner.hashCode() + " with startId " + startId); Runnable myRunner = new Runnable() { public void run() @@ -440,12 +440,12 @@ public class MailService extends CoreService try { - Log.i(Email.LOG_TAG, "MailService running Runnable " + runner.hashCode() + " with startId " + startId); + Log.i(K9.LOG_TAG, "MailService running Runnable " + runner.hashCode() + " with startId " + startId); runner.run(); } finally { - Log.i(Email.LOG_TAG, "MailService completed Runnable " + runner.hashCode() + " with startId " + startId); + Log.i(K9.LOG_TAG, "MailService completed Runnable " + runner.hashCode() + " with startId " + startId); wakeLock.release(); if (startId != null) { diff --git a/src/com/android/email/service/PollService.java b/src/com/fsck/k9/service/PollService.java similarity index 89% rename from src/com/android/email/service/PollService.java rename to src/com/fsck/k9/service/PollService.java index c5daf51b7..c18e281f8 100644 --- a/src/com/android/email/service/PollService.java +++ b/src/com/fsck/k9/service/PollService.java @@ -1,4 +1,4 @@ -package com.android.email.service; +package com.fsck.k9.service; import android.content.Context; import android.content.Intent; @@ -6,14 +6,14 @@ import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; -import com.android.email.*; +import com.fsck.k9.*; import java.util.HashMap; public class PollService extends CoreService { - private static String START_SERVICE = "com.android.email.service.PollService.startService"; - private static String STOP_SERVICE = "com.android.email.service.PollService.stopService"; + private static String START_SERVICE = "com.fsck.k9.service.PollService.startService"; + private static String STOP_SERVICE = "com.fsck.k9.service.PollService.stopService"; private Listener mListener = new Listener(); @@ -38,7 +38,7 @@ public class PollService extends CoreService { if (START_SERVICE.equals(intent.getAction())) { - Log.i(Email.LOG_TAG, "PollService started with startId = " + startId); + Log.i(K9.LOG_TAG, "PollService started with startId = " + startId); MessagingController controller = MessagingController.getInstance(getApplication()); Listener listener = (Listener)controller.getCheckMailListener(); @@ -59,7 +59,7 @@ public class PollService extends CoreService } else if (STOP_SERVICE.equals(intent.getAction())) { - Log.i(Email.LOG_TAG, "PollService stopping"); + Log.i(K9.LOG_TAG, "PollService stopping"); stopSelf(); } @@ -84,9 +84,9 @@ public class PollService extends CoreService WakeLock oldWakeLock = wakeLock; PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email"); + wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9"); wakeLock.setReferenceCounted(false); - wakeLock.acquire(Email.WAKE_LOCK_TIMEOUT); + wakeLock.acquire(K9.WAKE_LOCK_TIMEOUT); if (oldWakeLock != null) { @@ -156,7 +156,7 @@ public class PollService extends CoreService controller.setCheckMailListener(null); MailService.rescheduleCheck(PollService.this, null); wakeLockRelease(); - Log.i(Email.LOG_TAG, "PollService stopping with startId = " + startId); + Log.i(K9.LOG_TAG, "PollService stopping with startId = " + startId); stopSelf(startId); } @@ -165,7 +165,7 @@ public class PollService extends CoreService public void checkMailFinished(Context context, Account account) { - Log.v(Email.LOG_TAG, "***** PollService *****: checkMailFinished"); + Log.v(K9.LOG_TAG, "***** PollService *****: checkMailFinished"); try { checkMailDone(context, account); diff --git a/src/com/android/email/service/PushService.java b/src/com/fsck/k9/service/PushService.java similarity index 70% rename from src/com/android/email/service/PushService.java rename to src/com/fsck/k9/service/PushService.java index b6960f9bc..3f0220285 100644 --- a/src/com/android/email/service/PushService.java +++ b/src/com/fsck/k9/service/PushService.java @@ -1,15 +1,15 @@ -package com.android.email.service; +package com.fsck.k9.service; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; public class PushService extends CoreService { - private static String START_SERVICE = "com.android.email.service.PushService.startService"; - private static String STOP_SERVICE = "com.android.email.service.PushService.stopService"; + private static String START_SERVICE = "com.fsck.k9.service.PushService.startService"; + private static String STOP_SERVICE = "com.fsck.k9.service.PushService.stopService"; public static void startService(Context context) { @@ -32,11 +32,11 @@ public class PushService extends CoreService { if (START_SERVICE.equals(intent.getAction())) { - Log.i(Email.LOG_TAG, "PushService started with startId = " + startId); + Log.i(K9.LOG_TAG, "PushService started with startId = " + startId); } else if (STOP_SERVICE.equals(intent.getAction())) { - Log.i(Email.LOG_TAG, "PushService stopping with startId = " + startId); + Log.i(K9.LOG_TAG, "PushService stopping with startId = " + startId); stopSelf(startId); } diff --git a/src/com/android/email/service/SleepService.java b/src/com/fsck/k9/service/SleepService.java similarity index 71% rename from src/com/android/email/service/SleepService.java rename to src/com/fsck/k9/service/SleepService.java index 2c9b4b10b..2cc404d96 100644 --- a/src/com/android/email/service/SleepService.java +++ b/src/com/fsck/k9/service/SleepService.java @@ -1,10 +1,10 @@ -package com.android.email.service; +package com.fsck.k9.service; import android.content.Context; import android.content.Intent; import android.os.PowerManager.WakeLock; import android.util.Log; -import com.android.email.Email; +import com.fsck.k9.K9; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; @@ -14,8 +14,8 @@ import java.util.concurrent.atomic.AtomicInteger; public class SleepService extends CoreService { - private static String ALARM_FIRED = "com.android.email.service.SleepService.ALARM_FIRED"; - private static String LATCH_ID = "com.android.email.service.SleepService.LATCH_ID_EXTRA"; + private static String ALARM_FIRED = "com.fsck.k9.service.SleepService.ALARM_FIRED"; + private static String LATCH_ID = "com.fsck.k9.service.SleepService.LATCH_ID_EXTRA"; private static ConcurrentHashMap sleepData = new ConcurrentHashMap(); @@ -25,9 +25,9 @@ public class SleepService extends CoreService public static void sleep(Context context, long sleepTime, WakeLock wakeLock, long wakeLockTimeout) { Integer id = latchId.getAndIncrement(); - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SleepService Preparing CountDownLatch with id = " + id + ", thread " + Thread.currentThread().getName()); + Log.d(K9.LOG_TAG, "SleepService Preparing CountDownLatch with id = " + id + ", thread " + Thread.currentThread().getName()); } SleepDatum sleepDatum = new SleepDatum(); CountDownLatch latch = new CountDownLatch(1); @@ -35,7 +35,7 @@ public class SleepService extends CoreService sleepData.put(id, sleepDatum); Intent i = new Intent(); - i.setClassName(context.getPackageName(), "com.android.email.service.SleepService"); + i.setClassName(context.getPackageName(), "com.fsck.k9.service.SleepService"); i.putExtra(LATCH_ID, id); i.setAction(ALARM_FIRED + "." + id); long startTime = System.currentTimeMillis(); @@ -52,9 +52,9 @@ public class SleepService extends CoreService boolean timedOut = latch.await(sleepTime, TimeUnit.MILLISECONDS); if (timedOut == false) { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SleepService latch timed out for id = " + id + ", thread " + Thread.currentThread().getName()); + Log.d(K9.LOG_TAG, "SleepService latch timed out for id = " + id + ", thread " + Thread.currentThread().getName()); } // don't call endSleep here or remove the sleepDatum here, instead of the following block. // We might not get the wakeLock before @@ -72,17 +72,17 @@ public class SleepService extends CoreService } catch (InterruptedException ie) { - Log.e(Email.LOG_TAG, "SleepService Interrupted", ie); + Log.e(K9.LOG_TAG, "SleepService Interrupted", ie); } long endTime = System.currentTimeMillis(); long actualSleep = endTime - startTime; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.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); } if (actualSleep < sleepTime) { - Log.w(Email.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); } } @@ -96,13 +96,13 @@ public class SleepService extends CoreService CountDownLatch latch = sleepDatum.latch; if (latch == null) { - Log.e(Email.LOG_TAG, "SleepService No CountDownLatch available with id = " + id); + Log.e(K9.LOG_TAG, "SleepService No CountDownLatch available with id = " + id); } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SleepService Counting down CountDownLatch with id = " + id); + Log.d(K9.LOG_TAG, "SleepService Counting down CountDownLatch with id = " + id); } latch.countDown(); } @@ -110,9 +110,9 @@ public class SleepService extends CoreService } else { - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SleepService Sleep for id " + id + " already finished"); + Log.d(K9.LOG_TAG, "SleepService Sleep for id " + id + " already finished"); } } } @@ -126,9 +126,9 @@ public class SleepService extends CoreService synchronized (wakeLock) { long timeout = sleepDatum.timeout; - if (Email.DEBUG) + if (K9.DEBUG) { - Log.d(Email.LOG_TAG, "SleepService Acquring wakeLock for id for " + timeout + "ms"); + Log.d(K9.LOG_TAG, "SleepService Acquring wakeLock for id for " + timeout + "ms"); } wakeLock.acquire(timeout); } diff --git a/src/com/fsck/k9beta/K9.java b/src/com/fsck/k9beta/K9.java deleted file mode 100644 index 4cc5361bf..000000000 --- a/src/com/fsck/k9beta/K9.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.fsck.k9beta; - -import com.android.email.Email; - -public class K9 extends Email { -} diff --git a/tools/build-beta b/tools/build-beta index 5248bc02b..31ee77046 100755 --- a/tools/build-beta +++ b/tools/build-beta @@ -1,9 +1,9 @@ perl -pi -e's|\@string/app_name|\@string/beta_app_name|g' AndroidManifest.xml -perl -pi -e's/com\.fsck\.k9/com.fsck.k9beta/g' build.xml AndroidManifest.xml src/com/android/email/provider/AttachmentProvider.java +perl -pi -e's/com\.fsck\.k9/com.fsck.k9beta/g' build.xml AndroidManifest.xml src/com.fsck.k9/provider/AttachmentProvider.java perl -pi -e's|com/fsck/k9/R.java|com/fsck/k9beta/R.java|g' build.xml perl -pi -e's|K9|K9-BETA|g' build.xml ant $@ perl -pi -e's|K9-BETA|K9|g' build.xml -perl -pi -e's/com\.fsck\.k9beta/com.fsck.k9/g' build.xml AndroidManifest.xml src/com/android/email/provider/AttachmentProvider.java +perl -pi -e's/com\.fsck\.k9beta/com.fsck.k9/g' build.xml AndroidManifest.xml src/com.fsck.k9/provider/AttachmentProvider.java perl -pi -e's|com/fsck/k9beta/R.java|com/fsck/k9/R.java|g' build.xml perl -pi -e's|\@string/beta_app_name|\@string/app_name|g' AndroidManifest.xml