public class MultiUserChatManager extends Manager
Modifier and Type | Method and Description |
---|---|
void |
addInvitationListener(InvitationListener listener)
Adds a listener to invitation notifications.
|
void |
decline(String room,
String inviter,
String reason)
Informs the sender of an invitation that the invitee declines the invitation.
|
List<HostedRoom> |
getHostedRooms(String serviceName)
Returns a List of HostedRooms where each HostedRoom has the XMPP address of the room and the room's name.
|
static MultiUserChatManager |
getInstanceFor(XMPPConnection connection)
Get a instance of a multi user chat manager for the given connection.
|
Set<String> |
getJoinedRooms()
Returns a Set of the rooms where the user has joined.
|
List<String> |
getJoinedRooms(String user)
Returns a List of the rooms where the requested user has joined.
|
MultiUserChat |
getMultiUserChat(String jid)
Creates a multi user chat.
|
RoomInfo |
getRoomInfo(String room)
Returns the discovered information of a given room without actually having to join the room.
|
List<String> |
getServiceNames()
Returns a collection with the XMPP addresses of the Multi-User Chat services.
|
boolean |
isServiceEnabled(String user)
Returns true if the specified user supports the Multi-User Chat protocol.
|
void |
removeInvitationListener(InvitationListener listener)
Removes a listener to invitation notifications.
|
connection
public static MultiUserChatManager getInstanceFor(XMPPConnection connection)
connection
- public MultiUserChat getMultiUserChat(String 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(String user) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
user
- the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public Set<String> getJoinedRooms()
public List<String> getJoinedRooms(String user) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
user
- the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public RoomInfo getRoomInfo(String room) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
room
- the name of the room in the form "roomName@service" of which we want to discover its information.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public List<String> getServiceNames() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public List<HostedRoom> getHostedRooms(String serviceName) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
serviceName
- the service that is hosting the rooms to discover.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void decline(String room, String inviter, String reason) throws SmackException.NotConnectedException
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.SmackException.NotConnectedException
public void addInvitationListener(InvitationListener listener)
listener
- an invitation listener.public void removeInvitationListener(InvitationListener listener)
listener
- an invitation listener.