(
Context context,
EntityAccount account, EntityFolder folder,
IMAPStore istore, IMAPFolder ifolder, MimeMessage imessage,
boolean browsed, boolean download,
List<EntityRule> rules, State state, SyncStats stats)
| 4618 | } |
| 4619 | |
| 4620 | static EntityMessage synchronizeMessage( |
| 4621 | Context context, |
| 4622 | EntityAccount account, EntityFolder folder, |
| 4623 | IMAPStore istore, IMAPFolder ifolder, MimeMessage imessage, |
| 4624 | boolean browsed, boolean download, |
| 4625 | List<EntityRule> rules, State state, SyncStats stats) throws MessagingException, IOException { |
| 4626 | DB db = DB.getInstance(context); |
| 4627 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); |
| 4628 | boolean outlook_categories = prefs.getBoolean("outlook_categories", false); |
| 4629 | boolean download_headers = prefs.getBoolean("download_headers", false); |
| 4630 | boolean download_plain = prefs.getBoolean("download_plain", false); |
| 4631 | boolean notify_known = prefs.getBoolean("notify_known", false); |
| 4632 | boolean native_dkim = prefs.getBoolean("native_dkim", false); |
| 4633 | boolean experiments = prefs.getBoolean("experiments", false); |
| 4634 | boolean mdn = prefs.getBoolean("mdn", experiments); |
| 4635 | boolean pro = ActivityBilling.isPro(context); |
| 4636 | |
| 4637 | long uid = ifolder.getUID(imessage); |
| 4638 | if (uid < 0) { |
| 4639 | Log.w(folder.name + " invalid uid=" + uid); |
| 4640 | throw new MessageRemovedException("uid"); |
| 4641 | } |
| 4642 | |
| 4643 | if (imessage.isExpunged()) { |
| 4644 | Log.w(folder.name + " expunged uid=" + uid); |
| 4645 | throw new MessageRemovedException("Expunged"); |
| 4646 | } |
| 4647 | |
| 4648 | if (imessage.isSet(Flags.Flag.DELETED)) { |
| 4649 | Log.w(folder.name + " deleted uid=" + uid); |
| 4650 | if (expunge(context, ifolder, Arrays.asList(imessage))) |
| 4651 | throw new MessageRemovedException("Deleted"); |
| 4652 | } |
| 4653 | |
| 4654 | MessageHelper helper = new MessageHelper(imessage, context); |
| 4655 | boolean recent = helper.getRecent(); |
| 4656 | boolean seen = helper.getSeen(); |
| 4657 | boolean answered = helper.getAnswered(); |
| 4658 | boolean flagged = helper.getFlagged(); |
| 4659 | boolean deleted = helper.getDeleted(); |
| 4660 | String flags = helper.getFlags(); |
| 4661 | String[] keywords = helper.getKeywords(outlook_categories && account.isOutlook()); |
| 4662 | String[] labels = helper.getLabels(); |
| 4663 | boolean update = false; |
| 4664 | boolean process = false; |
| 4665 | boolean syncSimilar = false; |
| 4666 | |
| 4667 | // Find message by uid (fast, no headers required) |
| 4668 | EntityMessage message = db.message().getMessageByUid(folder.id, uid); |
| 4669 | |
| 4670 | // Find message by Message-ID (slow, headers required) |
| 4671 | // - messages in inbox have same id as message sent to self |
| 4672 | // - messages in archive have same id as original |
| 4673 | boolean have = false; |
| 4674 | Integer color = null; |
| 4675 | String notes = null; |
| 4676 | Integer notes_color = null; |
| 4677 | if (message == null) { |
no test coverage detected