Package org.linphone.core

# Interface FriendList

public interface FriendList
This object representing a list of `Friend`.
You can use it to store contacts locally or synchronize them through CardDAV
protocol.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static enum`
`FriendList.Status`
`static enum`
`FriendList.SyncStatus`
`static enum`
`FriendList.Type`

## Method Summary

Modifier and Type
Method
Description
`FriendList.Status`
`addFriend(Friend linphoneFriend)`
Add a friend to a friend list.
`void`
`addListener(FriendListListener listener)`
`FriendList.Status`
`addLocalFriend(Friend linphoneFriend)`
Add a friend to a friend list.
`void`
`exportFriendsAsVcard4File(String vcardFile)`
Creates and export `Friend` objects from `FriendList` to a file
using vCard 4 format.
`Friend`
`findFriendByAddress(Address address)`
Find a friend in the friend list using a LinphoneAddress.
`Friend`
`findFriendByPhoneNumber(String phoneNumber)`
Find a friend in the friend list using a phone number.
`Friend`
`findFriendByRefKey(String refKey)`
Find a friend in the friend list using a ref key.
`Friend`
`findFriendByUri(String uri)`
Find a friend in the friend list using an URI string.
`Friend[]`
`findFriendsByAddress(Address address)`
Find all friends in the friend list using a LinphoneAddress.
`Friend[]`
`findFriendsByUri(String uri)`
Find all friends in the friend list using an URI string.
`Core`
`getCore()`
Returns the `Core` object attached to this LinphoneFriendList.
`String`
`getDisplayName()`
Get the display name of the friend list.
`Friend[]`
`getFriends()`
Retrieves the list of `Friend` from this LinphoneFriendList.
`boolean`
`getIsReadOnly()`
Gets whether this friend list is read only or not.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`Address`
`getRlsAddress()`
Get the RLS (Resource List Server) URI associated with the friend list to
subscribe to these friends presence.
`String`
`getRlsUri()`
Deprecated.
`FriendList.Type`
`getType()`
Get the `FriendList.Type` of a friend list.
`String`
`getUri()`
Get the URI associated with the friend list.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`int`
`importFriendsFromVcard4Buffer(String vcardBuffer)`
Creates and adds `Friend` objects to `FriendList` from a buffer
that contains the vCard(s) to parse.
`int`
`importFriendsFromVcard4File(String vcardFile)`
Creates and adds `Friend` objects to `FriendList` from a file that
contains the vCard(s) to parse.
`boolean`
`isDatabaseStorageEnabled()`
Gets whether this friend list and it's friends will be stored in DB or not.
`boolean`
`isSubscriptionBodyless()`
Get wether the subscription of the friend list is bodyless or not.
`boolean`
`isSubscriptionsEnabled()`
Gets whether subscription to NOTIFYs are enabled or not.
`void`
`notifyPresence(PresenceModel presence)`
Notify our presence to all the friends in the friend list that have subscribed
to our presence directly (not using a RLS).
`FriendList.Status`
`removeFriend(Friend linphoneFriend)`
Remove a friend from a friend list.
`void`
`removeListener(FriendListListener listener)`
`void`
`setDatabaseStorageEnabled(boolean enable)`
Sets whether this friend list and it's friends will be stored in DB or not.
`void`
`setDisplayName(String displayName)`
Set the display name of the friend list.
`void`
`setIsReadOnly(boolean readOnly)`
Sets whether this friend list is read only or not.
`void`
`setRlsAddress(Address rlsAddr)`
Set the RLS (Resource List Server) URI associated with the friend list to
subscribe to these friends presence.
`void`
`setRlsUri(String rlsUri)`
Deprecated.
`void`
`setSubscriptionBodyless(boolean bodyless)`
Set wether the subscription of the friend list is bodyless or not.
`void`
`setSubscriptionsEnabled(boolean enabled)`
Enable subscription to NOTIFYs.
`void`
`setType(FriendList.Type type)`
Assign a friend list type to the friend list.
`void`
`setUri(String uri)`
Set the URI associated with the friend list.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`void`
`synchronizeFriendsFromServer()`
Starts a CardDAV synchronization using value set using
linphone_friend_list_set_uri.
`boolean`
`synchronizeFriendsWith(Friend[] sourceFriends)`
Synchronize a local friendlist with another list of friends.
`String`
`toString()`
`void`
`updateDirtyFriends()`
Goes through all the `Friend` that are dirty and does a CardDAV PUT to
update the server.
`void`
`updateRevision(String revision)`
Sets the revision from the last synchronization.
`void`
`updateSubscriptions()`
Update presence subscriptions for the entire list.

## Method Details

### getCore

Core getCore()
Returns the `Core` object attached to this LinphoneFriendList.

Returns:
  a `Core` object

### isDatabaseStorageEnabled

boolean isDatabaseStorageEnabled()
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

### setDatabaseStorageEnabled

void setDatabaseStorageEnabled(boolean enable)
Sets whether this friend list and it's friends will be stored in DB or not.

Parameters:
  `enable` - true to enable this friend list storage in DB, false to disable
  it.

### getDisplayName

String getDisplayName()
Get the display name of the friend list.

Returns:
  The display name of the friend list.

### setDisplayName

void setDisplayName(String displayName)
Set the display name of the friend list.

Parameters:
  `displayName` - The new display name of the friend list.

### getFriends

Friend[] getFriends()
Retrieves the list of `Friend` from this LinphoneFriendList.

Returns:
  A list of `Friend` A list of `Friend` objects.

### getIsReadOnly

boolean getIsReadOnly()
Gets whether this friend list is read only or not.
If it is, you won't be able to add/remove friends in/from it, nor to edit
existing friends in it.

Returns:
  true if this friend list is in read-only mode and thus can't be
  modified, false otherwise.

### setIsReadOnly

void setIsReadOnly(boolean readOnly)
Sets whether this friend list is read only or not.
If it is, you won't be able to add/remove friends in/from it, nor to edit
existing friends in it.

Parameters:
  `readOnly` - true to make this friend list "read only", false otherwise.

### isSubscriptionBodyless

boolean isSubscriptionBodyless()
Get wether the subscription of the friend list is bodyless or not.

Returns:
  Wether the subscription of the friend list is bodyless or not.

### getRlsAddress

Address getRlsAddress()
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.

### setRlsAddress

void setRlsAddress(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.

### getRlsUri

@Deprecated String getRlsUri()
Deprecated.
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.

### setRlsUri

@Deprecated void setRlsUri(String rlsUri)
Deprecated.
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(org.linphone.core.Address)` instead.

