Friend

public class Friend : LinphoneObject

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…

  • Undocumented

    Declaration

    Swift

    public static func getSwiftObject(cObject: OpaquePointer) -> Friend
  • Undocumented

    Declaration

    Swift

    public var getCobject: OpaquePointer? { get }
  • Contructor same as linphone_friend_new + setAddress()

    Declaration

    Swift

    public static func newFromVcard(vcard: Vcard) -> Friend?

    Parameters

    vcard

    a Vcard object

    Return Value

    a new Friend which has its vCard attribute initialized from the given vCard. This can be get by getVcard().

  • Get address of this friend.

    Note

    the Address object returned is hold by the LinphoneFriend, however calling several time this function may return different objects.

    Declaration

    Swift

    public var address: Address? { get }

    Return Value

    the Address.

  • Undocumented

    Declaration

    Swift

    public func setAddress(newValue: Address) throws
  • Returns a list of Address for this friend.

    Declaration

    Swift

    public var addresses: [Address] { get }

    Return Value

    A list of Address.

  • Returns the capabilities associated to this friend.

    Declaration

    Swift

    public var capabilities: Int { get }

    Return Value

    an int representing the capabilities of the friend

  • Get the consolidated presence of a friend.

    Declaration

    Swift

    public var consolidatedPresence: ConsolidatedPresence { get }

    Return Value

    The ConsolidatedPresence of the friend

  • Returns the Core object managing this friend, if any.

    Declaration

    Swift

    public var core: Core? { get }

    Return Value

    the Core object associated.

  • get current subscription policy for this Friend

    Declaration

    Swift

    public var incSubscribePolicy: SubscribePolicy { get }

    Return Value

    the SubscribePolicy enum

  • Undocumented

    Declaration

    Swift

    public func setIncsubscribepolicy(newValue: SubscribePolicy) throws
  • Tells whether we already received presence information for a friend.

    Declaration

    Swift

    public var isPresenceReceived: Bool { get }

    Return Value

    true if presence information has been received for the friend, false otherwise.

  • Get the display name for this friend.

    Declaration

    Swift

    public var name: String { get }

    Return Value

    The display name of this friend.

  • Undocumented

    Declaration

    Swift

    public func setName(newValue: String) throws
  • Returns a list of phone numbers for this friend.

    Declaration

    Swift

    public var phoneNumbers: [String] { get }

    Return Value

    A list of phone numbers as string.

  • Get the presence model of a friend.

    Declaration

    Swift

    public var presenceModel: PresenceModel? { get set }

    Return Value

    A PresenceModel object, or nil if the friend do not have presence information (in which case he is considered offline).

  • Get the reference key of a friend.

    Declaration

    Swift

    public var refKey: String { get set }

    Return Value

    The reference key of the friend.

  • get subscription flag value

    Declaration

    Swift

    public var subscribesEnabled: Bool { get }

    Return Value

    returns true is subscription is activated for this friend

  • Undocumented

    Declaration

    Swift

    public func setSubscribesenabled(newValue: Bool) throws
  • Get subscription state of a friend.

    Declaration

    Swift

    public var subscriptionState: SubscriptionState { get }

    Return Value

    the SubscriptionState enum

  • Retrieve user data associated with friend.

    Declaration

    Swift

    public var userData: UnsafeMutableRawPointer? { get set }

    Return Value

    the user data pointer.

  • Returns the vCard object associated to this friend, if any.

    Declaration

    Swift

    public var vcard: Vcard? { get set }

    Return Value

    the Vcard or nil.

  • Adds an address in this friend.

    Declaration

    Swift

    public func addAddress(address: Address)

    Parameters

    address

    Address object

  • Adds a phone number in this friend.

    Declaration

    Swift

    public func addPhoneNumber(phoneNumber: String)

    Parameters

    phoneNumber

    number to add

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

    Declaration

    Swift

    public func createVcard(name: String?) throws -> Bool

    Parameters

    name

    The full name of the friend or nil to use the one from the friend’s SIP URI

    Return Value

    true if the vCard has been created, false if it wasn’t possible (for exemple if name and the friend’s SIP URI are null or if the friend’s SIP URI doesn’t have a display name), or if there is already one vcard

  • Commits modification made to the friend configuration.

    Declaration

    Swift

    public func done()
  • 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.

    Declaration

    Swift

    public func edit()
  • Returns the version of a friend’s capbility.

    Declaration

    Swift

    public func getCapabilityVersion(capability: FriendCapability) -> Float

    Parameters

    capability

    Return Value

    the version of a friend’s capbility.

  • Get the presence model for a specific SIP URI or phone number of a friend.

    Declaration

    Swift

    public func getPresenceModelForUriOrTel(uriOrTel: String) -> PresenceModel?

    Parameters

    uriOrTel

    The SIP URI or phone number for which to get the presence model

    Return Value

    A PresenceModel object, or nil if the friend do not have presence information for this SIP URI or phone number.

  • Returns whether or not a friend has a capbility.

    Declaration

    Swift

    public func hasCapability(capability: FriendCapability) -> Bool

    Parameters

    capability

    Return Value

    whether or not a friend has a capbility

  • Returns whether or not a friend has a capbility with a given version.

    Declaration

    Swift

    public func hasCapabilityWithVersion(capability: FriendCapability, version: Float) -> Bool

    Parameters

    capability
    version

    the version to test

    Return Value

    whether or not a friend has a capbility with a given version or -1.0 if friend has not capability.

  • Returns whether or not a friend has a capbility with a given version or more.

    Declaration

    Swift

    public func hasCapabilityWithVersionOrMore(capability: FriendCapability, version: Float) -> Bool

    Parameters

    capability
    version

    the version to test

    Return Value

    whether or not a friend has a capbility with a given version or more.

  • Returns whether a friend contains the given phone number.

    Declaration

    Swift

    public func hasPhoneNumber(phoneNumber: String) -> Bool

    Parameters

    phoneNumber

    the phone number to search for

    Return Value

    true if found, false otherwise

  • Check that the given friend is in a friend list.

    Declaration

    Swift

    public func inList() -> Bool

    Return Value

    true if the friend is in a friend list, false otherwise.

  • Removes a friend from it’s friend list and from the rc if exists.

    Declaration

    Swift

    public func remove()
  • Removes an address in this friend.

    Declaration

    Swift

    public func removeAddress(address: Address)

    Parameters

    address

    Address object

  • Removes a phone number in this friend.

    Declaration

    Swift

    public func removePhoneNumber(phoneNumber: String)

    Parameters

    phoneNumber

    number to remove

  • Saves a friend either in database if configured, otherwise in linphonerc.

    Declaration

    Swift

    public func save(core: Core)

    Parameters

    core

    the linphone core

  • Set the presence model for a specific SIP URI or phone number of a friend.

    Declaration

    Swift

    public func setPresenceModelForUriOrTel(uriOrTel: String, presence: PresenceModel?)

    Parameters

    uriOrTel

    The SIP URI or phone number for which to set the presence model

    presence

    The PresenceModel object to set