MCPcopy Create free account
hub / github.com/M66B/FairEmail / findUid

Method findUid

app/src/main/java/eu/faircode/email/Core.java:865–888  ·  view source on GitHub ↗
(Context context, EntityAccount account, IMAPFolder ifolder, String msgid, Long from)

Source from the content-addressed store, hash-verified

863 }
864
865 private static Long findUid(Context context, EntityAccount account, IMAPFolder ifolder, String msgid, Long from) throws MessagingException, IOException {
866 String name = ifolder.getFullName();
867 Log.i(name + " searching for msgid=" + msgid);
868
869 Long uid = null;
870
871 Message[] imessages = findMsgId(context, account, ifolder, msgid, from);
872 if (imessages != null)
873 for (Message iexisting : imessages)
874 try {
875 long muid = ifolder.getUID(iexisting);
876 if (muid < 0)
877 continue;
878 Log.i(name + " found uid=" + muid + " for msgid=" + msgid);
879 // RFC3501: Unique identifiers are assigned in a strictly ascending fashion
880 if (uid == null || muid > uid)
881 uid = muid;
882 } catch (MessageRemovedException ex) {
883 Log.w(ex);
884 }
885
886 Log.i(name + " got uid=" + uid + " for msgid=" + msgid);
887 return uid;
888 }
889
890 private static Message[] findMsgId(Context context, EntityAccount account, IMAPFolder ifolder, String msgid, Long from) throws MessagingException, IOException {
891 // https://stackoverflow.com/questions/18891509/how-to-get-message-from-messageidterm-for-yahoo-imap-profile

Callers 5

ensureUidMethod · 0.95
onAddMethod · 0.95
onMoveMethod · 0.95
onDetachMethod · 0.95
onSubjectMethod · 0.95

Calls 5

iMethod · 0.95
findMsgIdMethod · 0.95
wMethod · 0.95
getUIDMethod · 0.65
getFullNameMethod · 0.45

Tested by

no test coverage detected