Class ChatRoom
A chat room is the place where ChatMessage are exchanged.
To create (or find) a ChatRoom,
you first need a ChatRoomParams object. A chat room is uniquely identified by
it's local and remote SIP addresses, meaning you can only have one chat
room between two accounts (unless the backend is FlexisipChat). Then you can call
Inherited Members
Namespace: Linphone
Assembly: cs.temp.dll.dll
Syntax
public class ChatRoom : LinphoneObject
Properties
Call
Gets the current call associated to this chatroom if any To commit a message, use linphone_chat_room_send_message
Declaration
public Call Call { get; }
Property Value
Type | Description |
---|---|
Call | Call or null. |
Capabilities
Get the capabilities of a chat room.
Declaration
public uint Capabilities { get; }
Property Value
Type | Description |
---|---|
System.UInt32 | The capabilities of the chat room (as a LinphoneChatRoomCapabilitiesMask) |
Char
When realtime text is enabled RealtimeTextEnabled, LinphoneCoreIsComposingReceivedCb is call everytime a char is received from peer.
At the end of remote typing a regular ChatMessage is received with committed data from LinphoneCoreMessageReceivedCb.
Declaration
public uint Char { get; }
Property Value
Type | Description |
---|---|
System.UInt32 | RFC 4103/T.140 char |
ComposingAddresses
Gets the list of participants that are currently composing.
Declaration
public IEnumerable<Address> ComposingAddresses { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Address> | List of addresses that are in the is_composing state. |
ConferenceAddress
Get the conference address of the chat room.
Declaration
public Address ConferenceAddress { get; set; }
Property Value
Type | Description |
---|---|
Address | The conference address of the chat room or null if this type of chat room is not conference based. |
Core
Returns back pointer to Core object.
Declaration
public Core Core { get; }
Property Value
Type | Description |
---|---|
Core | the Core object this chat room is attached to. |
CurrentCallbacks
Gets the current LinphoneChatRoomCbs.
This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneChatRoomCbs that is calling the callback.
Declaration
public ChatRoomListener CurrentCallbacks { get; }
Property Value
Type | Description |
---|---|
ChatRoomListener | The LinphoneChatRoomCbs that has called the last callback |
CurrentParams
Returns current parameters associated with the chat room.
This is typically the parameters passed at chat room chat_roomeation to linphone_core_chat_roomeate_chat_room() or some default parameters if no ChatRoomParams was explicitely passed during chat room chat_roomeation.
Declaration
public ChatRoomParams CurrentParams { get; }
Property Value
Type | Description |
---|---|
ChatRoomParams | the current ChatRoomParams parameters. |
EphemeralEnabled
Returns whether or not the ephemeral message feature is enabled in the chat room.
Declaration
public bool EphemeralEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if ephemeral is enabled, false otherwise. |
EphemeralLifetime
Get lifetime (in seconds) for all new ephemeral messages in the chat room.
After the message is read, it will be deleted after "time" seconds.
Declaration
public int EphemeralLifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | the ephemeral lifetime (in secoonds) |
Remarks
See : EphemeralEnabled
HistoryEventsSize
Gets the number of events in a chat room.
Declaration
public int HistoryEventsSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 | the number of events. |
HistorySize
Gets the number of messages in a chat room.
Declaration
public int HistorySize { get; }
Property Value
Type | Description |
---|---|
System.Int32 | the number of messages. |
IsEmpty
Returns whether or not a ChatRoom has at least one ChatMessage or not.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if there are no ChatMessage, false otherwise. |
IsRemoteComposing
Tells whether the remote is currently composing a message.
Declaration
public bool IsRemoteComposing { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the remote is currently composing a message, false otherwise. |
LastMessageInHistory
Gets the last chat message sent or received in this chat room.
Declaration
public ChatMessage LastMessageInHistory { get; }
Property Value
Type | Description |
---|---|
ChatMessage | the latest ChatMessage or null if no message. |
LastUpdateTime
Return the last updated time for the chat room.
Declaration
public long LastUpdateTime { get; }
Property Value
Type | Description |
---|---|
System.Int64 | the last updated time |
Listener
Declaration
public ChatRoomListener Listener { get; }
Property Value
Type | Description |
---|---|
ChatRoomListener |
LocalAddress
Get the local address associated to this chat room.
Declaration
public Address LocalAddress { get; }
Property Value
Type | Description |
---|---|
Address | The local address. |
Me
Get the participant representing myself in the chat room.
Declaration
public Participant Me { get; }
Property Value
Type | Description |
---|---|
Participant | The participant representing myself in the conference or null if me is not set. |
NbParticipants
Get the number of participants in the chat room (that is without ourselves).
Declaration
public int NbParticipants { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of participants in the chat room |
Participants
Get the list of participants of a chat room.
Declaration
public IEnumerable<Participant> Participants { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Participant> | A of the participants |
PeerAddress
Get the peer address associated to this chat room.
Declaration
public Address PeerAddress { get; }
Property Value
Type | Description |
---|---|
Address | The peer address. |
SecurityLevel
Get the security level of a chat room.
Declaration
public ChatRoomSecurityLevel SecurityLevel { get; }
Property Value
Type | Description |
---|---|
ChatRoomSecurityLevel | The current ChatRoomSecurityLevel of the chat room |
State
Get the state of the chat room.
Declaration
public ChatRoomState State { get; }
Property Value
Type | Description |
---|---|
ChatRoomState | The current ChatRoomState of the chat room |
Subject
Get the subject of a chat room.
Declaration
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
System.String | The subject of the chat room. |
UnreadMessagesCount
Gets the number of unread messages in the chatroom.
Declaration
public int UnreadMessagesCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | the number of unread messages. |
Methods
AddParticipant(Address)
Add a participant to a chat room.
This may fail if this type of chat room does not handle participants. Use CanHandleParticipants() to know if this chat room handles participants.
Declaration
public void AddParticipant(Address addr)
Parameters
Type | Name | Description |
---|---|---|
Address | addr | The address of the participant to add to the chat room |
AddParticipants(IEnumerable<Address>)
Add several participants to a chat room at once.
This may fail if this type of chat room does not handle participants. Use CanHandleParticipants() to know if this chat room handles participants.
Declaration
public bool AddParticipants(IEnumerable<Address> addresses)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Address> | addresses | The participants to add. |
Returns
Type | Description |
---|---|
System.Boolean | true if everything is OK, false otherwise |
AllowCpim()
Allow cpim on a basic chat room .
Declaration
public void AllowCpim()
AllowMultipart()
Allow multipart on a basic chat room .
Declaration
public void AllowMultipart()
CanHandleParticipants()
Tells whether a chat room is able to handle participants.
Declaration
public bool CanHandleParticipants()
Returns
Type | Description |
---|---|
System.Boolean | true if the chat room can handle participants, false otherwise |
Compose()
Notifies the destination of the chat message being composed that the user is typing a new message.
Declaration
public void Compose()
CreateEmptyMessage()
Creates an empty message attached to the given chat room.
Declaration
public ChatMessage CreateEmptyMessage()
Returns
Type | Description |
---|---|
ChatMessage | a new ChatMessage |
CreateFileTransferMessage(Content)
Creates a message attached to the given chat room with a particular content.
Use linphone_chat_room_send_message to initiate the transfer
Declaration
public ChatMessage CreateFileTransferMessage(Content initialContent)
Parameters
Type | Name | Description |
---|---|---|
Content | initialContent | Content initial content. |
Returns
Type | Description |
---|---|
ChatMessage | a new ChatMessage |
CreateForwardMessage(ChatMessage)
Creates a forward message attached to the given chat room with a particular message.
Declaration
public ChatMessage CreateForwardMessage(ChatMessage message)
Parameters
Type | Name | Description |
---|---|---|
ChatMessage | message | ChatMessage message to be forwarded. |
Returns
Type | Description |
---|---|
ChatMessage | a new ChatMessage |
CreateMessage(String)
Creates a message attached to the given chat room with a plain text content filled with the given message.
Declaration
public ChatMessage CreateMessage(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | text message, null if absent. |
Returns
Type | Description |
---|---|
ChatMessage | a new ChatMessage |
CreateMessageFromUtf8(String)
Creates a message attached to the given chat room with a plain text content filled with the given message.
Introduced in 01/07/2020
Declaration
public ChatMessage CreateMessageFromUtf8(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | text message in UTF8, null if absent. |
Returns
Type | Description |
---|---|
ChatMessage | a new ChatMessage |
DeleteHistory()
Delete all messages from the history.
Declaration
public void DeleteHistory()
DeleteMessage(ChatMessage)
Delete a message from the chat room history.
Declaration
public void DeleteMessage(ChatMessage message)
Parameters
Type | Name | Description |
---|---|---|
ChatMessage | message | The ChatMessage object to remove. |
EphemeralSupportedByAllParticipants()
Uses linphone spec to check if all participants support ephemeral messages.
It doesn't prevent to send ephemeral messages in the room but those who don't support it won't delete messages after lifetime has expired.
Declaration
public bool EphemeralSupportedByAllParticipants()
Returns
Type | Description |
---|---|
System.Boolean | true if all participants in the chat room support ephemeral messages, false otherwise |
Remarks
See : EphemeralEnabled
Finalize()
Declaration
protected void Finalize()
FindMessage(String)
Gets the chat message sent or received in this chat room that matches the message_id.
Declaration
public ChatMessage FindMessage(string messageId)
Parameters
Type | Name | Description |
---|---|---|
System.String | messageId | The id of the message to find |
Returns
Type | Description |
---|---|
ChatMessage | the ChatMessage if found or null. |
FindParticipant(Address)
Find a participant of a chat room from its address.
Declaration
public Participant FindParticipant(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | The Address to search in the list of participants of the chat room |
Returns
Type | Description |
---|---|
Participant | The participant if found, null otherwise. |
GetHistory(Int32)
Gets nb_message most recent messages from chat_room chat room, sorted from oldest to most recent.
Declaration
public IEnumerable<ChatMessage> GetHistory(int nbMessage)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nbMessage | Number of message to retrieve. 0 means everything. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ChatMessage> | A list of chat messages. |
GetHistoryEvents(Int32)
Gets nb_events most recent events from chat_room chat room, sorted from oldest to most recent.
Declaration
public IEnumerable<EventLog> GetHistoryEvents(int nbEvents)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nbEvents | Number of events to retrieve. 0 means everything. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EventLog> | The list of the most recent events. |
GetHistoryMessageEvents(Int32)
Gets nb_events most recent chat message events from chat_room chat room, sorted from oldest to most recent.
Declaration
public IEnumerable<EventLog> GetHistoryMessageEvents(int nbEvents)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nbEvents | Number of events to retrieve. 0 means everything. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EventLog> | A list |
GetHistoryRange(Int32, Int32)
Gets the partial list of messages in the given range, sorted from oldest to most recent.
Declaration
public IEnumerable<ChatMessage> GetHistoryRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | begin | The first message of the range to be retrieved. History most recent message has index 0. |
System.Int32 | end | The last message of the range to be retrieved. History oldest message has index of history size - 1 (use HistorySize to retrieve history size) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ChatMessage> | A list of chat messages. |
GetHistoryRangeEvents(Int32, Int32)
Gets the partial list of events in the given range, sorted from oldest to most recent.
Declaration
public IEnumerable<EventLog> GetHistoryRangeEvents(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | begin | The first event of the range to be retrieved. History most recent event has index 0. |
System.Int32 | end | The last event of the range to be retrieved. History oldest event has index of history size - 1 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EventLog> | The list of the found events. |
GetHistoryRangeMessageEvents(Int32, Int32)
Gets the partial list of chat message events in the given range, sorted from oldest to most recent.
Declaration
public IEnumerable<EventLog> GetHistoryRangeMessageEvents(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | begin | The first event of the range to be retrieved. History most recent event has index 0. |
System.Int32 | end | The last event of the range to be retrieved. History oldest event has index of history size - 1 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EventLog> | The list of chat message events. |
HasBeenLeft()
Return whether or not the chat room has been left.
Declaration
public bool HasBeenLeft()
Returns
Type | Description |
---|---|
System.Boolean | true if the chat room has been left, false otherwise. |
HasCapability(Int32)
Check if a chat room has given capabilities.
Declaration
public bool HasCapability(int mask)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | mask | a LinphoneChatRoomCapabilitiesMask mask |
Returns
Type | Description |
---|---|
System.Boolean | true if the mask matches, false otherwise |
Leave()
Leave a chat room.
Declaration
public void Leave()
LimeAvailable()
Returns wether lime is available for given peer or not.
Declaration
public bool LimeAvailable()
Returns
Type | Description |
---|---|
System.Boolean |
MarkAsRead()
Mark all messages of the conversation as read.
Declaration
public void MarkAsRead()
NotifyParticipantDeviceRegistration(Address)
Notify the chatroom that a participant device has just registered.
This function is meaningful only for server implementation of chatroom, and shall not by used by client applications.
Declaration
public void NotifyParticipantDeviceRegistration(Address participantDevice)
Parameters
Type | Name | Description |
---|---|---|
Address | participantDevice | list of the participant devices to be used by the group chat room |
ReceiveChatMessage(ChatMessage)
Used to receive a chat message when using async mechanism with IM enchat_roomyption engine.
Declaration
public void ReceiveChatMessage(ChatMessage message)
Parameters
Type | Name | Description |
---|---|---|
ChatMessage | message | ChatMessage object |
RemoveParticipant(Participant)
Remove a participant of a chat room.
Declaration
public void RemoveParticipant(Participant participant)
Parameters
Type | Name | Description |
---|---|---|
Participant | participant | The participant to remove from the chat room |
RemoveParticipants(IEnumerable<Participant>)
Remove several participants of a chat room at once.
Declaration
public void RemoveParticipants(IEnumerable<Participant> participants)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Participant> | participants | The participants to remove. |
SetParticipantAdminStatus(Participant, Boolean)
Change the admin status of a participant of a chat room (you need to be an admin yourself to do this).
Declaration
public void SetParticipantAdminStatus(Participant participant, bool isAdmin)
Parameters
Type | Name | Description |
---|---|---|
Participant | participant | The Participant for which to change the admin status |
System.Boolean | isAdmin | A boolean value telling whether the participant should now be an admin or not |
SetParticipantDevices(Address, IEnumerable<ParticipantDeviceIdentity>)
Set the list of participant devices in the form of SIP URIs with GRUUs for a given participant.
This function is meaningful only for server implementation of chatroom, and shall not by used by client applications.
Declaration
public void SetParticipantDevices(Address participantAddress, IEnumerable<ParticipantDeviceIdentity> deviceIdentities)
Parameters
Type | Name | Description |
---|---|---|
Address | participantAddress | The participant address |
System.Collections.Generic.IEnumerable<ParticipantDeviceIdentity> | deviceIdentities | List of the participant devices to be used by the group chat room |