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 }
-
Undocumented
Declaration
Swift
public func setAddress(newValue: Address) throws
-
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 -
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
-
Gets the contact’s native URI.
Declaration
Swift
public var nativeUri: String { get set }
Return Value
the native URI set if any, nil otherwise.
-
Gets the contact’s organization from it’s vCard. It’s a shortcut to getVcard() and Vcard.getOrganization().
Declaration
Swift
public var organization: String { get set }
Return Value
the organization set if any & vCard is available, nil otherwise.
-
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.
-
Returns a list of
FriendPhoneNumber
for this friend.Declaration
Swift
public var phoneNumbersWithLabel: [FriendPhoneNumber] { get }
Return Value
A list of phone numbers as string.
-
Gets the contact’s picture URI.
Declaration
Swift
public var photo: String { get set }
Return Value
the picture URI set if any, nil otherwise.
-
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.
-
Gets if the friend is to be considered as important for the user.
Declaration
Swift
public var starred: Bool { get set }
Return Value
true if the contact is a user’s favorite, false otherwise.
-
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.
-
Adds a phone number in this friend.
Declaration
Swift
public func addPhoneNumber(phoneNumber: String)
Parameters
phoneNumber
number to add
-
Adds a
FriendPhoneNumber
to this friend.Declaration
Swift
public func addPhoneNumberWithLabel(phoneNumber: FriendPhoneNumber)
Parameters
phoneNumber
the
FriendPhoneNumber
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
FriendCapability
objectReturn 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
FriendCapability
objectReturn 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
FriendCapability
objectversion
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
FriendCapability
objectversion
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 a phone number in this friend.
Declaration
Swift
public func removePhoneNumber(phoneNumber: String)
Parameters
phoneNumber
number to remove
-
Removes a
FriendPhoneNumber
from this friend.Declaration
Swift
public func removePhoneNumberWithLabel(phoneNumber: FriendPhoneNumber)
Parameters
phoneNumber
the
FriendPhoneNumber
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