Quote on send

pull/147/head
M66B 6 years ago
parent 852c489ad7
commit aea6c63db9

@ -653,7 +653,7 @@ public class FragmentCompose extends FragmentEx {
Properties props = MessageHelper.getSessionProperties(Helper.AUTH_TYPE_PASSWORD, false);
Session isession = Session.getInstance(props, null);
MimeMessage imessage = new MimeMessage(isession);
MessageHelper.build(context, message, false, imessage);
MessageHelper.build(context, message, imessage);
// Serialize message
ByteArrayOutputStream os = new ByteArrayOutputStream();
@ -1621,6 +1621,12 @@ public class FragmentCompose extends FragmentEx {
draft.subject = subject;
draft.received = new Date().getTime();
db.message().updateMessage(draft);
if (action == R.id.action_send)
if (draft.replying != null || draft.forwarding != null)
body += HtmlHelper.getQuote(context,
draft.replying == null ? draft.forwarding : draft.replying, false);
draft.write(context, body);
// Execute action

@ -175,7 +175,7 @@ public class MessageHelper {
return props;
}
static MimeMessageEx from(Context context, EntityMessage message, boolean send, Session isession) throws MessagingException, IOException {
static MimeMessageEx from(Context context, EntityMessage message, Session isession) throws MessagingException, IOException {
DB db = DB.getInstance(context);
MimeMessageEx imessage = new MimeMessageEx(isession, message.msgid);
@ -277,12 +277,12 @@ public class MessageHelper {
return imessage;
}
build(context, message, send, imessage);
build(context, message, imessage);
return imessage;
}
static void build(Context context, EntityMessage message, boolean send, MimeMessage imessage) throws IOException, MessagingException {
static void build(Context context, EntityMessage message, MimeMessage imessage) throws IOException, MessagingException {
DB db = DB.getInstance(context);
StringBuilder body = new StringBuilder();
@ -294,11 +294,6 @@ public class MessageHelper {
body.append(identity.signature);
}
if (send)
if (message.replying != null || message.forwarding != null)
body.append(HtmlHelper.getQuote(context,
message.replying == null ? message.forwarding : message.replying, false));
String plain = Jsoup.parse(body.toString()).text();
StringBuilder html = new StringBuilder();

@ -1635,7 +1635,7 @@ public class ServiceSynchronize extends LifecycleService {
private void doAdd(EntityFolder folder, Session isession, IMAPStore istore, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException, IOException {
// Append message
MimeMessage imessage = MessageHelper.from(this, message, false, isession);
MimeMessage imessage = MessageHelper.from(this, message, isession);
if (EntityFolder.DRAFTS.equals(folder.type)) {
if (ifolder.getPermanentFlags().contains(Flags.Flag.DRAFT))
@ -1668,7 +1668,7 @@ public class ServiceSynchronize extends LifecycleService {
ifolder.expunge();
// Append target
MimeMessageEx icopy = MessageHelper.from(this, message, false, isession);
MimeMessageEx icopy = MessageHelper.from(this, message, isession);
Folder itarget = istore.getFolder(target.name);
itarget.appendMessages(new Message[]{icopy});
}
@ -1710,7 +1710,7 @@ public class ServiceSynchronize extends LifecycleService {
final Session isession = Session.getInstance(props, null);
// Create message
MimeMessage imessage = MessageHelper.from(this, message, true, isession);
MimeMessage imessage = MessageHelper.from(this, message, isession);
// Add reply to
if (ident.replyto != null)

Loading…
Cancel
Save