public class AdHocChatRoomIcqImpl extends java.lang.Object implements AdHocChatRoom
Constructor and Description |
---|
AdHocChatRoomIcqImpl(net.kano.joustsim.oscar.oscar.service.chatrooms.ChatInvitation chatInvitation,
ProtocolProviderServiceIcqImpl icqProvider)
Constructor for chat room instances, with a given chat room invitation.
|
AdHocChatRoomIcqImpl(java.lang.String roomName,
net.kano.joustsim.oscar.oscar.service.chatrooms.ChatRoomSession chatRoomSession,
ProtocolProviderServiceIcqImpl icqProvider)
Constructor for chat room instances.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(AdHocChatRoomMessageListener listener)
Registers listener so that it would receive events every time a
new message is received on this chat room.
|
void |
addParticipantPresenceListener(AdHocChatRoomParticipantPresenceListener listener)
Adds a listener that will be notified of changes in our status in the
room such as us being kicked, banned, or granted admin permissions.
|
Message |
createMessage(byte[] content,
java.lang.String contentType,
java.lang.String contentEncoding,
java.lang.String subject)
Create a Message instance for sending arbitrary MIME-encoding content.
|
Message |
createMessage(java.lang.String messageText)
Create a Message instance for sending a simple text messages with default
(text/plain) content type and encoding.
|
Contact |
findParticipantForNickName(java.lang.String nickName)
Finds the member of this chat room corresponding to the given nick name.
|
void |
fireMessageEvent(java.util.EventObject evt)
Notifies all interested listeners that a
ChatRoomMessageDeliveredEvent,
ChatRoomMessageReceivedEvent or a
ChatRoomMessageDeliveryFailedEvent has been fired.
|
java.lang.String |
getIdentifier()
Returns the identifier of this AdHocChatRoom.
|
java.lang.String |
getName()
Returns the name of this AdHocChatRoom.
|
ProtocolProviderService |
getParentProvider()
Returns the protocol provider service that created us.
|
java.util.List<Contact> |
getParticipants()
Returns a List of Contacts corresponding to all
participants currently participating in this room.
|
int |
getParticipantsCount()
Returns the number of participants that are currently in this chat room.
|
java.lang.String |
getSubject()
Returns the last known room subject/theme or null if the user
hasn't joined the room or the room does not have a subject yet.
|
java.lang.String |
getUserNickname()
Returns the local user's nickname in the context of this chat room or
null if not currently joined.
|
void |
invite(java.lang.String userAddress,
java.lang.String reason)
Invites another user to this room.
|
void |
join()
Joins this chat room with the nickname of the local user so that the user
would start receiving events and messages for it.
|
void |
leave()
Leave this chat room.
|
void |
removeMessageListener(AdHocChatRoomMessageListener listener)
Removes listener so that it won't receive any further message
events from this room.
|
void |
removeParticipantPresenceListener(AdHocChatRoomParticipantPresenceListener listener)
Removes a listener that was being notified of changes in the status of
other ad-hoc chat room participants.
|
void |
sendMessage(Message message)
Sends the message to the destination indicated by the
to contact.
|
public AdHocChatRoomIcqImpl(net.kano.joustsim.oscar.oscar.service.chatrooms.ChatInvitation chatInvitation, ProtocolProviderServiceIcqImpl icqProvider)
chatInvitation
- Chat room invitation that the user received from
the ICQ networkicqProvider
- The ICQ providerpublic AdHocChatRoomIcqImpl(java.lang.String roomName, net.kano.joustsim.oscar.oscar.service.chatrooms.ChatRoomSession chatRoomSession, ProtocolProviderServiceIcqImpl icqProvider)
roomName
- The name of the chat room.chatRoomSession
- Chat room session from the icq networkicqProvider
- The icq providerpublic void addParticipantPresenceListener(AdHocChatRoomParticipantPresenceListener listener)
addParticipantPresenceListener
in interface AdHocChatRoom
listener
- a participant status listener.public void addMessageListener(AdHocChatRoomMessageListener listener)
addMessageListener
in interface AdHocChatRoom
listener
- a MessageListener that would be notified every
time a new message is received on this chat room.public Message createMessage(byte[] content, java.lang.String contentType, java.lang.String contentEncoding, java.lang.String subject)
content
- content valuecontentType
- the MIME-type for contentcontentEncoding
- encoding used for contentsubject
- a String subject or null for now
subject.public Message createMessage(java.lang.String messageText)
createMessage
in interface AdHocChatRoom
messageText
- the string content of the message.public java.lang.String getIdentifier()
getIdentifier
in interface AdHocChatRoom
public java.util.List<Contact> getParticipants()
getParticipants
in interface AdHocChatRoom
public int getParticipantsCount()
getParticipantsCount
in interface AdHocChatRoom
public java.lang.String getName()
getName
in interface AdHocChatRoom
public ProtocolProviderService getParentProvider()
getParentProvider
in interface AdHocChatRoom
public java.lang.String getSubject()
To be notified every time the room's subject change you should add a ChatRoomPropertyChangelistener to this room.
public java.lang.String getUserNickname()
public void invite(java.lang.String userAddress, java.lang.String reason)
invite
in interface AdHocChatRoom
userAddress
- the address of the user (email address) to invite to
the room.(one may also invite users not on their contact
list).reason
- invitation messagepublic void join() throws OperationFailedException
join
in interface AdHocChatRoom
OperationFailedException
- with the corresponding code if an error
occurs while joining the room.public void leave()
leave
in interface AdHocChatRoom
public void removeParticipantPresenceListener(AdHocChatRoomParticipantPresenceListener listener)
removeParticipantPresenceListener
in interface AdHocChatRoom
listener
- a participant status listener.public void removeMessageListener(AdHocChatRoomMessageListener listener)
removeMessageListener
in interface AdHocChatRoom
listener
- the MessageListener to remove from this roompublic void sendMessage(Message message) throws OperationFailedException
sendMessage
in interface AdHocChatRoom
message
- The Message to send.OperationFailedException
- if the underlying stack is not
registered or initialized or if the chat room is not joined.public void fireMessageEvent(java.util.EventObject evt)
evt
- The specific eventpublic Contact findParticipantForNickName(java.lang.String nickName)
nickName
- the nick name to search for.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.