Source:
private boolean shouldNotifyForMessage(Account account, LocalFolder localFolder, Message message) { if (account.getName() == null) { return false; } if (!account.isNotifyNewMail() || message.isSet(Flag.SEEN)) { return false; } Account.FolderMode aDisplayMode = account.getFolderDisplayMode(); Account.FolderMode aNotifyMode = account.getFolderNotifyNewMailMode(); Folder.FolderClass fDisplayClass = localFolder.getDisplayClass(); Folder.FolderClass fNotifyClass = localFolder.getNotifyClass(); if (modeMismatch(aDisplayMode, fDisplayClass)) { return false; } if (modeMismatch(aNotifyMode, fNotifyClass)) { return false; } if (account.getStoreUri().startsWith("pop3") && message.olderThan(new Date(account.getLatestOldMessageSeenTime()))) { return false; } Folder folder = message.getFolder(); if (folder != null) { String folderName = folder.getName(); if (!account.getInboxFolderName().equals(folderName) && (account.getTrashFolderName().equals(folderName) || account.getDraftsFolderName().equals(folderName) || account.getSpamFolderName().equals(folderName) || account.getSentFolderName().equals(folderName))) { return false; } } if (message.getUid() != null && localFolder.getLastUid() != null) { try { Integer messageUid = Integer.parseInt(message.getUid()); if (messageUid <= localFolder.getLastUid()) { if (K9.DEBUG) Log.d(K9.LOG_TAG, "Message uid is " + messageUid + ", max message uid is " + localFolder.getLastUid() + ". Skipping notification."); return false; } } catch (NumberFormatException e) { } } return !(account.isAnIdentity(message.getFrom()) && !account.isNotifySelfNewMail()); }

Target:
private boolean shouldNotifyForMessage(Account account, LocalFolder localFolder, Message message) { if (account.getName() == null) { return false; } if (!account.isNotifyNewMail() || message.isSet(Flag.SEEN)) { return false; } Account.FolderMode aDisplayMode = account.getFolderDisplayMode(); Account.FolderMode aNotifyMode = account.getFolderNotifyNewMailMode(); Folder.FolderClass fDisplayClass = localFolder.getDisplayClass(); Folder.FolderClass fNotifyClass = localFolder.getNotifyClass(); if (modeMismatch(aDisplayMode, fDisplayClass)) { return false; } if (modeMismatch(aNotifyMode, fNotifyClass)) { return false; } if (account.getStoreUri().startsWith("pop3") && message.olderThan(new Date(account.getLatestOldMessageSeenTime()))) { return false; } Folder folder = message.getFolder(); if (folder != null) { String folderName = folder.getName(); if (!account.getInboxFolderName().equals(folderName) && (account.getTrashFolderName().equals(folderName) || account.getDraftsFolderName().equals(folderName) || account.getSpamFolderName().equals(folderName) || account.getSentFolderName().equals(folderName))) { return false; } } if (message.getUid() != null && localFolder.getLastUid() != null) { try { Integer messageUid = Integer.parseInt(message.getUid()); if (messageUid <= localFolder.getLastUid()) { if (K9.DEBUG) Log.d(K9.LOG_TAG, "Message uid is " + messageUid + ", max message uid is " + localFolder.getLastUid() + ". Skipping notification."); return false; } } catch (NumberFormatException e) { } } if (account.isAnIdentity(message.getFrom()) && !account.isNotifySelfNewMail()) { return false; } return true; }