PresenceModel

public class PresenceModel : LinphoneObject

Presence model type holding information about the presence of a person.

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    public var getCobject: OpaquePointer? { get }
  • Creates a presence model specifying an activity.

    See

    See also: linphone_presence_model_new, newWithActivityAndNote() The created presence model has the activity specified in the parameters.

    Declaration

    Swift

    public static func newWithActivity(activity: PresenceActivityType, description: String?) -> PresenceModel?

    Parameters

    activity

    The PresenceActivityType to set for the created presence model.

    description

    An additional description of the activity (mainly useful for the ‘other’ activity). Set it to nil to not add a description.

    Return Value

    The created PresenceModel, or nil if an error occured.

  • Creates a presence model specifying an activity and adding a note.

    See

    See also: newWithActivity(), newWithActivityAndNote() 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

    activity

    The PresenceActivityType to set for the created presence model.

    description

    An additional description of the activity (mainly useful for the ‘other’ activity). Set it to nil to not add a description.

    note

    An additional note giving additional information about the contact presence.

    lang

    The 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 PresenceModel, 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 PresenceActivity object if successful, nil otherwise.

  • Sets the basic status of a presence model.

    Declaration

    Swift

    public var basicStatus: PresenceBasicStatus { get }

    Parameters

    basicStatus

    The PresenceBasicStatus to set for the PresenceModel object.

    Return Value

    The PresenceBasicStatus of the PresenceModel object given as parameter.

  • Undocumented

    Declaration

    Swift

    public func setBasicstatus(newValue: PresenceBasicStatus) throws
  • Gets the capabilities of a PresenceModel object.

    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 ConsolidatedPresence corresponding to the presence model

  • Sets the contact of a presence model.

    Declaration

    Swift

    public var contact: String { get }

    Parameters

    contact

    The contact string to set.

    Return Value

    A pointer to a dynamically allocated string containing the contact, or nil if no contact is found.
    The returned string is to be freed by calling ms_free().

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

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

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

  • Sets the presentity of a presence model.

    Declaration

    Swift

    public var presentity: Address? { get }

    Parameters

    presentity

    The presentity address to set (presentity is copied).

    Return Value

    A pointer to a const Address, 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: time_t { get }

    Return Value

    The timestamp of the PresenceModel object or -1 on error.

  • Sets the user data of a PresenceModel object.

    Declaration

    Swift

    public var userData: UnsafeMutableRawPointer? { get set }

    Parameters

    userData

    A pointer to the user data to set.
    Gets the user data of a PresenceModel object.

    Return Value

    A pointer to the user data.

  • Adds an activity to a presence model.

    Declaration

    Swift

    public func addActivity(activity: PresenceActivity) throws

    Parameters

    activity

    The PresenceActivity object to add to the model.

    Return Value

    0 if successful, a value < 0 in case of error.

  • Adds a note to a presence model.

    Declaration

    Swift

    public func addNote(noteContent: String, lang: String?) throws

    Parameters

    noteContent

    The note to be added to the presence model.

    lang

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

  • Adds a person to a presence model.

    Declaration

    Swift

    public func addPerson(person: PresencePerson) throws

    Parameters

    person

    The PresencePerson object 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) throws

    Parameters

    service

    The PresenceService object 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() throws

    Return Value

    0 if successful, a value < 0 in case of error.

  • Clears all the notes of a presence model.

    Declaration

    Swift

    public func clearNotes() throws

    Return Value

    0 if successful, a value < 0 in case of error.

  • Clears the persons of a presence model.

    Declaration

    Swift

    public func clearPersons() throws

    Return Value

    0 if successful, a value < 0 in case of error.

  • Clears the services of a presence model.

    Declaration

    Swift

    public func clearServices() throws

    Return 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) -> Float

    Parameters

    capability

    The FriendCapability to test.

    Return Value

    the version of the capability of a PresenceModel or -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

    lang

    The 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 PresenceNote object if successful, nil otherwise.

  • Gets the nth activity of a presence model.

    Declaration

    Swift

    public func getNthActivity(index: UInt) -> PresenceActivity?

    Parameters

    index

    The index of the activity to get (the first activity having the index 0).

    Return Value

    A pointer to a PresenceActivity object if successful, nil otherwise.

  • Gets the nth person of a presence model.

    Declaration

    Swift

    public func getNthPerson(index: UInt) -> PresencePerson?

    Parameters

    index

    The index of the person to get (the first person having the index 0).

    Return Value

    A pointer to a PresencePerson object if successful, nil otherwise.

  • Gets the nth service of a presence model.

    Declaration

    Swift

    public func getNthService(index: UInt) -> PresenceService?

    Parameters

    index

    The index of the service to get (the first service having the index 0).

    Return Value

    A pointer to a PresenceService object if successful, nil otherwise.

  • Returns whether or not the PresenceModel object has a given capability.

    Declaration

    Swift

    public func hasCapability(capability: FriendCapability) -> Bool

    Parameters

    capability

    The capability to test.

    Return Value

    whether or not the PresenceModel object has a given capability.

  • Returns whether or not the PresenceModel object has a given capability with a certain version.

    Declaration

    Swift

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

    Parameters

    capability

    The FriendCapability to test.

    version

    The wanted version to test.

    Return Value

    whether or not the PresenceModel object has a given capability with a certain version.

  • Returns whether or not the PresenceModel object has a given capability with a certain version or more.

    Declaration

    Swift

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

    Parameters

    capability

    The FriendCapability to test.

    version

    The wanted version to test.

    Return Value

    whether or not the PresenceModel object has a given capability with a certain version or more.

  • Sets the activity of a presence model (limits to only one activity).

    Declaration

    Swift

    public func setActivity(activity: PresenceActivityType, description: String?) throws

    Parameters

    activity

    The PresenceActivityType to set for the model.

    description

    An 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. 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().