i2p.susi.webmail
Class PersistentMailCache

java.lang.Object
  extended by i2p.susi.webmail.PersistentMailCache

 class PersistentMailCache
extends Object

Manage the on-disk cache. This is a custom format with subdirectories, gzipped files, and the encoded UIDL in the file name. We store either the headers or the full message. No, it is not Maildir format but we could add Maildir-style status suffixes (e.g. ":2.SR") later. Exporting to a Maildir format would be just ungzipping each file to a flat directory. TODO draft and sent folders, cached server caps and config.

Since:
0.9.14

Constructor Summary
PersistentMailCache(String host, int port, String user, String pass)
          Use the params to generate a unique directory name.
 
Method Summary
 void deleteMail(Mail mail)
          Delete data from disk.
 void deleteMail(String uidl)
          Delete data from disk.
 boolean getMail(Mail mail, boolean headerOnly)
          Fetch any needed data from disk.
 Collection<Mail> getMails()
          Fetch all mails from disk.
 boolean saveMail(Mail mail)
          Save data to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentMailCache

public PersistentMailCache(String host,
                           int port,
                           String user,
                           String pass)
                    throws IOException
Use the params to generate a unique directory name.

Parameters:
pass - ignored
Throws:
IOException
Method Detail

getMails

public Collection<Mail> getMails()
Fetch all mails from disk.

Returns:
a new collection

getMail

public boolean getMail(Mail mail,
                       boolean headerOnly)
Fetch any needed data from disk.

Returns:
success

saveMail

public boolean saveMail(Mail mail)
Save data to disk.

Returns:
success

deleteMail

public void deleteMail(Mail mail)
Delete data from disk.


deleteMail

public void deleteMail(String uidl)
Delete data from disk.