Liblinphone  5.3.0
Public Member Functions | List of all members
linphone::Content Class Reference

This object holds data that can be embedded in a signaling message. More...

#include <content.hh>

Inheritance diagram for linphone::Content:

Public Member Functions

LINPHONECXX_PUBLIC Content (void *ptr, bool takeRef=true)
 
LINPHONECXX_PUBLIC _LinphoneContent * cPtr ()
 
LINPHONECXX_PUBLIC const uint8_t * getBuffer () const
 Get the content data buffer, usually a string. More...
 
LINPHONECXX_PUBLIC std::string getDisposition () const
 Get the disposition of the Content, for example "recipient-list". More...
 
LINPHONECXX_PUBLIC void setDisposition (const std::string &disposition)
 Set the disposition of the Content, for example "recipient-list". More...
 
LINPHONECXX_PUBLIC std::string getEncoding () const
 Get the encoding of the data buffer, for example "gzip". More...
 
LINPHONECXX_PUBLIC void setEncoding (const std::string &encoding)
 Set the encoding of the data buffer, for example "gzip". More...
 
LINPHONECXX_PUBLIC int getFileDuration ()
 Gets the file duration in seconds, if information is available.
 
LINPHONECXX_PUBLIC std::string getFilePath () const
 Get the file transfer filepath set for this content (replace linphone_chat_message_get_file_transfer_filepath). More...
 
LINPHONECXX_PUBLIC void setFilePath (const std::string &filePath)
 Set the file transfer filepath for this content (replace linphone_chat_message_set_file_transfer_filepath). More...
 
LINPHONECXX_PUBLIC size_t getFileSize () const
 Get the file size if content is either a FileContent or a FileTransferContent. More...
 
LINPHONECXX_PUBLIC bool isFile () const
 Tells whether or not this content contains a file. More...
 
LINPHONECXX_PUBLIC bool isFileEncrypted () const
 Tells whether or not this content contains an encrypted file. More...
 
LINPHONECXX_PUBLIC bool isFileTransfer () const
 Tells whether or not this content is a file transfer. More...
 
LINPHONECXX_PUBLIC bool isIcalendar () const
 Tells whether or not this content contains an icalendar by checking it's content type. More...
 
LINPHONECXX_PUBLIC bool isMultipart () const
 Tell whether a content is a multipart content. More...
 
LINPHONECXX_PUBLIC bool isText () const
 Tells whether or not this content contains text. More...
 
LINPHONECXX_PUBLIC bool isVoiceRecording () const
 Tells whether or not this content contains a voice recording by checking it's content type. More...
 
LINPHONECXX_PUBLIC std::string getKey () const
 Get the key associated with a RCS file transfer message if encrypted. More...
 
LINPHONECXX_PUBLIC size_t getKeySize () const
 Get the size of key associated with a RCS file transfer message if encrypted. More...
 
LINPHONECXX_PUBLIC std::string getName () const
 Get the name associated with a RCS file transfer message. More...
 
LINPHONECXX_PUBLIC void setName (const std::string &name)
 Set the name associated with a RCS file transfer message. More...
 
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Content > > getParts () const
 Get all the parts from a multipart content. More...
 
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string getPlainFilePath () const
 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. More...
 
LINPHONECXX_PUBLIC size_t getSize () const
 Get the content data buffer size, excluding null character despite null character is always set for convenience. More...
 
LINPHONECXX_PUBLIC void setSize (size_t size)
 Set the content data size, excluding null character despite null character is always set for convenience. More...
 
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string getStringBuffer () const
 Get the string content data buffer. More...
 
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void setStringBuffer (const std::string &buffer)
 Set the string content data buffer. More...
 
LINPHONECXX_PUBLIC std::string getSubtype () const
 Get the mime subtype of the content data. More...
 
LINPHONECXX_PUBLIC void setSubtype (const std::string &subtype)
 Set the mime subtype of the content data. More...
 
LINPHONECXX_PUBLIC std::string getType () const
 Get the mime type of the content data. More...
 
LINPHONECXX_PUBLIC void setType (const std::string &type)
 Set the mime type of the content data. More...
 
LINPHONECXX_PUBLIC std::string getUtf8Text () const
 Get the string content data buffer. More...
 
LINPHONECXX_PUBLIC void setUtf8Text (const std::string &buffer)
 Get the string content data buffer. More...
 
LINPHONECXX_PUBLIC void addContentTypeParameter (const std::string &name, const std::string &value)
 Adds a parameter to the ContentType header. More...
 
