Loading k9mail-library/src/main/java/com/fsck/k9/mail/internet/MimeUtility.java +4 −0 Original line number Diff line number Diff line Loading @@ -1129,6 +1129,10 @@ public class MimeUtility { return isSameMimeType(mimeType, "message/rfc822"); } public static boolean isMessageType(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("message/"); } public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } Loading k9mail/src/main/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -434,6 +434,17 @@ </provider> <provider android:name=".provider.RawMessageProvider" android:authorities="${applicationId}.rawmessageprovider" android:exported="false"> <meta-data android:name="de.cketti.safecontentresolver.ALLOW_INTERNAL_ACCESS" android:value="true" /> </provider> <provider android:name=".provider.MessageProvider" android:authorities="${applicationId}.messageprovider" Loading k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +35 −10 Original line number Diff line number Diff line package com.fsck.k9.activity; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; Loading Loading @@ -121,6 +122,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, public static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY"; public static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL"; public static final String ACTION_FORWARD = "com.fsck.k9.intent.action.FORWARD"; public static final String ACTION_FORWARD_AS_ATTACHMENT = "com.fsck.k9.intent.action.FORWARD_AS_ATTACHMENT"; public static final String ACTION_EDIT_DRAFT = "com.fsck.k9.intent.action.EDIT_DRAFT"; private static final String ACTION_AUTOCRYPT_PEER = "org.autocrypt.PEER_ACTION"; Loading Loading @@ -355,6 +357,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, this.action = Action.REPLY_ALL; } else if (ACTION_FORWARD.equals(action)) { this.action = Action.FORWARD; } else if (ACTION_FORWARD_AS_ATTACHMENT.equals(action)) { this.action = Action.FORWARD_AS_ATTACHMENT; } else if (ACTION_EDIT_DRAFT.equals(action)) { this.action = Action.EDIT_DRAFT; } else { Loading Loading @@ -388,13 +392,19 @@ public class MessageCompose extends K9Activity implements OnClickListener, if (!relatedMessageProcessed) { if (action == Action.REPLY || action == Action.REPLY_ALL || action == Action.FORWARD || action == Action.EDIT_DRAFT) { action == Action.FORWARD || action == Action.FORWARD_AS_ATTACHMENT || action == Action.EDIT_DRAFT) { messageLoaderHelper = new MessageLoaderHelper(this, getLoaderManager(), getFragmentManager(), messageLoaderCallbacks); internalMessageHandler.sendEmptyMessage(MSG_PROGRESS_ON); if (action == Action.FORWARD_AS_ATTACHMENT) { messageLoaderHelper.asyncStartOrResumeLoadingMessageMetadata(relatedMessageReference); } else { Parcelable cachedDecryptionResult = intent.getParcelableExtra(EXTRA_MESSAGE_DECRYPTION_RESULT); messageLoaderHelper.asyncStartOrResumeLoadingMessage(relatedMessageReference, cachedDecryptionResult); messageLoaderHelper.asyncStartOrResumeLoadingMessage( relatedMessageReference, cachedDecryptionResult); } } if (action != Action.EDIT_DRAFT) { Loading @@ -418,7 +428,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, recipientMvpView.requestFocusOnToField(); } if (action == Action.FORWARD) { if (action == Action.FORWARD || action == Action.FORWARD_AS_ATTACHMENT) { relatedMessageReference = relatedMessageReference.withModifiedFlag(Flag.FORWARDED); } Loading Loading @@ -1193,7 +1203,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, break; } case FORWARD: { processMessageToForward(messageViewInfo); processMessageToForward(messageViewInfo, false); break; } case FORWARD_AS_ATTACHMENT: { processMessageToForward(messageViewInfo, true); break; } case EDIT_DRAFT: { Loading @@ -1205,12 +1219,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, break; } } } catch (MessagingException me) { } catch (MessagingException e) { /* * Let the user continue composing their message even if we have a problem processing * the source message. Log it as an error, though. */ Timber.e(me, "Error while processing source message: "); Timber.e(e, "Error while processing source message: "); } finally { relatedMessageProcessed = true; changesMadeSinceLastSave = false; Loading Loading @@ -1268,7 +1282,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, } private void processMessageToForward(MessageViewInfo messageViewInfo) throws MessagingException { private void processMessageToForward(MessageViewInfo messageViewInfo, boolean asAttachment) throws MessagingException { Message message = messageViewInfo.message; String subject = message.getSubject(); Loading @@ -1290,9 +1304,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, } // Quote the message and setup the UI. if (asAttachment) { attachmentPresenter.processMessageToForwardAsAttachment(messageViewInfo); } else { quotedMessagePresenter.processMessageToForward(messageViewInfo); attachmentPresenter.processMessageToForward(messageViewInfo); } } private void processDraftMessage(MessageViewInfo messageViewInfo) { Message message = messageViewInfo.message; Loading Loading @@ -1772,6 +1790,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, Toast.makeText(MessageCompose.this, getString(R.string.message_compose_attachments_skipped_toast), Toast.LENGTH_LONG).show(); } @Override public void showMissingAttachmentsPartialMessageForwardWarning() { Toast.makeText(MessageCompose.this, getString(R.string.message_compose_attachments_forward_toast), Toast.LENGTH_LONG).show(); } }; private Handler internalMessageHandler = new Handler() { Loading Loading @@ -1809,6 +1833,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, REPLY(R.string.compose_title_reply), REPLY_ALL(R.string.compose_title_reply_all), FORWARD(R.string.compose_title_forward), FORWARD_AS_ATTACHMENT(R.string.compose_title_forward_as_attachment), EDIT_DRAFT(R.string.compose_title_compose); private final int titleResource; Loading k9mail/src/main/java/com/fsck/k9/activity/MessageList.java +14 −0 Original line number Diff line number Diff line Loading @@ -895,6 +895,10 @@ public class MessageList extends K9Activity implements MessageListFragmentListen mMessageViewFragment.onForward(); return true; } case R.id.forward_as_attachment: { mMessageViewFragment.onForwardAsAttachment(); return true; } case R.id.share: { mMessageViewFragment.onSendAlternate(); return true; Loading Loading @@ -1245,6 +1249,16 @@ public class MessageList extends K9Activity implements MessageListFragmentListen MessageActions.actionForward(this, messageReference, decryptionResultForReply); } @Override public void onForwardAsAttachment(MessageReference messageReference) { onForwardAsAttachment(messageReference, null); } @Override public void onForwardAsAttachment(MessageReference messageReference, Parcelable decryptionResultForReply) { MessageActions.actionForwardAsAttachment(this, messageReference, decryptionResultForReply); } @Override public void onReply(MessageReference messageReference) { onReply(messageReference, null); Loading k9mail/src/main/java/com/fsck/k9/activity/MessageLoaderHelper.java +22 −3 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class MessageLoaderHelper { // transient state private boolean onlyLoadMetadata; private MessageReference messageReference; private Account account; Loading @@ -110,6 +111,7 @@ public class MessageLoaderHelper { @UiThread public void asyncStartOrResumeLoadingMessage(MessageReference messageReference, Parcelable cachedDecryptionResult) { onlyLoadMetadata = false; this.messageReference = messageReference; this.account = Preferences.getPreferences(context).getAccount(messageReference.getAccountUuid()); Loading @@ -124,6 +126,15 @@ public class MessageLoaderHelper { startOrResumeLocalMessageLoader(); } @UiThread public void asyncStartOrResumeLoadingMessageMetadata(MessageReference messageReference) { onlyLoadMetadata = true; this.messageReference = messageReference; this.account = Preferences.getPreferences(context).getAccount(messageReference.getAccountUuid()); startOrResumeLocalMessageLoader(); } @UiThread public void asyncReloadMessage() { startOrResumeLocalMessageLoader(); Loading Loading @@ -206,13 +217,20 @@ public class MessageLoaderHelper { callback.onMessageDataLoadFinished(localMessage); boolean messageIncomplete = !localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL); boolean downloadedCompletely = localMessage.isSet(Flag.X_DOWNLOADED_FULL); boolean downloadedPartially = localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL); boolean messageIncomplete = !downloadedCompletely && !downloadedPartially; if (messageIncomplete) { startDownloadingMessageBody(false); return; } if (onlyLoadMetadata) { MessageViewInfo messageViewInfo = MessageViewInfo.createForMetadataOnly(localMessage, !downloadedCompletely); onDecodeMessageFinished(messageViewInfo); return; } if (K9.isOpenPgpProviderConfigured()) { startOrResumeCryptoOperation(); return; Loading @@ -239,7 +257,8 @@ public class MessageLoaderHelper { throw new IllegalStateException("loader id must be message loader id"); } return new LocalMessageLoader(context, MessagingController.getInstance(context), account, messageReference); MessagingController messagingController = MessagingController.getInstance(context); return new LocalMessageLoader(context, messagingController, account, messageReference, onlyLoadMetadata); } @Override Loading Loading
k9mail-library/src/main/java/com/fsck/k9/mail/internet/MimeUtility.java +4 −0 Original line number Diff line number Diff line Loading @@ -1129,6 +1129,10 @@ public class MimeUtility { return isSameMimeType(mimeType, "message/rfc822"); } public static boolean isMessageType(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("message/"); } public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } Loading
k9mail/src/main/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -434,6 +434,17 @@ </provider> <provider android:name=".provider.RawMessageProvider" android:authorities="${applicationId}.rawmessageprovider" android:exported="false"> <meta-data android:name="de.cketti.safecontentresolver.ALLOW_INTERNAL_ACCESS" android:value="true" /> </provider> <provider android:name=".provider.MessageProvider" android:authorities="${applicationId}.messageprovider" Loading
k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +35 −10 Original line number Diff line number Diff line package com.fsck.k9.activity; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; Loading Loading @@ -121,6 +122,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, public static final String ACTION_REPLY = "com.fsck.k9.intent.action.REPLY"; public static final String ACTION_REPLY_ALL = "com.fsck.k9.intent.action.REPLY_ALL"; public static final String ACTION_FORWARD = "com.fsck.k9.intent.action.FORWARD"; public static final String ACTION_FORWARD_AS_ATTACHMENT = "com.fsck.k9.intent.action.FORWARD_AS_ATTACHMENT"; public static final String ACTION_EDIT_DRAFT = "com.fsck.k9.intent.action.EDIT_DRAFT"; private static final String ACTION_AUTOCRYPT_PEER = "org.autocrypt.PEER_ACTION"; Loading Loading @@ -355,6 +357,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, this.action = Action.REPLY_ALL; } else if (ACTION_FORWARD.equals(action)) { this.action = Action.FORWARD; } else if (ACTION_FORWARD_AS_ATTACHMENT.equals(action)) { this.action = Action.FORWARD_AS_ATTACHMENT; } else if (ACTION_EDIT_DRAFT.equals(action)) { this.action = Action.EDIT_DRAFT; } else { Loading Loading @@ -388,13 +392,19 @@ public class MessageCompose extends K9Activity implements OnClickListener, if (!relatedMessageProcessed) { if (action == Action.REPLY || action == Action.REPLY_ALL || action == Action.FORWARD || action == Action.EDIT_DRAFT) { action == Action.FORWARD || action == Action.FORWARD_AS_ATTACHMENT || action == Action.EDIT_DRAFT) { messageLoaderHelper = new MessageLoaderHelper(this, getLoaderManager(), getFragmentManager(), messageLoaderCallbacks); internalMessageHandler.sendEmptyMessage(MSG_PROGRESS_ON); if (action == Action.FORWARD_AS_ATTACHMENT) { messageLoaderHelper.asyncStartOrResumeLoadingMessageMetadata(relatedMessageReference); } else { Parcelable cachedDecryptionResult = intent.getParcelableExtra(EXTRA_MESSAGE_DECRYPTION_RESULT); messageLoaderHelper.asyncStartOrResumeLoadingMessage(relatedMessageReference, cachedDecryptionResult); messageLoaderHelper.asyncStartOrResumeLoadingMessage( relatedMessageReference, cachedDecryptionResult); } } if (action != Action.EDIT_DRAFT) { Loading @@ -418,7 +428,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, recipientMvpView.requestFocusOnToField(); } if (action == Action.FORWARD) { if (action == Action.FORWARD || action == Action.FORWARD_AS_ATTACHMENT) { relatedMessageReference = relatedMessageReference.withModifiedFlag(Flag.FORWARDED); } Loading Loading @@ -1193,7 +1203,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, break; } case FORWARD: { processMessageToForward(messageViewInfo); processMessageToForward(messageViewInfo, false); break; } case FORWARD_AS_ATTACHMENT: { processMessageToForward(messageViewInfo, true); break; } case EDIT_DRAFT: { Loading @@ -1205,12 +1219,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, break; } } } catch (MessagingException me) { } catch (MessagingException e) { /* * Let the user continue composing their message even if we have a problem processing * the source message. Log it as an error, though. */ Timber.e(me, "Error while processing source message: "); Timber.e(e, "Error while processing source message: "); } finally { relatedMessageProcessed = true; changesMadeSinceLastSave = false; Loading Loading @@ -1268,7 +1282,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, } private void processMessageToForward(MessageViewInfo messageViewInfo) throws MessagingException { private void processMessageToForward(MessageViewInfo messageViewInfo, boolean asAttachment) throws MessagingException { Message message = messageViewInfo.message; String subject = message.getSubject(); Loading @@ -1290,9 +1304,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, } // Quote the message and setup the UI. if (asAttachment) { attachmentPresenter.processMessageToForwardAsAttachment(messageViewInfo); } else { quotedMessagePresenter.processMessageToForward(messageViewInfo); attachmentPresenter.processMessageToForward(messageViewInfo); } } private void processDraftMessage(MessageViewInfo messageViewInfo) { Message message = messageViewInfo.message; Loading Loading @@ -1772,6 +1790,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, Toast.makeText(MessageCompose.this, getString(R.string.message_compose_attachments_skipped_toast), Toast.LENGTH_LONG).show(); } @Override public void showMissingAttachmentsPartialMessageForwardWarning() { Toast.makeText(MessageCompose.this, getString(R.string.message_compose_attachments_forward_toast), Toast.LENGTH_LONG).show(); } }; private Handler internalMessageHandler = new Handler() { Loading Loading @@ -1809,6 +1833,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, REPLY(R.string.compose_title_reply), REPLY_ALL(R.string.compose_title_reply_all), FORWARD(R.string.compose_title_forward), FORWARD_AS_ATTACHMENT(R.string.compose_title_forward_as_attachment), EDIT_DRAFT(R.string.compose_title_compose); private final int titleResource; Loading
k9mail/src/main/java/com/fsck/k9/activity/MessageList.java +14 −0 Original line number Diff line number Diff line Loading @@ -895,6 +895,10 @@ public class MessageList extends K9Activity implements MessageListFragmentListen mMessageViewFragment.onForward(); return true; } case R.id.forward_as_attachment: { mMessageViewFragment.onForwardAsAttachment(); return true; } case R.id.share: { mMessageViewFragment.onSendAlternate(); return true; Loading Loading @@ -1245,6 +1249,16 @@ public class MessageList extends K9Activity implements MessageListFragmentListen MessageActions.actionForward(this, messageReference, decryptionResultForReply); } @Override public void onForwardAsAttachment(MessageReference messageReference) { onForwardAsAttachment(messageReference, null); } @Override public void onForwardAsAttachment(MessageReference messageReference, Parcelable decryptionResultForReply) { MessageActions.actionForwardAsAttachment(this, messageReference, decryptionResultForReply); } @Override public void onReply(MessageReference messageReference) { onReply(messageReference, null); Loading
k9mail/src/main/java/com/fsck/k9/activity/MessageLoaderHelper.java +22 −3 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class MessageLoaderHelper { // transient state private boolean onlyLoadMetadata; private MessageReference messageReference; private Account account; Loading @@ -110,6 +111,7 @@ public class MessageLoaderHelper { @UiThread public void asyncStartOrResumeLoadingMessage(MessageReference messageReference, Parcelable cachedDecryptionResult) { onlyLoadMetadata = false; this.messageReference = messageReference; this.account = Preferences.getPreferences(context).getAccount(messageReference.getAccountUuid()); Loading @@ -124,6 +126,15 @@ public class MessageLoaderHelper { startOrResumeLocalMessageLoader(); } @UiThread public void asyncStartOrResumeLoadingMessageMetadata(MessageReference messageReference) { onlyLoadMetadata = true; this.messageReference = messageReference; this.account = Preferences.getPreferences(context).getAccount(messageReference.getAccountUuid()); startOrResumeLocalMessageLoader(); } @UiThread public void asyncReloadMessage() { startOrResumeLocalMessageLoader(); Loading Loading @@ -206,13 +217,20 @@ public class MessageLoaderHelper { callback.onMessageDataLoadFinished(localMessage); boolean messageIncomplete = !localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL); boolean downloadedCompletely = localMessage.isSet(Flag.X_DOWNLOADED_FULL); boolean downloadedPartially = localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL); boolean messageIncomplete = !downloadedCompletely && !downloadedPartially; if (messageIncomplete) { startDownloadingMessageBody(false); return; } if (onlyLoadMetadata) { MessageViewInfo messageViewInfo = MessageViewInfo.createForMetadataOnly(localMessage, !downloadedCompletely); onDecodeMessageFinished(messageViewInfo); return; } if (K9.isOpenPgpProviderConfigured()) { startOrResumeCryptoOperation(); return; Loading @@ -239,7 +257,8 @@ public class MessageLoaderHelper { throw new IllegalStateException("loader id must be message loader id"); } return new LocalMessageLoader(context, MessagingController.getInstance(context), account, messageReference); MessagingController messagingController = MessagingController.getInstance(context); return new LocalMessageLoader(context, messagingController, account, messageReference, onlyLoadMetadata); } @Override Loading