PresenceModel
public class PresenceModel : LinphoneObject
Presence model type holding information about the presence of a person.
-
Creates a presence model specifying an activity.
See
See also: linphone_presence_model_new
See
See also: linphone_presence_model_new_with_activity_and_note
The created presence model has the activity specified in the parameters.
Declaration
Swift
public static func newWithActivity(activity: PresenceActivityType, description: String) -> PresenceModel?Parameters
activityThe activity to set for the created presence model.
descriptionAn additional description of the activity (mainly useful for the ‘other’ activity). Set it to nil to not add a description.
Return Value
The created presence model, or nil if an error occured.
-
Creates a presence model specifying an activity and adding a note.
See
See also: linphone_presence_model_new_with_activity
See
See also: linphone_presence_model_new_with_activity_and_note
The created presence model has the activity and the note specified in the parameters.
Declaration
Swift
public static func newWithActivityAndNote(activity: PresenceActivityType, description: String, note: String, lang: String) -> PresenceModel?Parameters
activityThe activity to set for the created presence model.
descriptionAn additional description of the activity (mainly useful for the ‘other’ activity). Set it to nil to not add a description.
noteAn additional note giving additional information about the contact presence.
langThe language the note is written in. It can be set to nil in order to not specify the language of the note.
Return Value
The created presence model, or nil if an error occured.
-
Gets the first activity of a presence model (there is usually only one).
Declaration
Swift
public var activity: PresenceActivity? { get }Return Value
A
PresenceActivityobject if successful, nil otherwise. -
Gets the basic status of a presence model.
Declaration
Swift
public var basicStatus: PresenceBasicStatus { get }Return Value
The LinphonePresenceBasicStatus of the
PresenceModelobject given as parameter. -
Undocumented
Declaration
Swift
public func setBasicstatus(newValue: PresenceBasicStatus) throws -
Gets the capabilities of a
PresenceModelobject.Declaration
Swift
public var capabilities: Int { get }Return Value
the capabilities.
-
Get the consolidated presence from a presence model.
Declaration
Swift
public var consolidatedPresence: ConsolidatedPresence { get }Return Value
The LinphoneConsolidatedPresence corresponding to the presence model
-
Gets the contact of a presence model.
The returned string is to be freed by calling ms_free().
Declaration
Swift
public var contact: String { get }Return Value
A pointer to a dynamically allocated string containing the contact, or nil if no contact is found.
-
Undocumented
Declaration
Swift
public func setContact(newValue: String) throws -
Tells whether a presence model is considered online. It is any of theses cases:
Declaration
Swift
public var isOnline: Bool { get } -
Gets the number of activities included in the presence model.
Declaration
Swift
public var nbActivities: UInt { get }Return Value
The number of activities included in the
PresenceModelobject. -
Gets the number of persons included in the presence model.
Declaration
Swift
public var nbPersons: UInt { get }Return Value
The number of persons included in the
PresenceModelobject. -
Gets the number of services included in the presence model.
Declaration
Swift
public var nbServices: UInt { get }Return Value
The number of services included in the
PresenceModelobject. -
Gets the presentity of a presence model.
Declaration
Swift
public var presentity: Address? { get }Return Value
A pointer to a const LinphoneAddress, or nil if no contact is found.
-
Undocumented
Declaration
Swift
public func setPresentity(newValue: Address) throws -
Gets the timestamp of a presence model.
Declaration
Swift
public var timestamp: Int { get }Return Value
The timestamp of the
PresenceModelobject or -1 on error. -
Adds an activity to a presence model.
Declaration
Swift
public func addActivity(activity: PresenceActivity) throwsParameters
activityThe
PresenceActivityobject to add to the model.Return Value
0 if successful, a value < 0 in case of error.
-
Adds a note to a presence model.
Only one note for each language can be set, so e.g. setting a note for the ‘fr’ language if there is only one will replace the existing one.
Declaration
Swift
public func addNote(noteContent: String, lang: String) throwsParameters
noteContentThe note to be added to the presence model.
langThe language of the note to be added. Can be nil if no language is to be specified for the note.
Return Value
0 if successful, a value < 0 in case of error.
-
Adds a person to a presence model.
Declaration
Swift
public func addPerson(person: PresencePerson) throwsParameters
personThe
PresencePersonobject to add to the model.Return Value
0 if successful, a value < 0 in case of error.
-
Adds a service to a presence model.
Declaration
Swift
public func addService(service: PresenceService) throwsParameters
serviceThe
PresenceServiceobject to add to the model.Return Value
0 if successful, a value < 0 in case of error.
-
Clears the activities of a presence model.
Declaration
Swift
public func clearActivities() throwsReturn Value
0 if successful, a value < 0 in case of error.
-
Clears all the notes of a presence model.
Declaration
Swift
public func clearNotes() throwsReturn Value
0 if successful, a value < 0 in case of error.
-
Clears the persons of a presence model.
Declaration
Swift
public func clearPersons() throwsReturn Value
0 if successful, a value < 0 in case of error.
-
Clears the services of a presence model.
Declaration
Swift
public func clearServices() throwsReturn Value
0 if successful, a value < 0 in case of error.
-
Returns the version of the capability of a
PresenceModel.Declaration
Swift
public func getCapabilityVersion(capability: FriendCapability) -> FloatParameters
capabilityThe capability to test.
Return Value
the version of the capability of a
PresenceModelor -1.0 if the model has not the capability. -
Gets the first note of a presence model (there is usually only one).
Declaration
Swift
public func getNote(lang: String) -> PresenceNote?Parameters
langThe language of the note to get. Can be nil to get a note that has no language specified or to get the first note whatever language it is written into.
Return Value
A pointer to a
PresenceNoteobject if successful, nil otherwise. -
Gets the nth activity of a presence model.
Declaration
Swift
public func getNthActivity(idx: UInt) -> PresenceActivity?Parameters
idxThe index of the activity to get (the first activity having the index 0).
Return Value
A pointer to a
PresenceActivityobject if successful, nil otherwise. -
Gets the nth person of a presence model.
Declaration
Swift
public func getNthPerson(idx: UInt) -> PresencePerson?Parameters
idxThe index of the person to get (the first person having the index 0).
Return Value
A pointer to a
PresencePersonobject if successful, nil otherwise. -
Gets the nth service of a presence model.
Declaration
Swift
public func getNthService(idx: UInt) -> PresenceService?Parameters
idxThe index of the service to get (the first service having the index 0).
Return Value
A pointer to a
PresenceServiceobject if successful, nil otherwise. -
Returns whether or not the
PresenceModelobject has a given capability.Declaration
Swift
public func hasCapability(capability: FriendCapability) -> BoolParameters
capabilityThe capability to test.
Return Value
whether or not the
PresenceModelobject has a given capability. -
Returns whether or not the
PresenceModelobject has a given capability with a certain version.Declaration
Swift
public func hasCapabilityWithVersion(capability: FriendCapability, version: Float) -> BoolParameters
capabilityThe capability to test.
versionThe wanted version to test.
Return Value
whether or not the
PresenceModelobject has a given capability with a certain version. -
Returns whether or not the
PresenceModelobject has a given capability with a certain version or more.Declaration
Swift
public func hasCapabilityWithVersionOrMore(capability: FriendCapability, version: Float) -> BoolParameters
capabilityThe capability to test.
versionThe wanted version to test.
Return Value
whether or not the
PresenceModelobject has a given capability with a certain version or more. -
Sets the activity of a presence model (limits to only one activity).
WARNING: This function will modify the basic status of the model according to the activity being set. If you don’t want the basic status to be modified automatically, you can use the combination of setBasicStatus(), clearActivities() and addActivity().
Declaration
Swift
public func setActivity(activity: PresenceActivityType, description: String) throwsParameters
activityThe LinphonePresenceActivityType to set for the model.
descriptionAn additional description of the activity to set for the model. Can be nil if no additional description is to be added.
Return Value
0 if successful, a value < 0 in case of error.
PresenceModel Class Reference