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

This object representing a list of Friend. More...

#include <friend_list.hh>

Inheritance diagram for linphone::FriendList:

Public Types

enum  SyncStatus {
  SyncStatus::Started = 0,
  SyncStatus::Successful = 1,
  SyncStatus::Failure = 2
}
 Enum describing the status of a CardDAV synchronization. More...
 
enum  Status {
  Status::OK = 0,
  Status::NonExistentFriend = 1,
  Status::InvalidFriend = 2
}
 Enum describing the status of a LinphoneFriendList operation. More...
 
enum  Type {
  Default = -1,
  CardDAV = 0,
  VCard4 = 1
}
 The types of FriendList.
 

Public Member Functions

LINPHONECXX_PUBLIC FriendList (void *ptr, bool takeRef=true)
 
LINPHONECXX_PUBLIC _LinphoneFriendList * cPtr ()
 
LINPHONECXX_PUBLIC void addListener (const std::shared_ptr< FriendListListener > &listener)
 Add an application listener to the FriendList instance. More...
 
LINPHONECXX_PUBLIC void removeListener (const std::shared_ptr< FriendListListener > &listener)
 Remove a previously added listener from the FriendList instance. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::CoregetCore () const
 Returns the Core object attached to this LinphoneFriendList. More...
 
LINPHONECXX_PUBLIC bool databaseStorageEnabled () const
 Gets whether this friend list and it's friends will be stored in DB or not. More...
 
LINPHONECXX_PUBLIC void enableDatabaseStorage (bool enable)
 Sets whether this friend list and it's friends will be stored in DB or not. More...
 
LINPHONECXX_PUBLIC std::string getDisplayName () const
 Get the display name of the friend list. More...
 
LINPHONECXX_PUBLIC void setDisplayName (const std::string &displayName)
 Set the display name of the friend list. More...
 
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Friend > > getFriends () const
 Retrieves the list of Friend from this LinphoneFriendList. More...
 
LINPHONECXX_PUBLIC bool isSubscriptionBodyless () const
 Get wheter the subscription of the friend list is bodyless or not. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::AddressgetRlsAddress () const
 Get the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence. More...
 
LINPHONECXX_PUBLIC void setRlsAddress (const std::shared_ptr< const linphone::Address > &rlsAddr)
 Set the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence. More...
 
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string getRlsUri () const
 Get the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence. More...
 
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void setRlsUri (const std::string &rlsUri)
 Set the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence. More...
 
LINPHONECXX_PUBLIC void setSubscriptionBodyless (bool bodyless)
 Set wheter the subscription of the friend list is bodyless or not. More...
 
LINPHONECXX_PUBLIC bool subscriptionsEnabled ()
 Gets whether subscription to NOTIFYs are enabled or not. More...
 
LINPHONECXX_PUBLIC void enableSubscriptions (bool enabled)
 Enable subscription to NOTIFYs. More...
 
LINPHONECXX_PUBLIC Type getType ()
 Get the Type of a friend list.
 
LINPHONECXX_PUBLIC void setType (Type type)
 Assign a friend list type to the friend list. More...
 
LINPHONECXX_PUBLIC std::string getUri () const
 Get the URI associated with the friend list. More...
 
LINPHONECXX_PUBLIC void setUri (const std::string &uri)
 Set the URI associated with the friend list. More...
 
LINPHONECXX_PUBLIC Status addFriend (const std::shared_ptr< linphone::Friend > &linphoneFriend)
 Add a friend to a friend list. More...
 
LINPHONECXX_PUBLIC Status addLocalFriend (const std::shared_ptr< linphone::Friend > &linphoneFriend)
 Add a friend to a friend list. More...
 
LINPHONECXX_PUBLIC void exportFriendsAsVcard4File (const std::string &vcardFile)
 Creates and export Friend objects from FriendList to a file using vCard 4 format. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::FriendfindFriendByAddress (const std::shared_ptr< const linphone::Address > &address) const
 Find a friend in the friend list using a LinphoneAddress. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::FriendfindFriendByPhoneNumber (const std::string &phoneNumber) const
 Find a friend in the friend list using a phone number. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::FriendfindFriendByRefKey (const std::string &refKey) const
 Find a friend in the friend list using a ref key. More...
 
