tigase.jaxmpp.core.client.xmpp.modules.presence

## Class PresenceModule

- java.lang.Object
- - tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule<Presence>
  - - tigase.jaxmpp.core.client.xmpp.modules.presence.PresenceModule

- All Implemented Interfaces:
    EventHandler, ContextAware, InitializingModule, XmppModule, XmppSessionLogic.XmppSessionEstablishedHandler

      public class PresenceModule
      extends AbstractStanzaModule<Presence>
      implements InitializingModule, ContextAware, XmppSessionLogic.XmppSessionEstablishedHandler

  Module for handling presence information.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `PresenceModule.BeforePresenceSendHandler` Event fired before each presence sent by client.
    `static interface` | `PresenceModule.ContactAvailableHandler` Event fired when contact (understood as bare JID) becomes available.
    `static interface` | `PresenceModule.ContactChangedPresenceHandler` Event fired when contact changed his presence.
    `static interface` | `PresenceModule.ContactUnavailableHandler` Event fired when contact (understood as bare JID) goes offline.
    `static interface` | `PresenceModule.ContactUnsubscribedHandler` Event fired when contact is unsubscribed.
    `static interface` | `PresenceModule.SubscribeRequestHandler` Event fired when subscription request is received.

    - ### Nested classes/interfaces inherited from interface tigase.jaxmpp.core.client.XmppSessionLogic.XmppSessionEstablishedHandler

      `XmppSessionLogic.XmppSessionEstablishedHandler.XmppSessionEstablishedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Criteria` | `CRIT`
    `static String` | `INITIAL_PRESENCE_ENABLED_KEY`
    `static String` | `PRESENCE_STORE_KEY`

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

      `context, log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PresenceModule()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBeforePresenceSendHandler(PresenceModule.BeforePresenceSendHandler handler)`
    `void` | `addContactAvailableHandler(PresenceModule.ContactAvailableHandler handler)`
    `void` | `addContactChangedPresenceHandler(PresenceModule.ContactChangedPresenceHandler handler)`
    `void` | `addContactUnavailableHandler(PresenceModule.ContactUnavailableHandler handler)`
    `void` | `addContactUnsubscribedHandler(PresenceModule.ContactUnsubscribedHandler handler)`
    `void` | `addSubscribeRequestHandler(PresenceModule.SubscribeRequestHandler handler)`
    `void` | `afterRegister()` Called when module is registered.
    `void` | `beforeRegister()` Called just before registration module in XmppModulesManager .
    `void` | `beforeUnregister()` Called when module is unregistered.
    `protected void` | `contactOffline(Presence i, JID jid)`
    `Criteria` | `getCriteria()` Criteria
    `String[]` | `getFeatures()` Returns features what are implemented by Module.
    `PresenceStore` | `getPresenceStore()`
    `static PresenceStore` | `getPresenceStore(SessionObject sessionObject)`
    `void` | `onXmppSessionEstablished(SessionObject sessionObject)`
    `void` | `process(Presence presence)` Method for processing incoming stanza.
    `void` | `removeBeforePresenceSendHandler(PresenceModule.BeforePresenceSendHandler handler)`
    `void` | `removeContactAvailableHandler(PresenceModule.ContactAvailableHandler handler)`
    `void` | `removeContactChangedPresenceHandler(PresenceModule.ContactChangedPresenceHandler handler)`
    `void` | `removeContactUnavailableHandler(PresenceModule.ContactUnavailableHandler handler)`
    `void` | `removeContactUnsubscribedHandler(PresenceModule.ContactUnsubscribedHandler handler)`
    `void` | `removeSubscribeRequestHandler(PresenceModule.SubscribeRequestHandler handler)`
    `void` | `sendInitialPresence()`
    `void` | `setContext(Context context)`
    `void` | `setInitialPresence(boolean enabled)`
    `void` | `setPresence(Presence.Show show, String status, Integer priority)` Sends own presence.
    `static void` | `setPresenceStore(SessionObject sessionObject, PresenceStore presenceStore)`
    `void` | `subscribe(JID jid)` Subscribe for presence.
    `void` | `subscribed(JID jid)`
    `void` | `unsubscribe(JID jid)`
    `void` | `unsubscribed(JID jid)`

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

      `fireEvent, getFirstChild, process, write, write, write`

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

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

