Package i2p.susi.webmail
Class MailCache
- java.lang.Object
-
- i2p.susi.webmail.MailCache
-
class MailCache extends Object
There's one of these for each Folder. However, only DIR_FOLDER has a non-null POP3MailBox.- Author:
- user
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MailCache.FetchMode
-
Constructor Summary
Constructors Constructor Description MailCache(I2PAppContext ctx, POP3MailBox mailbox, String folderName, String host, int port, String user, String pass)
Does NOT load the mails in.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(String uidl)
Mark mail for deletion locally.void
delete(Collection<String> uidls)
Mark mail for deletion locally.File
getAttachmentDir()
Folder<String>
getFolder()
String
getFolderName()
Buffer
getFullWriteBuffer(String uidl)
For writing a new full mail (NOT headers only) Caller must close.boolean
getMail(MailCache.FetchMode mode)
Fetch any needed data from pop3 server.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.String
getTranslatedName()
String[]
getUIDLs()
The ones known locally, which will include any known on the server, if connected.boolean
isLoaded()
Has loadFromDisk completed?boolean
isLoading()
Is loadFromDisk in progress?boolean
loadFromDisk(NewMailListener nml)
Threaded.boolean
moveTo(String uidl, MailCache toMC)
Move a mail to another MailCache, neither may be DIR_DRAFTSvoid
writeComplete(String uidl, Buffer buffer, boolean success)
For writing a new full mail
-
-
-
Constructor Detail
-
MailCache
MailCache(I2PAppContext ctx, POP3MailBox mailbox, String folderName, String host, int port, String user, String pass) throws IOException
Does NOT load the mails in. Caller MUST call loadFromDisk().- Parameters:
mailbox
- non-null for DIR_FOLDER; null otherwise- Throws:
IOException
-
-
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
-
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 getmode
- 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
-
-