ymsg.network.event
Class SessionChatEvent

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

public class SessionChatEvent
extends SessionEvent

Represents a chatroom event.

  getFrom getChatUser getChatUsers getLobby getMessage
chatLogonReceived y[1] y[1] y y n
chatLogoffReceived y[1] y[1] y y n
chatMessageReceived y y y[2] y y

The protocol supports the ability to deliver multiple users in each chat packet, but an examination of actual chat packets reveals this feature appears not to be used. So with that in mind...
[1] = to be super-safe it is best to use the array version of this get method, and not to assume there will be only one user.
[2] = there is no way a single message can come from multiple users, so it is safe to use the single user get method if you want.

Since:
1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class EventObject
source
 
Constructor Summary
SessionChatEvent(Object o, int sz, YahooChatLobby ycl)
          Create a new instance.
SessionChatEvent(Object o, YahooChatUser ycu, String m, YahooChatLobby ycl)
          Create a new instance.
 
Method Summary
 YahooChatUser getChatUser()
          Returns a single chat user (actually just the first user in the array of users specified) relating to this event.
 YahooChatUser[] getChatUsers()
          Returns an array of chat users relating to this event.
 String getFrom()
          Returns the id of a single chat user relating to this event.
 YahooChatLobby getLobby()
          Returns the chat lobby relating to this event.
 boolean isEmote()
          Returns true if this message is an emote.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class SessionEvent
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

SessionChatEvent

public SessionChatEvent(Object o,
                        int sz,
                        YahooChatLobby ycl)
Create a new instance. API users should not call this directly. The API itself will create its own events. This constructor is for logon/off events.

Parameters:
o - source of event (Session)
sz - number of users in event
ycl - lobby object for this event
Since:
1.0

SessionChatEvent

public SessionChatEvent(Object o,
                        YahooChatUser ycu,
                        String m,
                        YahooChatLobby ycl)
Create a new instance. API users should not call this directly. The API itself will create its own events. This constructor is used for message events.

Parameters:
o - source of event (Session)
ycu - the chat user object for this event
m - message text (UTF-8)
ycl - lobby object for this event
Since:
1.0
Method Detail

getChatUser

public YahooChatUser getChatUser()
Returns a single chat user (actually just the first user in the array of users specified) relating to this event. This method is suitable for message receiving events.

Returns:
a chat user object
Since:
1.0

getChatUsers

public YahooChatUser[] getChatUsers()
Returns an array of chat users relating to this event. This method is suitable for chat logon/off events.

Returns:
an array of chat user object
Since:
1.0

getLobby

public YahooChatLobby getLobby()
Returns the chat lobby relating to this event.

Returns:
a chat lobby object
Since:
1.0

getFrom

public String getFrom()
Returns the id of a single chat user relating to this event. Just a shortcut to getUser().getId(). This method is suitable for message receiving events.

Overrides:
getFrom in class SessionEvent
Returns:
Yahoo id as a string
Since:
1.0

isEmote

public boolean isEmote()
Returns true if this message is an emote.

Returns:
True if emote
Since:
1.0

toString

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

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