- - ### Field Detail

    - #### CRIT

          public static final Criteria CRIT

    - #### PRESENCE_STORE_KEY

          public static final String PRESENCE_STORE_KEY

      See Also:
        Constant Field Values

    - #### INITIAL_PRESENCE_ENABLED_KEY

          public static final String INITIAL_PRESENCE_ENABLED_KEY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PresenceModule

          public PresenceModule()

  - ### Method Detail

    - #### getPresenceStore

          public static PresenceStore getPresenceStore(SessionObject sessionObject)

    - #### setPresenceStore

          public static void setPresenceStore(SessionObject sessionObject,
                                              PresenceStore presenceStore)

    - #### addBeforePresenceSendHandler

          public void addBeforePresenceSendHandler(PresenceModule.BeforePresenceSendHandler handler)

    - #### addContactAvailableHandler

          public void addContactAvailableHandler(PresenceModule.ContactAvailableHandler handler)

    - #### addContactChangedPresenceHandler

          public void addContactChangedPresenceHandler(PresenceModule.ContactChangedPresenceHandler handler)

    - #### addContactUnavailableHandler

          public void addContactUnavailableHandler(PresenceModule.ContactUnavailableHandler handler)

    - #### addContactUnsubscribedHandler

          public void addContactUnsubscribedHandler(PresenceModule.ContactUnsubscribedHandler handler)

    - #### addSubscribeRequestHandler

          public void addSubscribeRequestHandler(PresenceModule.SubscribeRequestHandler handler)

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

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

    - #### beforeUnregister

          public void beforeUnregister()

      Description copied from interface: `InitializingModule`
      Called when module is unregistered.
      Specified by:
        `beforeUnregister` in interface `InitializingModule`
      Overrides:
        `beforeUnregister` in class `AbstractStanzaModule<Presence>`

    - #### contactOffline

          protected void contactOffline(Presence i,
                                        JID jid)
                                 throws JaxmppException

      Throws:
        `JaxmppException`

    - #### getCriteria

          public Criteria getCriteria()

      Description copied from interface: `XmppModule`
      Criteria
      Specified by:
        `getCriteria` in interface `XmppModule`
      Returns:

    - #### getFeatures

          public String[] getFeatures()

      Description copied from interface: `XmppModule`

      Returns features what are implemented by Module.

      See Service Discovery Features

      Specified by:
        `getFeatures` in interface `XmppModule`
      Returns:
        array of features

    - #### getPresenceStore

          public PresenceStore getPresenceStore()

    - #### onXmppSessionEstablished

          public void onXmppSessionEstablished(SessionObject sessionObject)
                                        throws JaxmppException

      Specified by:
        `onXmppSessionEstablished` in interface `XmppSessionLogic.XmppSessionEstablishedHandler`
      Throws:
        `JaxmppException`

    - #### process

          public void process(Presence presence)
                       throws JaxmppException

      Description copied from class: `AbstractStanzaModule`
      Method for processing incoming stanza.
      Specified by:
        `process` in class `AbstractStanzaModule<Presence>`
      Throws:
        `JaxmppException`

    - #### removeBeforePresenceSendHandler

          public void removeBeforePresenceSendHandler(PresenceModule.BeforePresenceSendHandler handler)

    - #### removeContactAvailableHandler

          public void removeContactAvailableHandler(PresenceModule.ContactAvailableHandler handler)

    - #### removeContactChangedPresenceHandler

          public void removeContactChangedPresenceHandler(PresenceModule.ContactChangedPresenceHandler handler)

    - #### removeContactUnavailableHandler

          public void removeContactUnavailableHandler(PresenceModule.ContactUnavailableHandler handler)

    - #### removeContactUnsubscribedHandler

          public void removeContactUnsubscribedHandler(PresenceModule.ContactUnsubscribedHandler handler)

    - #### removeSubscribeRequestHandler

          public void removeSubscribeRequestHandler(PresenceModule.SubscribeRequestHandler handler)

    - #### sendInitialPresence

          public void sendInitialPresence()
                                   throws XMLException,
                                          JaxmppException

      Throws:
        `XMLException`
        `JaxmppException`

    - #### setContext

          public void setContext(Context context)

      Specified by:
        `setContext` in interface `ContextAware`
      Overrides:
        `setContext` in class `AbstractStanzaModule<Presence>`

    - #### setInitialPresence

          public void setInitialPresence(boolean enabled)

    - #### setPresence

          public void setPresence(Presence.Show show,
                                  String status,
                                  Integer priority)
                           throws XMLException,
                                  JaxmppException

      Sends own presence.
      Parameters:
        `show` - presence substate.
        `status` - human readable description of status.
        `priority` - priority.
      Throws:
        `XMLException`
        `JaxmppException`

    - #### subscribe

          public void subscribe(JID jid)
                         throws JaxmppException,
                                XMLException

      Subscribe for presence.
      Parameters:
        `jid` - JID
      Throws:
        `JaxmppException`
        `XMLException`

    - #### subscribed

          public void subscribed(JID jid)
                          throws JaxmppException,
                                 XMLException

      Throws:
        `JaxmppException`
        `XMLException`

    - #### unsubscribe

          public void unsubscribe(JID jid)
                           throws JaxmppException,
                                  XMLException

      Throws:
        `JaxmppException`
        `XMLException`

    - #### unsubscribed

          public void unsubscribed(JID jid)
                            throws JaxmppException,
                                   XMLException

      Throws:
        `JaxmppException`
        `XMLException`

Copyright © 2006–2016 Tigase. All rights reserved.