Class MucClientManager
-
- All Implemented Interfaces:
-
org.jitsi.xmpp.mucclient.ConnectionStateListener
public class MucClientManager implements ConnectionStateListener
Manages a set of MucClient, each of which represents an XMPP client connection (via an XMPPConnection) and a Multi-User Chat. Allows loading the configuration of a MucClient from properties in a ConfigurationService, as well as adding and removing MucClients dynamically.
Boris Grozev
-
-
Constructor Summary
Constructors Constructor Description MucClientManager()Initializes a new MucClientManager instance. MucClientManager(Array<String> features)Initializes a new MucClientManager instance.
-
Method Summary
Modifier and Type Method Description voidaddConnectionStateListener(ConnectionStateListener listener)voidremoveConnectionStateListener(ConnectionStateListener listener)booleanaddMucClient(MucClientConfiguration config)Adds a new MucClient with a specific MucClientConfiguration. voidsetPresenceExtension(ExtensionElement extension)Adds an ExtensionElement to the presence of all our MucClients, and removes any other extensions with the same element name and namespace, if any exist. voidremovePresenceExtension(String elementName, String namespace)Removes an ExtensionElement with a particular element name and namespace from the presence of all our MucClients. voidregisterIQ(IQ iq, boolean requireResponse)Indicates to this instance that the registered IQ listener is interested in IQs with a specific child element name and namespace, represented in an IQ. voidregisterIQ(IQ iq)voidregisterIQ(String elementName, String namespace)voidregisterIQ(String elementName, String namespace, boolean requireResponse)Indicates to this instance that the registered IQ listener is interested in IQs with a specific element name and namespace. booleanremoveMucClient(String id)Stops and removes a MucClient identified by its ID. MucClientgetMucClient(@NotNull() String id)voidstop()Stops and removed all MucClients. longgetClientCount()Return the number of configured MucClients. longgetClientConnectedCount()Return the number of MucClients that are successfully connected to XMPP. List<String>getMucClientIds()Return a list of ids for MUC client configs that have been added. longgetMucCount()Return the number of configured MUCs. longgetMucJoinedCount()Return the number of MUCs that have been successfully joined. voidconnected(@NotNull() MucClient mucClient)voidclosed(@NotNull() MucClient mucClient)voidclosedOnError(@NotNull() MucClient mucClient)voidreconnecting(@NotNull() MucClient mucClient)voidreconnectionFailed(@NotNull() MucClient mucClient)voidpingFailed(@NotNull() MucClient mucClient)voidsetIQListener(IQListener iqListener)Sets the IQ listener which will be called when an IQ of a registered type is received (see registerIQ). -
-
Constructor Detail
-
MucClientManager
MucClientManager()
Initializes a new MucClientManager instance.
-
MucClientManager
MucClientManager(Array<String> features)
Initializes a new MucClientManager instance.- Parameters:
features- the features to use for disco#info.
-
-
Method Detail
-
addConnectionStateListener
void addConnectionStateListener(ConnectionStateListener listener)
-
removeConnectionStateListener
void removeConnectionStateListener(ConnectionStateListener listener)
-
addMucClient
boolean addMucClient(MucClientConfiguration config)
Adds a new MucClient with a specific MucClientConfiguration. Initializes and starts the client asynchronously.
- Parameters:
config- the configuration of the new MucClient.- Returns:
trueif a new client was added, andfalseif a client with the ID described by the configuration already existed.
-
setPresenceExtension
void setPresenceExtension(ExtensionElement extension)
Adds an ExtensionElement to the presence of all our MucClients, and removes any other extensions with the same element name and namespace, if any exist.
- Parameters:
extension- the extension to add.
-
removePresenceExtension
void removePresenceExtension(String elementName, String namespace)
Removes an ExtensionElement with a particular element name and namespace from the presence of all our MucClients.
- Parameters:
elementName- the name of the element of the extension to remove.namespace- the namespace of the element of the extension to remove.
-
registerIQ
void registerIQ(IQ iq, boolean requireResponse)
Indicates to this instance that the registered IQ listener is interested in IQs with a specific child element name and namespace, represented in an IQ.
- Parameters:
iq- the IQ which represents a [element name, namespace] pair.requireResponse- whether to send an error stanza as a response if the IQListener producesnullfor requests of this type.
-
registerIQ
void registerIQ(IQ iq)
-
registerIQ
void registerIQ(String elementName, String namespace)
-
registerIQ
void registerIQ(String elementName, String namespace, boolean requireResponse)
Indicates to this instance that the registered IQ listener is interested in IQs with a specific element name and namespace.
- Parameters:
elementName- the child element name.namespace- the child element namespace.requireResponse- whether to send an error stanza as a response if the IQListener producesnullfor requests of this type.
-
removeMucClient
boolean removeMucClient(String id)
Stops and removes a MucClient identified by its ID.
- Parameters:
id- the ID of the client to remove.- Returns:
trueif a MucClient with this specified ID exists and was removed, andfalseotherwise.
-
getMucClient
@Nullable() MucClient getMucClient(@NotNull() String id)
-
stop
void stop()
Stops and removed all MucClients.
-
getClientCount
long getClientCount()
Return the number of configured MucClients.
-
getClientConnectedCount
long getClientConnectedCount()
Return the number of MucClients that are successfully connected to XMPP.
-
getMucClientIds
List<String> getMucClientIds()
Return a list of ids for MUC client configs that have been added.
-
getMucCount
long getMucCount()
Return the number of configured MUCs.
-
getMucJoinedCount
long getMucJoinedCount()
Return the number of MUCs that have been successfully joined.
-
closedOnError
void closedOnError(@NotNull() MucClient mucClient)
-
reconnecting
void reconnecting(@NotNull() MucClient mucClient)
-
reconnectionFailed
void reconnectionFailed(@NotNull() MucClient mucClient)
-
pingFailed
void pingFailed(@NotNull() MucClient mucClient)
-
setIQListener
void setIQListener(IQListener iqListener)
Sets the IQ listener which will be called when an IQ of a registered type is received (see registerIQ).
- Parameters:
iqListener- the listener to set.
-
-
-
-