ChatMessage

public class ChatMessage : LinphoneObject

An chat message is the object that is sent and received through LinphoneChatRooms.

  • LinphoneChatMessageState is used to notify if messages have been successfully delivered or not.

    See more

    Declaration

    Swift

    public enum State : Int
  • LinphoneChatMessageDirection is used to indicate if a message is outgoing or incoming.

    See more

    Declaration

    Swift

    public enum Direction : Int
  • Undocumented

    Declaration

    Swift

    public func getDelegate() -> ChatMessageDelegate?
  • Undocumented

    Declaration

    Swift

    public func addDelegate(delegate: ChatMessageDelegate)
  • Undocumented

    Declaration

    Swift

    public func removeDelegate(delegate: ChatMessageDelegate)
  • Linphone message has an app-specific field that can store a text. The application might want to use it for keeping data over restarts, like thumbnail image path.

    Declaration

    Swift

    public var appdata: String { get set }

    Return Value

    the application-specific data or nil if none has been stored.

  • Returns the chatroom this message belongs to.

    Declaration

    Swift

    public var chatRoom: ChatRoom? { get }
  • Get the content type of a chat message.

    Declaration

    Swift

    public var contentType: String { get set }

    Return Value

    The content type of the chat message

  • Returns the list of contents in the message.

    Declaration

    Swift

    public var contents: [Content] { get }

    Return Value

    A list of Content objects. LinphoneContent the list of Content.

  • Returns back pointer to Core object.

    Declaration

    Swift

    public var core: Core? { get }
  • Gets the current LinphoneChatMessageCbs. This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneChatMessageCbs that is calling the callback.

    Declaration

    Swift

    public var currentCallbacks: ChatMessageDelegate? { get }

    Return Value

    The LinphoneChatMessageCbs that has called the last callback

  • Get full details about delivery error of a chat message.

    Declaration

    Swift

    public var errorInfo: ErrorInfo? { get }

    Return Value

    a ErrorInfo describing the details.

  • Linphone message can carry external body as defined by rfc2017.

    Declaration

    Swift

    public var externalBodyUrl: String { get set }

    Return Value

    external body url or nil if not present.

  • Get the path to the file to read from or write to during the file transfer.

    • deprecated: use Content.getFilePath() instead.

    Declaration

    Swift

    public var fileTransferFilepath: String { get set }

    Return Value

    The path to the file to use for the file transfer.

  • Get the file_transfer_information (used by call backs to recover informations during a rcs file transfer)

    Declaration

    Swift

    public var fileTransferInformation: Content? { get }

    Return Value

    a pointer to the Content structure or nil if not present.

  • Gets the forward info if available as a string.

    Declaration

    Swift

    public var forwardInfo: String { get }

    Return Value

    the Content buffer if available, null otherwise

  • Get origin of the message.

    Declaration

    Swift

    public var fromAddress: Address? { get }

    Return Value

    Address

  • Return whether or not a chat message is a file transfer.

    Declaration

    Swift

    public var isFileTransfer: Bool { get }

    Return Value

    Whether or not the message is a file transfer

  • Gets whether or not a file is currently being downloaded or uploaded.

    Declaration

    Swift

    public var isFileTransferInProgress: Bool { get }

    Return Value

    true if download or upload is in progress, false otherwise

  • Returns true if the chat message is a forward message.

    Declaration

    Swift

    public var isForward: Bool { get }

    Return Value

    true if it is a forward message, false otherwise

  • Returns true if the message has been sent, returns true if the message has been received.

    Declaration

    Swift

    public var isOutgoing: Bool { get }
  • Returns true if the message has been read, otherwise returns true.

    Declaration

    Swift

    public var isRead: Bool { get }
  • Get if the message was encrypted when transfered.

    Declaration

    Swift

    public var isSecured: Bool { get }

    Return Value

    whether the message was encrypted when transfered or not

  • Return whether or not a chat message is a text.

    Declaration

    Swift

    public var isText: Bool { get }

    Return Value

    Whether or not the message is a text

  • Returns the origin address of a message if it was a outgoing message, or the destination address if it was an incoming message.

    Declaration

    Swift

    public var localAddress: Address? { get }

    Return Value

    Address

  • Get the message identifier. It is used to identify a message so that it can be notified as delivered and/or displayed.

    Declaration

    Swift

    public var messageId: String { get }

    Return Value

    The message identifier.

  • Get the state of the message.

    Declaration

    Swift

    public var state: ChatMessage.State { get }

    Return Value

    LinphoneChatMessageState

  • Get text part of this message.

    • deprecated: use getTextContent() instead

    Declaration

    Swift

    public var text: String { get }

    Return Value

    text or nil if no text.

  • Gets the text content if available as a string.

    Declaration

    Swift

    public var textContent: String { get }

    Return Value

    the Content buffer if available, null otherwise

  • Get the time the message was sent.

    Declaration

    Swift

    public var time: Int { get }
  • Get destination of the message.

    Declaration

    Swift

    public var toAddress: Address? { get }

    Return Value

    Address

  • Get if a chat message is to be stored.

    Declaration

    Swift

    public var toBeStored: Bool { get set }

    Return Value

    Whether or not the message is to be stored

  • Add custom headers to the message.

    Declaration

    Swift

    public func addCustomHeader(headerName: String, headerValue: String)

    Parameters

    headerName

    name of the header

    headerValue

    header value

  • Adds a file content to the ChatMessage.

    Declaration

    Swift

    public func addFileContent(cContent: Content)

    Parameters

    cContent

    Content object to add.

  • Adds a text content to the ChatMessage.

    Declaration

    Swift

    public func addTextContent(text: String)

    Parameters

    text

    The text to add to the message.

  • Cancel an ongoing file transfer attached to this message. (upload or download)

    Declaration

    Swift

    public func cancelFileTransfer()
  • Start the download of the Content referenced in the ChatMessage from remote server.

    Declaration

    Swift

    public func downloadContent(cContent: Content) -> Bool

    Parameters

    cContent

    Content object to download.

  • Start the download of the file referenced in a ChatMessage from remote server.

    • deprecated: Use downloadContent() instead

    Declaration

    Swift

    public func downloadFile() -> Bool
  • Retrieve a custom header value given its name.

    Declaration

    Swift

    public func getCustomHeader(headerName: String) -> String

    Parameters

    headerName

    header name searched

  • Gets the list of participants for which the imdn state has reached the specified state and the time at which they did.

    Declaration

    Swift

    public func getParticipantsByImdnState(state: ChatMessage.State) -> [ParticipantImdnState]

    Parameters

    state

    The LinphoneChatMessageState the imdn have reached (only use LinphoneChatMessageStateDelivered, LinphoneChatMessageStateDeliveredToUser, LinphoneChatMessageStateDisplayed and LinphoneChatMessageStateNotDelivered)

    Return Value

    A list of ParticipantImdnState objects. LinphoneParticipantImdnState 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.

  • Returns true if the chat message has a text content.

    Declaration

    Swift

    public func hasTextContent() -> Bool

    Return Value

    true if it has one, false otherwise

  • Fulfill a chat message char by char. Message linked to a Real Time Text Call send char in realtime following RFC 4103/T.140 To commit a message, use linphone_chat_room_send_message

    Declaration

    Swift

    public func putChar(character: UInt32) throws

    Parameters

    character

    T.140 char

    Return Value

    0 if succeed.

  • Removes a content from the ChatMessage.

    Declaration

    Swift

    public func removeContent(content: Content)

    Parameters

    content

    the Content object to remove.

  • Removes a custom header from the message.

    Declaration

    Swift

    public func removeCustomHeader(headerName: String)

    Parameters

    headerName

    name of the header to remove

  • Resend a chat message if it is in the ‘not delivered’ state for whatever reason.

    Note

    Unlike linphone_chat_message_resend, that function only takes a reference on the ChatMessage instead of totaly takes ownership on it. Thus, the ChatMessage object must be released by the API user after calling that function.

    Declaration

    Swift

    public func resend()
  • Send a chat message.

    Declaration

    Swift

    public func send()