ConversationParticipant
Class that represents a participant of the conversation.
In order to apply changes made by setters, you have to call one of the following methods:
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler)
- IConversation.addParticipants(List, IMessengerCompletionHandler)
- IConversation.editParticipants(List, IMessengerCompletionHandler)
The default permissions for all participants are: write / edit / remove their own messages.
The creator of any conversation by default:
- is the owner (ConversationParticipant.isOwner() is true)
- can edit / remove other participants' messages
- can manage other participants
Constructors
ConversationParticipant
Creates a new participant with default permissions.
Use ConversationConfig.ConversationConfigBuilder.setParticipants(List) or IConversation.addParticipants(List, IMessengerCompletionHandler) to add participants to the conversation.
Parameters
imUserId:
long
IM user's ID. Can be retrieved from IUser.getIMId()
Methods
canEditAllMessages
- (boolean
)canEditAllMessagesWhether the conversation participant can edit messages other than its own.
Returns
type:
boolean
canEditMessages
- (boolean
)canEditMessagesWhether the conversation participant can edit its own messages.
Once a participant is created, the default value is true.
Returns
type:
boolean
canManageParticipants
- (boolean
)canManageParticipantsWhether the participant can manage other participants in the conversation:
- add / remove / edit permissions
- add / remove participants
If true and isOwner is true, the participant can manage other owners.
Returns
type:
boolean
canRemoveAllMessages
- (boolean
)canRemoveAllMessagesWhether the conversation participant can remove messages other than its own.
Returns
type:
boolean
canRemoveMessages
- (boolean
)canRemoveMessagesWhether the conversation participant can remove its own messages.
Once a participant is created, the default value is true.
Returns
type:
boolean
canWrite
- (boolean
)canWriteWhether the conversation participant can send messages to the conversation.
Once a participant is created, the default value is true.
Returns
type:
boolean
getIMUserId
- (long
)getIMUserIdGets the IM user's ID.
Returns
type:
long
getLastReadEventSequence
- (long
)getLastReadEventSequenceGets the sequence of the event that has been last marked as read. Participants mark events as read via IConversation.markAsRead(long, IMessengerCompletionHandler).
The method returns the sequence of the last read event in a conversation or 0, if the participant has not marked events as read.
Returns
type:
long
isOwner
- (boolean
)isOwnerWhether the conversation participant is an owner.
There could be more than one owner in the conversation.
Whether the participant can edit the conversation. If true and canManageParticipants is true, the participant can manage other owners.
Returns
type:
boolean
setCanEditAllMessages
- ()setCanEditAllMessages:(boolean
)canEditAllMessages Whether the participant can edit messages other than its own.
It could be set only if the user that calls this method has the ConversationParticipant.canManageParticipants() permission.
If the user that calls this method has both canManageParticipants and isOwner permissions, it can edit other owners.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
canEditAllMessages:
boolean
Returns
setCanEditMessages
- ()setCanEditMessages:(boolean
)canEditMessages Whether the participant can edit its own messages in the conversation.
The permission is given by default.
It could be changed only if the user that calls this method has the ConversationParticipant.canManageParticipants() permission.
If the user that calls this method has both canManageParticipants and isOwner permissions, it can edit other owners.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
canEditMessages:
boolean
Returns
setCanManageParticipants
- ()setCanManageParticipants:(boolean
)canManageParticipants Whether the conversation participant can manage other participants in the conversation:
- add, remove and edit permissions
- add and remove participants
It could be set only if the user that calls this method has the ConversationParticipant.canManageParticipants() permission.
If the user that calls this method has both canManageParticipants and isOwner permissions, it can edit other owners.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
canManageParticipants:
boolean
Returns
setCanRemoveAllMessages
- ()setCanRemoveAllMessages:(boolean
)canRemoveAllMessages Whether the participant can remove messages other than its own.
It could be set only if the user that calls this method has the ConversationParticipant.canManageParticipants() permission.
If the user that calls this method has both canManageParticipants and isOwner permissions, it can edit other owners.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
canRemoveAllMessages:
boolean
Returns
setCanRemoveMessages
- ()setCanRemoveMessages:(boolean
)canRemoveMessages Whether the participant can remove its own messages in the conversation.
The permission is given by default.
It could be changed only if the user that calls this method has the ConversationParticipant.canManageParticipants() permission.
If the user that calls this method has both canManageParticipants and isOwner permissions, it can edit other owners.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
canRemoveMessages:
boolean
Returns
setCanWrite
- ()setCanWrite:(boolean
)canWrite Whether the participant can write in the conversation.
The permission is given by default.
It could be changed only if the user that calls this method has the ConversationParticipant.canManageParticipants() permission.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
canWrite:
boolean
Returns
setOwner
- ()setOwner:(boolean
)isOwner Whether the conversation participant is the owner.
It could be set only if the user that calls this method has the ConversationParticipant.canManageParticipants() and ConversationParticipant.isOwner() permissions.
Note that a method call does not apply changes by itself; there are appropriate methods for applying:
- IConversation.editParticipants(List, IMessengerCompletionHandler) for an existing conversation
- IMessenger.createConversation(ConversationConfig, IMessengerCompletionHandler) for a new conversation
Parameters
isOwner:
boolean