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

Presence model type holding information about the presence of a person. More...

#include <presence_model.hh>

Inheritance diagram for linphone::PresenceModel:

Public Member Functions

LINPHONECXX_PUBLIC PresenceModel (void *ptr, bool takeRef=true)
 
LINPHONECXX_PUBLIC _LinphonePresenceModel * cPtr ()
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresenceActivitygetActivity () const
 Gets the first activity of a presence model (there is usually only one). More...
 
LINPHONECXX_PUBLIC linphone::PresenceBasicStatus getBasicStatus () const
 Gets the basic status of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status setBasicStatus (linphone::PresenceBasicStatus basicStatus)
 Sets the basic status of a presence model. More...
 
LINPHONECXX_PUBLIC int getCapabilities () const
 Gets the capabilities of a PresenceModel object. More...
 
LINPHONECXX_PUBLIC linphone::ConsolidatedPresence getConsolidatedPresence () const
 Get the consolidated presence from a presence model. More...
 
LINPHONECXX_PUBLIC std::string getContact () const
 Gets the contact of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status setContact (const std::string &contact)
 Sets the contact of a presence model. More...
 
LINPHONECXX_PUBLIC bool isOnline () const
 Tells whether a presence model is considered online. More...
 
LINPHONECXX_PUBLIC time_t getLatestActivityTimestamp () const
 Gets the latest activity timestamp of a presence model. More...
 
LINPHONECXX_PUBLIC unsigned int getNbActivities () const
 Gets the number of activities included in the presence model. More...
 
LINPHONECXX_PUBLIC unsigned int getNbPersons () const
 Gets the number of persons included in the presence model. More...
 
LINPHONECXX_PUBLIC unsigned int getNbServices () const
 Gets the number of services included in the presence model. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::AddressgetPresentity () const
 Gets the presentity of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status setPresentity (const std::shared_ptr< const linphone::Address > &presentity)
 Sets the presentity of a presence model. More...
 
LINPHONECXX_PUBLIC time_t getTimestamp () const
 Gets the timestamp of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status addActivity (const std::shared_ptr< linphone::PresenceActivity > &activity)
 Adds an activity to a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status addNote (const std::string &noteContent, const std::string &lang)
 Adds a note to a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status addPerson (const std::shared_ptr< linphone::PresencePerson > &person)
 Adds a person to a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status addService (const std::shared_ptr< linphone::PresenceService > &service)
 Adds a service to a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status clearActivities ()
 Clears the activities of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status clearNotes ()
 Clears all the notes of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status clearPersons ()
 Clears the persons of a presence model. More...
 
LINPHONECXX_PUBLIC linphone::Status clearServices ()
 Clears the services of a presence model. More...
 
LINPHONECXX_PUBLIC float getCapabilityVersion (linphone::Friend::Capability capability) const
 Returns the version of the capability of a PresenceModel. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresenceNotegetNote (const std::string &lang) const
 Gets the first note of a presence model (there is usually only one). More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresenceActivitygetNthActivity (unsigned int index) const
 Gets the nth activity of a presence model. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresencePersongetNthPerson (unsigned int index) const
 Gets the nth person of a presence model. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresenceServicegetNthService (unsigned int index) const
 Gets the nth service of a presence model. More...
 
LINPHONECXX_PUBLIC bool hasCapability (linphone::Friend::Capability capability) const
 Returns whether or not the PresenceModel object has a given capability. More...
 
LINPHONECXX_PUBLIC bool hasCapabilityWithVersion (linphone::Friend::Capability capability, float version) const
 Returns whether or not the PresenceModel object has a given capability with a certain version. More...
 
LINPHONECXX_PUBLIC bool hasCapabilityWithVersionOrMore (linphone::Friend::Capability capability, float version) const
 Returns whether or not the PresenceModel object has a given capability with a certain version or more. More...
 
LINPHONECXX_PUBLIC linphone::Status setActivity (linphone::PresenceActivity::Type activity, const std::string &description)
 Sets the activity of a presence model (limits to only one activity). More...
 

Static Public Member Functions

static LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresenceModelnewWithActivity (linphone::PresenceActivity::Type activity, const std::string &description)
 Creates a presence model specifying an activity. More...
 
static LINPHONECXX_PUBLIC std::shared_ptr< linphone::PresenceModelnewWithActivityAndNote (linphone::PresenceActivity::Type activity, const std::string &description, const std::string &note, const std::string &lang)
 Creates a presence model specifying an activity and adding a note. More...
 

Detailed Description

Presence model type holding information about the presence of a person.

Member Function Documentation

◆ addActivity()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::addActivity ( const std::shared_ptr< linphone::PresenceActivity > &  activity)

Adds an activity to a presence model.

Parameters
activityThe PresenceActivity object to add to the model.
Returns
0 if successful, a value < 0 in case of error.

◆ addNote()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::addNote ( const std::string &  noteContent,
const std::string &  lang 
)

