|
|
@ -62,6 +62,7 @@ import java.util.regex.Pattern;
|
|
|
|
import javax.mail.Address;
|
|
|
|
import javax.mail.Address;
|
|
|
|
import javax.mail.Header;
|
|
|
|
import javax.mail.Header;
|
|
|
|
import javax.mail.MessagingException;
|
|
|
|
import javax.mail.MessagingException;
|
|
|
|
|
|
|
|
import javax.mail.Part;
|
|
|
|
import javax.mail.internet.AddressException;
|
|
|
|
import javax.mail.internet.AddressException;
|
|
|
|
import javax.mail.internet.InternetAddress;
|
|
|
|
import javax.mail.internet.InternetAddress;
|
|
|
|
import javax.mail.internet.InternetHeaders;
|
|
|
|
import javax.mail.internet.InternetHeaders;
|
|
|
@ -639,6 +640,7 @@ public class EntityRule {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
String to = jargs.optString("to");
|
|
|
|
String to = jargs.optString("to");
|
|
|
|
boolean resend = jargs.optBoolean("resend");
|
|
|
|
boolean resend = jargs.optBoolean("resend");
|
|
|
|
|
|
|
|
boolean attached = jargs.optBoolean("attached");
|
|
|
|
boolean attachments = jargs.optBoolean("attachments");
|
|
|
|
boolean attachments = jargs.optBoolean("attachments");
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(to) &&
|
|
|
|
if (TextUtils.isEmpty(to) &&
|
|
|
@ -667,6 +669,11 @@ public class EntityRule {
|
|
|
|
EntityOperation.queue(context, message, EntityOperation.HEADERS);
|
|
|
|
EntityOperation.queue(context, message, EntityOperation.HEADERS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!resend && attached && !Boolean.TRUE.equals(message.raw)) {
|
|
|
|
|
|
|
|
complete = false;
|
|
|
|
|
|
|
|
EntityOperation.queue(context, message, EntityOperation.RAW);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!complete) {
|
|
|
|
if (!complete) {
|
|
|
|
EntityOperation.queue(context, message, EntityOperation.RULE, this.id);
|
|
|
|
EntityOperation.queue(context, message, EntityOperation.RULE, this.id);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -699,6 +706,7 @@ public class EntityRule {
|
|
|
|
boolean attachments = jargs.optBoolean("attachments");
|
|
|
|
boolean attachments = jargs.optBoolean("attachments");
|
|
|
|
String to = jargs.optString("to");
|
|
|
|
String to = jargs.optString("to");
|
|
|
|
boolean resend = jargs.optBoolean("resend");
|
|
|
|
boolean resend = jargs.optBoolean("resend");
|
|
|
|
|
|
|
|
boolean attached = jargs.optBoolean("attached");
|
|
|
|
boolean cc = jargs.optBoolean("cc");
|
|
|
|
boolean cc = jargs.optBoolean("cc");
|
|
|
|
|
|
|
|
|
|
|
|
boolean isReply = TextUtils.isEmpty(to);
|
|
|
|
boolean isReply = TextUtils.isEmpty(to);
|
|
|
@ -835,6 +843,22 @@ public class EntityRule {
|
|
|
|
if (attachments || resend)
|
|
|
|
if (attachments || resend)
|
|
|
|
EntityAttachment.copy(context, message.id, reply.id);
|
|
|
|
EntityAttachment.copy(context, message.id, reply.id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!resend && attached) {
|
|
|
|
|
|
|
|
EntityAttachment attachment = new EntityAttachment();
|
|
|
|
|
|
|
|
attachment.message = reply.id;
|
|
|
|
|
|
|
|
attachment.sequence = 1;
|
|
|
|
|
|
|
|
attachment.name = "email.eml";
|
|
|
|
|
|
|
|
attachment.type = "message/rfc822";
|
|
|
|
|
|
|
|
attachment.disposition = Part.ATTACHMENT;
|
|
|
|
|
|
|
|
attachment.progress = 0;
|
|
|
|
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File source = message.getRawFile(context);
|
|
|
|
|
|
|
|
File target = attachment.getFile(context);
|
|
|
|
|
|
|
|
Helper.copy(source, target);
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, target.length());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EntityOperation.queue(context, reply, EntityOperation.SEND);
|
|
|
|
EntityOperation.queue(context, reply, EntityOperation.SEND);
|
|
|
|
|
|
|
|
|
|
|
|
// Batch send operations, wait until after commit
|
|
|
|
// Batch send operations, wait until after commit
|
|
|
|