Content

public class Content : LinphoneObject

This object holds data that can be embedded in a signaling message. Use Core.createContent() to create it, and then you should set at least it’s type and subtype and fill the buffer with your data. A Content can be multipart (contain other contents), have file information (name, path, size), be encrypted, have custom headers, etc… It is mainly used to send information through a ChatMessage.

  • Undocumented

    Declaration

    Swift

    public static func getSwiftObject(cObject: OpaquePointer) -> Content
  • Undocumented

    Declaration

    Swift

    public var getCobject: OpaquePointer? { get }
  • Get the content data buffer, usually a string.

    Declaration

    Swift

    public var buffer: UnsafePointer<UInt8> { get }

    Return Value

    The content data buffer.

  • Get the encoding of the data buffer, for example “gzip”.

    Declaration

    Swift

    public var encoding: String { get set }

    Return Value

    The encoding of the data buffer.

  • Get the file transfer filepath set for this content (replace linphone_chat_message_get_file_transfer_filepath).

    Declaration

    Swift

    public var filePath: String { get set }

    Return Value

    The file path set for this content if it has been set, nil otherwise.

  • Get the file size if content is either a FileContent or a FileTransferContent.

    Declaration

    Swift

    public var fileSize: Int { get }

    Return Value

    The represented file size.

  • Tells whether or not this content contains a file.

    Declaration

    Swift

    public var isFile: Bool { get }

    Return Value

    true if this content contains a file, false otherwise.

  • Tells whether or not this content contains an encrypted file.

    Declaration

    Swift

    public var isFileEncrypted: Bool { get }

    Return Value

    True is this content contains a file and this file is encrypted, false otherwise.

  • Tells whether or not this content is a file transfer.

    Declaration

    Swift

    public var isFileTransfer: Bool { get }

    Return Value

    true if this content is a file transfer, false otherwise.

  • Tell whether a content is a multipart content.

    Declaration

    Swift

    public var isMultipart: Bool { get }

    Return Value

    A boolean value telling whether the content is multipart or not.

  • Tells whether or not this content contains text.

    Declaration

    Swift

    public var isText: Bool { get }

    Return Value

    true if this content contains plain text, false otherwise.

  • key

    Get the key associated with a RCS file transfer message if encrypted.

    Declaration

    Swift

    public var key: String { get }

    Return Value

    The key to encrypt/decrypt the file associated to this content.

  • Get the size of key associated with a RCS file transfer message if encrypted.

    Declaration

    Swift

    public var keySize: Int { get }

    Return Value

    The key size in bytes

  • Get the name associated with a RCS file transfer message. It is used to store the original filename of the file to be downloaded from server.

    Declaration

    Swift

    public var name: String { get set }

    Return Value

    The name of the content.

  • Get all the parts from a multipart content.

    Declaration

    Swift

    public var parts: [Content] { get }

    Return Value

    A object holding the part if found, nil otherwise.

  • If the content is an encrypted file, generate a temporary plain copy of the file and returns its paths The caller is responsible to then delete this temporary copy and the returned string.

    Declaration

    Swift

    public var plainFilePath: String { get }

    Return Value

    The file path set for this content if it has been set, nil otherwise.

  • Get the content data buffer size, excluding null character despite null character is always set for convenience.

    Declaration

    Swift

    public var size: Int { get set }

    Return Value

    The content data buffer size.

  • Get the string content data buffer.

    • deprecated: 2020-07-01. Use getUtf8Text() instead.

    Declaration

    Swift

    @available(*, deprecated)
    public var stringBuffer: String { get set }

    Return Value

    The string content data buffer.

  • Get the mime subtype of the content data.

    Declaration

    Swift

    public var subtype: String { get set }

    Return Value

    The mime subtype of the content data, for example “html”.

  • Get the mime type of the content data.

    Declaration

    Swift

    public var type: String { get set }

    Return Value

    The mime type of the content data, for example “application”.

  • Retrieve the user pointer associated with the content.

    Declaration

    Swift

    public var userData: UnsafeMutableRawPointer? { get set }

    Return Value

    The user pointer associated with the content.

  • Get the string content data buffer. Introduced in 01/07/2020

    Declaration

    Swift

    public var utf8Text: String { get set }

    Return Value

    The string content data buffer in UTF8.

  • Adds a parameter to the ContentType header.

    Declaration

    Swift

    public func addContentTypeParameter(name: String, value: String?)

    Parameters

    name

    the name of the parameter to add.

    value

    the value of the parameter to add.

  • Find a part from a multipart content looking for a part header with a specified value.

    Declaration

    Swift

    public func findPartByHeader(headerName: String, headerValue: String) -> Content?

    Parameters

    headerName

    The name of the header to look for.

    headerValue

    The value of the header to look for.

    Return Value

    A Content object object the part if found, nil otherwise.

  • Get a custom header value of a content.

    Declaration

    Swift

    public func getCustomHeader(headerName: String) -> String

    Parameters

    headerName

    The name of the header to get the value from.

    Return Value

    The value of the header if found, nil otherwise.

  • Get a part from a multipart content according to its index.

    Declaration

    Swift

    public func getPart(index: Int) -> Content?

    Parameters

    index

    The index of the part to get.

    Return Value

    A Content object holding the part if found, nil otherwise.

  • Set the content data buffer, usually a string.

    Declaration

    Swift

    public func setBuffer(buffer: UnsafePointer<UInt8>, size: Int)

    Parameters

    buffer

    The content data buffer.

    size

    The size of the content data buffer.

  • Set the key associated with a RCS file transfer message if encrypted.

    Declaration

    Swift

    public func setKey(key: String, keyLength: Int)

    Parameters

    key

    The key to be used to encrypt/decrypt file associated to this content.

    keyLength

    The lengh of the key.