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 }
-
Set
Address
for this friend.Note
theAddress
object returned is hold by the LinphoneFriend, however calling several time this function may return different objects.Declaration
Swift
public var address: Address? { get }
Parameters
address
the
Address
to set return 0 if successfull, -1 otherwise Get address of this friend.Return Value
the
Address
. -
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 -
Configure incoming subscription policy for this friend.
Declaration
Swift
public var incSubscribePolicy: SubscribePolicy { get }
Parameters
policy
SubscribePolicy
policy to apply.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.
-
Set the display name for this friend.
Declaration
Swift
public var name: String { get }
Parameters
name
the display name to set
Return Value
The display name of this friend.
-
Undocumented
Declaration
Swift
public func setName(newValue: String) throws
-
Sets the contact’s native URI.
Gets the contact’s native URI.
Declaration
Swift
public var nativeUri: String { get set }
Parameters
nativeUri
the URI that matches the contact on the native system.
Return Value
the native URI set if any, nil otherwise.
-
Sets the contact’s organization. It’s a shortcut to getVcard() and Vcard.setOrganization().
Declaration
Swift
public var organization: String { get set }
Parameters
organization
the organization to store in Friend’s vCard.
Gets the contact’s organization from it’s vCard. It’s a shortcut to getVcard() and Vcard.getOrganization().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.
-
Sets the contact’s picture URI.
Declaration
Swift
public var photo: String { get set }
Parameters
pictureUri
the picture URI to set.
Gets the contact’s picture URI.Return Value
the picture URI set if any, nil otherwise.
-
Set the presence model of a friend.
Declaration
Swift
public var presenceModel: PresenceModel? { get set }
Parameters
presence
The
PresenceModel
object to set for the friend
Get the presence model of a friend.Return Value
A
PresenceModel
object, or nil if the friend do not have presence information (in which case he is considered offline). -
Set the reference key of a friend.
Declaration
Swift
public var refKey: String { get set }
Parameters
key
The reference key to use for the friend.
Get the reference key of a friend.Return Value
The reference key of the friend.
-
Sets if the friend is a user’s favorite or important contact.
Declaration
Swift
public var starred: Bool { get set }
Parameters
isStarred
true if the friend is to be considered as important, false otherwise. Gets if the friend is to be considered as important for the user.
Return Value
true if the contact is a user’s favorite, false otherwise.
-
Configure
Friend
to subscribe to presence information.Declaration
Swift
public var subscribesEnabled: Bool { get }
Parameters
enable
if true this friend will receive subscription message
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 -
Store user pointer to friend object.
Declaration
Swift
public var userData: UnsafeMutableRawPointer? { get set }
Parameters
userData
the user data to store.
Retrieve user data associated with friend.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