Reply flag is not set anymore when replying to a mail
### Expected behaviour

Reply flag is set when replying to a mail.
### Actual behaviour

When replying to a mail I do not see a reply flag for the original mail I replied to. When checking the account with a different client (web/Thunderbird) I do not see a flag, too. So it is no frontend bug, the flag is not set anymore, beginning with 5.108.
### Steps to reproduce

See above.
### Environment

K-9 Mail version: 5.108

Android version: CM 12.1

Account type (IMAP, POP3, WebDAV/Exchange):
IMAP

diff --git a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java
index cd7cde46f..5072c6e5f 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java
@@ -2454,18 +2454,21 @@ public class MessageCompose extends K9Activity implements OnClickListener,
     }
 
     static class SendMessageTask extends AsyncTask<Void, Void, Void> {
-        Context context;
-        Account account;
-        Contacts contacts;
-        Message message;
-        Long draftId;
-
-        SendMessageTask(Context context, Account account, Contacts contacts, Message message, Long draftId) {
+        final Context context;
+        final Account account;
+        final Contacts contacts;
+        final Message message;
+        final Long draftId;
+        final MessageReference messageReference;
+
+        SendMessageTask(Context context, Account account, Contacts contacts, Message message,
+                        Long draftId, MessageReference messageReference) {
             this.context = context;
             this.account = account;
             this.contacts = contacts;
             this.message = message;
             this.draftId = draftId;
+            this.messageReference = messageReference;
         }
 
         @Override
@@ -2474,6 +2477,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
                 contacts.markAsContacted(message.getRecipients(RecipientType.TO));
                 contacts.markAsContacted(message.getRecipients(RecipientType.CC));
                 contacts.markAsContacted(message.getRecipients(RecipientType.BCC));
+                updateReferencedMessage();
             } catch (Exception e) {
                 Log.e(K9.LOG_TAG, "Failed to mark contact as contacted.", e);
             }
@@ -2486,6 +2490,26 @@ public class MessageCompose extends K9Activity implements OnClickListener,
 
             return null;
         }
+
+        /**
+         * Set the flag on the referenced message(indicated we replied / forwarded the message)
+         **/
+        private void updateReferencedMessage() {
+            if (messageReference != null && messageReference.getFlag() != null) {
+                if (K9.DEBUG) {
+                    Log.d(K9.LOG_TAG, "Setting referenced message (" +
+                            messageReference.getFolderName() + ", " +
+                            messageReference.getUid() + ") flag to " +
+                            messageReference.getFlag());
+                }
+                final Account account = Preferences.getPreferences(context)
+                        .getAccount(messageReference.getAccountUuid());
+                final String folderName = messageReference.getFolderName();
+                final String sourceMessageUid = messageReference.getUid();
+                MessagingController.getInstance(context).setFlag(account, folderName,
+                        sourceMessageUid, messageReference.getFlag(), true);
+            }
+        }
     }
 
     class Listener extends MessagingListener {
@@ -2981,7 +3005,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
         } else {
             currentMessageBuilder = null;
             new SendMessageTask(getApplicationContext(), mAccount, mContacts, message,
-                    mDraftId != INVALID_DRAFT_ID ? mDraftId : null).execute();
+                    mDraftId != INVALID_DRAFT_ID ? mDraftId : null, mMessageReference).execute();
             finish();
         }
     }
['k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java']