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

## Class MessageModule

- java.lang.Object
- - tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule<T>
  - - tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaExtendableModule<Message>
    - - tigase.jaxmpp.core.client.xmpp.modules.chat.MessageModule

- All Implemented Interfaces:
    ContextAware, ExtendableModule, InitializingModule, XmppModule

      public class MessageModule
      extends AbstractStanzaExtendableModule<Message>

  Module to handle messages.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `MessageModule.ChatClosedHandler`
    `static interface` | `MessageModule.ChatCreatedHandler`
    `static interface` | `MessageModule.ChatUpdatedHandler`
    `static interface` | `MessageModule.MessageReceivedHandler`

  - ### Field Summary

    - ### Fields inherited from class tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule

      `context, log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MessageModule()`
    `MessageModule(AbstractChatManager chatManager)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterRegister()` Called when module is registered.
    `void` | `beforeRegister()` Called just before registration module in XmppModulesManager .
    `void` | `close(Chat chat)` Destroy chat object.
    `Chat` | `createChat(JID jid)` Creates new chat object.
    `Chat` | `createChatInstance(Message message, JID interlocutorJid)`
    `protected Message` | `executeBeforeMessageProcess(Message element, Chat chat)`
    `protected String` | `generateThreadID()`
    `AbstractChatManager` | `getChatManager()`
    `List<Chat>` | `getChats()` Returns all chat objects.
    `Criteria` | `getCriteria()` Criteria
    `String[]` | `getFeatures()` Returns features what are implemented by Module.
    `protected boolean` | `isMessageHandledByMUC(JID from)`
    `void` | `process(Message message)` Method for processing incoming stanza.
    `Message` | `sendMessage(Chat chat, String body)` Sends message in passed chat.
    `Message` | `sendMessage(Chat chat, String body, List<? extends Element> additionalElems)` Sends message in passed chat.
    `Message` | `sendMessage(JID toJID, String subject, String message)` Sends message.
    `Message` | `sendMessage(Message msg)` Sends message in passed chat.
    `protected boolean` | `update(Chat chat, JID fromJid, String threadId)`
    `Message` | `writeMessage(Message msg)`

    - ### Methods inherited from class tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaExtendableModule

      `addExtension, getExtensionChain, getFeaturesWithExtensions, removeExtension, write, write, write`

    - ### Methods inherited from class tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule

      `beforeUnregister, fireEvent, getFirstChild, process, setContext`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MessageModule

          public MessageModule()

    - #### MessageModule

          public MessageModule(AbstractChatManager chatManager)

  - ### Method Detail

    - #### afterRegister

          public void afterRegister()

      Description copied from interface: `InitializingModule`
      Called when module is registered. At this moment module is formally registered and it is part of client.
      Specified by:
        `afterRegister` in interface `InitializingModule`
      Overrides:
        `afterRegister` in class `AbstractStanzaModule<Message>`

    - #### beforeRegister

          public void beforeRegister()

      Description copied from interface: `InitializingModule`
      Called just before registration module in XmppModulesManager . It is good place to check if module is initialized properly.
      Specified by:
        `beforeRegister` in interface `InitializingModule`
      Overrides:
        `beforeRegister` in class `AbstractStanzaModule<Message>`

    - #### 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`

    - #### createChatInstance

          public Chat createChatInstance(Message message,
                                         JID interlocutorJid)
                                  throws JaxmppException

      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 message)
                       throws JaxmppException

      Method for processing incoming stanza.
      Specified by:
        `process` in class `AbstractStanzaModule<Message>`
      Parameters:
        `message` - incoming stanza
      Throws:
        `JaxmppException`

    - #### sendMessage

          public Message sendMessage(Chat chat,
                                     String body)
                              throws JaxmppException

      Sends message in passed chat. It uses correct interlocutor JID and thread-id.
      Parameters:
        `body` - message to send.
      Returns:
      Throws:
        `JaxmppException`

    - #### sendMessage

          public Message sendMessage(Message msg)
                              throws JaxmppException

      Sends message in passed chat.
      Parameters:
        `msg` - message stanza to send.
      Returns:
      Throws:
        `JaxmppException`

    - #### sendMessage

          public Message sendMessage(Chat chat,
                                     String body,
                                     List<? extends Element> additionalElems)
                              throws JaxmppException

      Sends message in passed chat. It uses correct interlocutor JID and thread-id.
      Parameters:
        `body` - message to send.
      Returns:
      Throws:
        `JaxmppException`

    - #### sendMessage

          public Message sendMessage(JID toJID,
                                     String subject,
                                     String message)
                              throws JaxmppException

      Sends message. It does not create chat object.
      Parameters:
        `toJID` - recipient's JID
        `subject` - subject of message
        `message` - message
      Throws:
        `JaxmppException`

    - #### writeMessage

          public Message writeMessage(Message msg)
                               throws JaxmppException

      Throws:
        `JaxmppException`

    - #### executeBeforeMessageProcess

          protected Message executeBeforeMessageProcess(Message element,
                                                        Chat chat)

    - #### generateThreadID

          protected String generateThreadID()

    - #### isMessageHandledByMUC

          protected boolean isMessageHandledByMUC(JID from)

    - #### update

          protected boolean update(Chat chat,
                                   JID fromJid,
                                   String threadId)
                            throws JaxmppException

      Throws:
        `JaxmppException`

Copyright © 2006–2023 Tigase. All rights reserved.