LINPHONECXX_PUBLIC void addCustomHeader (const std::string &headerName, const std::string &headerValue)
 Adds a custom header in a content. More...
 
LINPHONECXX_PUBLIC std::string exportPlainFile () const
 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. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ContentfindPartByHeader (const std::string &headerName, const std::string &headerValue) const
 Find a part from a multipart content looking for a part header with a specified value. More...
 
LINPHONECXX_PUBLIC std::string getCustomHeader (const std::string &headerName) const
 Get a custom header value of a content. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ContentgetPart (int index) const
 Get a part from a multipart content according to its index. More...
 
LINPHONECXX_PUBLIC void setBuffer (const uint8_t *buffer, size_t size)
 Set the content data buffer, usually a string. More...
 
LINPHONECXX_PUBLIC void setKey (const std::string &key, const size_t keyLength)
 Set the key associated with a RCS file transfer message if encrypted. More...
 

Detailed Description

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.

Member Function Documentation

◆ addContentTypeParameter()

LINPHONECXX_PUBLIC void linphone::Content::addContentTypeParameter ( const std::string &  name,
const std::string &  value 
)

Adds a parameter to the ContentType header.

Parameters
namethe name of the parameter to add.
valuethe value of the parameter to add.

◆ addCustomHeader()

LINPHONECXX_PUBLIC void linphone::Content::addCustomHeader ( const std::string &  headerName,
const std::string &  headerValue 
)

Adds a custom header in a content.

Parameters
headerNameThe name of the header to add.
headerValueThe value of the header to add.

◆ exportPlainFile()

LINPHONECXX_PUBLIC std::string linphone::Content::exportPlainFile ( ) const

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.

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

◆ findPartByHeader()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Content> linphone::Content::findPartByHeader ( const std::string &  headerName,
const std::string &  headerValue 
) const

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

Parameters
headerNameThe name of the header to look for.
headerValueThe value of the header to look for.
Returns
A Content object object the part if found, nullptr otherwise.

◆ getBuffer()

LINPHONECXX_PUBLIC const uint8_t* linphone::Content::getBuffer ( ) const

Get the content data buffer, usually a string.

Returns
The content data buffer.

◆ getCustomHeader()

LINPHONECXX_PUBLIC std::string linphone::Content::getCustomHeader ( const std::string &  headerName) const

Get a custom header value of a content.

Parameters
headerNameThe name of the header to get the value from.
Returns
The value of the header if found, nullptr otherwise.

◆ getDisposition()

LINPHONECXX_PUBLIC std::string linphone::Content::getDisposition ( ) const

Get the disposition of the Content, for example "recipient-list".

Returns
The disposition of the Content.

◆ getEncoding()

LINPHONECXX_PUBLIC std::string linphone::Content::getEncoding ( ) const

Get the encoding of the data buffer, for example "gzip".

Returns
The encoding of the data buffer.

◆ getFilePath()

LINPHONECXX_PUBLIC std::string linphone::Content::getFilePath ( ) const

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

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

◆ getFileSize()

LINPHONECXX_PUBLIC size_t linphone::Content::getFileSize ( ) const

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

Returns
The represented file size.

◆ getKey()

LINPHONECXX_PUBLIC std::string linphone::Content::getKey ( ) const

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

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

◆ getKeySize()

LINPHONECXX_PUBLIC size_t linphone::Content::getKeySize ( ) const

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

Returns
The key size in bytes

◆ getName()

LINPHONECXX_PUBLIC std::string linphone::Content::getName ( ) const

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.

Returns
The name of the content.

◆ getPart()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Content> linphone::Content::getPart ( int  index) const

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

Parameters
indexThe index of the part to get.
Returns
A Content object holding the part if found, nullptr otherwise.

◆ getParts()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::Content> > linphone::Content::getParts ( ) const

Get all the parts from a multipart content.

Returns
A object holding the part if found, nullptr otherwise.

◆ getPlainFilePath()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string linphone::Content::getPlainFilePath ( ) const

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.

Returns
The file path set for this content if it has been set, nullptr otherwise.
Deprecated:
2022-01-07. Use exportPlainFile() instead.

◆ getSize()

LINPHONECXX_PUBLIC size_t linphone::Content::getSize ( ) const

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

Returns
The content data buffer size.

◆ getStringBuffer()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string linphone::Content::getStringBuffer ( ) const

Get the string content data buffer.

Returns
The string content data buffer.
Deprecated:
2020-07-01. Use getUtf8Text() instead.

◆ getSubtype()

LINPHONECXX_PUBLIC std::string linphone::Content::getSubtype ( ) const

