Liblinphone 5.2.0

Public Types | Public Member Functions | Static Public Member Functions | List of all members
linphone::ChatRoom Class Reference

A chat room is the place where ChatMessage are exchanged. More...

`#include <chat_room.hh>`

Inheritance diagram for linphone::ChatRoom:

## Public Types
enum class | State { None = 0 , Instantiated = 1 , CreationPending = 2 , Created = 3 , CreationFailed = 4 , TerminationPending = 5 , Terminated = 6 , TerminationFailed = 7 , Deleted = 8 }
| State is used to indicate the current state of a chat room. More...

## Public Member Functions
LINPHONECXX_PUBLIC | ChatRoom (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneChatRoom * | cPtr ()
LINPHONECXX_PUBLIC void | addListener (const std::shared_ptr< ChatRoomListener > &listener)
| Add an application listener to the ChatRoom instance.
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< ChatRoomListener > &listener)
| Remove a previously added listener from the ChatRoom instance.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Call > | getCall () const
| Gets the current call associated to this chatroom if any To commit a message, use ChatMessage::send()
LINPHONECXX_PUBLIC unsigned int | getCapabilities () const
| Get the capabilities of a chat room.
LINPHONECXX_PUBLIC uint32_t | getChar ()
| When realtime text is enabled CallParams::realtimeTextEnabled(), LinphoneCoreIsComposingReceivedCb is call everytime a char is received from peer.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Address > > | getComposingAddresses ()
| Gets the list of participants that are currently composing.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getConferenceAddress () const
| Get the conference address of the chat room.
LINPHONECXX_PUBLIC void | setConferenceAddress (const std::shared_ptr< const linphone::Address > &conferenceAddress)
| Set the conference address of a group chat room.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const
| Returns back pointer to Core object.
LINPHONECXX_PUBLIC time_t | getCreationTime () const
| Return the creation time for the chat room.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ChatRoomParams > | getCurrentParams () const
| Returns current parameters associated with the chat room.
LINPHONECXX_PUBLIC bool | ephemeralEnabled () const
| Returns whether or not the ephemeral message feature is enabled in the chat room.
LINPHONECXX_PUBLIC void | enableEphemeral (bool enable)
| Enable or disable the ephemeral message feature in the chat room.
LINPHONECXX_PUBLIC long | getEphemeralLifetime () const
| Get lifetime (in seconds) for all new ephemeral messages in the chat room.
LINPHONECXX_PUBLIC void | setEphemeralLifetime (long time)
| Set lifetime (in seconds) for all new ephemeral messages in the chat room.
LINPHONECXX_PUBLIC linphone::ChatRoomEphemeralMode | getEphemeralMode () const
| Get the ephemeral mode of the chat room.
LINPHONECXX_PUBLIC void | setEphemeralMode (linphone::ChatRoomEphemeralMode mode)
| Set the ephemeral mode of the chat room.
LINPHONECXX_PUBLIC int | getHistoryEventsSize ()
| Gets the number of events in a chat room.
LINPHONECXX_PUBLIC int | getHistorySize ()
| Gets the number of messages in a chat room.
LINPHONECXX_PUBLIC bool | isEmpty ()
| Returns whether or not a ChatRoom has at least one ChatMessage or not.
LINPHONECXX_PUBLIC bool | isReadOnly () const
| Return whether or not a message can be sent using this chat room.
LINPHONECXX_PUBLIC bool | isRemoteComposing () const
| Tells whether the remote is currently composing a message.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | getLastMessageInHistory ()
| Gets the last chat message sent or received in this chat room.
LINPHONECXX_PUBLIC time_t | getLastUpdateTime () const
| Return the last updated time for the chat room.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getLocalAddress ()
| Get the local address associated to this chat room.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Participant > | getMe () const
| Get the participant representing myself in the chat room.
LINPHONECXX_PUBLIC int | getNbParticipants () const
| Get the number of participants in the chat room (that is without ourselves).
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Participant > > | getParticipants () const
| Get the list of participants of a chat room.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getPeerAddress ()
| Get the peer address associated to this chat room.
LINPHONECXX_PUBLIC linphone::ChatRoomSecurityLevel | getSecurityLevel ()
| Get the security level of a chat room.
LINPHONECXX_PUBLIC State | getState () const
| Get the state of the chat room.
LINPHONECXX_PUBLIC std::string | getSubject () const
| Get the subject of a chat room.
LINPHONECXX_PUBLIC void | setSubject (const std::string &subject)
| Set the subject of a chat room.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessage > > | getUnreadHistory ()
| Gets all unread messages for this chat room, sorted from oldest to most recent.
LINPHONECXX_PUBLIC int | getUnreadMessagesCount ()
| Gets the number of unread messages in the chatroom.
LINPHONECXX_PUBLIC void | addParticipant (const std::shared_ptr< const linphone::Address > &addr)
| Add a participant to a chat room.
LINPHONECXX_PUBLIC bool | addParticipants (const std::list< std::shared_ptr< linphone::Address > > &addresses)
| Add several participants to a chat room at once.
LINPHONECXX_PUBLIC void | allowCpim ()
| Allow cpim on a basic chat room .
LINPHONECXX_PUBLIC void | allowMultipart ()
| Allow multipart on a basic chat room .
LINPHONECXX_PUBLIC bool | canHandleParticipants () const
| Tells whether a chat room is able to handle participants.
LINPHONECXX_PUBLIC void | compose ()
| Notifies the destination of the chat message being composed that the user is typing a new message.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | createEmptyMessage ()
| Creates an empty message attached to the given chat room.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | createFileTransferMessage (const std::shared_ptr< linphone::Content > &initialContent)
| Creates a message attached to the given chat room with a particular content.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | createForwardMessage (const std::shared_ptr< linphone::ChatMessage > &message)
| Creates a forward message attached to the given chat room with a particular message.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::shared_ptr< linphone::ChatMessage > | createMessage (const std::string &message)
| Creates a message attached to the given chat room with a plain text content filled with the given message.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | createMessageFromUtf8 (const std::string &message)
| Creates a message attached to the given chat room with a plain text content filled with the given message.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | createReplyMessage (const std::shared_ptr< linphone::ChatMessage > &message)
| Creates a reply message attached to the given chat room with a particular message.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | createVoiceRecordingMessage (const std::shared_ptr< linphone::Recorder > &recorder)
| Creates a chat message with a voice recording attached to the given chat room.
LINPHONECXX_PUBLIC void | deleteHistory ()
| Delete all messages from the history.
LINPHONECXX_PUBLIC void | deleteMessage (const std::shared_ptr< linphone::ChatMessage > &message)
| Delete a message from the chat room history.
LINPHONECXX_PUBLIC bool | ephemeralSupportedByAllParticipants () const
| Uses linphone spec to check if all participants support ephemeral messages.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | findMessage (const std::string &messageId)
| Gets the chat message sent or received in this chat room that matches the message_id.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Participant > | findParticipant (const std::shared_ptr< const linphone::Address > &address) const
| Find a participant of a chat room from its address.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessage > > | getHistory (int nbMessage)
| Gets nb_message most recent messages from chat_room chat room, sorted from oldest to most recent.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > | getHistoryEvents (int nbEvents)
| Gets nb_events most recent events from chat_room chat room, sorted from oldest to most recent.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > | getHistoryMessageEvents (int nbEvents)
| Gets nb_events most recent chat message events from chat_room chat room, sorted from oldest to most recent.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessage > > | getHistoryRange (int begin, int end)
| Gets the partial list of messages in the given range, sorted from oldest to most recent.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > | getHistoryRangeEvents (int begin, int end)
| Gets the partial list of events in the given range, sorted from oldest to most recent.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > | getHistoryRangeMessageEvents (int begin, int end)
| Gets the partial list of chat message events in the given range, sorted from oldest to most recent.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool | hasBeenLeft () const
| Return whether or not the chat room has been left.
LINPHONECXX_PUBLIC bool | hasCapability (int mask) const
| Check if a chat room has given capabilities.
LINPHONECXX_PUBLIC void | leave ()
| Leave a chat room.
LINPHONECXX_PUBLIC bool | limeAvailable ()
| Returns wether lime is available for given peer or not.
LINPHONECXX_PUBLIC void | markAsRead ()
| Mark all messages of the conversation as read.
LINPHONECXX_PUBLIC void | notifyParticipantDeviceRegistration (const std::shared_ptr< const linphone::Address > &participantDevice)
| Notify the chatroom that a participant device has just registered.
LINPHONECXX_PUBLIC void | receiveChatMessage (const std::shared_ptr< linphone::ChatMessage > &message)
| Used to receive a chat message when using async mechanism with IM enchat_roomyption engine.
LINPHONECXX_PUBLIC void | removeParticipant (const std::shared_ptr< linphone::Participant > &participant)
| Remove a participant of a chat room.
LINPHONECXX_PUBLIC void | removeParticipants (const std::list< std::shared_ptr< linphone::Participant > > &participants)
| Remove several participants of a chat room at once.
LINPHONECXX_PUBLIC void | setParticipantAdminStatus (const std::shared_ptr< linphone::Participant > &participant, bool isAdmin)
| Change the admin status of a participant of a chat room (you need to be an admin yourself to do this).
LINPHONECXX_PUBLIC void | setParticipantDevices (const std::shared_ptr< const linphone::Address > &participantAddress, const std::list< std::shared_ptr< linphone::ParticipantDeviceIdentity > > &deviceIdentities)
| Set the list of participant devices in the form of SIP URIs with GRUUs for a given participant.

