public class POP3MailBox extends Object implements NewMailListener
Modifier and Type | Class and Description |
---|---|
static interface |
POP3MailBox.FetchRequest |
Constructor and Description |
---|
POP3MailBox(String host,
int port,
String user,
String pass)
Does not connect.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close without waiting for response.
|
(package private) void |
close(boolean shouldWait)
Close and optionally wait for response.
|
boolean |
connectToServer()
Connect to pop3 server if not connected.
|
(package private) Collection<String> |
delete(Collection<String> uidls)
Delete all at once and close.
|
void |
destroy()
Close without waiting for response,
and remove any delayed tasks and resources.
|
void |
foundNewMail()
Relay from the checker to the webmail session object,
which relays to MailCache, which will fetch the mail from us
in a big circle
|
void |
getBodies(Collection<POP3MailBox.FetchRequest> requests)
Fetch headers and/or bodies.
|
ReadBuffer |
getBody(String uidl)
Fetch the body.
|
ReadBuffer |
getHeader(String uidl)
Fetch the header.
|
(package private) long |
getLastActivity()
Timestamp.
|
(package private) long |
getLastChecked()
Timestamp.
|
(package private) Object |
getLock()
For helper threads to lock
|
int |
getNumMails()
Warning - forces a connection.
|
int |
getSize(String uidl)
Get cached size of a message (via previous LIST command).
|
Collection<String> |
getUIDLs()
Only if connected.
|
(package private) boolean |
hasQueuedDeletions()
Do we have UIDLs to delete?
|
boolean |
isConnected()
Is the connection is still alive
|
String |
lastError() |
void |
queueForDeletion(Collection<String> uidls)
Queue for later deletion.
|
void |
queueForDeletion(String uidl)
Queue for later deletion.
|
void |
refresh() |
void |
setNewMailListener(NewMailListener nml)
Relay from the checker to the webmail session object,
which relays to MailCache, which will fetch the mail from us
in a big circle
|
public ReadBuffer getHeader(String uidl)
uidl
- public ReadBuffer getBody(String uidl)
uidl
- public void getBodies(Collection<POP3MailBox.FetchRequest> requests)
public void queueForDeletion(Collection<String> uidls)
public void queueForDeletion(String uidl)
Collection<String> delete(Collection<String> uidls)
public int getSize(String uidl)
uidl
- public boolean isConnected()
long getLastActivity()
long getLastChecked()
public void refresh()
public boolean connectToServer()
public int getNumMails()
public String lastError()
public void setNewMailListener(NewMailListener nml)
public void foundNewMail()
foundNewMail
in interface NewMailListener
public void destroy()
Object getLock()
boolean hasQueuedDeletions()
public void close()
void close(boolean shouldWait)
public Collection<String> getUIDLs()