### setSubscriptionBodyless

void setSubscriptionBodyless(boolean bodyless)
Set wether 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.

### isSubscriptionsEnabled

boolean isSubscriptionsEnabled()
Gets whether subscription to NOTIFYs are enabled or not.

Returns:
  Whether subscriptions are enabled or not

### setSubscriptionsEnabled

void setSubscriptionsEnabled(boolean enabled)
Enable subscription to NOTIFYs.

Parameters:
  `enabled` - should subscription be enabled or not

### getType

FriendList.Type getType()
Get the `FriendList.Type` of a friend list.

### setType

void setType(FriendList.Type type)
Assign a friend list type to the friend list.

Parameters:
  `type` - `FriendList.Type` to assign

### getUri

String getUri()
Get the URI associated with the friend list.

Returns:
  The URI associated with the friend list.

### setUri

void setUri(String uri)
Set the URI associated with the friend list.

Parameters:
  `uri` - The URI to associate with the friend list.

### addFriend

FriendList.Status addFriend(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:
  `FriendList.Status.OK` if successfully added, `FriendList.Status.InvalidFriend`
  if the friend is not valid.

### addLocalFriend

FriendList.Status addLocalFriend(Friend linphoneFriend)
Add a friend to a friend list.
The friend will never be sent to a remote CardDAV server. Warning! `Friend`
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:
  `FriendList.Status.OK` if successfully added, `FriendList.Status.InvalidFriend`
  if the friend is not valid.

### exportFriendsAsVcard4File

void exportFriendsAsVcard4File(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

Friend findFriendByAddress(Address address)
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, null otherwise.

### findFriendByPhoneNumber

Friend findFriendByPhoneNumber(String phoneNumber)
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, null otherwise.

### findFriendByRefKey

Friend findFriendByRefKey(String refKey)
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, null otherwise.

### findFriendByUri

Friend findFriendByUri(String uri)
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, null otherwise.

### findFriendsByAddress

Friend[] findFriendsByAddress(Address address)
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, null otherwise. A list of `Friend`
  objects.

### findFriendsByUri

Friend[] findFriendsByUri(String uri)
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, null otherwise. A list of `Friend`
  objects.

### importFriendsFromVcard4Buffer

int importFriendsFromVcard4Buffer(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

int importFriendsFromVcard4File(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

### notifyPresence

void notifyPresence(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

FriendList.Status removeFriend(Friend linphoneFriend)
Remove a friend from a friend list.

Parameters:
  `linphoneFriend` - `Friend` object to remove from the friend list.
Returns:
  `FriendList.Status.OK` if removed successfully, `FriendList.Status.NonExistentFriend`
  if the friend is not in the list.

### synchronizeFriendsFromServer

void synchronizeFriendsFromServer()
Starts a CardDAV synchronization using value set using
linphone_friend_list_set_uri.

### synchronizeFriendsWith

boolean synchronizeFriendsWith(Friend[] sourceFriends)
Synchronize a local friendlist with another list of friends.
All friends in common will be updated using the data from the source friends.
Missing friends from the source friends will be added. Extra friends from the
local friendlist will be removed.

Parameters:
  `sourceFriends` - the list of `Friend` whose data will be copied. (not
  a `FriendList` !) A list of `Friend` objects.
Returns:
  true if the friendlist has been modified, false if no change happened

### updateDirtyFriends

void updateDirtyFriends()
Goes through all the `Friend` that are dirty and does a CardDAV PUT to
update the server.

### updateRevision

void updateRevision(String revision)
Sets the revision from the last synchronization.

Parameters:
  `revision` - The revision.
  warning: before 5.4.0 release revision was an int, it's now a string.

### updateSubscriptions

void 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.

### addListener

void addListener(FriendListListener listener)

### removeListener

void removeListener(FriendListListener listener)

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`