## Static Public Member Functions
static LINPHONECXX_PUBLIC std::string | stateToString (State state)
| Converts a State enum to a string.

## Detailed Description

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 ChatRoomBackend::FlexisipChat). Then you can call Core::searchChatRoom() or Core::createChatRoom(). Be careful as a ChatRoomBackend::FlexisipChat backend ChatRoom will be created asynchronously, so make sure you add a LinphoneChatRoomCbs to the returned object to be notified when it will be in state State::Created. All chat rooms are loaded from database when the Core starts, and you can get them using Core::getChatRooms(). This method doesn't return empty chat rooms nor ones for which the local address doesn't match an existing ProxyConfig identity, unless you specify otherwise in the [misc] section of your configuration file by setting hide_empty_chat_rooms=0 and/or hide_chat_rooms_from_removed_proxies=0.

## Member Enumeration Documentation

## ◆ State

enum class linphone::ChatRoom::State
| strong

State is used to indicate the current state of a chat room.

Enumerator
None | Initial state.
Instantiated | Chat room is now instantiated on local.
CreationPending | One creation request was sent to the server.
Created | Chat room was created on the server.
CreationFailed | Chat room creation failed.
TerminationPending | Wait for chat room termination.
Terminated | Chat room exists on server but not in local.
TerminationFailed | The chat room termination failed.
Deleted | Chat room was deleted on the server.