LINPHONECXX_PUBLIC std::shared_ptr< linphone::FriendfindFriendByUri (const std::string &uri) const
 Find a friend in the friend list using an URI string. More...
 
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Friend > > findFriendsByAddress (const std::shared_ptr< const linphone::Address > &address) const
 Find all friends in the friend list using a LinphoneAddress. More...
 
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Friend > > findFriendsByUri (const std::string &uri) const
 Find all friends in the friend list using an URI string. More...
 
LINPHONECXX_PUBLIC int importFriendsFromVcard4Buffer (const std::string &vcardBuffer)
 Creates and adds Friend objects to FriendList from a buffer that contains the vCard(s) to parse. More...
 
LINPHONECXX_PUBLIC int importFriendsFromVcard4File (const std::string &vcardFile)
 Creates and adds Friend objects to FriendList from a file that contains the vCard(s) to parse. More...
 
LINPHONECXX_PUBLIC void notifyPresence (const std::shared_ptr< linphone::PresenceModel > &presence)
 Notify our presence to all the friends in the friend list that have subscribed to our presence directly (not using a RLS). More...
 
LINPHONECXX_PUBLIC Status removeFriend (const std::shared_ptr< linphone::Friend > &linphoneFriend)
 Remove a friend from a friend list. More...
 
LINPHONECXX_PUBLIC void synchronizeFriendsFromServer ()
 Starts a CardDAV synchronization using value set using linphone_friend_list_set_uri.
 
LINPHONECXX_PUBLIC void updateDirtyFriends ()
 Goes through all the Friend that are dirty and does a CardDAV PUT to update the server.
 
LINPHONECXX_PUBLIC void updateRevision (int revision)
 Sets the revision from the last synchronization. More...
 
LINPHONECXX_PUBLIC void updateSubscriptions ()
 Update presence subscriptions for the entire list. More...
 

Detailed Description

This object representing a list of Friend.

You can use it to store contacts locally or synchronize them through CardDAV protocol.

Member Enumeration Documentation

◆ Status

Enum describing the status of a LinphoneFriendList operation.

Enumerator
OK 

Operation went fine.

NonExistentFriend 

Friend wasn't found in the FriendList

InvalidFriend 

Friend is already present in a FriendList

◆ SyncStatus

Enum describing the status of a CardDAV synchronization.

Enumerator
Started 

Synchronization started.

Successful 

Synchronization finished successfuly.

Failure 

Synchronization failed.

Member Function Documentation

◆ addFriend()

LINPHONECXX_PUBLIC Status linphone::FriendList::addFriend ( const std::shared_ptr< linphone::Friend > &  linphoneFriend)

Add a friend to a friend list.

If or when a remote CardDAV server will be attached to the list, the friend will be sent to the server.

Parameters
linphoneFriendFriend object to add to the friend list.
Returns
Status::OK if successfully added, Status::InvalidFriend if the friend is not valid.

◆ addListener()

LINPHONECXX_PUBLIC void linphone::FriendList::addListener ( const std::shared_ptr< FriendListListener > &  listener)

Add an application listener to the FriendList instance.

Parameters
listenerthe application listener

◆ addLocalFriend()

LINPHONECXX_PUBLIC Status linphone::FriendList::addLocalFriend ( const std::shared_ptr< linphone::Friend > &  linphoneFriend)

Add a friend to a friend list.

The friend will never be sent to a remote CardDAV server. Warning! #LinphoneFriends added this way will be removed on the next synchronization, and the callback contact_deleted will be called.

Parameters
linphoneFriendFriend object to add to the friend list.
Returns
Status::OK if successfully added, Status::InvalidFriend if the friend is not valid.

◆ databaseStorageEnabled()

LINPHONECXX_PUBLIC bool linphone::FriendList::databaseStorageEnabled ( ) const

