Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.msn
Class OperationSetAdHocMultiUserChatMsnImpl

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

public class OperationSetAdHocMultiUserChatMsnImpl
extends Object
implements OperationSetAdHocMultiUserChat

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

Author:
Valentin Martinet

Constructor Summary
OperationSetAdHocMultiUserChatMsnImpl(ProtocolProviderServiceMsnImpl provider)
          Creates an OperationSetAdHocMultiUserChatMsnImpl by specifying the parent provider.
 
Method Summary
 void addInvitationListener(AdHocChatRoomInvitationListener listener)
          Adds a listener to invitation notifications.
 void addInvitationRejectionListener(AdHocChatRoomInvitationRejectionListener listener)
          Adds a listener to invitation notifications.
 void addPresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
          Adds the given presence listener to existing presence listeners list.
 AdHocChatRoom createAdHocChatRoom(String adHocRoomName, List<String> contacts, String reason)
          Creates an ad-hoc room with the named adHocRoomName and in including to the specified contacts.
 AdHocChatRoom createAdHocChatRoom(String adHocRoomName, Map<String,Object> adHocRoomProperties)
          Creates an AdHocChatRoom whose name is adHocRoomName with the properties contained in adHocRoomProperties
 Message createMessage(String messageText)
          Creates a message by a given message text.
 void fireLocalUserPresenceEvent(AdHocChatRoom adHocChatRoom, String eventType, String reason)
          Delivers a LocalUserAdHocChatRoomPresenceChangeEvent to all registered LocalUserAdHocChatRoomPresenceListeners.
 List<AdHocChatRoom> getAdHocChatRooms()
          Returns a list of all currently joined AdHocChatRoom-s.
 boolean isGroupChatMessage(net.sf.jml.MsnSwitchboard switchboard)
          Checks if an incoming message is a multi user chat message.
 void rejectInvitation(AdHocChatRoomInvitation invitation, String rejectReason)
          Supposed to reject an invitation for MUC.
 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 events.
 void removePresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
          Removes the given listener from presence listeners' list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetAdHocMultiUserChatMsnImpl

public OperationSetAdHocMultiUserChatMsnImpl(ProtocolProviderServiceMsnImpl provider)
Creates an OperationSetAdHocMultiUserChatMsnImpl by specifying the parent provider.

Parameters:
provider - the Msn provider
Method Detail

addPresenceListener

public void addPresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
Adds the given presence listener to existing presence listeners list.

Specified by:
addPresenceListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the listener to add

addInvitationListener

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

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

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.

addInvitationRejectionListener

public void addInvitationRejectionListener(AdHocChatRoomInvitationRejectionListener listener)
Adds a listener to invitation notifications.

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

removeInvitationRejectionListener

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

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

createMessage

public Message createMessage(String messageText)
Creates a message by a given message text.

Parameters:
messageText - The message text.
Returns:
the newly created message.

createAdHocChatRoom

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

Specified by:
createAdHocChatRoom in interface OperationSetAdHocMultiUserChat
Parameters:
adHocRoomName - the name of the ad-hoc room
contacts - the list of contacts ID
reason - the reason (will not be used since MSN does not support invitation with the possibility to reject it)
Returns:
the ad-hoc room that has been just created
Throws:
OperationFailedException
OperationNotSupportedException

createAdHocChatRoom

public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
                                         Map<String,Object> adHocRoomProperties)
                                  throws OperationFailedException,
                                         OperationNotSupportedException
Creates an AdHocChatRoom whose name is adHocRoomName with the properties contained in adHocRoomProperties

Specified by:
createAdHocChatRoom in interface OperationSetAdHocMultiUserChat
Parameters:
adHocRoomName - the name of the ad-hoc room
adHocRoomProperties - the ad-hoc room's properties
Returns:
the created ad-hoc room
Throws:
OperationFailedException
OperationNotSupportedException

fireLocalUserPresenceEvent

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

Parameters:
adHocChatRoom - 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

isGroupChatMessage

public boolean isGroupChatMessage(net.sf.jml.MsnSwitchboard switchboard)
Checks if an incoming message is a multi user chat message. This is done by the switchboard, if it is not created by the user, its an active file transfer switchboard or the user count is too low then this method return false.

Parameters:
switchboard - The corresponding MSNswitchboard.
Returns:
true if it is a group chat message or false in the other case.

removePresenceListener

public void removePresenceListener(LocalUserAdHocChatRoomPresenceListener listener)
Removes the given listener from presence listeners' list.

Specified by:
removePresenceListener in interface OperationSetAdHocMultiUserChat
Parameters:
listener - the listener to remove

rejectInvitation

public void rejectInvitation(AdHocChatRoomInvitation invitation,
                             String rejectReason)
Supposed to reject an invitation for MUC. Note: Not supported inside the MSN.

Specified by:
rejectInvitation in interface OperationSetAdHocMultiUserChat
Parameters:
invitation - the invitation we are rejecting.
rejectReason - the reason to reject the invitation (optional)

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

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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