Class MailCache


  • class MailCache
    extends Object
    There's one of these for each Folder. However, only DIR_FOLDER has a non-null POP3MailBox.
    Author:
    user
    • Method Detail

      • getFolderName

        public String getFolderName()
        Returns:
        as passed in
        Since:
        0.9.35
      • getTranslatedName

        public String getTranslatedName()
        Returns:
        translation of name passed in
        Since:
        0.9.35
      • getFolder

        public Folder<String> getFolder()
        Returns:
        non-null
        Since:
        0.9.35
      • getFullWriteBuffer

        public Buffer getFullWriteBuffer​(String uidl)
        For writing a new full mail (NOT headers only) Caller must close.
        Since:
        0.9.35
      • writeComplete

        public void writeComplete​(String uidl,
                                  Buffer buffer,
                                  boolean success)
        For writing a new full mail
        Parameters:
        buffer - as received from getFullBuffer
        Since:
        0.9.35
      • getAttachmentDir

        public File getAttachmentDir()
        Returns:
        non-null only for Drafts
        Since:
        0.9.35
      • moveTo

        public boolean moveTo​(String uidl,
                              MailCache toMC)
        Move a mail to another MailCache, neither may be DIR_DRAFTS
        Returns:
        success
        Since:
        0.9.35
      • isLoading

        public boolean isLoading()
        Is loadFromDisk in progress?
        Since:
        0.9.35
      • isLoaded

        public boolean isLoaded()
        Has loadFromDisk completed?
        Since:
        0.9.35
      • loadFromDisk

        public boolean loadFromDisk​(NewMailListener nml)
        Threaded. Returns immediately. This will not access the mailbox. Mailbox need not be ready.
        Returns:
        success false if in progress already and nml will NOT be called back, true if nml will be called back
        Since:
        0.9.13
      • getUIDLs

        public String[] getUIDLs()
        The ones known locally, which will include any known on the server, if connected. Will not include any marked for deletion. This will not access the mailbox. Mailbox need not be ready. loadFromDisk() must have been called first.
        Returns:
        non-null
        Since:
        0.9.13
      • getMail

        public Mail getMail​(String uidl,
                            MailCache.FetchMode mode)
        Fetch any needed data from pop3 server, unless mode is CACHE_ONLY, or this isn't the Inbox. Blocking unless mode is CACHE_ONLY.
        Parameters:
        uidl - message id to get
        mode - CACHE_ONLY to not pull from pop server
        Returns:
        An e-mail or null
      • getMail

        public boolean getMail​(MailCache.FetchMode mode)
        Fetch any needed data from pop3 server. Mail objects are inserted into the requests. After this, call getUIDLs() to get all known mail UIDLs. MUST already be connected, otherwise returns false. Call only on inbox! Blocking.
        Parameters:
        mode - HEADER or ALL only
        Returns:
        true if any were fetched
        Since:
        0.9.13
      • delete

        public void delete​(String uidl)
        Mark mail for deletion locally. Send delete requests to POP3 then quit and reconnect. No success/failure indication is returned. Does not delete from folder.
        Since:
        0.9.13
      • delete

        public void delete​(Collection<String> uidls)
        Mark mail for deletion locally. Send delete requests to POP3 then quit and reconnect. No success/failure indication is returned. Does not delete from folder.
        Since:
        0.9.13