Gets whether this friend list and it's friends will be stored in DB or not.

Returns
Whether the list and it's friends will be saved in database or not

◆ enableDatabaseStorage()

LINPHONECXX_PUBLIC void linphone::FriendList::enableDatabaseStorage ( bool  enable)

Sets whether this friend list and it's friends will be stored in DB or not.

Parameters
enabletrue to enable this friend list storage in DB, false to disable it.

◆ enableSubscriptions()

LINPHONECXX_PUBLIC void linphone::FriendList::enableSubscriptions ( bool  enabled)

Enable subscription to NOTIFYs.

Parameters
enabledshould subscription be enabled or not

◆ exportFriendsAsVcard4File()

LINPHONECXX_PUBLIC void linphone::FriendList::exportFriendsAsVcard4File ( const std::string &  vcardFile)

Creates and export Friend objects from FriendList to a file using vCard 4 format.

Parameters
vcardFilethe path to a file that will contain the vCards

◆ findFriendByAddress()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Friend> linphone::FriendList::findFriendByAddress ( const std::shared_ptr< const linphone::Address > &  address) const

Find a friend in the friend list using a LinphoneAddress.

Parameters
addressAddress object of the friend we want to search for.
Returns
A Friend if found, nullptr otherwise.

◆ findFriendByPhoneNumber()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Friend> linphone::FriendList::findFriendByPhoneNumber ( const std::string &  phoneNumber) const

Find a friend in the friend list using a phone number.

Parameters
phoneNumbera string of the phone number for which we want to find a friend.
Returns
A Friend if found, nullptr otherwise.

◆ findFriendByRefKey()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Friend> linphone::FriendList::findFriendByRefKey ( const std::string &  refKey) const

Find a friend in the friend list using a ref key.

Parameters
refKeyThe ref key string of the friend we want to search for.
Returns
A Friend if found, nullptr otherwise.

◆ findFriendByUri()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Friend> linphone::FriendList::findFriendByUri ( const std::string &  uri) const

Find a friend in the friend list using an URI string.

Parameters
uriA string containing the URI of the friend we want to search for.
Returns
A Friend if found, nullptr otherwise.

◆ findFriendsByAddress()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::Friend> > linphone::FriendList::findFriendsByAddress ( const std::shared_ptr< const linphone::Address > &  address) const

Find all friends in the friend list using a LinphoneAddress.

Parameters
addressAddress object of the friends we want to search for.
Returns
A list of Friend if found, nullptr otherwise.

◆ findFriendsByUri()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::Friend> > linphone::FriendList::findFriendsByUri ( const std::string &  uri) const

Find all friends in the friend list using an URI string.

Parameters
uriA string containing the URI of the friends we want to search for.
Returns
A list of Friend if found, nullptr otherwise.

◆ getCore()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Core> linphone::FriendList::getCore ( ) const

Returns the Core object attached to this LinphoneFriendList.

Returns
a Core object

◆ getDisplayName()

LINPHONECXX_PUBLIC std::string linphone::FriendList::getDisplayName ( ) const

Get the display name of the friend list.

Returns
The display name of the friend list.

◆ getFriends()

LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::Friend> > linphone::FriendList::getFriends ( ) const

Retrieves the list of Friend from this LinphoneFriendList.

Returns
A list of Friend

◆ getRlsAddress()

LINPHONECXX_PUBLIC std::shared_ptr<linphone::Address> linphone::FriendList::getRlsAddress ( ) const

Get the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.

Returns
The RLS URI as Address associated with the friend list.

◆ getRlsUri()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string linphone::FriendList::getRlsUri ( ) const

Get the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.

Returns
The RLS URI associated with the friend list.
Deprecated:
27/10/2020. Use getRlsAddress() instead.

◆ getUri()

LINPHONECXX_PUBLIC std::string linphone::FriendList::getUri ( ) const

Get the URI associated with the friend list.

Returns
The URI associated with the friend list.

◆ importFriendsFromVcard4Buffer()

