Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.yahoo
Class OperationSetAdHocMultiUserChatYahooImpl

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

public class OperationSetAdHocMultiUserChatYahooImpl
extends Object
implements OperationSetAdHocMultiUserChat

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

Author:
Rupert Burchardi, Valentin Martinet, Yana Stamcheva

Constructor Summary
OperationSetAdHocMultiUserChatYahooImpl(ProtocolProviderServiceYahooImpl yahooProvider)
          Instantiates the user operation set with a currently valid instance of the Yahoo 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 in including to the specified 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.
 Message createMessage(String messageText)
          Creates a message by a given message text.
 void fireInvitationEvent(AdHocChatRoom targetChatRoom, String inviter, String reason)
          Delivers a AdHocChatRoomInvitationReceivedEvent to all registered AdHocChatRoomInvitationListeners.
 void fireInvitationRejectedEvent(AdHocChatRoom sourceChatRoom, String invitee, String reason)
          Delivers a AdHocChatRoomInvitationRejectedEvent to all registered AdHocChatRoomInvitationRejectionListeners.
 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 a listener that was being notified of changes in our status in a room such as us being kicked, banned or dropped.
 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 kicked, banned or dropped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetAdHocMultiUserChatYahooImpl

OperationSetAdHocMultiUserChatYahooImpl(ProtocolProviderServiceYahooImpl yahooProvider)
Instantiates the user operation set with a currently valid instance of the Yahoo protocol provider.

Parameters:
yahooProvider - a currently valid instance of ProtocolProviderServiceYahooImpl.
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.

removeInvitationListener

public void removeInvitationListener(AdHocChatRoomInvitationListener listener)
Removes a listener that was being notified of changes in our status in a room such as us being kicked, banned or dropped.

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

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.

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.

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.

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 kicked, banned or dropped.

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

createAdHocChatRoom

public AdHocChatRoom createAdHocChatRoom(String roomName,
                                         Map<String,Object> roomProperties)
                                  throws OperationFailedException
Creates a room with the named roomName and according to the specified roomProperties on the server that this protocol provider is currently connected to. Note the roomProperties also contain users that we like to invite to the chatRoom, this is required in the yahoo protocol.

Specified by:
createAdHocChatRoom in interface OperationSetAdHocMultiUserChat
Parameters:
roomName - the name of the AdHocChatRoom 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).

createAdHocChatRoom

public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,
                                         List<String> contacts,
                                         String reason)
                                  throws OperationFailedException
Creates an ad-hoc room with the named adHocRoomName and in including to the specified contacts. When the method returns the ad-hoc room the local user will have joined it.

Specified by:
createAdHocChatRoom in interface OperationSetAdHocMultiUserChat
Parameters:
adHocRoomName - the name of the room to be created
contacts - the list of contacts ID
reason - the reason for contacts' invitation
Returns:
the ad-hoc room that has been just created
Throws:
OperationFailedException - if the room couldn't be created for some reason

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

fireInvitationEvent

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

Parameters:
targetChatRoom - the room that invitation refers to
inviter - the inviter that sent the invitation
reason - the reason why the inviter sent the invitation

fireInvitationRejectedEvent

public void fireInvitationRejectedEvent(AdHocChatRoom sourceChatRoom,
                                        String invitee,
                                        String reason)
Delivers a AdHocChatRoomInvitationRejectedEvent to all registered AdHocChatRoomInvitationRejectionListeners.

Parameters:
sourceChatRoom - the room that invitation refers to
invitee - the name of the invitee that rejected the invitation
reason - the reason of the rejection

fireLocalUserPresenceEvent

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

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

createMessage

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

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

getAdHocChatRooms

public List<AdHocChatRoom> getAdHocChatRooms()
Description copied from interface: OperationSetAdHocMultiUserChat
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.