Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class OperationSetMultiUserChatJabberImpl

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.AbstractOperationSetMultiUserChat
      extended by net.java.sip.communicator.impl.protocol.jabber.OperationSetMultiUserChatJabberImpl
All Implemented Interfaces:
EventListener, SubscriptionListener, OperationSet, OperationSetMultiUserChat

public class OperationSetMultiUserChatJabberImpl
extends AbstractOperationSetMultiUserChat
implements SubscriptionListener

A jabber implementation of the multi user chat operation set.

Author:
Emil Ivov, Yana Stamcheva

Constructor Summary
OperationSetMultiUserChatJabberImpl(ProtocolProviderServiceJabberImpl jabberProvider)
          Instantiates the user operation set with a currently valid instance of the Jabber protocol provider.
 
Method Summary
 void contactModified(ContactPropertyChangeEvent evt)
          Updates corresponding chat room members when a contact has been modified in our contact list.
 ChatRoom createChatRoom(String roomName, Map<String,Object> roomProperties)
          Creates a room with the named roomName and according to the specified roomProperties on the server that this protocol provider is currently connected to.
 ChatRoom findRoom(String roomName)
          Returns a reference to a chatRoom named roomName or null if that room does not exist.
 void fireInvitationEvent(ChatRoom targetChatRoom, String inviter, String reason, byte[] password)
          Delivers a ChatRoomInvitationReceivedEvent to all registered ChatRoomInvitationListeners.
 ChatRoomJabberImpl getChatRoom(String chatRoomName)
          Returns a reference to the chat room named chatRoomName or null if the room hasn't been cached yet.
 List<ChatRoom> getCurrentlyJoinedChatRooms()
          Returns a list of the chat rooms that we have joined and are currently active in.
 List<String> getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember)
          Returns the list of currently joined chat rooms for chatRoomMember.
 List<String> getExistingChatRooms()
          Returns the List of Strings indicating chat rooms currently available on the server that this protocol provider is connected to.
 boolean isMultiChatSupportedByContact(Contact contact)
          Returns true if contact supports multi user chat sessions.
 void rejectInvitation(ChatRoomInvitation invitation, String rejectReason)
          Informs the sender of an invitation that we decline their invitation.
 void subscriptionCreated(SubscriptionEvent evt)
          Updates corresponding chat room members when a contact has been created in our contact list.
 void subscriptionFailed(SubscriptionEvent evt)
          Not interested in this event for our member update purposes.
 void subscriptionMoved(SubscriptionMovedEvent evt)
          Not interested in this event for our member update purposes.
 void subscriptionRemoved(SubscriptionEvent evt)
          Updates corresponding chat room members when a contact has been removed from our contact list.
 void subscriptionResolved(SubscriptionEvent evt)
          Not interested in this event for our member update purposes.
 
Methods inherited from class net.java.sip.communicator.service.protocol.AbstractOperationSetMultiUserChat
addInvitationListener, addInvitationRejectionListener, addPresenceListener, fireInvitationReceived, fireInvitationRejectedEvent, fireLocalUserPresenceEvent, removeInvitationListener, removeInvitationRejectionListener, removePresenceListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetMultiUserChatJabberImpl

OperationSetMultiUserChatJabberImpl(ProtocolProviderServiceJabberImpl jabberProvider)
Instantiates the user operation set with a currently valid instance of the Jabber protocol provider.

Parameters:
jabberProvider - a currently valid instance of ProtocolProviderServiceJabberImpl.
Method Detail

createChatRoom

public ChatRoom createChatRoom(String roomName,
                               Map<String,Object> roomProperties)
                        throws OperationFailedException,
                               OperationNotSupportedException
Creates a room with the named roomName and according to the specified roomProperties on the server that this protocol provider is currently connected to.

Specified by:
createChatRoom in interface OperationSetMultiUserChat
Parameters:
roomName - the name of the ChatRoom to create.
roomProperties - properties specifying how the room should be created.
Returns:
ChatRoom the chat room that we've just created.
Throws:
OperationFailedException - if the room couldn't be created for some reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
OperationNotSupportedException - if chat room creation is not supported by this server

findRoom

public ChatRoom findRoom(String roomName)
                  throws OperationFailedException,
                         OperationNotSupportedException
Returns a reference to a chatRoom named roomName or null if that room does not exist.

Specified by:
findRoom in interface OperationSetMultiUserChat
Parameters:
roomName - the name of the ChatRoom that we're looking for.
Returns:
the ChatRoom named roomName if it exists, null otherwise.
Throws:
OperationFailedException - if an error occurs while trying to discover the room on the server.
OperationNotSupportedException - if the server does not support multi user chat