Get the mime subtype of the content data.

Returns
The mime subtype of the content data, for example "html".

◆ getType()

LINPHONECXX_PUBLIC std::string linphone::Content::getType ( ) const

Get the mime type of the content data.

Returns
The mime type of the content data, for example "application".

◆ getUtf8Text()

LINPHONECXX_PUBLIC std::string linphone::Content::getUtf8Text ( ) const

Get the string content data buffer.

Introduced in 01/07/2020

Returns
The string content data buffer in UTF8.

◆ isFile()

LINPHONECXX_PUBLIC bool linphone::Content::isFile ( ) const

Tells whether or not this content contains a file.

Returns
true if this content contains a file, false otherwise.

◆ isFileEncrypted()

LINPHONECXX_PUBLIC bool linphone::Content::isFileEncrypted ( ) const

Tells whether or not this content contains an encrypted file.

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

◆ isFileTransfer()

LINPHONECXX_PUBLIC bool linphone::Content::isFileTransfer ( ) const

Tells whether or not this content is a file transfer.

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

◆ isIcalendar()

LINPHONECXX_PUBLIC bool linphone::Content::isIcalendar ( ) const

Tells whether or not this content contains an icalendar by checking it's content type.

Returns
true if this content type is 'text/calendar;conference-event=yes', false otherwise.

◆ isMultipart()

LINPHONECXX_PUBLIC bool linphone::Content::isMultipart ( ) const

Tell whether a content is a multipart content.

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

◆ isText()

LINPHONECXX_PUBLIC bool linphone::Content::isText ( ) const

Tells whether or not this content contains text.

Returns
true if this content contains plain text, false otherwise.

◆ isVoiceRecording()

LINPHONECXX_PUBLIC bool linphone::Content::isVoiceRecording ( ) const

Tells whether or not this content contains a voice recording by checking it's content type.

Returns
true if this content type is 'audio/wav;voice-recording=yes', false otherwise.

◆ setBuffer()

LINPHONECXX_PUBLIC void linphone::Content::setBuffer ( const uint8_t *  buffer,
size_t  size 
)

Set the content data buffer, usually a string.

Parameters
bufferThe content data buffer.
sizeThe size of the content data buffer.

◆ setDisposition()

LINPHONECXX_PUBLIC void linphone::Content::setDisposition ( const std::string &  disposition)

Set the disposition of the Content, for example "recipient-list".

Parameters
dispositionThe disposition of the Content.

◆ setEncoding()

LINPHONECXX_PUBLIC void linphone::Content::setEncoding ( const std::string &  encoding)

Set the encoding of the data buffer, for example "gzip".

Parameters
encodingThe encoding of the data buffer.

◆ setFilePath()

LINPHONECXX_PUBLIC void linphone::Content::setFilePath ( const std::string &  filePath)

Set the file transfer filepath for this content (replace linphone_chat_message_set_file_transfer_filepath).

Parameters
filePaththe file transfer filepath.

◆ setKey()

LINPHONECXX_PUBLIC void linphone::Content::setKey ( const std::string &  key,
const size_t  keyLength 
)

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

Parameters
keyThe key to be used to encrypt/decrypt file associated to this content.
keyLengthThe lengh of the key.

◆ setName()

LINPHONECXX_PUBLIC void linphone::Content::setName ( const std::string &  name)

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.

Parameters
nameThe name of the content.

◆ setSize()

LINPHONECXX_PUBLIC void linphone::Content::setSize ( size_t  size)

Set the content data size, excluding null character despite null character is always set for convenience.

Parameters
sizeThe content data buffer size.

◆ setStringBuffer()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void linphone::Content::setStringBuffer ( const std::string &  buffer)

Set the string content data buffer.

Parameters
bufferThe string content data buffer in UTF8.
Deprecated:
2020-07-01. Use setUtf8Text() instead.

◆ setSubtype()

LINPHONECXX_PUBLIC void linphone::Content::setSubtype ( const std::string &  subtype)

Set the mime subtype of the content data.

Parameters
subtypeThe mime subtype of the content data, for example "html".

◆ setType()

LINPHONECXX_PUBLIC void linphone::Content::setType ( const std::string &  type)

Set the mime type of the content data.

Parameters
typeThe mime type of the content data, for example "application".

◆ setUtf8Text()

LINPHONECXX_PUBLIC void linphone::Content::setUtf8Text ( const std::string &  buffer)

Get the string content data buffer.

Introduced in 01/07/2020

Parameters
bufferThe string content data buffer in UTF8.

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