ymsg.network.event
Class SessionNewMailEvent

Object
  extended byEventObject
      extended bySessionEvent
          extended bySessionNewMailEvent
All Implemented Interfaces:
Serializable

public class SessionNewMailEvent
extends SessionEvent

Represents an new mail event. Yahoo likes to inform the client when there is Yahoo Mail which is unread. This object can take two different forms; the first being simply a count of unread mail (the most common) and the second being an actual e-mail itself (yet to actually see this 'in real life', but the documentation suggests it is possible).

The inherited method getFrom returns the 'real world' name of the e-mail sender (for example "John Smith") while getEmailAddress returns the e-mail address (for example "j.smith@test.com").

If present, the e-mail body (text) can be read by using the inherited getMessage method.

  getMailCount getFrom getEmailAddress getSubject getMessage
newMailReceived (v1) y (gt. zero) n n(?) n n
newMailReceived (v2) y (eq. zero) y y y y

Since:
1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class EventObject
source
 
Constructor Summary
SessionNewMailEvent(Object o, String ml)
          Create a new instance.
 
Method Summary
 String getEmailAddress()
          Returns the e-mail address of the sender.
 int getMailCount()
          Gets the number of new Yahoo e-mails.
 String getSubject()
          Returns the subject line of this mail, if this event represents an actual e-mail, not just a count.
 boolean isWholeMail()
          Returns whether this event is an actual mail, or just a count.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class SessionEvent
getFrom, getMessage, getStatus, getTimestamp, getTo
 
Methods inherited from class EventObject
getSource
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SessionNewMailEvent

public SessionNewMailEvent(Object o,
                           String ml)
Create a new instance. API users should not call this directly. The API itself will create its own events.

Parameters:
o - source of event (Session)
ml - number of new Yahoo e-mails
Since:
1.0
Method Detail

getMailCount

public int getMailCount()
Gets the number of new Yahoo e-mails. Will return zero if this is not a mail count, but an actual message.

Returns:
number of unread e-mails, or zero
Since:
1.0

getSubject

public String getSubject()
Returns the subject line of this mail, if this event represents an actual e-mail, not just a count. Otherwise returns null.

Returns:
subject or null
Since:
1.0

getEmailAddress

public String getEmailAddress()
Returns the e-mail address of the sender.

Returns:
address string
Since:
1.0

isWholeMail

public boolean isWholeMail()
Returns whether this event is an actual mail, or just a count.

Returns:
true if it is, false if it ain't
Since:
1.0

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class SessionEvent
Returns:
object as a string
Since:
1.0