LINPHONECXX_PUBLIC int linphone::FriendList::importFriendsFromVcard4Buffer ( const std::string &  vcardBuffer)

Creates and adds Friend objects to FriendList from a buffer that contains the vCard(s) to parse.

Parameters
vcardBufferthe buffer that contains the vCard(s) to parse
Returns
the amount of linphone friends created

◆ importFriendsFromVcard4File()

LINPHONECXX_PUBLIC int linphone::FriendList::importFriendsFromVcard4File ( const std::string &  vcardFile)

Creates and adds Friend objects to FriendList from a file that contains the vCard(s) to parse.

Parameters
vcardFilethe path to a file that contains the vCard(s) to parse
Returns
the amount of linphone friends created

◆ isSubscriptionBodyless()

LINPHONECXX_PUBLIC bool linphone::FriendList::isSubscriptionBodyless ( ) const

Get wheter the subscription of the friend list is bodyless or not.

Returns
Wheter the subscription of the friend list is bodyless or not.

◆ notifyPresence()

LINPHONECXX_PUBLIC void linphone::FriendList::notifyPresence ( const std::shared_ptr< linphone::PresenceModel > &  presence)

Notify our presence to all the friends in the friend list that have subscribed to our presence directly (not using a RLS).

Parameters
presencePresenceModel object.

◆ removeFriend()

LINPHONECXX_PUBLIC Status linphone::FriendList::removeFriend ( const std::shared_ptr< linphone::Friend > &  linphoneFriend)

Remove a friend from a friend list.

Parameters
linphoneFriendFriend object to remove from the friend list.
Returns
Status::OK if removed successfully, Status::NonExistentFriend if the friend is not in the list.

◆ removeListener()

LINPHONECXX_PUBLIC void linphone::FriendList::removeListener ( const std::shared_ptr< FriendListListener > &  listener)

Remove a previously added listener from the FriendList instance.

Parameters
listenerthe application listener

◆ setDisplayName()

LINPHONECXX_PUBLIC void linphone::FriendList::setDisplayName ( const std::string &  displayName)

Set the display name of the friend list.

Parameters
displayNameThe new display name of the friend list.

◆ setRlsAddress()

LINPHONECXX_PUBLIC void linphone::FriendList::setRlsAddress ( const std::shared_ptr< const linphone::Address > &  rlsAddr)

Set the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.

Parameters
rlsAddrThe RLS URI to associate with the friend list.

◆ setRlsUri()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void linphone::FriendList::setRlsUri ( const std::string &  rlsUri)

Set the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.

Parameters
rlsUriThe RLS URI to associate with the friend list.
Deprecated:
27/10/2020. Use setRlsAddress() instead.

◆ setSubscriptionBodyless()

LINPHONECXX_PUBLIC void linphone::FriendList::setSubscriptionBodyless ( bool  bodyless)

Set wheter the subscription of the friend list is bodyless or not.

Parameters
bodylessboolean telling if the subscription of the friend list is bodyless or not.

◆ setType()

LINPHONECXX_PUBLIC void linphone::FriendList::setType ( Type  type)

Assign a friend list type to the friend list.

Parameters
typeType to assign

◆ setUri()

LINPHONECXX_PUBLIC void linphone::FriendList::setUri ( const std::string &  uri)

Set the URI associated with the friend list.

Parameters
uriThe URI to associate with the friend list.

◆ subscriptionsEnabled()

LINPHONECXX_PUBLIC bool linphone::FriendList::subscriptionsEnabled ( )

Gets whether subscription to NOTIFYs are enabled or not.

Returns
Whether subscriptions are enabled or not

◆ updateRevision()

LINPHONECXX_PUBLIC void linphone::FriendList::updateRevision ( int  revision)

Sets the revision from the last synchronization.

Parameters
revisionThe revision

◆ updateSubscriptions()

LINPHONECXX_PUBLIC void linphone::FriendList::updateSubscriptions ( )

Update presence subscriptions for the entire list.

Calling this function is necessary when list subscriptions are enabled, ie when a RLS presence server is used.


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