public class ChatRoomIrcImpl extends AbstractChatRoom
cachedConferenceDescriptions, conferencePublishedListeners
Constructor and Description |
---|
ChatRoomIrcImpl(java.lang.String chatRoomName,
ProtocolProviderServiceIrcImpl parentProvider)
Creates an instance of ChatRoomIrcImpl, by specifying the room
name and the protocol provider.
|
ChatRoomIrcImpl(java.lang.String chatRoomName,
ProtocolProviderServiceIrcImpl parentProvider,
boolean isSystem)
Creates an instance of ChatRoomIrcImpl, by specifying the room
name, the protocol provider and the isPrivate property.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addChatRoomMember(java.lang.String memberID,
ChatRoomMember member)
Adds a ChatRoomMember to the list of members of this chat room.
|
void |
addLocalUserRoleListener(ChatRoomLocalUserRoleListener listener)
Adds a listener that will be notified of changes in our role in the room
such as us being granded operator.
|
void |
addMemberPresenceListener(ChatRoomMemberPresenceListener 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.
|
void |
addMemberPropertyChangeListener(ChatRoomMemberPropertyChangeListener listener)
Adds the given listener to the list of listeners registered to
receive events upon modification of chat room member properties such as
its nickname being changed for example.
|
void |
addMemberRoleListener(ChatRoomMemberRoleListener listener)
Adds a listener that will be notified of changes of a member role in the
room such as being granted operator.
|
void |
addMessageListener(ChatRoomMessageListener listener)
Registers listener so that it would receive events every time
a new message is received on this chat room.
|
void |
addPropertyChangeListener(ChatRoomPropertyChangeListener listener)
Adds listener to the list of listeners registered to receive
events upon modification of chat room properties such as its subject for
example.
|
void |
banParticipant(ChatRoomMember chatRoomMember,
java.lang.String reason)
Bans the given ChatRoomMember.
|
protected void |
clearChatRoomMemberList()
Removes all chat room members from the list.
|
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.
|
boolean |
destroy(java.lang.String reason,
java.lang.String alternateAddress)
IRC chat rooms cannot be destroyed.
|
boolean |
equals(java.lang.Object obj)
equals implementation for Chat Room.
|
void |
fireLocalUserRoleChangedEvent(ChatRoomLocalUserRoleChangeEvent event)
Notify all ChatRoomLocalUserRoleListeners that the local user's
role has been changed in this ChatRoom.
|
void |
fireMemberPresenceEvent(ChatRoomMember member,
ChatRoomMember actorMember,
java.lang.String eventID,
java.lang.String eventReason)
Creates the corresponding ChatRoomMemberPresenceChangeEvent and notifies
all ChatRoomMemberPresenceListeners that a ChatRoomMember has
joined or left this ChatRoom.
|
void |
fireMemberPropertyChangeEvent(ChatRoomMemberPropertyChangeEvent evt)
Delivers the specified event to all registered property change listeners.
|
void |
fireMemberRoleEvent(ChatRoomMember member,
ChatRoomMemberRole newRole)
Creates the corresponding ChatRoomMemberRoleChangeEvent and notifies
all ChatRoomMemberRoleListeners that a ChatRoomMember has
changed his role in this ChatRoom.
|
void |
fireMessageDeliveryFailedEvent(int errorCode,
java.lang.String reason,
java.util.Date date,
Message message)
Notifies interested listeners that a message delivery has failed.
|
void |
fireMessageReceivedEvent(Message message,
ChatRoomMember fromMember,
java.util.Date date,
int eventType)
Notifies all interested listeners that a
ChatRoomMessageReceivedEvent has been fired.
|
void |
firePropertyChangeEvent(java.beans.PropertyChangeEvent evt)
Delivers the specified event to all registered property change listeners.
|
java.util.Iterator<ChatRoomMember> |
getBanList()
Returns the list of banned chat room members.
|
ChatRoomMember |
getChatRoomMember(java.lang.String memberID)
Returns the ChatRoomMember corresponding to the given member id.
|
ChatRoomConfigurationForm |
getConfigurationForm()
Returns the ChatRoomConfigurationForm containing all
configuration properties for this chat room.
|
java.lang.String |
getIdentifier()
Returns the identifier of this ChatRoom.
|
java.util.List<ChatRoomMember> |
getMembers()
Returns a List of ChatRoomMemberss corresponding to all
members currently participating in this room.
|
int |
getMembersCount()
Returns the number of participants that are currently in this chat room.
|
java.util.List<java.lang.String> |
getMembersWhiteList()
Returns the ids of the users that has the member role in the room.
|
java.lang.String |
getName()
Returns the name of this ChatRoom.
|
ProtocolProviderService |
getParentProvider()
Returns the protocol provider service that created us.
|
Contact |
getPrivateContactByNickname(java.lang.String name)
Find the Contact instance corresponding to the specified chat room
member.
|
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.
|
ChatRoomMemberRole |
getUserRole()
Returns the local user role.
|
void |
grantAdmin(java.lang.String address)
Grants admin role to the participant given by address.
|
void |
grantMembership(java.lang.String address)
Grants membership role to the participant given by address.
|
void |
grantModerator(java.lang.String address)
Grants moderator role to the participant given by address.
|
void |
grantOwnership(java.lang.String address)
Grants ownership role to the participant given by address.
|
void |
grantVoice(java.lang.String address)
Grants voice to the participant given by address.
|
int |
hashCode()
hashCode implementation for Chat Room.
|
void |
invite(java.lang.String userAddress,
java.lang.String reason)
Invites another user to this room.
|
boolean |
isJoined()
Returns true if the local user is currently in the multi user chat (after
calling one of the
join() methods). |
boolean |
isPersistent()
Determines whether this chat room should be stored in the configuration
file or not.
|
boolean |
isSystem()
Indicates whether or not this chat room is corresponding to a server
channel.
|
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 |
join(byte[] password)
Joins this chat room so that the user would start receiving events and
messages for it.
|
void |
joinAs(java.lang.String nickname)
Joins this chat room with the specified nickname so that the user would
start receiving events and messages for it.
|
void |
joinAs(java.lang.String nickname,
byte[] password)
Joins this chat room with the specified nickname and password so that the
user would start receiving events and messages for it.
|
void |
kickParticipant(ChatRoomMember chatRoomMember,
java.lang.String reason)
Kicks the given ChatRoomMember.
|
void |
leave()
Leave this chat room.
|
ConferenceDescription |
publishConference(ConferenceDescription cd,
java.lang.String name)
Publishes a ConferenceDescription to the chat room.
|
protected void |
removeChatRoomMember(java.lang.String memberID)
Removes a ChatRoomMember from the list of members of this chat
room.
|
void |
removelocalUserRoleListener(ChatRoomLocalUserRoleListener listener)
Removes a listener that was being notified of changes in our role in this
chat room such as us being granted operator.
|
void |
removeMemberPresenceListener(ChatRoomMemberPresenceListener listener)
Removes a listener that was being notified of changes in the status of
other chat room participants such as users being kicked, banned, or
granted admin permissions.
|
void |
removeMemberPropertyChangeListener(ChatRoomMemberPropertyChangeListener listener)
Removes the given listener from the list of listeners currently
registered for chat room member property change events.
|
void |
removeMemberRoleListener(ChatRoomMemberRoleListener listener)
Removes a listener that was being notified of changes of a member role in
this chat room such as us being granded operator.
|
void |
removeMessageListener(ChatRoomMessageListener listener)
Removes listener so that it won't receive any further message
events from this room.
|
void |
removePropertyChangeListener(ChatRoomPropertyChangeListener listener)
Removes listener from the list of listeners current
registered for chat room modification events.
|
void |
revokeAdmin(java.lang.String address)
Revokes the admin role for the participant given by address.
|
void |
revokeMembership(java.lang.String address)
Revokes the membership role for the participant given by address
.
|
void |
revokeModerator(java.lang.String address)
Revokes the moderator role for the participant given by address.
|
void |
revokeOwnership(java.lang.String address)
Revokes the ownership role for the participant given by address.
|
void |
revokeVoice(java.lang.String address)
Revokes the voice for the participant given by address.
|
void |
sendMessage(Message message)
Sends the message to the destination indicated by the
to contact.
|
(package private) void |
setLocalUser(ChatRoomMemberIrcImpl user)
Method for setting chat room member instance representing the user.
|
void |
setLocalUserRole(ChatRoomMemberRole role)
Sets the local user role.
|
void |
setMembersWhiteList(java.util.List<java.lang.String> members)
Changes the list of users that has role member for this room.
|
void |
setSubject(java.lang.String subject)
Sets the subject of this chat room.
|
protected void |
setSubjectFromServer(java.lang.String subject)
Sets the subject obtained from the server once we're connected.
|
protected void |
setSystem(boolean isSystem)
Sets whether or not this chat room is corresponding to a server
channel.
|
void |
setUserNickname(java.lang.String nickName)
Changes the the local user's nickname in the context of this chat room.
|
(package private) void |
updateChatRoomMemberName(java.lang.String oldName)
Update the ChatRoomMember instance.
|
void |
updatePrivateContactPresenceStatus(Contact sourceContact)
IRC does not provide continuous presence status updates, so no
implementation is necessary.
|
void |
updatePrivateContactPresenceStatus(java.lang.String nickname)
IRC does not provide continuous presence status updates, so no
implementation is necessary.
|
(package private) void |
updateSubject(java.lang.String subject)
Update the subject for this chat room.
|
addConferencePublishedListener, clearCachedConferenceDescriptionList, fireConferencePublishedEvent, getCachedConferenceDescriptions, getCachedConferenceDescriptionSize, processConferenceDescription, removeConferencePublishedListener
public ChatRoomIrcImpl(java.lang.String chatRoomName, ProtocolProviderServiceIrcImpl parentProvider)
chatRoomName
- the name of the chat roomparentProvider
- the protocol providerpublic ChatRoomIrcImpl(java.lang.String chatRoomName, ProtocolProviderServiceIrcImpl parentProvider, boolean isSystem)
chatRoomName
- the name of the chat room (cannot be null or empty
string)parentProvider
- the protocol providerisSystem
- indicates if this chat room is a system roompublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- other instancepublic java.lang.String getName()
public java.lang.String getIdentifier()
protected void addChatRoomMember(java.lang.String memberID, ChatRoomMember member)
memberID
- the identifier of the membermember
- the ChatRoomMember to add.protected void removeChatRoomMember(java.lang.String memberID)
memberID
- the name of the ChatRoomMember to remove.public void join() throws OperationFailedException
OperationFailedException
- with the corresponding code if an error
occurs while joining the room.public void join(byte[] password) throws OperationFailedException
password
- the password to use when authenticating on the chatroom.OperationFailedException
- with the corresponding code if an error
occurs while joining the room.public void joinAs(java.lang.String nickname) throws OperationFailedException
nickname
- the nickname to use.OperationFailedException
- with the corresponding code if an error
occurs while joining the room.public void joinAs(java.lang.String nickname, byte[] password) throws OperationFailedException
nickname
- the nickname to use.password
- a password necessary to authenticate when joining the
room.OperationFailedException
- with the corresponding code if an error
occurs while joining the room.public boolean isJoined()
join()
methods).public void leave()
public java.util.Iterator<ChatRoomMember> getBanList() throws OperationFailedException
OperationFailedException
- if we are not joined or we don't have
enough privileges to obtain the ban list.public void banParticipant(ChatRoomMember chatRoomMember, java.lang.String reason) throws OperationFailedException
chatRoomMember
- the chat room member to banreason
- the reason of the banOperationFailedException
- if we are not joined or we don't have
enough privileges to ban a participant.public void kickParticipant(ChatRoomMember chatRoomMember, java.lang.String reason) throws OperationFailedException
chatRoomMember
- the chat room member to kickreason
- the reason of the kickOperationFailedException
- if we are not joined or we don't have
enough privileges to kick a participant.public ChatRoomConfigurationForm getConfigurationForm() throws OperationFailedException
OperationFailedException
- if the user doesn't have
permissions to see and change chat room configurationpublic void addPropertyChangeListener(ChatRoomPropertyChangeListener listener)
listener
- ChatRoomChangeListenerpublic void removePropertyChangeListener(ChatRoomPropertyChangeListener listener)
listener
- the ChatRoomChangeListener to remove.public void addMemberPropertyChangeListener(ChatRoomMemberPropertyChangeListener listener)
listener
- the ChatRoomMemberPropertyChangeListener
that is to be registered for ChatRoomMemberPropertyChangeEvents.public void removeMemberPropertyChangeListener(ChatRoomMemberPropertyChangeListener listener)
listener
- the ChatRoomMemberPropertyChangeListener to
remove.public void addMemberRoleListener(ChatRoomMemberRoleListener listener)
listener
- a member role listener.public void removeMemberRoleListener(ChatRoomMemberRoleListener listener)
listener
- a member role listener.public void addLocalUserRoleListener(ChatRoomLocalUserRoleListener listener)
listener
- a local user role listener.public void removelocalUserRoleListener(ChatRoomLocalUserRoleListener listener)
listener
- a local user role listener.public java.lang.String getSubject()
To be notified every time the room's subject change you should add a ChatRoomPropertyChangelistener to this room.
To change the room's subject use setSubject(String)
.
public void setSubject(java.lang.String subject) throws OperationFailedException
subject
- the new subject that we'd like this room to haveOperationFailedException
- thrown if the user is not joined to the
channel or if he/she doesn't have enough privileges to change the
topic or if the topic is null.public java.lang.String getUserNickname()
public void setUserNickname(java.lang.String nickName) throws OperationFailedException
nickName
- the new nickname within the room.OperationFailedException
- if the setting the new nickname changes
for some reason.public void addMemberPresenceListener(ChatRoomMemberPresenceListener listener)
listener
- a participant status listener.public void removeMemberPresenceListener(ChatRoomMemberPresenceListener listener)
listener
- a participant status listener.public void addMessageListener(ChatRoomMessageListener listener)
listener
- a MessageListener that would be notified every
time a new message is received on this chat room.public void removeMessageListener(ChatRoomMessageListener listener)
listener
- the MessageListener to remove from this roompublic ChatRoomMember getChatRoomMember(java.lang.String memberID)
memberID
- the identifier of the memberprotected void clearChatRoomMemberList()
public void invite(java.lang.String userAddress, java.lang.String reason)
userAddress
- the address of the user to invite to the room.(one may
also invite users not on their contact list).reason
- a reason, subject, or welcome message that would tell the
the user why they are being invited.public java.util.List<ChatRoomMember> getMembers()
public int getMembersCount()
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)
messageText
- the string content of the message.public void sendMessage(Message message) throws OperationFailedException
message
- the Message to send.OperationFailedException
- if the underlying stack is not
registered or initialized or if the chat room is not joined.public ProtocolProviderService getParentProvider()
public void fireMessageReceivedEvent(Message message, ChatRoomMember fromMember, java.util.Date date, int eventType)
message
- the received messagefromMember
- the ChatRoomMember, which is the sender of the
messagedate
- the time at which the message has been receivedeventType
- the type of the received event. One of the
XXX_MESSAGE_RECEIVED constants declared in the
ChatRoomMessageReceivedEvent class.public void fireMessageDeliveryFailedEvent(int errorCode, java.lang.String reason, java.util.Date date, Message message)
errorCode
- the type of error that occurredreason
- the reason of delivery failuredate
- the date the event was receivedmessage
- the message that was failed to be deliveredpublic void firePropertyChangeEvent(java.beans.PropertyChangeEvent evt)
evt
- the PropertyChangeEvent that we'd like delivered to
all registered property change listeners.public void fireMemberPropertyChangeEvent(ChatRoomMemberPropertyChangeEvent evt)
evt
- the ChatRoomMemberPropertyChangeEvent that we'd like
deliver to all registered member property change listeners.public void fireMemberPresenceEvent(ChatRoomMember member, ChatRoomMember actorMember, java.lang.String eventID, java.lang.String eventReason)
member
- the ChatRoomMember that this event is aboutactorMember
- a member that act in the event (for example the kicker
in a member kicked event)eventID
- the identifier of the eventeventReason
- the reason of the eventpublic void fireMemberRoleEvent(ChatRoomMember member, ChatRoomMemberRole newRole)
member
- the ChatRoomMember that this event is aboutnewRole
- the new role of the given memberpublic void fireLocalUserRoleChangedEvent(ChatRoomLocalUserRoleChangeEvent event)
event
- the event that describes the local user's role changepublic boolean isSystem()
true
to indicate that this chat room is
corresponding to a server channel, false
- otherwise.protected void setSystem(boolean isSystem)
isSystem
- true
to indicate that this chat room is
corresponding to a server channel, false
- otherwise.protected void setSubjectFromServer(java.lang.String subject)
subject
- the subject to setpublic boolean isPersistent()
public ChatRoomMemberRole getUserRole()
void setLocalUser(ChatRoomMemberIrcImpl user)
user
- instance representing the user. This instance cannot be null.public void setLocalUserRole(ChatRoomMemberRole role) throws OperationFailedException
role
- the role to setOperationFailedException
- if the operation don't succeedpublic void grantAdmin(java.lang.String address)
address
- the address of the participant to grant admin role topublic void grantMembership(java.lang.String address)
address
- the address of the participant to grant membership role topublic void grantModerator(java.lang.String address)
address
- the address of the participant to grant moderator role topublic void grantOwnership(java.lang.String address)
address
- the address of the participant to grant ownership role topublic void grantVoice(java.lang.String address)
address
- the address of the participant to grant voice topublic void revokeAdmin(java.lang.String address)
address
- the address of the participant to revoke admin role forpublic void revokeMembership(java.lang.String address)
address
- the address of the participant to revoke membership role
forpublic void revokeModerator(java.lang.String address)
address
- the address of the participant to revoke moderator role
forpublic void revokeOwnership(java.lang.String address)
address
- the address of the participant to revoke ownership role
forpublic void revokeVoice(java.lang.String address)
address
- the address of the participant to revoke voice forpublic ConferenceDescription publishConference(ConferenceDescription cd, java.lang.String name)
cd
- the description to publishname
- the name of the conferencepublic Contact getPrivateContactByNickname(java.lang.String name)
name
- nick name of the chat room memberpublic void updatePrivateContactPresenceStatus(java.lang.String nickname)
nickname
- nick name to look uppublic void updatePrivateContactPresenceStatus(Contact sourceContact)
sourceContact
- contact to look uppublic boolean destroy(java.lang.String reason, java.lang.String alternateAddress)
reason
- the reason for destroying.alternateAddress
- the alternate addresspublic java.util.List<java.lang.String> getMembersWhiteList()
public void setMembersWhiteList(java.util.List<java.lang.String> members)
members
- the ids of user to have member role.void updateSubject(java.lang.String subject)
subject
- the subjectvoid updateChatRoomMemberName(java.lang.String oldName)
oldName
- The old nick name under which the member instance is
currently stored.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.