getCurrentlyJoinedChatRooms

public List<ChatRoom> getCurrentlyJoinedChatRooms()
Returns a list of the chat rooms that we have joined and are currently active in.

Specified by:
getCurrentlyJoinedChatRooms in interface OperationSetMultiUserChat
Returns:
a List of the rooms where the user has joined using a given connection.

getExistingChatRooms

public List<String> getExistingChatRooms()
                                  throws OperationFailedException,
                                         OperationNotSupportedException
Returns the List of Strings indicating chat rooms currently available on the server that this protocol provider is connected to.

Specified by:
getExistingChatRooms in interface OperationSetMultiUserChat
Returns:
a java.util.List of the name Strings for chat rooms that are currently available on the server that this protocol provider is connected to.
Throws:
OperationFailedException - if we faile retrieving this list from the server.
OperationNotSupportedException - if the server does not support multi user chat

isMultiChatSupportedByContact

public boolean isMultiChatSupportedByContact(Contact contact)
Returns true if contact supports multi user chat sessions.

Specified by:
isMultiChatSupportedByContact in interface OperationSetMultiUserChat
Parameters:
contact - reference to the contact whose support for chat rooms we are currently querying.
Returns:
a boolean indicating whether contact supports chatrooms.
To do:
Implement this net.java.sip.communicator.service.protocol.OperationSetMultiUserChat method

rejectInvitation

public void rejectInvitation(ChatRoomInvitation invitation,
                             String rejectReason)
Informs the sender of an invitation that we decline their invitation.

Specified by:
rejectInvitation in interface OperationSetMultiUserChat
Parameters:
invitation - the connection to use for sending the rejection.
rejectReason - the reason to reject the given invitation

getChatRoom

public ChatRoomJabberImpl getChatRoom(String chatRoomName)
Returns a reference to the chat room named chatRoomName or null if the room hasn't been cached yet.

Parameters:
chatRoomName - the name of the room we're looking for.
Returns:
the ChatRoomJabberImpl instance that has been cached for chatRoomName or null if no such room has been cached so far.

getCurrentlyJoinedChatRooms

public List<String> getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember)
                                         throws OperationFailedException,
                                                OperationNotSupportedException
Returns the list of currently joined chat rooms for chatRoomMember.

Specified by:
getCurrentlyJoinedChatRooms in interface OperationSetMultiUserChat
Parameters:
chatRoomMember - the member we're looking for
Returns:
a list of all currently joined chat rooms
Throws:
OperationFailedException - if the operation fails
OperationNotSupportedException - if the operation is not supported

fireInvitationEvent

public void fireInvitationEvent(ChatRoom targetChatRoom,
                                String inviter,
                                String reason,
                                byte[] password)
Delivers a ChatRoomInvitationReceivedEvent to all registered ChatRoomInvitationListeners.

Parameters:
targetChatRoom - the room that invitation refers to
inviter - the inviter that sent the invitation
reason - the reason why the inviter sent the invitation
password - the password to use when joining the room

contactModified

public void contactModified(ContactPropertyChangeEvent evt)
Updates corresponding chat room members when a contact has been modified in our contact list.

Specified by:
contactModified in interface SubscriptionListener
Parameters:
evt - the SubscriptionEvent that notified us

subscriptionCreated

public void subscriptionCreated(SubscriptionEvent evt)
Updates corresponding chat room members when a contact has been created in our contact list.

Specified by:
subscriptionCreated in interface SubscriptionListener
Parameters:
evt - the SubscriptionEvent that notified us

subscriptionFailed

public void subscriptionFailed(SubscriptionEvent evt)
Not interested in this event for our member update purposes.

Specified by:
subscriptionFailed in interface SubscriptionListener
Parameters:
evt - the SubscriptionEvent that notified us

subscriptionMoved

public void subscriptionMoved(SubscriptionMovedEvent evt)
Not interested in this event for our member update purposes.

Specified by:
subscriptionMoved in interface SubscriptionListener
Parameters:
evt - the SubscriptionEvent that notified us

subscriptionRemoved

public void subscriptionRemoved(SubscriptionEvent evt)
Updates corresponding chat room members when a contact has been removed from our contact list.

Specified by:
subscriptionRemoved in interface SubscriptionListener
Parameters:
evt - the SubscriptionEvent that notified us

subscriptionResolved

public void subscriptionResolved(SubscriptionEvent evt)
Not interested in this event for our member update purposes.

Specified by:
subscriptionResolved in interface SubscriptionListener
Parameters:
evt - the SubscriptionEvent that notified us

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.