Liblinphone 5.2.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 class | SyncStatus { Started = 0 , Successful = 1 , Failure = 2 }
| Enum describing the status of a CardDAV synchronization. More...
enum class | Status { OK = 0 , NonExistentFriend = 1 , InvalidFriend = 2 }
| Enum describing the status of a LinphoneFriendList operation. More...

## 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.
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< FriendListListener > &listener)
| Remove a previously added listener from the FriendList instance.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const
| Returns the Core object attached to this LinphoneFriendList.
LINPHONECXX_PUBLIC std::string | getDisplayName () const
| Get the display name of the friend list.
LINPHONECXX_PUBLIC void | setDisplayName (const std::string &displayName)
| Set the display name of the friend list.
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Friend > > | getFriends () const
| Retrieves the list of Friend from this LinphoneFriendList.
LINPHONECXX_PUBLIC bool | isSubscriptionBodyless ()
| Get wheter the subscription of the friend list is bodyless or not.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getRlsAddress () const
| Get the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.
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.
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.
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.
LINPHONECXX_PUBLIC void | setSubscriptionBodyless (bool bodyless)
| Set wheter the subscription of the friend list is bodyless or not.
LINPHONECXX_PUBLIC bool | subscriptionsEnabled ()
| Gets whether subscription to NOTIFYs are enabled or not.
LINPHONECXX_PUBLIC void | enableSubscriptions (bool enabled)
| Enable subscription to NOTIFYs.
LINPHONECXX_PUBLIC linphone::FriendListType | getType ()
| Get the FriendListType of a friend list.
LINPHONECXX_PUBLIC void | setType (linphone::FriendListType type)
| Assign a friend list type to the friend list.
LINPHONECXX_PUBLIC std::string | getUri () const
| Get the URI associated with the friend list.
LINPHONECXX_PUBLIC void | setUri (const std::string &uri)
| Set the URI associated with the friend list.
LINPHONECXX_PUBLIC Status | addFriend (const std::shared_ptr< linphone::Friend > &linphoneFriend)
| Add a friend to a friend list.
LINPHONECXX_PUBLIC Status | addLocalFriend (const std::shared_ptr< linphone::Friend > &linphoneFriend)
| Add a friend to a friend list.
LINPHONECXX_PUBLIC void | exportFriendsAsVcard4File (const std::string &vcardFile)
| Creates and export Friend objects from FriendList to a file using vCard 4 format.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Friend > | findFriendByAddress (const std::shared_ptr< const linphone::Address > &address) const
| Find a friend in the friend list using a LinphoneAddress.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Friend > | findFriendByPhoneNumber (const std::string &phoneNumber) const
| Find a friend in the friend list using a phone number.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Friend > | findFriendByRefKey (const std::string &refKey) const
| Find a friend in the friend list using a ref key.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Friend > | findFriendByUri (const std::string &uri) const
| Find a friend in the friend list using an URI string.
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.
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.
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.
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.
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).
LINPHONECXX_PUBLIC Status | removeFriend (const std::shared_ptr< linphone::Friend > &linphoneFriend)
| Remove a friend from a friend list.
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.
LINPHONECXX_PUBLIC void | updateSubscriptions ()
| Update presence subscriptions for the entire list.

## 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 class linphone::FriendList::Status
| strong

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 class linphone::FriendList::SyncStatus
| strong

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

  linphoneFriend | Friend 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

  listener | the 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

  linphoneFriend | Friend object to add to the friend list.

Returns
  Status::OK if successfully added, Status::InvalidFriend if the friend is not valid.

## ◆ enableSubscriptions()

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

Enable subscription to NOTIFYs.

Parameters

  enabled | should 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

  vcardFile | the 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

  address | Address 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

  phoneNumber | a 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

  refKey | The 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

  uri | A 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

  address | Address 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

  uri | A 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< const 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.

## ◆ getType()

LINPHONECXX_PUBLIC linphone::FriendListType linphone::FriendList::getType | ( |  | ) |

Get the FriendListType of a friend list.

Returns
  the FriendListType of the list

## ◆ 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

  vcardBuffer | the 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

  vcardFile | the 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 | ( |  | ) |

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

  presence | PresenceModel object.

## ◆ removeFriend()

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

Remove a friend from a friend list.

Parameters

  linphoneFriend | Friend 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

  listener | the application listener

## ◆ setDisplayName()

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

Set the display name of the friend list.

Parameters

  displayName | The 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

  rlsAddr | The 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

  rlsUri | The 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

  bodyless | boolean telling if the subscription of the friend list is bodyless or not.

## ◆ setType()

LINPHONECXX_PUBLIC void linphone::FriendList::setType | ( | linphone::FriendListType | type | ) |

Assign a friend list type to the friend list.

Parameters

  type | FriendListType to assign

## ◆ setUri()

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

Set the URI associated with the friend list.

Parameters

  uri | The 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

  revision | The 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:

- friend_list.hh