ChatRoom
public class ChatRoom : LinphoneObject
A chat room is the place where text messages are exchanged. Can be created by {@link Core#createChatRoom}.
-
Undocumented
Declaration
Swift
public static func getSwiftObject(cObject: OpaquePointer) -> ChatRoom
-
Undocumented
Declaration
Swift
public var getCobject: OpaquePointer? { get }
-
LinphoneChatRoomState is used to indicate the current state of a chat room.
See moreDeclaration
Swift
public enum State : Int
-
Undocumented
Declaration
Swift
public func addDelegate(delegate: ChatRoomDelegate)
-
Undocumented
Declaration
Swift
public func removeDelegate(delegate: ChatRoomDelegate)
-
Get the capabilities of a chat room.
Declaration
Swift
public var capabilities: UInt { get }
Return Value
The capabilities of the chat room
-
When realtime text is enabled linphone_call_params_realtime_text_enabled, 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
Swift
public var char: UInt32 { get }
Return Value
RFC 4103/T.140 char
-
Get the conference address of the chat room.
Declaration
Swift
public var conferenceAddress: Address? { get set }
Return Value
The conference address of the chat room or nil if this type of chat room is not conference based
-
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
Swift
public var currentCallbacks: ChatRoomDelegate? { get }
Return Value
The LinphoneChatRoomCbs that has called the last callback
-
Returns current parameters associated with the chat room. This is typically the parameters passed at chat room creation to {@link Core#createChatRoom} or some default parameters if no
ChatRoomParams
was explicitely passed during chat room creation.Declaration
Swift
public var currentParams: ChatRoomParams? { get }
Return Value
the chat room current parameters.
-
Returns whether or not the ephemeral message feature is enabled in the chat room.
Declaration
Swift
public var ephemeralEnabled: Bool { get set }
Return Value
true if ephemeral is enabled, false otherwise.
-
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
Swift
public var ephemeralLifetime: Int { get set }
Return Value
the ephemeral lifetime (in secoonds)
-
Gets the number of events in a chat room.
Declaration
Swift
public var historyEventsSize: Int { get }
Return Value
the number of events.
-
Gets the number of messages in a chat room.
Declaration
Swift
public var historySize: Int { get }
Return Value
the number of messages.
-
Returns whether or not a
ChatRoom
has at least oneChatMessage
or not.Declaration
Swift
public var isEmpty: Bool { get }
Return Value
true if there are no
ChatMessage
, false otherwise. -
Tells whether the remote is currently composing a message.
Declaration
Swift
public var isRemoteComposing: Bool { get }
Return Value
if the remote is currently composing a message, true otherwise.
-
Gets the last chat message sent or received in this chat room.
Declaration
Swift
public var lastMessageInHistory: ChatMessage? { get }
Return Value
the latest
ChatMessage
-
Return the last updated time for the chat room.
Declaration
Swift
public var lastUpdateTime: time_t { get }
Return Value
the last updated time
-
Get the participant representing myself in the chat room.
Declaration
Swift
public var me: Participant? { get }
Return Value
The participant representing myself in the conference.
-
Get the number of participants in the chat room (that is without ourselves).
Declaration
Swift
public var nbParticipants: Int { get }
Return Value
The number of participants in the chat room
-
Get the list of participants of a chat room.
Declaration
Swift
public var participants: [Participant] { get }
Return Value
A list of LinphoneParticipant objects. LinphoneParticipant
-
Get the security level of a chat room.
Declaration
Swift
public var securityLevel: ChatRoomSecurityLevel { get }
Return Value
The security level of the chat room
-
Get the state of the chat room.
Declaration
Swift
public var state: ChatRoom.State { get }
Return Value
The state of the chat room
-
Get the subject of a chat room.
Declaration
Swift
public var subject: String { get set }
Return Value
The subject of the chat room
-
Gets the number of unread messages in the chatroom.
Declaration
Swift
public var unreadMessagesCount: Int { get }
Return Value
the number of unread messages.
-
Retrieve the user pointer associated with the chat room.
Declaration
Swift
public var userData: UnsafeMutableRawPointer? { get set }
Return Value
The user pointer associated with the chat room.
-
Add a participant to a chat room. This may fail if this type of chat room does not handle participants. Use {@link ChatRoom#canHandleParticipants} to know if this chat room handles participants.
Declaration
Swift
public func addParticipant(addr: Address)
Parameters
addr
The address of the participant to add to the chat room
-
Add several participants to a chat room at once. This may fail if this type of chat room does not handle participants. Use {@link ChatRoom#canHandleParticipants} to know if this chat room handles participants.
Declaration
Swift
public func addParticipants(addresses: [Address]) -> Bool
Parameters
addresses
A list of
Address
objects. LinphoneAddressReturn Value
True if everything is OK, False otherwise
-
Allow cpim on a basic chat room .
Declaration
Swift
public func allowCpim()
-
Allow multipart on a basic chat room .
Declaration
Swift
public func allowMultipart()
-
Tells whether a chat room is able to handle participants.
Declaration
Swift
public func canHandleParticipants() -> Bool
Return Value
A boolean value telling whether the chat room can handle participants or not
-
Notifies the destination of the chat message being composed that the user is typing a new message.
Declaration
Swift
public func compose()
-
Creates an empty message attached to a dedicated chat room.
Declaration
Swift
public func createEmptyMessage() throws -> ChatMessage
Return Value
a new
ChatMessage
-
Creates a message attached to a dedicated chat room with a particular content. Use linphone_chat_room_send_message to initiate the transfer
Declaration
Swift
public func createFileTransferMessage(initialContent: Content) throws -> ChatMessage
Parameters
initialContent
Content
initial content. LinphoneCoreVTable.file_transfer_send is invoked later to notify file transfer progress and collect next chunk of the message if LinphoneContent.data is nil.Return Value
a new
ChatMessage
-
Creates a forward message attached to a dedicated chat room with a particular message.
Declaration
Swift
public func createForwardMessage(msg: ChatMessage) throws -> ChatMessage
Parameters
msg
ChatMessage
message to be forwarded.Return Value
a new
ChatMessage
-
Creates a message attached to a dedicated chat room.
Declaration
Swift
public func createMessage(message: String) throws -> ChatMessage
Parameters
message
text message, nil if absent.
Return Value
a new
ChatMessage
-
Delete all messages from the history.
Declaration
Swift
public func deleteHistory()
-
Delete a message from the chat room history.
Declaration
Swift
public func deleteMessage(msg: ChatMessage)
Parameters
msg
The
ChatMessage
object to remove. -
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
Swift
public func ephemeralSupportedByAllParticipants() -> Bool
Return Value
true if all participants in the chat room support ephemeral messages, false otherwise
-
Gets the chat message sent or received in this chat room that matches the message_id.
Declaration
Swift
public func findMessage(messageId: String) -> ChatMessage?
Parameters
messageId
The id of the message to find
Return Value
the
ChatMessage
-
Find a participant of a chat room from its address.
Declaration
Swift
public func findParticipant(addr: Address) -> Participant?
Parameters
addr
The address to search in the list of participants of the chat room
Return Value
The participant if found, nil otherwise.
-
Gets nb_message most recent messages from cr chat room, sorted from oldest to most recent.
Declaration
Swift
public func getHistory(nbMessage: Int) -> [ChatMessage]
Parameters
nbMessage
Number of message to retrieve. 0 means everything.
Return Value
A list of
ChatMessage
objects. LinphoneChatMessage The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. -
Gets nb_events most recent events from cr chat room, sorted from oldest to most recent.
Declaration
Swift
public func getHistoryEvents(nbEvents: Int) -> [EventLog]
Parameters
nbEvents
Number of events to retrieve. 0 means everything.
Return Value
A list of
EventLog
objects. LinphoneEventLog The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. -
Gets nb_events most recent chat message events from cr chat room, sorted from oldest to most recent.
Declaration
Swift
public func getHistoryMessageEvents(nbEvents: Int) -> [EventLog]
Parameters
nbEvents
Number of events to retrieve. 0 means everything.
Return Value
A list of
EventLog
objects. LinphoneEventLog The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. -
Gets the partial list of messages in the given range, sorted from oldest to most recent.
Declaration
Swift
public func getHistoryRange(begin: Int, end: Int) -> [ChatMessage]
Parameters
begin
The first message of the range to be retrieved. History most recent message has index 0.
end
The last message of the range to be retrieved. History oldest message has index of history size - 1 (use linphone_chat_room_get_history_size to retrieve history size)
Return Value
A list of
ChatMessage
objects. LinphoneChatMessage The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. -
Gets the partial list of events in the given range, sorted from oldest to most recent.
Declaration
Swift
public func getHistoryRangeEvents(begin: Int, end: Int) -> [EventLog]
Parameters
begin
The first event of the range to be retrieved. History most recent event has index 0.
end
The last event of the range to be retrieved. History oldest event has index of history size - 1
Return Value
A list of
EventLog
objects. LinphoneEventLog The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. -
Gets the partial list of chat message events in the given range, sorted from oldest to most recent.
Declaration
Swift
public func getHistoryRangeMessageEvents(begin: Int, end: Int) -> [EventLog]
Parameters
begin
The first event of the range to be retrieved. History most recent event has index 0.
end
The last event of the range to be retrieved. History oldest event has index of history size - 1
Return Value
A list of
EventLog
objects. LinphoneEventLog The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. -
Return whether or not the chat room has been left.
Declaration
Swift
public func hasBeenLeft() -> Bool
Return Value
whether or not the chat room has been left
-
Check if a chat room has given capabilities.
Declaration
Swift
public func hasCapability(mask: Int) -> Bool
Parameters
mask
A Capabilities mask
Return Value
True if the mask matches, false otherwise
-
Leave a chat room.
Declaration
Swift
public func leave()
-
Returns true if lime is available for given peer.
Declaration
Swift
public func limeAvailable() -> Bool
Return Value
true if zrtp secrets have already been shared and ready to use
-
Mark all messages of the conversation as read.
Declaration
Swift
public func markAsRead()
-
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
Swift
public func notifyParticipantDeviceRegistration(participantDevice: Address)
-
Used to receive a chat message when using async mechanism with IM encryption engine.
Declaration
Swift
public func receiveChatMessage(msg: ChatMessage)
Parameters
msg
ChatMessage
object -
Remove a participant of a chat room.
Declaration
Swift
public func removeParticipant(participant: Participant)
Parameters
participant
The participant to remove from the chat room
-
Remove several participants of a chat room at once.
Declaration
Swift
public func removeParticipants(participants: [Participant])
Parameters
participants
A list of LinphoneParticipant objects. LinphoneParticipant
-
Send a message to peer member of this chat room. The state of the sending message will be notified via the callbacks defined in the LinphoneChatMessageCbs object that can be obtained by calling linphone_chat_message_get_callbacks. - Note: Unlike linphone_chat_room_send_chat_message, that function only takes a reference on the
ChatMessage
instead of totaly takes ownership on it. Thus, theChatMessage
object must be released by the API user after calling that function.Declaration
Swift
public func sendChatMessage(msg: ChatMessage)
Parameters
msg
The message to send.
-
Change the admin status of a participant of a chat room (you need to be an admin yourself to do this).
Declaration
Swift
public func setParticipantAdminStatus(participant: Participant, isAdmin: Bool)
Parameters
participant
The Participant for which to change the admin status
isAdmin
A boolean value telling whether the participant should now be an admin or not
-
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
Swift
public func setParticipantDevices(partAddr: Address, deviceIdentities: [ParticipantDeviceIdentity])
Parameters
partAddr
The participant address
deviceIdentities
A list of LinphoneParticipantDeviceIdentity objects. LinphoneParticipantDeviceIdentity list of the participant devices to be used by the group chat room