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.
  • Method Details

    • getCore

      @NonNull 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

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

      Returns:
      The display name of the friend list.
    • setDisplayName

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

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

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

      Returns:
      A list of Friend
    • isSubscriptionBodyless

      boolean 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.
    • getRlsAddress

      @Nullable 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(@Nullable 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 @Nullable String getRlsUri()
      Deprecated.
      27/10/2020. Use getRlsAddress() instead.
      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.
    • setRlsUri

      @Deprecated void setRlsUri(@Nullable 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.
    • setSubscriptionBodyless

      void setSubscriptionBodyless(boolean 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.
    • 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

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

      Returns:
      The URI associated with the friend list.
    • setUri

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

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

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

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

      @Nullable Friend findFriendByAddress(@NonNull 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

      @Nullable Friend findFriendByPhoneNumber(@NonNull 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

      @Nullable Friend findFriendByRefKey(@NonNull 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

      @Nullable Friend findFriendByUri(@NonNull 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

      @NonNull Friend[] findFriendsByAddress(@NonNull 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.
    • findFriendsByUri

      @NonNull Friend[] findFriendsByUri(@NonNull 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.
    • importFriendsFromVcard4Buffer

      int importFriendsFromVcard4Buffer(@NonNull 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(@NonNull 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(@NonNull 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(@NonNull 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.

    • updateDirtyFriends

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

    • updateRevision

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

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