## Member Function Documentation

## ◆ addListener()

LINPHONECXX_PUBLIC void linphone::ChatRoom::addListener | ( | const std::shared_ptr< ChatRoomListener > & | listener | ) |

Add an application listener to the ChatRoom instance.

Parameters

  listener | the application listener

## ◆ addParticipant()

LINPHONECXX_PUBLIC void linphone::ChatRoom::addParticipant | ( | const std::shared_ptr< const linphone::Address > & | addr | ) |

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.

Parameters

  addr | The address of the participant to add to the chat room

## ◆ addParticipants()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::addParticipants | ( | const std::list< std::shared_ptr< linphone::Address > > & | addresses | ) |

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.

Parameters

  addresses | The participants to add.

Returns
  true if everything is OK, false otherwise

## ◆ canHandleParticipants()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::canHandleParticipants | ( |  | ) | const

Tells whether a chat room is able to handle participants.

Returns
  true if the chat room can handle participants, false otherwise

## ◆ createEmptyMessage()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createEmptyMessage | ( |  | ) |

Creates an empty message attached to the given chat room.

Returns
  a new ChatMessage

## ◆ createFileTransferMessage()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createFileTransferMessage | ( | const std::shared_ptr< linphone::Content > & | initialContent | ) |

Creates a message attached to the given chat room with a particular content.

Use ChatMessage::send() to initiate the transfer