Adds a note to a presence model.

Parameters
noteContentThe note to be added to the presence model.
langThe language of the note to be added. Can be nullptr if no language is to be specified for the note.
Returns
0 if successful, a value < 0 in case of error. Only one note for each language can be set, so e.g. setting a note for the 'fr' language if there is only one will replace the existing one.

◆ addPerson()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::addPerson ( const std::shared_ptr< linphone::PresencePerson > &  person)

Adds a person to a presence model.

Parameters
personThe PresencePerson object to add to the model.
Returns
0 if successful, a value < 0 in case of error.

◆ addService()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::addService ( const std::shared_ptr< linphone::PresenceService > &  service)

Adds a service to a presence model.

Parameters
serviceThe PresenceService object to add to the model.
Returns
0 if successful, a value < 0 in case of error.

◆ clearActivities()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::clearActivities ( )

Clears the activities of a presence model.

Returns
0 if successful, a value < 0 in case of error.

◆ clearNotes()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::clearNotes ( )

Clears all the notes of a presence model.

Returns
0 if successful, a value < 0 in case of error.

◆ clearPersons()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::clearPersons ( )

Clears the persons of a presence model.

Returns
0 if successful, a value < 0 in case of error.

◆ clearServices()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::clearServices ( )

Clears the services of a presence model.

Returns
0 if successful, a value < 0 in case of error.

◆ getActivity()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresenceActivity> linphone::PresenceModel::getActivity ( ) const

Gets the first activity of a presence model (there is usually only one).

Returns
A PresenceActivity object if successful, nullptr otherwise.

◆ getBasicStatus()

LINPHONECXX_PUBLIC linphone::PresenceBasicStatus linphone::PresenceModel::getBasicStatus ( ) const

Gets the basic status of a presence model.

Returns
The PresenceBasicStatus of the PresenceModel object given as parameter.

◆ getCapabilities()

LINPHONECXX_PUBLIC int linphone::PresenceModel::getCapabilities ( ) const

Gets the capabilities of a PresenceModel object.

Returns
the capabilities.

◆ getCapabilityVersion()

LINPHONECXX_PUBLIC float linphone::PresenceModel::getCapabilityVersion ( linphone::Friend::Capability  capability) const

Returns the version of the capability of a PresenceModel.

Parameters
capabilityThe Friend::Capability to test.
Returns
the version of the capability of a PresenceModel or -1.0 if the model has not the capability.

◆ getConsolidatedPresence()

LINPHONECXX_PUBLIC linphone::ConsolidatedPresence linphone::PresenceModel::getConsolidatedPresence ( ) const

Get the consolidated presence from a presence model.

Returns
The ConsolidatedPresence corresponding to the presence model

◆ getContact()

LINPHONECXX_PUBLIC std::string linphone::PresenceModel::getContact ( ) const

Gets the contact of a presence model.

Returns
A pointer to a dynamically allocated string containing the contact, or nullptr if no contact is found. The returned string is to be freed by calling ms_free().

◆ getLatestActivityTimestamp()

LINPHONECXX_PUBLIC time_t linphone::PresenceModel::getLatestActivityTimestamp ( ) const

Gets the latest activity timestamp of a presence model.

Returns
The activity timestamp of the PresenceModel object or -1 if there is no activity (such as when status is Online).

◆ getNbActivities()

LINPHONECXX_PUBLIC unsigned int linphone::PresenceModel::getNbActivities ( ) const

Gets the number of activities included in the presence model.

Returns
The number of activities included in the PresenceModel object.

◆ getNbPersons()

LINPHONECXX_PUBLIC unsigned int linphone::PresenceModel::getNbPersons ( ) const

Gets the number of persons included in the presence model.

Returns
The number of persons included in the PresenceModel object.

◆ getNbServices()

LINPHONECXX_PUBLIC unsigned int linphone::PresenceModel::getNbServices ( ) const

Gets the number of services included in the presence model.

Returns
The number of services included in the PresenceModel object.

◆ getNote()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresenceNote> linphone::PresenceModel::getNote ( const std::string &  lang) const

Gets the first note of a presence model (there is usually only one).

Parameters
langThe language of the note to get. Can be nullptr to get a note that has no language specified or to get the first note whatever language it is written into.
Returns
A pointer to a PresenceNote object if successful, nullptr otherwise.

◆ getNthActivity()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresenceActivity> linphone::PresenceModel::getNthActivity ( unsigned int  index) const

Gets the nth activity of a presence model.

Parameters
indexThe index of the activity to get (the first activity having the index 0).
Returns
A pointer to a PresenceActivity object if successful, nullptr otherwise.

◆ getNthPerson()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresencePerson> linphone::PresenceModel::getNthPerson ( unsigned int  index) const

Gets the nth person of a presence model.

Parameters
indexThe index of the person to get (the first person having the index 0).
Returns
A pointer to a PresencePerson object if successful, nullptr otherwise.

