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
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 Details
-
MailCache
MailCache(I2PAppContext ctx, POP3MailBox mailbox, String folderName, String host, int port, String user, String pass) throws IOExceptionDoes NOT load the mails in. Caller MUST call loadFromDisk().- Parameters:
mailbox
- non-null for DIR_FOLDER; null otherwise- Throws:
IOException
-
-
Method Details
-
getFolderName
- Returns:
- as passed in
- Since:
- 0.9.35
-
getTranslatedName
- Returns:
- translation of name passed in
- Since:
- 0.9.35
-
getFolder
- Returns:
- non-null
- Since:
- 0.9.35
-
getFullWriteBuffer
For writing a new full mail (NOT headers only) Caller must close.- Since:
- 0.9.35
-
writeComplete
For writing a new full mail- Parameters:
buffer
- as received from getFullBuffer- Since:
- 0.9.35
-
getAttachmentDir
- Returns:
- non-null only for Drafts
- Since:
- 0.9.35
-
moveTo
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
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
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
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
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
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
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
-