Parameters

  initialContent | Content initial content.

Returns
  a new ChatMessage

## ◆ createForwardMessage()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createForwardMessage | ( | const std::shared_ptr< linphone::ChatMessage > & | message | ) |

Creates a forward message attached to the given chat room with a particular message.

Parameters

  message | ChatMessage message to be forwarded.

Returns
  a new ChatMessage

## ◆ createMessage()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createMessage | ( | const std::string & | message | ) |

Creates a message attached to the given chat room with a plain text content filled with the given message.

Parameters

  message | text message, nullptr if absent.

Returns
  a new ChatMessage

Deprecated
  01/07/2020. Use createMessageFromUtf8() instead.

## ◆ createMessageFromUtf8()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createMessageFromUtf8 | ( | const std::string & | message | ) |

Creates a message attached to the given chat room with a plain text content filled with the given message.

Introduced in 01/07/2020

Parameters

  message | text message in UTF8, nullptr if absent.

Returns
  a new ChatMessage

## ◆ createReplyMessage()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createReplyMessage | ( | const std::shared_ptr< linphone::ChatMessage > & | message | ) |

Creates a reply message attached to the given chat room with a particular message.

Parameters

  message | ChatMessage message to reply to.

Returns
  a new ChatMessage

## ◆ createVoiceRecordingMessage()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::createVoiceRecordingMessage | ( | const std::shared_ptr< linphone::Recorder > & | recorder | ) |

Creates a chat message with a voice recording attached to the given chat room.

Warning
  If the recorder isn't in Closed state, it will return an empty message!

Parameters

  recorder | the Recorder object used to record the voice message.

Returns
  a new ChatMessage

## ◆ deleteMessage()

LINPHONECXX_PUBLIC void linphone::ChatRoom::deleteMessage | ( | const std::shared_ptr< linphone::ChatMessage > & | message | ) |

Delete a message from the chat room history.

Parameters

  message | The ChatMessage object to remove.

## ◆ enableEphemeral()

LINPHONECXX_PUBLIC void linphone::ChatRoom::enableEphemeral | ( | bool | enable | ) |

Enable or disable the ephemeral message feature in the chat room.

Works only for flexisip-based chat room. An ephemeral message will automatically disappear from the sender and recipient's chatrooms after a specified timeout configurable with setEphemeralLifetime(). The timer starts when the message has been displayed at the recipent, which means:

Parameters

  enable | true if the ephemeral message feature is enabled, false otherwise.

## ◆ ephemeralEnabled()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::ephemeralEnabled | ( |  | ) | const

Returns whether or not the ephemeral message feature is enabled in the chat room.

Returns
  true if ephemeral is enabled, false otherwise.

## ◆ ephemeralSupportedByAllParticipants()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::ephemeralSupportedByAllParticipants | ( |  | ) | const

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.

See also
  ephemeralEnabled()

Returns
  true if all participants in the chat room support ephemeral messages, false otherwise

## ◆ findMessage()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::findMessage | ( | const std::string & | messageId | ) |

Gets the chat message sent or received in this chat room that matches the message_id.

Parameters

  messageId | The id of the message to find

Returns
  the ChatMessage if found or nullptr.

## ◆ findParticipant()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Participant > linphone::ChatRoom::findParticipant | ( | const std::shared_ptr< const linphone::Address > & | address | ) | const

Find a participant of a chat room from its address.

Parameters

  address | The Address to search in the list of participants of the chat room

Returns
  The participant if found, nullptr otherwise.

## ◆ getCall()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Call > linphone::ChatRoom::getCall | ( |  | ) | const

Gets the current call associated to this chatroom if any To commit a message, use ChatMessage::send()

Returns
  Call or nullptr.

## ◆ getCapabilities()

LINPHONECXX_PUBLIC unsigned int linphone::ChatRoom::getCapabilities | ( |  | ) | const

Get the capabilities of a chat room.

Returns
  The capabilities of the chat room (as a LinphoneChatRoomCapabilitiesMask)

## ◆ getChar()

LINPHONECXX_PUBLIC uint32_t linphone::ChatRoom::getChar | ( |  | ) |

