Commit c91ec151 authored by Hussein's avatar Hussein

P4A-1024 Add logic to append on pEpSync folder

parent c5961ee4
......@@ -59,6 +59,7 @@ public class Account implements BaseAccount, StoreConfig {
* Default value for the inbox folder (never changes for POP3 and IMAP)
*/
private static final String INBOX = "INBOX";
private static final String PEP_FOLDER = "pEp";
/**
* This local folder is used to store messages to be sent.
......@@ -1054,7 +1055,17 @@ public class Account implements BaseAccount, StoreConfig {
folderName.equals(getArchiveFolderName()) ||
folderName.equals(getSpamFolderName()) ||
folderName.equals(getOutboxFolderName()) ||
folderName.equals(getSentFolderName())));
folderName.equals(getSentFolderName()) ||
folderName.equals(getpEpSyncFolderName())
));
}
public String getpEpSyncFolderName() {
if (K9.isUsingpEpSyncFolder()) {
return PEP_FOLDER;
} else {
return inboxFolderName;
}
}
public synchronized String getDraftsFolderName() {
......
......@@ -4084,6 +4084,7 @@ public class MessagingController implements Sync.MessageToSendCallback {
Account.FolderMode aSyncMode = account.getFolderSyncMode();
Store localStore = account.getLocalStore();
// TODO: 22/06/2020 Improvement only check inbox and sync folder
for (final Folder folder : localStore.getPersonalNamespaces(false)) {
folder.open(Folder.OPEN_MODE_RW);
......@@ -4772,7 +4773,7 @@ public class MessagingController implements Sync.MessageToSendCallback {
Message localMessage = null;
try {
LocalStore localStore = account.getLocalStore();
LocalFolder localFolder = localStore.getFolder(account.getInboxFolderName());
LocalFolder localFolder = localStore.getFolder(account.getpEpSyncFolderName());
localFolder.open(Folder.OPEN_MODE_RW);
......@@ -4782,7 +4783,7 @@ public class MessagingController implements Sync.MessageToSendCallback {
localMessage = localFolder.getMessage(message.getUid());
localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true);
PendingCommand command = PendingAppend.create(localFolder.getName(), localMessage.getUid());
PendingCommand command = PendingAppend.create(account.getpEpSyncFolderName(), localMessage.getUid());
queuePendingCommand(account, command);
processPendingCommands(account);
......@@ -4820,7 +4821,7 @@ public class MessagingController implements Sync.MessageToSendCallback {
recipients.addAll(ccRecipients);
List<Account> accountsToAppend = getAccountsToAppend(recipients);
/*if (accountsToAppend != null) {
if (accountsToAppend != null) {
for (Account account : accountsToAppend) {
Timber.e("%s %s", "pEpEngine", "Start Append: " + message.getMessageId());
appendToInboxpEpSyncMessage(account, message);
......@@ -4828,12 +4829,12 @@ public class MessagingController implements Sync.MessageToSendCallback {
}
} else {*/
} else {
Timber.e("%s %s", "pEpEngine", "Start SMTP send: " + message.getMessageId());
sendpEpSyncMessage(fromAccount, message);
Timber.e("%s %s", "pEpEngine", "Finish SMTP send: " + message.getMessageId());
//}
}
checkpEpSyncMailForAccount(fromAccount, null);
......
......@@ -974,7 +974,8 @@ public class LocalStore extends Store implements Serializable {
}
if (name.equalsIgnoreCase(mAccount.getInboxFolderName()) ||
name.equalsIgnoreCase(mAccount.getDraftsFolderName())) {
name.equalsIgnoreCase(mAccount.getDraftsFolderName()) ||
name.equalsIgnoreCase(mAccount.getpEpSyncFolderName())) {
prefHolder.syncClass = LocalFolder.FolderClass.FIRST_CLASS;
} else {
prefHolder.syncClass = LocalFolder.FolderClass.NO_CLASS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment