Friend

public class Friend : LinphoneObject

Represents a buddy, all presence actions like subscription and status change notification are performed on this object.

  • 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 with vCard initialized

  • 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

    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 objects. LinphoneAddress

  • 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 consolidated presence of the friend

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

    Declaration

    Swift

    public var core: Core? { get }
  • get current subscription policy for this Friend

    Declaration

    Swift

    public var incSubscribePolicy: SubscribePolicy { get }

    Return Value

    LinphoneSubscribePolicy

  • 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

    if presence information has been received for the friend, true 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 const char * objects. const char *

  • 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

    LinphoneSubscriptionState

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

    Declaration

    Swift

    public var vcard: Vcard? { get set }
  • Adds an address in this friend.

    Declaration

    Swift

    public func addAddress(addr: Address)

    Parameters

    addr

    Address object

  • Adds a phone number in this friend.

    Declaration

    Swift

    public func addPhoneNumber(phone: String)

    Parameters

    phone

    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 address or subscription policy and so on). 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

    LinphoneFriendCapability object

    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

    LinphoneFriendCapability object

    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

    LinphoneFriendCapability object

    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

    LinphoneFriendCapability object

    version

    the version to test

    Return Value

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

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

    Declaration

    Swift

    public func inList() -> Bool

    Return Value

    if the friend is in a friend list, true 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(addr: Address)

    Parameters

    addr

    Address object

  • Removes a phone number in this friend.

    Declaration

    Swift

    public func removePhoneNumber(phone: String)

    Parameters

    phone

    number to remove

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

    Declaration

    Swift

    public func save(lc: Core)

    Parameters

    lc

    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