javax.mail.event
Class MessageCountEvent
public class MessageCountEvent
This class notifies changes in the number of messages in a folder.
Note that some folder types may only deliver MessageCountEvents at certain
times or after certain operations. IMAP in particular will only notify the
client of MessageCountEvents when a client issues a new command. Refer to
RFC 2060 http://www.ietf.org/rfc/rfc2060.txt for details.
A client may want "poll" the folder by occasionally calling the
getMessageCount
or
isConnected
methods
to solicit any such notifications.
static int | ADDED - The messages were added to their folder
|
static int | REMOVED - The messages were removed from their folder
|
protected Message[] | msgs - The messages.
|
protected boolean | removed - If true, this event is the result of an explicit expunge by this client,
and the messages in this folder have been renumbered to account for this.
|
protected int | type - The event type.
|
void | dispatch(Object listener) - Invokes the appropriate MessageCountListener method.
|
Message[] | getMessages() - Return the array of messages added or removed.
|
int | getType() - Return the type of this event.
|
boolean | isRemoved() - Indicates whether this event is the result of an explicit expunge by this
client, or due to an expunge from external sources.
|
ADDED
public static final int ADDED
The messages were added to their folder
- 1
REMOVED
public static final int REMOVED
The messages were removed from their folder
- 2
msgs
protected Message[] msgs
The messages.
removed
protected boolean removed
If true, this event is the result of an explicit expunge by this client,
and the messages in this folder have been renumbered to account for this.
If false, this event is the result of an expunge by external sources.
type
protected int type
The event type.
MessageCountEvent
public MessageCountEvent(Folder source,
int type,
boolean removed,
Message[] msgs)
Constructor.
source
- The containing foldertype
- The event typeremoved
- If true, this event is the result of an explicit expunge by
this client, and the messages in this folder have been renumbered to
account for this. If false, this event is the result of an expunge by
external sources.msgs
- The messages added/removed
dispatch
public void dispatch(Object listener)
Invokes the appropriate MessageCountListener method.
- dispatch in interface MailEvent
getMessages
public Message[] getMessages()
Return the array of messages added or removed.
getType
public int getType()
Return the type of this event.
isRemoved
public boolean isRemoved()
Indicates whether this event is the result of an explicit expunge by this
client, or due to an expunge from external sources. If true, this event is
due to an explicit expunge and hence all remaining messages in this folder
have been renumbered. If false, this event is due to an external expunge.
Note that this method is valid only if the type of this event is REMOVED