◆ getNthService()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresenceService> linphone::PresenceModel::getNthService ( unsigned int  index) const

Gets the nth service of a presence model.

Parameters
indexThe index of the service to get (the first service having the index 0).
Returns
A pointer to a PresenceService object if successful, nullptr otherwise.

◆ getPresentity()

LINPHONECXX_PUBLIC std::shared_ptr<const linphone::Address> linphone::PresenceModel::getPresentity ( ) const

Gets the presentity of a presence model.

Returns
A pointer to a const Address, or nullptr if no contact is found.

◆ getTimestamp()

LINPHONECXX_PUBLIC time_t linphone::PresenceModel::getTimestamp ( ) const

Gets the timestamp of a presence model.

Returns
The timestamp of the PresenceModel object or -1 on error.

◆ hasCapability()

LINPHONECXX_PUBLIC bool linphone::PresenceModel::hasCapability ( linphone::Friend::Capability  capability) const

Returns whether or not the PresenceModel object has a given capability.

Parameters
capabilityThe capability to test.
Returns
whether or not the PresenceModel object has a given capability.

◆ hasCapabilityWithVersion()

LINPHONECXX_PUBLIC bool linphone::PresenceModel::hasCapabilityWithVersion ( linphone::Friend::Capability  capability,
float  version 
) const

Returns whether or not the PresenceModel object has a given capability with a certain version.

Parameters
capabilityThe Friend::Capability to test.
versionThe wanted version to test.
Returns
whether or not the PresenceModel object has a given capability with a certain version.

◆ hasCapabilityWithVersionOrMore()

LINPHONECXX_PUBLIC bool linphone::PresenceModel::hasCapabilityWithVersionOrMore ( linphone::Friend::Capability  capability,
float  version 
) const

Returns whether or not the PresenceModel object has a given capability with a certain version or more.

Parameters
capabilityThe Friend::Capability to test.
versionThe wanted version to test.
Returns
whether or not the PresenceModel object has a given capability with a certain version or more.

◆ isOnline()

LINPHONECXX_PUBLIC bool linphone::PresenceModel::isOnline ( ) const

Tells whether a presence model is considered online.

It is any of theses cases:

◆ newWithActivity()

static LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresenceModel> linphone::PresenceModel::newWithActivity ( linphone::PresenceActivity::Type  activity,
const std::string &  description 
)
static

Creates a presence model specifying an activity.

Parameters
activityThe PresenceActivity::Type to set for the created presence model.
descriptionAn additional description of the activity (mainly useful for the 'other' activity). Set it to nullptr to not add a description.
Returns
The created PresenceModel, or nullptr if an error occured.
See also
linphone_presence_model_new, newWithActivityAndNote() The created presence model has the activity specified in the parameters.

◆ newWithActivityAndNote()

static LINPHONECXX_PUBLIC std::shared_ptr<linphone::PresenceModel> linphone::PresenceModel::newWithActivityAndNote ( linphone::PresenceActivity::Type  activity,
const std::string &  description,
const std::string &  note,
const std::string &  lang 
)
static

Creates a presence model specifying an activity and adding a note.

Parameters
activityThe PresenceActivity::Type to set for the created presence model.
descriptionAn additional description of the activity (mainly useful for the 'other' activity). Set it to nullptr to not add a description.
noteAn additional note giving additional information about the contact presence.
langThe language the note is written in. It can be set to nullptr in order to not specify the language of the note.
Returns
The created PresenceModel, or nullptr if an error occured.
See also
newWithActivity(), newWithActivityAndNote() The created presence model has the activity and the note specified in the parameters.

◆ setActivity()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::setActivity ( linphone::PresenceActivity::Type  activity,
const std::string &  description 
)

Sets the activity of a presence model (limits to only one activity).

Parameters
activityThe PresenceActivity::Type to set for the model.
descriptionAn additional description of the activity to set for the model. Can be nullptr if no additional description is to be added.
Returns
0 if successful, a value < 0 in case of error. WARNING: This function will modify the basic status of the model according to the activity being set. If you don't want the basic status to be modified automatically, you can use the combination of setBasicStatus(), clearActivities() and addActivity().

◆ setBasicStatus()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::setBasicStatus ( linphone::PresenceBasicStatus  basicStatus)

Sets the basic status of a presence model.

Parameters
basicStatusThe PresenceBasicStatus to set for the PresenceModel object.
Returns
0 if successful, a value < 0 in case of error.

◆ setContact()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::setContact ( const std::string &  contact)

Sets the contact of a presence model.

Parameters
contactThe contact string to set.
Returns
0 if successful, a value < 0 in case of error.

◆ setPresentity()

LINPHONECXX_PUBLIC linphone::Status linphone::PresenceModel::setPresentity ( const std::shared_ptr< const linphone::Address > &  presentity)

Sets the presentity of a presence model.

Parameters
presentityThe presentity address to set (presentity is copied).
Returns
0 if successful, a value < 0 in case of error.

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