Skip to content

Commit

Permalink
Optional inbox (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Feb 7, 2021
1 parent 89393d0 commit 99b4dbb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/eu/faircode/email/AdapterMessage.java
Expand Up @@ -1651,7 +1651,7 @@ else if (EntityFolder.JUNK.equals(folder.type))
boolean archive = (move && (hasArchive && !inArchive && !inSent && !inTrash && !inJunk));
boolean trash = (move || outbox || debug ||
message.accountProtocol == EntityAccount.TYPE_POP);
boolean junk = (move && hasJunk);
boolean junk = (move && hasJunk && hasInbox);
boolean inbox = (move && hasInbox && (inArchive || inTrash || inJunk));
boolean keywords = (!message.folderReadOnly && message.uid != null &&
message.accountProtocol == EntityAccount.TYPE_IMAP);
Expand Down Expand Up @@ -6473,7 +6473,7 @@ protected EntityFolder onExecute(Context context, Bundle args) throws Throwable
DB db = DB.getInstance(context);
EntityFolder inbox = db.folder().getFolderByType(account, EntityFolder.INBOX);

if (inbox == null || !inbox.selectable)
if (inbox == null)
throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));

return inbox;
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/eu/faircode/email/Core.java
Expand Up @@ -1915,8 +1915,6 @@ else if (EntityFolder.INBOX.equals(type) && !EntityFolder.INBOX.equals(folder.ty
Log.i("Delete local count=" + local.size());
for (String name : local.keySet()) {
EntityFolder folder = local.get(name);
if (EntityFolder.INBOX.equals(name) && !folder.selectable)
continue;
List<EntityFolder> childs = parentFolders.get(name);
if (EntityFolder.USER.equals(folder.type) ||
childs == null || childs.size() == 0) {
Expand Down
17 changes: 0 additions & 17 deletions app/src/main/java/eu/faircode/email/EmailService.java
Expand Up @@ -672,23 +672,6 @@ List<EntityFolder> getFolders() throws MessagingException {

EntityFolder.guessTypes(folders, getStore().getDefaultFolder().getSeparator());

boolean inbox = false;
for (EntityFolder folder : folders)
if (EntityFolder.INBOX.equals(folder.type)) {
inbox = true;
break;
}

if (!inbox) {
EntityFolder in = new EntityFolder();
in.name = EntityFolder.INBOX;
in.type = EntityFolder.INBOX;
in.setProperties();
in.selectable = false;
folders.add(in);
//throw new IllegalArgumentException(context.getString(R.string.title_setup_no_inbox));
}

return folders;
}

Expand Down
16 changes: 1 addition & 15 deletions app/src/main/java/eu/faircode/email/FragmentAccount.java
Expand Up @@ -677,7 +677,6 @@ protected CheckResult onExecute(Context context, Bundle args) throws Throwable {

result.idle = iservice.hasCapability("IDLE");

boolean inbox = false;
for (Folder ifolder : iservice.getStore().getDefaultFolder().list("*")) {
// Check folder attributes
String fullName = ifolder.getFullName();
Expand All @@ -700,16 +699,13 @@ protected CheckResult onExecute(Context context, Bundle args) throws Throwable {
folder = new EntityFolder(fullName, type);
result.folders.add(folder);

if (EntityFolder.INBOX.equals(type)) {
inbox = true;

if (EntityFolder.INBOX.equals(type))
result.utf8 = (Boolean) ((IMAPFolder) ifolder).doCommand(new IMAPFolder.ProtocolCommand() {
@Override
public Object doCommand(IMAPProtocol protocol) {
return protocol.supportsUtf8();
}
});
}

Log.i(folder.name + " id=" + folder.id +
" type=" + folder.type + " attr=" + TextUtils.join(",", attrs));
Expand All @@ -718,16 +714,6 @@ public Object doCommand(IMAPProtocol protocol) {

EntityFolder.guessTypes(result.folders, iservice.getStore().getDefaultFolder().getSeparator());

if (!inbox) {
EntityFolder in = new EntityFolder();
in.name = EntityFolder.INBOX;
in.type = EntityFolder.INBOX;
in.setProperties();
in.selectable = false;
result.folders.add(in);
//throw new IllegalArgumentException(context.getString(R.string.title_no_inbox));
}

if (result.folders.size() > 0)
Collections.sort(result.folders, result.folders.get(0).getComparator(null));
}
Expand Down

0 comments on commit 99b4dbb

Please sign in to comment.