When realtime text is enabled CallParams::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 LinphoneCoreCbsMessageReceivedCb.

Returns
  RFC 4103/T.140 char

## ◆ getComposingAddresses()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Address > > linphone::ChatRoom::getComposingAddresses | ( |  | ) |

Gets the list of participants that are currently composing.

Returns
  List of addresses that are in the is_composing state.

## ◆ getConferenceAddress()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::ChatRoom::getConferenceAddress | ( |  | ) | const

Get the conference address of the chat room.

Returns
  The conference address of the chat room or nullptr if this type of chat room is not conference based.

## ◆ getCore()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > linphone::ChatRoom::getCore | ( |  | ) | const

Returns back pointer to Core object.

Returns
  the Core object this chat room is attached to.

## ◆ getCreationTime()

LINPHONECXX_PUBLIC time_t linphone::ChatRoom::getCreationTime | ( |  | ) | const

Return the creation time for the chat room.

Returns
  the time at which the chat room was created

## ◆ getCurrentParams()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ChatRoomParams > linphone::ChatRoom::getCurrentParams | ( |  | ) | const

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.

Returns
  the current ChatRoomParams parameters.

## ◆ getEphemeralLifetime()

LINPHONECXX_PUBLIC long linphone::ChatRoom::getEphemeralLifetime | ( |  | ) | const

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.

See also
  ephemeralEnabled()

Returns
  the ephemeral lifetime (in secoonds)

## ◆ getEphemeralMode()

LINPHONECXX_PUBLIC linphone::ChatRoomEphemeralMode linphone::ChatRoom::getEphemeralMode | ( |  | ) | const

Get the ephemeral mode of the chat room.

See also
  ephemeralEnabled()

Returns
  the ephemeral mode ChatRoomEphemeralMode

## ◆ getHistory()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessage > > linphone::ChatRoom::getHistory | ( | int | nbMessage | ) |

Gets nb_message most recent messages from chat_room chat room, sorted from oldest to most recent.

Parameters

  nbMessage | Number of message to retrieve. 0 means everything.

Returns
  A list of chat messages.

## ◆ getHistoryEvents()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > linphone::ChatRoom::getHistoryEvents | ( | int | nbEvents | ) |

Gets nb_events most recent events from chat_room chat room, sorted from oldest to most recent.

Parameters

  nbEvents | Number of events to retrieve. 0 means everything.

Returns
  The list of the most recent events.

## ◆ getHistoryEventsSize()

LINPHONECXX_PUBLIC int linphone::ChatRoom::getHistoryEventsSize | ( |  | ) |

Gets the number of events in a chat room.

Returns
  the number of events.

## ◆ getHistoryMessageEvents()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > linphone::ChatRoom::getHistoryMessageEvents | ( | int | nbEvents | ) |

Gets nb_events most recent chat message events from chat_room chat room, sorted from oldest to most recent.

Parameters

  nbEvents | Number of events to retrieve. 0 means everything.

Returns
  A list

## ◆ getHistoryRange()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessage > > linphone::ChatRoom::getHistoryRange | ( | int | begin,
|  | int | end )

Gets the partial list of messages in the given range, sorted from oldest to most recent.

Parameters

  end | The last message of the range to be retrieved. History oldest message has index of history size - 1 (use getHistorySize() to retrieve history size)

Returns
  A list of chat messages.

## ◆ getHistoryRangeEvents()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > linphone::ChatRoom::getHistoryRangeEvents | ( | int | begin,
|  | int | end )

Gets the partial list of events in the given range, sorted from oldest to most recent.

Parameters

  end | The last event of the range to be retrieved. History oldest event has index of history size - 1

Returns
  The list of the found events.

## ◆ getHistoryRangeMessageEvents()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::EventLog > > linphone::ChatRoom::getHistoryRangeMessageEvents | ( | int | begin,
|  | int | end )

Gets the partial list of chat message events in the given range, sorted from oldest to most recent.

Parameters

  end | The last event of the range to be retrieved. History oldest event has index of history size - 1

Returns
  The list of chat message events.

## ◆ getHistorySize()

LINPHONECXX_PUBLIC int linphone::ChatRoom::getHistorySize | ( |  | ) |

