Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.irc
Class OperationSetMultiUserChatIrcImpl

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.AbstractOperationSetMultiUserChat
      extended by net.java.sip.communicator.impl.protocol.irc.OperationSetMultiUserChatIrcImpl
All Implemented Interfaces:
OperationSet, OperationSetMultiUserChat

public class OperationSetMultiUserChatIrcImpl
extends AbstractOperationSetMultiUserChat

Allows creating, configuring, joining and administering of individual text-based conference rooms.

Author:
Stephane Remy, Loic Kempf, Yana Stamcheva, Lubomir Marinov

Constructor Summary
OperationSetMultiUserChatIrcImpl(ProtocolProviderServiceIrcImpl provider)
          Instantiates the user operation set with a currently valid instance of the irc protocol provider.
 
Method Summary
 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.
protected  ChatRoomIrcImpl findPrivateChatRoom(String nickIdentifier)
          Returns the private room corresponding to the given nick name.
 ChatRoom findRoom(String roomName)
          Returns a reference to a chatRoom named roomName.
protected  ChatRoomMemberIrcImpl findSystemMember()
          Returns the system room member.
protected  ChatRoomIrcImpl findSystemRoom()
          Returns the room corresponding to the server channel.
protected  void fireInvitationEvent(ChatRoom targetChatRoom, String inviter, String reason, byte[] password)
          Delivers a ChatRoomInvitationReceivedEvent to all registered ChatRoomInvitationListeners.
protected  ChatRoomIrcImpl 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 a list of the chat rooms that chatRoomMember has joined and is currently active in.
 List<String> getExistingChatRooms()
          Returns the List of ChatRooms 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 reason)
          Informs the sender of an invitation that we decline their invitation.
 
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

OperationSetMultiUserChatIrcImpl

public OperationSetMultiUserChatIrcImpl(ProtocolProviderServiceIrcImpl provider)
Instantiates the user operation set with a currently valid instance of the irc protocol provider.

Parameters:
provider - a currently valid instance of ProtocolProviderServiceIrcImpl.
Method Detail

getExistingChatRooms

public List<String> getExistingChatRooms()
                                  throws OperationFailedException
Returns the List of ChatRooms currently available on the server that this protocol provider is connected to.

Returns:
a java.util.List of ChatRooms that are currently available on the server that this protocol provider is connected to.
Throws:
OperationFailedException - if we failed retrieving this list from the server.

getCurrentlyJoinedChatRooms

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

Returns:
a List of the rooms where the user has joined using a given connection.

getCurrentlyJoinedChatRooms

public List<String> getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember)
Returns a list of the chat rooms that chatRoomMember has joined and is currently active in.

Parameters:
chatRoomMember - the chat room member whose current ChatRooms we will be querying.
Returns:
a list of the chat rooms that chatRoomMember has joined and is currently active in.

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. When the method returns the room the local user will not have joined it and thus will not receive messages on it until the ChatRoom.join() method is called.

Parameters:
roomName - the name of the ChatRoom to create.
roomProperties - properties specifying how the room should be created.
Returns:
the newly created ChatRoom named roomName.
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)
Returns a reference to a chatRoom named roomName. The room is created if it doesn't exists

Parameters:
roomName - the name of the ChatRoom that we're looking for.
Returns:
the ChatRoom named roomName.

rejectInvitation

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

Parameters:
invitation - the invitation we are rejecting.
reason - the reason of rejecting

isMultiChatSupportedByContact

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

Parameters:
contact - reference to the contact whose support for chat rooms we are currently querying.
Returns:
a boolean indicating whether contact supports chat rooms.

getChatRoom

protected ChatRoomIrcImpl 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.

findPrivateChatRoom

protected ChatRoomIrcImpl findPrivateChatRoom(String nickIdentifier)
Returns the private room corresponding to the given nick name.

Parameters:
nickIdentifier - the nickName of the person for which the private room is.
Returns:
the private room corresponding to the given nick name

fireInvitationEvent

protected 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

findSystemRoom

protected ChatRoomIrcImpl findSystemRoom()
Returns the room corresponding to the server channel.

Returns:
the room corresponding to the server channel

findSystemMember

protected ChatRoomMemberIrcImpl findSystemMember()
Returns the system room member.

Returns:
the system room member.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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