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.
-
Set the encoding of the data buffer, for example “gzip”.
Declaration
Swift
public var encoding: String { get set }
Parameters
encoding
The encoding of the data buffer.
Get the encoding of the data buffer, for example “gzip”.Return Value
The encoding of the data buffer.
-
Gets the file duration in seconds, if information is available.
Declaration
Swift
public var fileDuration: Int { get }
-
Set the file transfer filepath for this content (replace linphone_chat_message_set_file_transfer_filepath).
Declaration
Swift
public var filePath: String { get set }
Parameters
filePath
the file transfer filepath.
Get the file transfer filepath set for this content (replace linphone_chat_message_get_file_transfer_filepath).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.
-
Tells whether or not this content contains an icalendar by checking it’s content type.
Declaration
Swift
public var isIcalendar: Bool { get }
Return Value
true if this content type is ‘text/calendar;conference-event=yes’, 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.
-
Tells whether or not this content contains a voice recording by checking it’s content type.
Declaration
Swift
public var isVoiceRecording: Bool { get }
Return Value
true if this content type is ‘audio/wav;voice-recording=yes’, false otherwise.
-
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
-
Set 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 }
Parameters
name
The name of the content.
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.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.
-
Generates 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.
- deprecated: 2022-01-07. Use exportPlainFile() instead.
Declaration
Swift
@available(*, deprecated) public var plainFilePath: String { get }
Return Value
The file path set for this content if it has been set, nil otherwise.
-
Set the content data size, excluding null character despite null character is always set for convenience.
Declaration
Swift
public var size: Int { get set }
Parameters
size
The content data buffer size. Get the content data buffer size, excluding null character despite null character is always set for convenience.
Return Value
The content data buffer size.
-
Set the string content data buffer.
- deprecated: 2020-07-01. Use setUtf8Text() instead. Get the string content data buffer.
- deprecated: 2020-07-01. Use getUtf8Text() instead.
Declaration
Swift
public var stringBuffer: String { get set }
Parameters
buffer
The string content data buffer in UTF8.
Return Value
The string content data buffer.
-
Set the mime subtype of the content data.
Get the mime subtype of the content data.
Declaration
Swift
public var subtype: String { get set }
Parameters
subtype
The mime subtype of the content data, for example “html”.
Return Value
The mime subtype of the content data, for example “html”.
-
Set the mime type of the content data.
Get the mime type of the content data.
Declaration
Swift
public var type: String { get set }
Parameters
type
The mime type of the content data, for example “application”.
Return Value
The mime type of the content data, for example “application”.
-
Assign a user pointer to the content.
Declaration
Swift
public var userData: UnsafeMutableRawPointer? { get set }
Parameters
userData
The user pointer to associate with the content.
Retrieve the user pointer associated with the content.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 }
Parameters
buffer
The string content data buffer in UTF8.
Get the string content data buffer. Introduced in 01/07/2020Return 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.
-
Generates 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 func exportPlainFile() -> String
Return Value
The file path set for this content if it has been set, nil otherwise.
-
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.