public final class MultiUserChatManager
extends org.jivesoftware.smack.Manager
Use getMultiUserChat(EntityBareJid)
to retrieve an object representing a Multi-User Chat room.
Automatic rejoin: The manager supports automatic rejoin of MultiUserChat rooms once the connection got
re-established. This mechanism is disabled by default. To enable it, use setAutoJoinOnReconnect(boolean)
.
You can set a AutoJoinFailedCallback
via setAutoJoinFailedCallback(AutoJoinFailedCallback)
to get
notified if this mechanism failed for some reason. Note that as soon as rejoining for a single room failed, no
further attempts will be made for the other rooms.
Modifier and Type | Method and Description |
---|---|
void |
addInvitationListener(InvitationListener listener)
Adds a listener to invitation notifications.
|
void |
decline(org.jxmpp.jid.EntityBareJid room,
org.jxmpp.jid.EntityBareJid inviter,
java.lang.String reason)
Informs the sender of an invitation that the invitee declines the invitation.
|
static MultiUserChatManager |
getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
Get a instance of a multi user chat manager for the given connection.
|
java.util.Set<org.jxmpp.jid.EntityBareJid> |
getJoinedRooms()
Returns a Set of the rooms where the user has joined.
|
java.util.List<org.jxmpp.jid.EntityBareJid> |
getJoinedRooms(org.jxmpp.jid.EntityFullJid user)
Returns a List of the rooms where the requested user has joined.
|
java.util.List<org.jxmpp.jid.DomainBareJid> |
getMucServiceDomains()
Returns a collection with the XMPP addresses of the Multi-User Chat services.
|
MultiUserChat |
getMultiUserChat(org.jxmpp.jid.EntityBareJid jid)
Creates a multi user chat.
|
RoomInfo |
getRoomInfo(org.jxmpp.jid.EntityBareJid room)
Returns the discovered information of a given room without actually having to join the room.
|
java.util.Map<org.jxmpp.jid.EntityBareJid,HostedRoom> |
getRoomsHostedBy(org.jxmpp.jid.DomainBareJid serviceName)
Returns a Map of HostedRooms where each HostedRoom has the XMPP address of the room and the room's name.
|
java.util.List<org.jxmpp.jid.DomainBareJid> |
getXMPPServiceDomains()
Deprecated.
use
getMucServiceDomains() instead. |
boolean |
isServiceEnabled(org.jxmpp.jid.Jid user)
Returns true if the specified user supports the Multi-User Chat protocol.
|
boolean |
providesMucService(org.jxmpp.jid.DomainBareJid domainBareJid)
Check if the provided domain bare JID provides a MUC service.
|
void |
removeInvitationListener(InvitationListener listener)
Removes a listener to invitation notifications.
|
void |
setAutoJoinFailedCallback(AutoJoinFailedCallback failedCallback)
Set a callback invoked by this manager when automatic join on reconnect failed.
|
void |
setAutoJoinOnReconnect(boolean autoJoin)
If automatic join on reconnect is enabled, then the manager will try to auto join MUC rooms after the connection
got re-established.
|
void |
setAutoJoinSuccessCallback(AutoJoinSuccessCallback successCallback)
Set a callback invoked by this manager when automatic join on reconnect success.
|
public static MultiUserChatManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
connection
- TODO javadoc me pleasepublic MultiUserChat getMultiUserChat(org.jxmpp.jid.EntityBareJid jid)
join
the chat room. On some server implementations, the room will not be
created until the first person joins it.
Most XMPP servers use a sub-domain for the chat service (eg chat.example.com for the XMPP server example.com). You must ensure that the room address you're trying to connect to includes the proper chat sub-domain.
jid
- the name of the room in the form "roomName@service", where "service" is the hostname at which the
multi-user chat service is running. Make sure to provide a valid JID.public boolean isServiceEnabled(org.jxmpp.jid.Jid user) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
user
- the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.Set<org.jxmpp.jid.EntityBareJid> getJoinedRooms()
BookmarkManager.getBookmarkedConferences()
.public java.util.List<org.jxmpp.jid.EntityBareJid> getJoinedRooms(org.jxmpp.jid.EntityFullJid user) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
user
- the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public RoomInfo getRoomInfo(org.jxmpp.jid.EntityBareJid room) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
room
- the name of the room in the form "roomName@service" of which we want to discover its information.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<org.jxmpp.jid.DomainBareJid> getMucServiceDomains() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.@Deprecated public java.util.List<org.jxmpp.jid.DomainBareJid> getXMPPServiceDomains() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
getMucServiceDomains()
instead.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public boolean providesMucService(org.jxmpp.jid.DomainBareJid domainBareJid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
domainBareJid
- the domain bare JID to check.true
if the provided JID provides a MUC service, false
otherwise.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.Map<org.jxmpp.jid.EntityBareJid,HostedRoom> getRoomsHostedBy(org.jxmpp.jid.DomainBareJid serviceName) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException, MultiUserChatException.NotAMucServiceException
serviceName
- the service that is hosting the rooms to discover.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.MultiUserChatException.NotAMucServiceException
- if the entity is not a MUC serivce.public void decline(org.jxmpp.jid.EntityBareJid room, org.jxmpp.jid.EntityBareJid inviter, java.lang.String reason) throws org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
room
- the room that sent the original invitation.inviter
- the inviter of the declined invitation.reason
- the reason why the invitee is declining the invitation.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void addInvitationListener(InvitationListener listener)
listener
- an invitation listener.public void removeInvitationListener(InvitationListener listener)
listener
- an invitation listener.public void setAutoJoinOnReconnect(boolean autoJoin)
autoJoin
- true
to enable, false
to disable.public void setAutoJoinFailedCallback(AutoJoinFailedCallback failedCallback)
null
, then automatic rejoin get also enabled.failedCallback
- the callback.public void setAutoJoinSuccessCallback(AutoJoinSuccessCallback successCallback)
null
, automatic rejoin will also
be enabled.successCallback
- the callback