Liblinphone
5.3.0
|
This object is used to store a SIP address. More...
#include <friend.hh>
Public Types | |
enum | Capability { Capability::None = 0, Capability::GroupChat = 1<<0, Capability::LimeX3Dh = 1<<1, Capability::EphemeralMessages = 1<<2 } |
Enum describing the capabilities of a Friend, populated through presence subscribe/notify process. More... | |
Public Member Functions | |
LINPHONECXX_PUBLIC | Friend (void *ptr, bool takeRef=true) |
LINPHONECXX_PUBLIC _LinphoneFriend * | cPtr () |
LINPHONECXX_PUBLIC void | addListener (const std::shared_ptr< FriendListener > &listener) |
Add an application listener to the Friend instance. More... | |
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< FriendListener > &listener) |
Remove a previously added listener from the Friend instance. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getAddress () const |
Get address of this friend. More... | |
LINPHONECXX_PUBLIC linphone::Status | setAddress (const std::shared_ptr< const linphone::Address > &address) |
Set Address for this friend. More... | |
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Address > > | getAddresses () const |
Returns a list of Address for this friend. More... | |
LINPHONECXX_PUBLIC int | getCapabilities () const |
Returns the capabilities associated to this friend. More... | |
LINPHONECXX_PUBLIC linphone::ConsolidatedPresence | getConsolidatedPresence () const |
Get the consolidated presence of a friend. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const |
Returns the Core object managing this friend, if any. More... | |
LINPHONECXX_PUBLIC linphone::SubscribePolicy | getIncSubscribePolicy () const |
get current subscription policy for this Friend More... | |
LINPHONECXX_PUBLIC linphone::Status | setIncSubscribePolicy (linphone::SubscribePolicy policy) |
Configure incoming subscription policy for this friend. More... | |
LINPHONECXX_PUBLIC bool | isPresenceReceived () const |
Tells whether we already received presence information for a friend. More... | |
LINPHONECXX_PUBLIC std::string | getJobTitle () const |
Gets the contact's job title from it's vCard. More... | |
LINPHONECXX_PUBLIC void | setJobTitle (const std::string &jobTitle) |
Sets the contact's job title. More... | |
LINPHONECXX_PUBLIC std::string | getName () const |
Get the display name for this friend. More... | |
LINPHONECXX_PUBLIC linphone::Status | setName (const std::string &name) |
Set the display name for this friend. More... | |
LINPHONECXX_PUBLIC std::string | getNativeUri () const |
Gets the contact's native URI. More... | |
LINPHONECXX_PUBLIC void | setNativeUri (const std::string &nativeUri) |
Sets the contact's native URI. More... | |
LINPHONECXX_PUBLIC std::string | getOrganization () const |
Gets the contact's organization from it's vCard. More... | |
LINPHONECXX_PUBLIC void | setOrganization (const std::string &organization) |
Sets the contact's organization. More... | |
LINPHONECXX_PUBLIC std::list< std::string > | getPhoneNumbers () const |
Returns a list of phone numbers for this friend. More... | |
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::FriendPhoneNumber > > | getPhoneNumbersWithLabel () const |
Returns a list of FriendPhoneNumber for this friend. More... | |
LINPHONECXX_PUBLIC std::string | getPhoto () const |
Gets the contact's picture URI. More... | |
LINPHONECXX_PUBLIC void | setPhoto (const std::string &pictureUri) |
Sets the contact's picture URI. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::PresenceModel > | getPresenceModel () const |
Get the presence model of a friend. More... | |
LINPHONECXX_PUBLIC void | setPresenceModel (const std::shared_ptr< linphone::PresenceModel > &presence) |
Set the presence model of a friend. More... | |
LINPHONECXX_PUBLIC std::string | getRefKey () const |
Get the reference key of a friend. More... | |
LINPHONECXX_PUBLIC void | setRefKey (const std::string &key) |
Set the reference key of a friend. More... | |
LINPHONECXX_PUBLIC bool | getStarred () const |
Gets if the friend is to be considered as important for the user. More... | |
LINPHONECXX_PUBLIC void | setStarred (bool isStarred) |
Sets if the friend is a user's favorite or important contact. More... | |
LINPHONECXX_PUBLIC bool | subscribesEnabled () const |
get subscription flag value More... | |
LINPHONECXX_PUBLIC linphone::Status | enableSubscribes (bool enable) |
Configure Friend to subscribe to presence information. More... | |
LINPHONECXX_PUBLIC linphone::SubscriptionState | getSubscriptionState () const |
Get subscription state of a friend. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Vcard > | getVcard () const |
Returns the vCard object associated to this friend, if any. More... | |
LINPHONECXX_PUBLIC void | setVcard (const std::shared_ptr< linphone::Vcard > &vcard) |
Binds a vCard object to a friend. More... | |
LINPHONECXX_PUBLIC void | addAddress (const std::shared_ptr< const linphone::Address > &address) |
Adds an address in this friend. More... | |
LINPHONECXX_PUBLIC void | addPhoneNumber (const std::string &phoneNumber) |
Adds a phone number in this friend. More... | |
LINPHONECXX_PUBLIC void | addPhoneNumberWithLabel (const std::shared_ptr< linphone::FriendPhoneNumber > &phoneNumber) |
Adds a FriendPhoneNumber to this friend. More... | |
LINPHONECXX_PUBLIC bool | createVcard (const std::string &name) |
Creates a vCard object associated to this friend if there isn't one yet and if the full name is available, either by the parameter or the one in the friend's SIP URI. More... | |
LINPHONECXX_PUBLIC void | done () |
Commits modification made to the friend configuration. | |
LINPHONECXX_PUBLIC void | edit () |
Starts editing a friend configuration. More... | |
LINPHONECXX_PUBLIC float | getCapabilityVersion (Capability capability) const |
Returns the version of a friend's capbility. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::PresenceModel > | getPresenceModelForUriOrTel (const std::string &uriOrTel) const |
Get the presence model for a specific SIP URI or phone number of a friend. More... | |
LINPHONECXX_PUBLIC bool | hasCapability (Capability capability) const |
Returns whether or not a friend has a capbility. More... | |
LINPHONECXX_PUBLIC bool | hasCapabilityWithVersion (Capability capability, float version) const |
Returns whether or not a friend has a capbility with a given version. More... | |
LINPHONECXX_PUBLIC bool | hasCapabilityWithVersionOrMore (Capability capability, float version) const |
Returns whether or not a friend has a capbility with a given version or more. More... | |
LINPHONECXX_PUBLIC bool | hasPhoneNumber (const std::string &phoneNumber) const |
Returns whether a friend contains the given phone number. More... | |
LINPHONECXX_PUBLIC bool | inList () const |
Check that the given friend is in a friend list. More... | |
LINPHONECXX_PUBLIC void | remove () |
Removes a friend from it's friend list and from the rc if exists. | |
LINPHONECXX_PUBLIC void | removeAddress (const std::shared_ptr< const linphone::Address > &address) |
Removes an address in this friend. More... | |
LINPHONECXX_PUBLIC void | removePhoneNumber (const std::string &phoneNumber) |
Removes a phone number in this friend. More... | |
LINPHONECXX_PUBLIC void | removePhoneNumberWithLabel (const std::shared_ptr< const linphone::FriendPhoneNumber > &phoneNumber) |
Removes a FriendPhoneNumber from this friend. More... | |
LINPHONECXX_PUBLIC void | save (const std::shared_ptr< linphone::Core > &core) |
Saves a friend either in database if configured, otherwise in linphonerc. More... | |
LINPHONECXX_PUBLIC void | setPresenceModelForUriOrTel (const std::string &uriOrTel, const std::shared_ptr< linphone::PresenceModel > &presence) |
Set the presence model for a specific SIP URI or phone number of a friend. More... | |
Static Public Member Functions | |
static LINPHONECXX_PUBLIC std::shared_ptr< linphone::Friend > | newFromVcard (const std::shared_ptr< linphone::Vcard > &vcard) |
Contructor same as linphone_friend_new + setAddress() More... | |
This object is used to store a SIP address.
Friend is mainly used to implement an adressbook feature, and are used as data for the MagicSearch object. If your proxy supports it, you can also use it to subscribe to presence information. The objects are stored in a FriendList which are in turn stored inside the Core. They can be stored inside a database if the path to it is configured, otherwise they will be lost after the Core is destroyed. Thanks to the vCard plugin, you can also store more information like phone numbers, organization, etc...
|
strong |
Enum describing the capabilities of a Friend, populated through presence subscribe/notify process.
Enumerator | |
---|---|
None | No capabilities populated. |
GroupChat | This friend can be invited in a Flexisip backend ChatRoom. |
LimeX3Dh | This friend can be invited in a Flexisip backend end-to-end encrypted ChatRoom. |
EphemeralMessages | This friend is able to delete ephemeral messages once they have expired. |
LINPHONECXX_PUBLIC void linphone::Friend::addAddress | ( | const std::shared_ptr< const linphone::Address > & | address | ) |
Adds an address in this friend.
address | Address object |
LINPHONECXX_PUBLIC void linphone::Friend::addListener | ( | const std::shared_ptr< FriendListener > & | listener | ) |
Add an application listener to the Friend instance.
listener | the application listener |
LINPHONECXX_PUBLIC void linphone::Friend::addPhoneNumber | ( | const std::string & | phoneNumber | ) |
Adds a phone number in this friend.
phoneNumber | number to add |
LINPHONECXX_PUBLIC void linphone::Friend::addPhoneNumberWithLabel | ( | const std::shared_ptr< linphone::FriendPhoneNumber > & | phoneNumber | ) |
Adds a FriendPhoneNumber to this friend.
phoneNumber | the FriendPhoneNumber to add |
LINPHONECXX_PUBLIC bool linphone::Friend::createVcard | ( | const std::string & | name | ) |
Creates a vCard object associated to this friend if there isn't one yet and if the full name is available, either by the parameter or the one in the friend's SIP URI.
name | The full name of the friend or nullptr to use the one from the friend's SIP URI |
LINPHONECXX_PUBLIC void linphone::Friend::edit | ( | ) |
Starts editing a friend configuration.
Because friend configuration must be consistent, applications MUST call edit() before doing any attempts to modify friend configuration (such as setAddress() or setIncSubscribePolicy()). Once the modifications are done, then the application must call done() to commit the changes.
LINPHONECXX_PUBLIC linphone::Status linphone::Friend::enableSubscribes | ( | bool | enable | ) |
Configure Friend to subscribe to presence information.
enable | if true this friend will receive subscription message |
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::Address> linphone::Friend::getAddress | ( | ) | const |
LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::Address> > linphone::Friend::getAddresses | ( | ) | const |
LINPHONECXX_PUBLIC int linphone::Friend::getCapabilities | ( | ) | const |
Returns the capabilities associated to this friend.
LINPHONECXX_PUBLIC float linphone::Friend::getCapabilityVersion | ( | Capability | capability | ) | const |
Returns the version of a friend's capbility.
capability | Capability object |
LINPHONECXX_PUBLIC linphone::ConsolidatedPresence linphone::Friend::getConsolidatedPresence | ( | ) | const |
Get the consolidated presence of a friend.
It will return the "most open" presence found if more than one presence model are found.
LINPHONECXX_PUBLIC std::shared_ptr<linphone::Core> linphone::Friend::getCore | ( | ) | const |
LINPHONECXX_PUBLIC linphone::SubscribePolicy linphone::Friend::getIncSubscribePolicy | ( | ) | const |
get current subscription policy for this Friend
LINPHONECXX_PUBLIC std::string linphone::Friend::getJobTitle | ( | ) | const |
Gets the contact's job title from it's vCard.
It's a shortcut to getVcard() and Vcard::getJobTitle().
LINPHONECXX_PUBLIC std::string linphone::Friend::getName | ( | ) | const |
Get the display name for this friend.
LINPHONECXX_PUBLIC std::string linphone::Friend::getNativeUri | ( | ) | const |
Gets the contact's native URI.
LINPHONECXX_PUBLIC std::string linphone::Friend::getOrganization | ( | ) | const |
Gets the contact's organization from it's vCard.
It's a shortcut to getVcard() and Vcard::getOrganization().
LINPHONECXX_PUBLIC std::list<std::string> linphone::Friend::getPhoneNumbers | ( | ) | const |
Returns a list of phone numbers for this friend.
LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::FriendPhoneNumber> > linphone::Friend::getPhoneNumbersWithLabel | ( | ) | const |
Returns a list of FriendPhoneNumber for this friend.
LINPHONECXX_PUBLIC std::string linphone::Friend::getPhoto | ( | ) | const |
Gets the contact's picture URI.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::PresenceModel> linphone::Friend::getPresenceModel | ( | ) | const |
Get the presence model of a friend.
If a friend has more than one SIP address and phone number, this method will return the most recent presence model using PresenceModel::getTimestamp().
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::PresenceModel> linphone::Friend::getPresenceModelForUriOrTel | ( | const std::string & | uriOrTel | ) | const |
Get the presence model for a specific SIP URI or phone number of a friend.
uriOrTel | The SIP URI or phone number for which to get the presence model |
LINPHONECXX_PUBLIC std::string linphone::Friend::getRefKey | ( | ) | const |
Get the reference key of a friend.
LINPHONECXX_PUBLIC bool linphone::Friend::getStarred | ( | ) | const |
Gets if the friend is to be considered as important for the user.
LINPHONECXX_PUBLIC linphone::SubscriptionState linphone::Friend::getSubscriptionState | ( | ) | const |
Get subscription state of a friend.
LINPHONECXX_PUBLIC std::shared_ptr<linphone::Vcard> linphone::Friend::getVcard | ( | ) | const |
Returns the vCard object associated to this friend, if any.
LINPHONECXX_PUBLIC bool linphone::Friend::hasCapability | ( | Capability | capability | ) | const |
Returns whether or not a friend has a capbility.
capability | Capability object |
LINPHONECXX_PUBLIC bool linphone::Friend::hasCapabilityWithVersion | ( | Capability | capability, |
float | version | ||
) | const |
Returns whether or not a friend has a capbility with a given version.
capability | Capability object |
version | the version to test |
LINPHONECXX_PUBLIC bool linphone::Friend::hasCapabilityWithVersionOrMore | ( | Capability | capability, |
float | version | ||
) | const |
Returns whether or not a friend has a capbility with a given version or more.
capability | Capability object |
version | the version to test |
LINPHONECXX_PUBLIC bool linphone::Friend::hasPhoneNumber | ( | const std::string & | phoneNumber | ) | const |
Returns whether a friend contains the given phone number.
phoneNumber | the phone number to search for |
LINPHONECXX_PUBLIC bool linphone::Friend::inList | ( | ) | const |
Check that the given friend is in a friend list.
LINPHONECXX_PUBLIC bool linphone::Friend::isPresenceReceived | ( | ) | const |
Tells whether we already received presence information for a friend.
|
static |
Contructor same as linphone_friend_new + setAddress()
vcard | a Vcard object |
LINPHONECXX_PUBLIC void linphone::Friend::removeAddress | ( | const std::shared_ptr< const linphone::Address > & | address | ) |
Removes an address in this friend.
address | Address object |
LINPHONECXX_PUBLIC void linphone::Friend::removeListener | ( | const std::shared_ptr< FriendListener > & | listener | ) |
Remove a previously added listener from the Friend instance.
listener | the application listener |
LINPHONECXX_PUBLIC void linphone::Friend::removePhoneNumber | ( | const std::string & | phoneNumber | ) |
Removes a phone number in this friend.
phoneNumber | number to remove |
LINPHONECXX_PUBLIC void linphone::Friend::removePhoneNumberWithLabel | ( | const std::shared_ptr< const linphone::FriendPhoneNumber > & | phoneNumber | ) |
Removes a FriendPhoneNumber from this friend.
phoneNumber | the FriendPhoneNumber to remove |
LINPHONECXX_PUBLIC void linphone::Friend::save | ( | const std::shared_ptr< linphone::Core > & | core | ) |
Saves a friend either in database if configured, otherwise in linphonerc.
core | the linphone core |
LINPHONECXX_PUBLIC linphone::Status linphone::Friend::setAddress | ( | const std::shared_ptr< const linphone::Address > & | address | ) |
LINPHONECXX_PUBLIC linphone::Status linphone::Friend::setIncSubscribePolicy | ( | linphone::SubscribePolicy | policy | ) |
Configure incoming subscription policy for this friend.
policy | SubscribePolicy policy to apply. |
LINPHONECXX_PUBLIC void linphone::Friend::setJobTitle | ( | const std::string & | jobTitle | ) |
Sets the contact's job title.
It's a shortcut to getVcard() and Vcard::setJobTitle().
jobTitle | the job title to store in Friend's vCard. |
LINPHONECXX_PUBLIC linphone::Status linphone::Friend::setName | ( | const std::string & | name | ) |
Set the display name for this friend.
name | the display name to set |
LINPHONECXX_PUBLIC void linphone::Friend::setNativeUri | ( | const std::string & | nativeUri | ) |
Sets the contact's native URI.
nativeUri | the URI that matches the contact on the native system. |
LINPHONECXX_PUBLIC void linphone::Friend::setOrganization | ( | const std::string & | organization | ) |
Sets the contact's organization.
It's a shortcut to getVcard() and Vcard::setOrganization().
organization | the organization to store in Friend's vCard. |
LINPHONECXX_PUBLIC void linphone::Friend::setPhoto | ( | const std::string & | pictureUri | ) |
Sets the contact's picture URI.
pictureUri | the picture URI to set. |
LINPHONECXX_PUBLIC void linphone::Friend::setPresenceModel | ( | const std::shared_ptr< linphone::PresenceModel > & | presence | ) |
Set the presence model of a friend.
presence | The PresenceModel object to set for the friend |
LINPHONECXX_PUBLIC void linphone::Friend::setPresenceModelForUriOrTel | ( | const std::string & | uriOrTel, |
const std::shared_ptr< linphone::PresenceModel > & | presence | ||
) |
Set the presence model for a specific SIP URI or phone number of a friend.
uriOrTel | The SIP URI or phone number for which to set the presence model |
presence | The PresenceModel object to set |
LINPHONECXX_PUBLIC void linphone::Friend::setRefKey | ( | const std::string & | key | ) |
Set the reference key of a friend.
key | The reference key to use for the friend. |
LINPHONECXX_PUBLIC void linphone::Friend::setStarred | ( | bool | isStarred | ) |
Sets if the friend is a user's favorite or important contact.
isStarred | true if the friend is to be considered as important, false otherwise. |
LINPHONECXX_PUBLIC void linphone::Friend::setVcard | ( | const std::shared_ptr< linphone::Vcard > & | vcard | ) |
Binds a vCard object to a friend.
vcard | The Vcard object to bind |
LINPHONECXX_PUBLIC bool linphone::Friend::subscribesEnabled | ( | ) | const |
get subscription flag value