Gets the number of messages in a chat room.

Returns
  the number of messages.

## ◆ getLastMessageInHistory()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > linphone::ChatRoom::getLastMessageInHistory | ( |  | ) |

Gets the last chat message sent or received in this chat room.

Returns
  the latest ChatMessage or nullptr if no message.

## ◆ getLastUpdateTime()

LINPHONECXX_PUBLIC time_t linphone::ChatRoom::getLastUpdateTime | ( |  | ) | const

Return the last updated time for the chat room.

Returns
  the last updated time

## ◆ getLocalAddress()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::ChatRoom::getLocalAddress | ( |  | ) |

Get the local address associated to this chat room.

Returns
  The local address.

## ◆ getMe()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Participant > linphone::ChatRoom::getMe | ( |  | ) | const

Get the participant representing myself in the chat room.

Returns
  The participant representing myself in the conference or nullptr if me is not set.

## ◆ getNbParticipants()

LINPHONECXX_PUBLIC int linphone::ChatRoom::getNbParticipants | ( |  | ) | const

Get the number of participants in the chat room (that is without ourselves).

Returns
  The number of participants in the chat room

## ◆ getParticipants()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Participant > > linphone::ChatRoom::getParticipants | ( |  | ) | const

Get the list of participants of a chat room.

Returns
  A of the participants

## ◆ getPeerAddress()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::ChatRoom::getPeerAddress | ( |  | ) |

Get the peer address associated to this chat room.

Returns
  The peer address.

## ◆ getSecurityLevel()

LINPHONECXX_PUBLIC linphone::ChatRoomSecurityLevel linphone::ChatRoom::getSecurityLevel | ( |  | ) |

Get the security level of a chat room.

Returns
  The current ChatRoomSecurityLevel of the chat room

## ◆ getState()

LINPHONECXX_PUBLIC State linphone::ChatRoom::getState | ( |  | ) | const

Get the state of the chat room.

Returns
  The current State of the chat room

## ◆ getSubject()

LINPHONECXX_PUBLIC std::string linphone::ChatRoom::getSubject | ( |  | ) | const

Get the subject of a chat room.

Returns
  The subject of the chat room.

## ◆ getUnreadHistory()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessage > > linphone::ChatRoom::getUnreadHistory | ( |  | ) |

Gets all unread messages for this chat room, sorted from oldest to most recent.

Returns
  A list of unread chat messages.

## ◆ getUnreadMessagesCount()

LINPHONECXX_PUBLIC int linphone::ChatRoom::getUnreadMessagesCount | ( |  | ) |

Gets the number of unread messages in the chatroom.

Returns
  the number of unread messages.

## ◆ hasBeenLeft()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool linphone::ChatRoom::hasBeenLeft | ( |  | ) | const

Return whether or not the chat room has been left.

Returns
  true if the chat room has been left, false otherwise.

Deprecated
  16/03/2022 use isReadOnly() instead.

## ◆ hasCapability()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::hasCapability | ( | int | mask | ) | const

Check if a chat room has given capabilities.

Parameters

  mask | a LinphoneChatRoomCapabilitiesMask mask

Returns
  true if the mask matches, false otherwise

## ◆ isEmpty()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::isEmpty | ( |  | ) |

Returns whether or not a ChatRoom has at least one ChatMessage or not.

Returns
  true if there are no ChatMessage, false otherwise.

## ◆ isReadOnly()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::isReadOnly | ( |  | ) | const

Return whether or not a message can be sent using this chat room.

A chat room may be read only until it's created, or when it's a group you have left.

Returns
  true if a chat message can't be sent in it, false otherwise.

## ◆ isRemoteComposing()

LINPHONECXX_PUBLIC bool linphone::ChatRoom::isRemoteComposing | ( |  | ) | const

Tells whether the remote is currently composing a message.

Returns
  true if the remote is currently composing a message, false otherwise.

## ◆ notifyParticipantDeviceRegistration()

LINPHONECXX_PUBLIC void linphone::ChatRoom::notifyParticipantDeviceRegistration | ( | const std::shared_ptr< const linphone::Address > & | participantDevice | ) |

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.

