tigase.jaxmpp.core.client.xmpp.modules.chat
Class MessageModule

java.lang.Object
  extended by tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule<Message>
      extended by tigase.jaxmpp.core.client.xmpp.modules.chat.MessageModule
All Implemented Interfaces:
XmppModule

public class MessageModule
extends AbstractStanzaModule<Message>

Module to handle messages.

Events:
ChatClosed : MessageEvent ()
Fires when Chat object is destroyed (for example by calling method close())
ChatCreated : MessageEvent ()
Fires when new Chat object is created. It will be called after receiving new message from buddy and on execute createChat().
ChatUpdated : MessageEvent ()
Fires when some data in Chat object is changed. For example when JID is changed (buddy changed resource) or threadid is setted.
MessageReceived : MessageEvent ()
Fires when message is received.

Author:
bmalkow

Nested Class Summary
static class MessageModule.AbstractMessageEvent
           
static class MessageModule.MessageEvent
           
 
Field Summary
static EventType ChatClosed
           
static EventType ChatCreated
           
static EventType ChatUpdated
           
static EventType MessageReceived
           
 
Fields inherited from class tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule
log, observable, sessionObject, writer
 
Constructor Summary
MessageModule(Observable parentObservable, SessionObject sessionObject, PacketWriter packetWriter)
           
 
Method Summary
 void close(Chat chat)
          Destroy chat object.
 Chat createChat(JID jid)
          Creates new chat object.
 AbstractChatManager getChatManager()
           
 List<Chat> getChats()
          Returns all chat objects.
 Criteria getCriteria()
          Criteria
 String[] getFeatures()
           Returns features what are implemented by Module.
 void process(Message element)
          
 void sendMessage(JID toJID, String subject, String message)
          Sends message.
 
Methods inherited from class tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule
addListener, addListener, process, removeAllListeners, removeListener, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ChatClosed

public static final EventType ChatClosed

ChatCreated

public static final EventType ChatCreated

ChatUpdated

public static final EventType ChatUpdated

MessageReceived

public static final EventType MessageReceived
Constructor Detail

MessageModule

public MessageModule(Observable parentObservable,
                     SessionObject sessionObject,
                     PacketWriter packetWriter)
Method Detail

close

public void close(Chat chat)
           throws JaxmppException
Destroy chat object.

Parameters:
chat - chat object
Throws:
JaxmppException

createChat

public Chat createChat(JID jid)
                throws JaxmppException
Creates new chat object.

Parameters:
jid - destination JID
Returns:
chat object
Throws:
JaxmppException

getChatManager

public AbstractChatManager getChatManager()

getChats

public List<Chat> getChats()
Returns all chat objects.

Returns:
collection of chat objects.

getCriteria

public Criteria getCriteria()
Criteria

Returns:

getFeatures

public String[] getFeatures()

Returns features what are implemented by Module.

See Service Discovery Features

Returns:
array of features

process

public void process(Message element)
             throws JaxmppException

Specified by:
process in class AbstractStanzaModule<Message>
Throws:
JaxmppException

sendMessage

public void sendMessage(JID toJID,
                        String subject,
                        String message)
                 throws XMLException,
                        JaxmppException
Sends message. It don't creates chat object.

Parameters:
toJID - recipient's JID
subject - subject of message
message - message
Throws:
XMLException
JaxmppException


Copyright © 2006-2012 Tigase. All Rights Reserved.