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 |
---|---|
(package private) boolean |
blockingConnectToServer()
Connect to pop3 server if not connected.
|
void |
close()
Close without waiting for response.
|
(package private) void |
close(boolean shouldWait)
Close and optionally wait for response.
|
boolean |
connectToServer(NewMailListener nml)
Connect to pop3 server if not connected.
|
(package private) void |
deletePending(boolean noWait)
Delete all pending deletions at once.
|
void |
destroy()
Close without waiting for response,
and remove any delayed tasks and resources.
|
void |
foundNewMail(boolean yes)
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.
|
Buffer |
getBody(String uidl,
Buffer buffer)
Fetch the body.
|
Buffer |
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?
|
(package private) 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 |
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 Buffer getHeader(String uidl)
uidl
- public Buffer getBody(String uidl, Buffer buffer)
uidl
- public void getBodies(Collection<POP3MailBox.FetchRequest> requests)
public void queueForDeletion(Collection<String> uidls)
public void queueForDeletion(String uidl)
void deletePending(boolean noWait)
noWait
- fire-and-forget mode, only if connectedpublic int getSize(String uidl)
uidl
- boolean isConnected()
long getLastActivity()
long getLastChecked()
public boolean connectToServer(NewMailListener nml)
boolean blockingConnectToServer()
public int getNumMails()
public String lastError()
public void setNewMailListener(NewMailListener nml)
public void foundNewMail(boolean yes)
foundNewMail
in interface NewMailListener
public void destroy()
Object getLock()
boolean hasQueuedDeletions()
public void close()
void close(boolean shouldWait)
public Collection<String> getUIDLs()