Parameters

  participantDevice | list of the participant devices to be used by the group chat room

## ◆ receiveChatMessage()

LINPHONECXX_PUBLIC void linphone::ChatRoom::receiveChatMessage | ( | const std::shared_ptr< linphone::ChatMessage > & | message | ) |

Used to receive a chat message when using async mechanism with IM enchat_roomyption engine.

Parameters

  message | ChatMessage object

## ◆ removeListener()

LINPHONECXX_PUBLIC void linphone::ChatRoom::removeListener | ( | const std::shared_ptr< ChatRoomListener > & | listener | ) |

Remove a previously added listener from the ChatRoom instance.

Parameters

  listener | the application listener

## ◆ removeParticipant()

LINPHONECXX_PUBLIC void linphone::ChatRoom::removeParticipant | ( | const std::shared_ptr< linphone::Participant > & | participant | ) |

Remove a participant of a chat room.

Parameters

  participant | The participant to remove from the chat room

## ◆ removeParticipants()

LINPHONECXX_PUBLIC void linphone::ChatRoom::removeParticipants | ( | const std::list< std::shared_ptr< linphone::Participant > > & | participants | ) |

Remove several participants of a chat room at once.

Parameters

  participants | The participants to remove.

## ◆ setConferenceAddress()

LINPHONECXX_PUBLIC void linphone::ChatRoom::setConferenceAddress | ( | const std::shared_ptr< const linphone::Address > & | conferenceAddress | ) |

Set the conference address of a group chat room.

This function needs to be called from the LinphoneChatRoomCbsConferenceAddressGenerationCb callback and only there. This function is meaningful only for server implementation of chatroom, and shall not by used by client applications.

Parameters

  conferenceAddress | The conference Address to be used by the group chat room

## ◆ setEphemeralLifetime()

LINPHONECXX_PUBLIC void linphone::ChatRoom::setEphemeralLifetime | ( | long | time | ) |

Set lifetime (in seconds) for all new ephemeral messages in the chat room.

After the message is read, it will be deleted after "time" seconds.

See also
  ephemeralEnabled()

Parameters

  time | The ephemeral lifetime, default is 0 (disabled)

Warning
  A value of "time" equal to 0 disables ephemeral messages

## ◆ setEphemeralMode()

LINPHONECXX_PUBLIC void linphone::ChatRoom::setEphemeralMode | ( | linphone::ChatRoomEphemeralMode | mode | ) |

Set the ephemeral mode of the chat room.

See also
  ephemeralEnabled()

Parameters

  mode | The ephemeral mode ChatRoomEphemeralMode

Warning
  This function only changes the mode of ephemeral messages ChatRoomEphemeralMode. It is required to manually enable ephemeral messages after setting the mode by calling enableEphemeral()

## ◆ setParticipantAdminStatus()

LINPHONECXX_PUBLIC void linphone::ChatRoom::setParticipantAdminStatus | ( | const std::shared_ptr< linphone::Participant > & | participant,
|  | bool | isAdmin )

Change the admin status of a participant of a chat room (you need to be an admin yourself to do this).

Parameters

  isAdmin | A boolean value telling whether the participant should now be an admin or not

## ◆ setParticipantDevices()

LINPHONECXX_PUBLIC void linphone::ChatRoom::setParticipantDevices | ( | const std::shared_ptr< const linphone::Address > & | participantAddress,
|  | const std::list< std::shared_ptr< linphone::ParticipantDeviceIdentity > > & | deviceIdentities )

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.

Parameters

  deviceIdentities | List of the participant devices to be used by the group chat room

## ◆ setSubject()

LINPHONECXX_PUBLIC void linphone::ChatRoom::setSubject | ( | const std::string & | subject | ) |

Set the subject of a chat room.

Parameters

  subject | The new subject to set for the chat room

## ◆ stateToString()

static LINPHONECXX_PUBLIC std::string linphone::ChatRoom::stateToString | ( | State | state | ) |
| static

Converts a State enum to a string.

Parameters

  state | a State to convert to string

Returns
  the string representation of the State

The documentation for this class was generated from the following file:

- chat_room.hh