|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hamsam.api.Message
An instant message. Instant messages contain not only plain text messages, but various other things such as URLs, font and color variations, smileys etc. Unfortunately, different protocols use different encoding schemes for sending instant messages. This class provides an implementation independent way of representing instant messages, so that users of Hamsam library do not have to worry about proprietory message formats.
Each message object contains a sequence of message components. Each message component will be one of the following.
All the message components mentioned above are inherited from the
MessageComponent
interface. You can use these components
in an IMListener
as shown below.
public void instantMessageReceived(Buddy buddy, Message message)
{
Enumeration e = message.getComponents();
while(e.hasMoreElements())
{
MessageComponent comp = (MessageComponent) e.nextElement();
if(comp instanceof TextComponent)
{
// handle text component
}
else if(comp instanceof SmileyComponent)
{
// handle smiley component
}
else if(comp instanceof URLComponent)
{
// handle URL component
}
}
}
Constructor Summary | |
Message()
Default constructor. |
Method Summary | |
void |
addComponent(MessageComponent comp)
Add a message component to this message. |
java.util.Enumeration |
getComponents()
Returns an enumeration of the components of this message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Message()
Method Detail |
public void addComponent(MessageComponent comp)
comp
- the component to be added.public java.util.Enumeration getComponents()
MessageComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |