Prevent notify move to self

pull/213/head
M66B 1 year ago
parent 6530b162a3
commit e530ea39e3

@ -5945,8 +5945,9 @@ class Core {
if (notify_trash && if (notify_trash &&
perform_expunge && perform_expunge &&
message.accountProtocol == EntityAccount.TYPE_IMAP && message.accountProtocol == EntityAccount.TYPE_IMAP) {
db.folder().getFolderByType(message.account, EntityFolder.TRASH) != null) { EntityFolder folder = db.folder().getFolderByType(message.account, EntityFolder.TRASH);
if (folder != null && !folder.id.equals(message.folder)) {
Intent trash = new Intent(context, ServiceUI.class) Intent trash = new Intent(context, ServiceUI.class)
.setAction("trash:" + message.id) .setAction("trash:" + message.id)
.putExtra("group", group); .putExtra("group", group);
@ -5963,6 +5964,7 @@ class Core {
wactions.add(actionTrash.build()); wactions.add(actionTrash.build());
} }
}
if (notify_trash && if (notify_trash &&
((message.accountProtocol == EntityAccount.TYPE_POP && message.accountLeaveDeleted) || ((message.accountProtocol == EntityAccount.TYPE_POP && message.accountLeaveDeleted) ||
@ -5985,8 +5987,9 @@ class Core {
} }
if (notify_junk && if (notify_junk &&
message.accountProtocol == EntityAccount.TYPE_IMAP && message.accountProtocol == EntityAccount.TYPE_IMAP) {
db.folder().getFolderByType(message.account, EntityFolder.JUNK) != null) { EntityFolder folder = db.folder().getFolderByType(message.account, EntityFolder.JUNK);
if (folder != null && !folder.id.equals(message.folder)) {
Intent junk = new Intent(context, ServiceUI.class) Intent junk = new Intent(context, ServiceUI.class)
.setAction("junk:" + message.id) .setAction("junk:" + message.id)
.putExtra("group", group); .putExtra("group", group);
@ -6002,10 +6005,12 @@ class Core {
wactions.add(actionJunk.build()); wactions.add(actionJunk.build());
} }
}
if (notify_archive && if (notify_archive &&
message.accountProtocol == EntityAccount.TYPE_IMAP && message.accountProtocol == EntityAccount.TYPE_IMAP) {
db.folder().getFolderByType(message.account, EntityFolder.ARCHIVE) != null) { EntityFolder folder = db.folder().getFolderByType(message.account, EntityFolder.ARCHIVE);
if (folder != null && !folder.id.equals(message.folder)) {
Intent archive = new Intent(context, ServiceUI.class) Intent archive = new Intent(context, ServiceUI.class)
.setAction("archive:" + message.id) .setAction("archive:" + message.id)
.putExtra("group", group); .putExtra("group", group);
@ -6022,13 +6027,14 @@ class Core {
wactions.add(actionArchive.build()); wactions.add(actionArchive.build());
} }
}
if (notify_move && if (notify_move &&
message.accountProtocol == EntityAccount.TYPE_IMAP) { message.accountProtocol == EntityAccount.TYPE_IMAP) {
EntityAccount account = db.account().getAccount(message.account); EntityAccount account = db.account().getAccount(message.account);
if (account != null && account.move_to != null) { if (account != null && account.move_to != null) {
EntityFolder folder = db.folder().getFolder(account.move_to); EntityFolder folder = db.folder().getFolder(account.move_to);
if (folder != null) { if (folder != null && !folder.id.equals(message.folder)) {
Intent move = new Intent(context, ServiceUI.class) Intent move = new Intent(context, ServiceUI.class)
.setAction("move:" + message.id) .setAction("move:" + message.id)
.putExtra("group", group); .putExtra("group", group);

Loading…
Cancel
Save