Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.icq
Class OperationSetAdHocMultiUserChatIcqImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.icq.OperationSetAdHocMultiUserChatIcqImpl
All Implemented Interfaces:
OperationSet, OperationSetAdHocMultiUserChat

public class OperationSetAdHocMultiUserChatIcqImpl
extends Object
implements OperationSetAdHocMultiUserChat

A ICQ implementation of the ad-hoc multi user chat operation set.

Author:
Valentin Martinet

Field Summary
protected  OperationSetPersistentPresenceIcqImpl opSetPersPresence
          A reference to the persistent presence operation set that we use to match incoming messages to Contacts and vice versa.
 
Constructor Summary
OperationSetAdHocMultiUserChatIcqImpl(ProtocolProviderServiceIcqImpl icqProvider)
          Instantiates the user operation set with a currently valid instance of the Icq protocol provider.
 
Method Summary
 void addInvitationListener(AdHocChatRoomInvitationListener listener)
          Adds a listener to invitation notifications.
 void addInvitationRejectionListener(AdHocChatRoomInvitationRejectionListener listener)
          Subscribes listener so that it would receive events indicating rejection of a multi user chat invitation that we've sent earlier.
 void addPresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
          Adds a listener that will be notified of changes in our status in a chat room such as us being kicked, banned or dropped.
 AdHocChatRoom createAdHocChatRoom(String adHocRoomName, List<String> contacts, String reason)
          Creates an ad-hoc room with the named adHocRoomName and inviting the specified list of contacts.
 AdHocChatRoom createAdHocChatRoom(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.
 void fireInvitationEvent(AdHocChatRoom targetChatRoom, String inviter, String reason, byte[] password)
          Delivers a AdHocChatRoomInvitationReceivedEvent to all registered AdHocChatRoomInvitationListeners.
 void fireLocalUserPresenceEvent(AdHocChatRoom chatRoom, String eventType, String reason)
          Delivers a LocalUserAdHocChatRoomPresenceChangeEvent to all registered LocalUserAdHocChatRoomPresenceListeners.
 List<AdHocChatRoom> getAdHocChatRooms()
          Returns a list of all currently joined AdHocChatRoom-s.
 void rejectInvitation(AdHocChatRoomInvitation invitation, String rejectReason)
          Informs the sender of an invitation that we decline their invitation.
 void removeInvitationListener(AdHocChatRoomInvitationListener listener)
          Removes listener from the list of invitation listeners registered to receive invitation events.
 void removeInvitationRejectionListener(AdHocChatRoomInvitationRejectionListener listener)
          Removes listener from the list of invitation listeners registered to receive invitation rejection events.
 void removePresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
          Removes a listener that was being notified of changes in our status in a room such as us being joined or dropped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

opSetPersPresence

protected OperationSetPersistentPresenceIcqImpl opSetPersPresence
A reference to the persistent presence operation set that we use to match incoming messages to Contacts and vice versa.

Constructor Detail

OperationSetAdHocMultiUserChatIcqImpl

OperationSetAdHocMultiUserChatIcqImpl(ProtocolProviderServiceIcqImpl icqProvider)
Instantiates the user operation set with a currently valid instance of the Icq protocol provider.

Parameters:
icqProvider - a currently valid instance of ProtocolProviderServiceIcqImpl.
Method Detail

addInvitationListener

public void addInvitationListener(AdHocChatRoomInvitationListener listener)
Adds a listener to invitation notifications.

Specified by:
addInvitationListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - an invitation listener.

addInvitationRejectionListener

public void addInvitationRejectionListener(AdHocChatRoomInvitationRejectionListener listener)
Subscribes listener so that it would receive events indicating rejection of a multi user chat invitation that we've sent earlier.

Specified by:
addInvitationRejectionListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the listener that we'll subscribe for invitation rejection events.

addPresenceListener

public void addPresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
Adds a listener that will be notified of changes in our status in a chat room such as us being kicked, banned or dropped.

Specified by:
addPresenceListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the LocalUserAdHocChatRoomPresenceListener.

getAdHocChatRooms

public List<AdHocChatRoom> getAdHocChatRooms()
Returns a list of all currently joined AdHocChatRoom-s.

Specified by:
getAdHocChatRooms in interface OperationSetAdHocMultiUserChat
Returns:
a list of all currently joined AdHocChatRoom-s

createAdHocChatRoom

public AdHocChatRoom createAdHocChatRoom(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:
createAdHocChatRoom in interface OperationSetAdHocMultiUserChat
Parameters:
roomName - the name of the AdHocChatRoom to create.
roomProperties - properties specifying how the room should be created. Contains list of invitees and the invitation message.
Returns:
AdHocChatRoom the ad-hoc 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 an ad-hoc chat room).
OperationNotSupportedException - if ad-hoc chat room creation is not supported by this server

createAdHocChatRoom

public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
                                         List<String> contacts,
                                         String reason)
                                  throws OperationFailedException,
                                         OperationNotSupportedException
Creates an ad-hoc room with the named adHocRoomName and inviting the specified list of contacts.

Specified by:
createAdHocChatRoom in interface OperationSetAdHocMultiUserChat
Parameters:
adHocRoomName - the name of the ad-hoc room (however, it won't/does not have to be used since the only way to create an ICQ room is having a room name which begins by the "chat" prefix followed by a random number (this is what is used in the ICQ 7 software).
contacts - the list of contacts ID
reason - the reason to be sent with the invitation for contacts.
Returns:
the ad-hoc room that has been just created
Throws:
OperationFailedException
OperationNotSupportedException

rejectInvitation

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

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

removeInvitationListener

public void removeInvitationListener(AdHocChatRoomInvitationListener listener)
Removes listener from the list of invitation listeners registered to receive invitation events.

Specified by:
removeInvitationListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the invitation listener to remove.

removeInvitationRejectionListener

public void removeInvitationRejectionListener(AdHocChatRoomInvitationRejectionListener listener)
Removes listener from the list of invitation listeners registered to receive invitation rejection events.

Specified by:
removeInvitationRejectionListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the invitation listener to remove.

removePresenceListener

public void removePresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
Removes a listener that was being notified of changes in our status in a room such as us being joined or dropped.

Specified by:
removePresenceListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the LocalUserAdHocChatRoomPresenceListener.

fireInvitationEvent

public void fireInvitationEvent(AdHocChatRoom targetChatRoom,
                                String inviter,
                                String reason,
                                byte[] password)
Delivers a AdHocChatRoomInvitationReceivedEvent to all registered AdHocChatRoomInvitationListeners.

Parameters:
targetChatRoom - the ad-hoc 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

fireLocalUserPresenceEvent

public void fireLocalUserPresenceEvent(AdHocChatRoom chatRoom,
                                       String eventType,
                                       String reason)
Delivers a LocalUserAdHocChatRoomPresenceChangeEvent to all registered LocalUserAdHocChatRoomPresenceListeners.

Parameters:
chatRoom - the AdHocChatRoom which has been joined, left, etc.
eventType - the type of this event; one of LOCAL_USER_JOINED, LOCAL_USER_LEFT, etc.
reason - the reason

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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