liblinphone  3.6.1
Typedefs | Enumerations | Functions
Managing Buddies and buddy list and presence

Typedefs

typedef enum _LinphoneOnlineStatus LinphoneOnlineStatus
 
typedef struct _LinphoneFriend LinphoneFriend
 
typedef enum
LinphonePresenceBasicStatus 
LinphonePresenceBasicStatus
 
typedef enum
LinphonePresenceActivityType 
LinphonePresenceActivityType
 
typedef struct
_LinphonePresenceModel 
LinphonePresenceModel
 
typedef struct
_LinphonePresenceActivity 
LinphonePresenceActivity
 
typedef struct
_LinphonePresenceNote 
LinphonePresenceNote
 

Enumerations

enum  LinphoneSubscribePolicy {
  LinphoneSPWait,
  LinphoneSPDeny,
  LinphoneSPAccept
}
 
enum  _LinphoneOnlineStatus {
  LinphoneStatusOffline,
  LinphoneStatusOnline,
  LinphoneStatusBusy,
  LinphoneStatusBeRightBack,
  LinphoneStatusAway,
  LinphoneStatusOnThePhone,
  LinphoneStatusOutToLunch,
  LinphoneStatusDoNotDisturb,
  LinphoneStatusMoved,
  LinphoneStatusAltService,
  LinphoneStatusPending,
  LinphoneStatusVacation
}
 
enum  LinphonePresenceBasicStatus {
  LinphonePresenceBasicStatusOpen,
  LinphonePresenceBasicStatusClosed
}
 
enum  LinphonePresenceActivityType {
  LinphonePresenceActivityOffline,
  LinphonePresenceActivityOnline,
  LinphonePresenceActivityAppointment,
  LinphonePresenceActivityAway,
  LinphonePresenceActivityBreakfast,
  LinphonePresenceActivityBusy,
  LinphonePresenceActivityDinner,
  LinphonePresenceActivityHoliday,
  LinphonePresenceActivityInTransit,
  LinphonePresenceActivityLookingForWork,
  LinphonePresenceActivityLunch,
  LinphonePresenceActivityMeal,
  LinphonePresenceActivityMeeting,
  LinphonePresenceActivityOnThePhone,
  LinphonePresenceActivityOther,
  LinphonePresenceActivityPerformance,
  LinphonePresenceActivityPermanentAbsence,
  LinphonePresenceActivityPlaying,
  LinphonePresenceActivityPresentation,
  LinphonePresenceActivityShopping,
  LinphonePresenceActivitySleeping,
  LinphonePresenceActivitySpectator,
  LinphonePresenceActivitySteering,
  LinphonePresenceActivityTravel,
  LinphonePresenceActivityTV,
  LinphonePresenceActivityUnknown,
  LinphonePresenceActivityVacation,
  LinphonePresenceActivityWorking,
  LinphonePresenceActivityWorship
}
 

Functions

LINPHONE_PUBLIC LinphoneFriendlinphone_friend_new ()
 
LINPHONE_PUBLIC LinphoneFriendlinphone_friend_new_with_addr (const char *addr)
 
LINPHONE_PUBLIC void linphone_friend_destroy (LinphoneFriend *lf)
 
LINPHONE_PUBLIC int linphone_friend_set_addr (LinphoneFriend *fr, const LinphoneAddress *address)
 
LINPHONE_PUBLIC int linphone_friend_set_name (LinphoneFriend *lf, const char *name)
 
LINPHONE_PUBLIC const
LinphoneAddress
linphone_friend_get_address (const LinphoneFriend *lf)
 
LINPHONE_PUBLIC bool_t linphone_friend_subscribes_enabled (const LinphoneFriend *lf)
 
LINPHONE_PUBLIC int linphone_friend_enable_subscribes (LinphoneFriend *fr, bool_t val)
 
LINPHONE_PUBLIC int linphone_friend_set_inc_subscribe_policy (LinphoneFriend *fr, LinphoneSubscribePolicy pol)
 
LINPHONE_PUBLIC
LinphoneSubscribePolicy 
linphone_friend_get_inc_subscribe_policy (const LinphoneFriend *lf)
 
LINPHONE_PUBLIC void linphone_friend_edit (LinphoneFriend *fr)
 
LINPHONE_PUBLIC void linphone_friend_done (LinphoneFriend *fr)
 
LINPHONE_PUBLIC
LinphoneOnlineStatus 
linphone_friend_get_status (const LinphoneFriend *lf)
 Get the status of a friend. More...
 
LINPHONE_PUBLIC const
LinphonePresenceModel
linphone_friend_get_presence_model (LinphoneFriend *lf)
 Get the presence information of a friend. More...
 
LINPHONE_PUBLIC const char * linphone_online_status_to_string (LinphoneOnlineStatus ss)
 
LINPHONE_PUBLIC void linphone_core_set_presence_info (LinphoneCore *lc, int minutes_away, const char *alternative_contact, LinphoneOnlineStatus os)
 Set my presence status. More...
 
LINPHONE_PUBLIC void linphone_core_set_presence_model (LinphoneCore *lc, LinphonePresenceModel *presence)
 Set my presence status. More...
 
LINPHONE_PUBLIC
LinphoneOnlineStatus 
linphone_core_get_presence_info (const LinphoneCore *lc)
 Get my presence status. More...
 
LINPHONE_PUBLIC
LinphonePresenceModel
linphone_core_get_presence_model (const LinphoneCore *lc)
 Get my presence status. More...
 
LINPHONE_PUBLIC void linphone_core_add_friend (LinphoneCore *lc, LinphoneFriend *fr)
 
LINPHONE_PUBLIC void linphone_core_remove_friend (LinphoneCore *lc, LinphoneFriend *fr)
 
LINPHONE_PUBLIC void linphone_core_reject_subscriber (LinphoneCore *lc, LinphoneFriend *lf)
 
LINPHONE_PUBLIC const MSList * linphone_core_get_friend_list (const LinphoneCore *lc)
 
LINPHONE_PUBLIC void linphone_core_notify_all_friends (LinphoneCore *lc, LinphonePresenceModel *presence)
 
LINPHONE_PUBLIC
LinphonePresenceModel
linphone_presence_model_new (void)
 Creates a default presence model. More...
 
LINPHONE_PUBLIC
LinphonePresenceModel
linphone_presence_model_new_with_activity (LinphonePresenceActivityType activity, const char *description)
 Creates a presence model specifying an activity. More...
 
LINPHONE_PUBLIC
LinphonePresenceModel
linphone_presence_model_new_with_activity_and_note (LinphonePresenceActivityType activity, const char *description, const char *note, const char *lang)
 Creates a presence model specifying an activity and adding a note. More...
 
LinphonePresenceModellinphone_presence_model_ref (LinphonePresenceModel *model)
 
LinphonePresenceModellinphone_presence_model_unref (LinphonePresenceModel *model)
 
void linphone_presence_model_set_user_data (LinphonePresenceModel *model, void *user_data)
 
void * linphone_presence_model_get_user_data (LinphonePresenceModel *model)
 
LINPHONE_PUBLIC
LinphonePresenceBasicStatus 
linphone_presence_model_get_basic_status (const LinphonePresenceModel *model)
 Gets the basic status of a presence model. More...
 
LINPHONE_PUBLIC time_t linphone_presence_model_get_timestamp (const LinphonePresenceModel *model)
 Gets the timestamp of a presence model. More...
 
LINPHONE_PUBLIC char * linphone_presence_model_get_contact (const LinphonePresenceModel *model)
 Gets the contact of a presence model. More...
 
LINPHONE_PUBLIC void linphone_presence_model_set_contact (LinphonePresenceModel *model, const char *contact)
 Sets the contact of a presence model. More...
 
LINPHONE_PUBLIC unsigned int linphone_presence_model_nb_activities (const LinphonePresenceModel *model)
 Gets the number of activities included in the presence model. More...
 
LINPHONE_PUBLIC
LinphonePresenceActivity
linphone_presence_model_get_nth_activity (const LinphonePresenceModel *model, unsigned int idx)
 Gets the nth activity of a presence model. More...
 
LINPHONE_PUBLIC
LinphonePresenceActivity
linphone_presence_model_get_activity (const LinphonePresenceModel *model)
 Gets the first activity of a presence model (there is usually only one). More...
 
LINPHONE_PUBLIC int linphone_presence_model_set_activity (LinphonePresenceModel *model, LinphonePresenceActivityType activity, const char *description)
 Sets the activity of a presence model (limits to only one activity). More...
 
LINPHONE_PUBLIC
LinphonePresenceNote
linphone_presence_model_get_note (const LinphonePresenceModel *model, const char *lang)
 Gets the first note of a presence model (there is usually only one). More...
 
LINPHONE_PUBLIC int linphone_presence_model_add_note (LinphonePresenceModel *model, const char *note_content, const char *lang)
 Adds a note to a presence model. More...
 
LINPHONE_PUBLIC int linphone_presence_model_clear_notes (LinphonePresenceModel *model)
 Clears all the notes of a presence model. More...
 
LinphonePresenceActivitylinphone_presence_activity_ref (LinphonePresenceActivity *activity)
 
LinphonePresenceActivitylinphone_presence_activity_unref (LinphonePresenceActivity *activity)
 
void linphone_presence_activity_set_user_data (LinphonePresenceActivity *activity, void *user_data)
 
void * linphone_presence_activity_get_user_data (LinphonePresenceActivity *activity)
 
LINPHONE_PUBLIC char * linphone_presence_activity_to_string (const LinphonePresenceActivity *activity)
 Gets the string representation of a presence activity. More...
 
LINPHONE_PUBLIC
LinphonePresenceActivityType 
linphone_presence_activity_get_type (const LinphonePresenceActivity *activity)
 Gets the activity type of a presence activity. More...
 
LINPHONE_PUBLIC const char * linphone_presence_activity_get_description (const LinphonePresenceActivity *activity)
 Gets the description of a presence activity. More...
 
LinphonePresenceNotelinphone_presence_note_ref (LinphonePresenceNote *note)
 
LinphonePresenceNotelinphone_presence_note_unref (LinphonePresenceNote *note)
 
void linphone_presence_note_set_user_data (LinphonePresenceNote *note, void *user_data)
 
void * linphone_presence_note_get_user_data (LinphonePresenceNote *note)
 
LINPHONE_PUBLIC const char * linphone_presence_note_get_content (const LinphonePresenceNote *note)
 Gets the content of a presence note. More...
 
LINPHONE_PUBLIC const char * linphone_presence_note_get_lang (const LinphonePresenceNote *note)
 Gets the language of a presence note. More...
 

Detailed Description

Buddies and buddy list
Each buddy is represented by a LinphoneFriend object created by function linphone_friend_new(). Buddy configuration parameters like sip uri or status publication policy for this friend are configurable for each buddy.
Here under a typical buddy creation:

LinphoneFriend* my_friend=linphone_friend_new_with_addr("sip:joe@sip.linphone.org"); /*creates friend object for buddy joe*/
linphone_friend_enable_subscribes(my_friend,TRUE); /*configure this friend to emit SUBSCRIBE message after being added to LinphoneCore*/
linphone_friend_set_inc_subscribe_policy(my_friend,LinphoneSPAccept); /* accept Incoming subscription request for this friend*/

friends status changes are reported by callback LinphoneCoreVTable.notify_presence_recv

static void notify_presence_recv_updated (struct _LinphoneCore *lc, LinphoneFriend *friend) {
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
printf("New state state [%s] for user id [%s] \n"
,linphone_address_as_string (friend_address));
}


Once created a buddy can be added to the buddy list using function linphone_core_add_friend() . Added friends will be notified about local status changes
Any subsequente modifications to LinphoneFriend must be first started by a call to function linphone_friend_edit() and validated by function linphone_friend_done()

linphone_friend_edit(my_friend); /* start editing friend */
linphone_friend_enable_subscribes(my_friend,FALSE); /*disable subscription for this friend*/
linphone_friend_done(my_friend); /*commit changes triggering an UNSUBSCRIBE message*/

Publishing presence status
Local presence status can be changed using function linphone_core_set_presence_model() .New status is propagated to all friends previously added to LinphoneCore.

Handling incoming subscription request
New incoming subscription requests are process according to the incoming subscription policy state for subscription initiated by members of the buddy list.
For incoming request comming from an unknown buddy, the call back LinphoneCoreVTable.new_subscription_request is invoked.


A complete tutorial can be found at : Registration tutorial

Typedef Documentation

Enum describing remote friend status

Deprecated:
Use LinphonePresenceModel and LinphonePresenceActivity instead
typedef struct _LinphoneFriend LinphoneFriend

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

Basic status as defined in section 4.1.4 of RFC 3863

Activities as defined in section 3.2 of RFC 4480

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

typedef struct _LinphonePresenceActivity LinphonePresenceActivity

Presence activity type holding information about a presence activity.

typedef struct _LinphonePresenceNote LinphonePresenceNote

Presence note type holding information about a presence note.

Enumeration Type Documentation

Enum controlling behavior for incoming subscription request.
Use by linphone_friend_set_inc_subscribe_policy()

Enumerator
LinphoneSPWait 

Does not automatically accept an incoming subscription request. This policy implies that a decision has to be taken for each incoming subscription request notified by callback LinphoneCoreVTable.new_subscription_request

LinphoneSPDeny 

Rejects incoming subscription request.

LinphoneSPAccept 

Automatically accepts a subscription request.

Enum describing remote friend status

Deprecated:
Use LinphonePresenceModel and LinphonePresenceActivity instead
Enumerator
LinphoneStatusOffline 

Offline

LinphoneStatusOnline 

Online

LinphoneStatusBusy 

Busy

LinphoneStatusBeRightBack 

Be right back

LinphoneStatusAway 

Away

LinphoneStatusOnThePhone 

On the phone

LinphoneStatusOutToLunch 

Out to lunch

LinphoneStatusDoNotDisturb 

Do not disturb

LinphoneStatusMoved 

Moved in this sate, call can be redirected if an alternate contact address has been set using function linphone_core_set_presence_info()

LinphoneStatusAltService 

Using another messaging service

LinphoneStatusPending 

Pending

LinphoneStatusVacation 

Vacation

Basic status as defined in section 4.1.4 of RFC 3863

Enumerator
LinphonePresenceBasicStatusOpen 

This value means that the associated contact element, if any, is ready to accept communication.

LinphonePresenceBasicStatusClosed 

This value means that the associated contact element, if any, is unable to accept communication.

Activities as defined in section 3.2 of RFC 4480

Enumerator
LinphonePresenceActivityOffline 

This value is not defined in the RFC, it corresponds to no activity with a basic status of "closed".

LinphonePresenceActivityOnline 

This value is not defined in the RFC, it corresponds to no activity with a basic status of "open".

LinphonePresenceActivityAppointment 

The person has a calendar appointment, without specifying exactly of what type. This activity is indicated if more detailed information is not available or the person chooses not to reveal more information.

LinphonePresenceActivityAway 

The person is physically away from all interactive communication devices.

LinphonePresenceActivityBreakfast 

The person is eating the first meal of the day, usually eaten in the morning.

LinphonePresenceActivityBusy 

The person is busy, without further details.

LinphonePresenceActivityDinner 

The person is having his or her main meal of the day, eaten in the evening or at midday.

LinphonePresenceActivityHoliday 

This is a scheduled national or local holiday.

LinphonePresenceActivityInTransit 

The person is riding in a vehicle, such as a car, but not steering.

LinphonePresenceActivityLookingForWork 

The person is looking for (paid) work.

LinphonePresenceActivityLunch 

The person is eating his or her midday meal.

LinphonePresenceActivityMeal 

The person is scheduled for a meal, without specifying whether it is breakfast, lunch, or dinner, or some other meal.

LinphonePresenceActivityMeeting 

The person is in an assembly or gathering of people, as for a business, social, or religious purpose. A meeting is a sub-class of an appointment.

LinphonePresenceActivityOnThePhone 

The person is talking on the telephone.

LinphonePresenceActivityOther 

The person is engaged in an activity with no defined representation. A string describing the activity in plain text SHOULD be provided.

LinphonePresenceActivityPerformance 

A performance is a sub-class of an appointment and includes musical, theatrical, and cinematic performances as well as lectures. It is distinguished from a meeting by the fact that the person may either be lecturing or be in the audience, with a potentially large number of other people, making interruptions particularly noticeable.

LinphonePresenceActivityPermanentAbsence 

The person will not return for the foreseeable future, e.g., because it is no longer working for the company.

LinphonePresenceActivityPlaying 

The person is occupying himself or herself in amusement, sport, or other recreation.

LinphonePresenceActivityPresentation 

The person is giving a presentation, lecture, or participating in a formal round-table discussion.

LinphonePresenceActivityShopping 

The person is visiting stores in search of goods or services.

LinphonePresenceActivitySleeping 

The person is sleeping.

LinphonePresenceActivitySpectator 

The person is observing an event, such as a sports event.

LinphonePresenceActivitySteering 

The person is controlling a vehicle, watercraft, or plane.

LinphonePresenceActivityTravel 

The person is on a business or personal trip, but not necessarily in-transit.

LinphonePresenceActivityTV 

The person is watching television.

LinphonePresenceActivityUnknown 

The activity of the person is unknown.

LinphonePresenceActivityVacation 

A period of time devoted to pleasure, rest, or relaxation.

LinphonePresenceActivityWorking 

The person is engaged in, typically paid, labor, as part of a profession or job.

LinphonePresenceActivityWorship 

The person is participating in religious rites.

Function Documentation

LINPHONE_PUBLIC LinphoneFriend* linphone_friend_new ( )

Contructor

Returns
a new empty LinphoneFriend
LINPHONE_PUBLIC LinphoneFriend* linphone_friend_new_with_addr ( const char *  addr)

Contructor same as linphone_friend_new() + linphone_friend_set_addr()

Parameters
addra buddy address, must be a sip uri like sip:joe@s.nosp@m.ip.l.nosp@m.inpho.nosp@m.ne.o.nosp@m.rg
Returns
a new LinphoneFriend with address initialized
LINPHONE_PUBLIC void linphone_friend_destroy ( LinphoneFriend lf)

Destructor

Parameters
lfLinphoneFriend object
LINPHONE_PUBLIC int linphone_friend_set_addr ( LinphoneFriend fr,
const LinphoneAddress address 
)

set LinphoneAddress for this friend

Parameters
frLinphoneFriend object
addressLinphoneAddress
LINPHONE_PUBLIC int linphone_friend_set_name ( LinphoneFriend lf,
const char *  name 
)

set the display name for this friend

Parameters
lfLinphoneFriend object
name
LINPHONE_PUBLIC const LinphoneAddress* linphone_friend_get_address ( const LinphoneFriend lf)

get address of this friend

Parameters
lfLinphoneFriend object
Returns
LinphoneAddress
LINPHONE_PUBLIC bool_t linphone_friend_subscribes_enabled ( const LinphoneFriend lf)

get subscription flag value

Parameters
lfLinphoneFriend object
Returns
returns true is subscription is activated for this friend
LINPHONE_PUBLIC int linphone_friend_enable_subscribes ( LinphoneFriend fr,
bool_t  val 
)

Configure LinphoneFriend to subscribe to presence information

Parameters
frLinphoneFriend object
valif TRUE this friend will receive subscription message
LINPHONE_PUBLIC int linphone_friend_set_inc_subscribe_policy ( LinphoneFriend fr,
LinphoneSubscribePolicy  pol 
)

Configure incoming subscription policy for this friend.

Parameters
frLinphoneFriend object
polLinphoneSubscribePolicy policy to apply.
LINPHONE_PUBLIC LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy ( const LinphoneFriend lf)

get current subscription policy for this LinphoneFriend

Parameters
lfLinphoneFriend object
Returns
LinphoneSubscribePolicy
LINPHONE_PUBLIC void linphone_friend_edit ( LinphoneFriend fr)

Starts editing a friend configuration.

Because friend configuration must be consistent, applications MUST call linphone_friend_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 linphone_friend_done() to commit the changes.

LINPHONE_PUBLIC void linphone_friend_done ( LinphoneFriend fr)

Commits modification made to the friend configuration.

Parameters
frLinphoneFriend object
LINPHONE_PUBLIC LinphoneOnlineStatus linphone_friend_get_status ( const LinphoneFriend lf)

Get the status of a friend.

Parameters
[in]lfA LinphoneFriend object
Returns
LinphoneOnlineStatus
Deprecated:
Use linphone_friend_get_presence_model() instead
LINPHONE_PUBLIC const LinphonePresenceModel* linphone_friend_get_presence_model ( LinphoneFriend lf)

Get the presence information of a friend.

Parameters
[in]lfA LinphoneFriend object
Returns
A LinphonePresenceModel object, or NULL if the friend do not have presence information (in which case he is considered offline)
LINPHONE_PUBLIC const char* linphone_online_status_to_string ( LinphoneOnlineStatus  ss)

Return humain readable presence status

Parameters
ss
Deprecated:
Use LinphonePresenceModel, LinphonePresenceActivity and linphone_presence_activity_to_string() instead.
LINPHONE_PUBLIC void linphone_core_set_presence_info ( LinphoneCore lc,
int  minutes_away,
const char *  alternative_contact,
LinphoneOnlineStatus  os 
)

Set my presence status.

Parameters
[in]lcLinphoneCore object
[in]minutes_awayhow long in away
[in]alternative_contactsip uri used to redirect call in state LinphoneStatusMoved
[in]osLinphoneOnlineStatus
Deprecated:
Use linphone_core_set_presence_model() instead
LINPHONE_PUBLIC void linphone_core_set_presence_model ( LinphoneCore lc,
LinphonePresenceModel presence 
)

Set my presence status.

Parameters
[in]lcLinphoneCore object
[in]presenceLinphonePresenceModel
LINPHONE_PUBLIC LinphoneOnlineStatus linphone_core_get_presence_info ( const LinphoneCore lc)

Get my presence status.

Parameters
[in]lcLinphoneCore object
Returns
LinphoneOnlineStatus
Deprecated:
Use linphone_core_get_presence_model() instead
LINPHONE_PUBLIC LinphonePresenceModel* linphone_core_get_presence_model ( const LinphoneCore lc)

Get my presence status.

Parameters
[in]lcLinphoneCore object
Returns
A LinphonePresenceModel object, or NULL if no presence model has been set.
LINPHONE_PUBLIC void linphone_core_add_friend ( LinphoneCore lc,
LinphoneFriend fr 
)

Add a friend to the current buddy list, if subscription attribute is set, a SIP SUBSCRIBE message is sent.

Parameters
lcLinphoneCore object
frLinphoneFriend to add
LINPHONE_PUBLIC void linphone_core_remove_friend ( LinphoneCore lc,
LinphoneFriend fr 
)

remove a friend from the buddy list

Parameters
lcLinphoneCore object
frLinphoneFriend to add
LINPHONE_PUBLIC void linphone_core_reject_subscriber ( LinphoneCore lc,
LinphoneFriend lf 
)

Black list a friend. same as linphone_friend_set_inc_subscribe_policy() with LinphoneSPDeny policy;

Parameters
lcLinphoneCore object
lfLinphoneFriend to add
LINPHONE_PUBLIC const MSList* linphone_core_get_friend_list ( const LinphoneCore lc)

get Buddy list of LinphoneFriend

Parameters
lcLinphoneCore object
LINPHONE_PUBLIC void linphone_core_notify_all_friends ( LinphoneCore lc,
LinphonePresenceModel presence 
)

notify all friends that have subscribed

Parameters
lcLinphoneCore object
osLinphoneOnlineStatus to notify
LINPHONE_PUBLIC LinphonePresenceModel* linphone_presence_model_new ( void  )

Creates a default presence model.

Returns
The created presence model, NULL on error.
See Also
linphone_presence_model_new_with_activity
linphone_presence_model_new_with_activity_and_note

The created presence model is considered 'offline'.

LINPHONE_PUBLIC LinphonePresenceModel* linphone_presence_model_new_with_activity ( LinphonePresenceActivityType  activity,
const char *  description 
)

Creates a presence model specifying an activity.

Parameters
[in]activityThe activity to set for the created presence model.
[in]descriptionAn additional description of the activity (mainly useful for the 'other' activity). Set it to NULL to not add a description.
Returns
The created presence model, or NULL if an error occured.
See Also
linphone_presence_model_new
linphone_presence_model_new_with_activity_and_note

The created presence model has the activity specified in the parameters.

LINPHONE_PUBLIC LinphonePresenceModel* linphone_presence_model_new_with_activity_and_note ( LinphonePresenceActivityType  activity,
const char *  description,
const char *  note,
const char *  lang 
)

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

Parameters
[in]activityThe activity to set for the created presence model.
[in]descriptionAn additional description of the activity (mainly useful for the 'other' activity). Set it to NULL to not add a description.
[in]noteAn additional note giving additional information about the contact presence.
[in]langThe language the note is written in. It can be set to NULL in order to not specify the language of the note.
Returns
The created presence model, or NULL if an error occured.
See Also
linphone_presence_model_new_with_activity
linphone_presence_model_new_with_activity_and_note

The created presence model has the activity and the note specified in the parameters.

LinphonePresenceModel* linphone_presence_model_ref ( LinphonePresenceModel model)

Increase the reference count of the LinphonePresenceModel object.

Parameters
[in]modelThe LinphonePresenceModel object for which the reference count is to be increased.
Returns
The LinphonePresenceModel object with the increased reference count.
LinphonePresenceModel* linphone_presence_model_unref ( LinphonePresenceModel model)

Decrease the reference count of the LinphonePresenceModel object and destroy it if it reaches 0.

Parameters
[in]modelThe LinphonePresenceModel object for which the reference count is to be decreased.
Returns
The LinphonePresenceModel object if the reference count is still positive, NULL if the object has been destroyed.
void linphone_presence_model_set_user_data ( LinphonePresenceModel model,
void *  user_data 
)

Sets the user data of a LinphonePresenceModel object.

Parameters
[in]modelThe LinphonePresenceModel object for which to set the user data.
[in]user_dataA pointer to the user data to set.
void* linphone_presence_model_get_user_data ( LinphonePresenceModel model)

Gets the user data of a LinphonePresenceModel object.

Parameters
[in]modelThe LinphonePresenceModel object for which to get the user data.
Returns
A pointer to the user data.
LINPHONE_PUBLIC LinphonePresenceBasicStatus linphone_presence_model_get_basic_status ( const LinphonePresenceModel model)

Gets the basic status of a presence model.

Parameters
[in]modelThe LinphonePresenceModel object to get the basic status from.
Returns
The LinphonePresenceBasicStatus of the LinphonePresenceModel object given as parameter.
LINPHONE_PUBLIC time_t linphone_presence_model_get_timestamp ( const LinphonePresenceModel model)

Gets the timestamp of a presence model.

Parameters
[in]modelThe LinphonePresenceModel object to get the timestamp from.
Returns
The timestamp of the LinphonePresenceModel object or -1 on error.
LINPHONE_PUBLIC char* linphone_presence_model_get_contact ( const LinphonePresenceModel model)

Gets the contact of a presence model.

Parameters
[in]modelThe LinphonePresenceModel object to get the contact from.
Returns
A pointer to a dynamically allocated string containing the contact, or NULL if no contact is found.

The returned string is to be freed by calling ms_free().

LINPHONE_PUBLIC void linphone_presence_model_set_contact ( LinphonePresenceModel model,
const char *  contact 
)

Sets the contact of a presence model.

Parameters
[in]modelThe LinphonePresenceModel object for which to set the contact.
[in]contactThe contact string to set.
LINPHONE_PUBLIC unsigned int linphone_presence_model_nb_activities ( const LinphonePresenceModel model)

Gets the number of activities included in the presence model.

Parameters
[in]modelThe LinphonePresenceModel object to get the number of activities from.
Returns
The number of activities included in the LinphonePresenceModel object.
LINPHONE_PUBLIC LinphonePresenceActivity* linphone_presence_model_get_nth_activity ( const LinphonePresenceModel model,
unsigned int  idx 
)

Gets the nth activity of a presence model.

Parameters
[in]modelThe LinphonePresenceModel object to get the activity from.
[in]idxThe index of the activity to get (the first activity having the index 0).
Returns
A pointer to a LinphonePresenceActivity object if successful, NULL otherwise.
LINPHONE_PUBLIC LinphonePresenceActivity* linphone_presence_model_get_activity ( const LinphonePresenceModel model)

Gets the first activity of a presence model (there is usually only one).

Parameters
[in]modelThe LinphonePresenceModel object to get the activity from.
Returns
A LinphonePresenceActivity object if successful, NULL otherwise.
LINPHONE_PUBLIC int linphone_presence_model_set_activity ( LinphonePresenceModel model,
LinphonePresenceActivityType  activity,
const char *  description 
)

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

Parameters
[in]modelThe LinphonePresenceModel object for which to set the activity.
[in]activityThe LinphonePresenceActivityType to set for the model.
[in]descriptionAn additional description of the activity to set for the model. Can be NULL if no additional description is to be added.
Returns
0 if successful, a value < 0 in case of error.
LINPHONE_PUBLIC LinphonePresenceNote* linphone_presence_model_get_note ( const LinphonePresenceModel model,
const char *  lang 
)

Gets the first note of a presence model (there is usually only one).

Parameters
[in]modelThe LinphonePresenceModel object to get the note from.
[in]langThe language of the note to get. Can be NULL to get a note that has no language specified or to get the first note whatever language it is written into.
Returns
A pointer to a LinphonePresenceNote object if successful, NULL otherwise.
LINPHONE_PUBLIC int linphone_presence_model_add_note ( LinphonePresenceModel model,
const char *  note_content,
const char *  lang 
)

Adds a note to a presence model.

Parameters
[in]modelThe LinphonePresenceModel object to add a note to.
[in]note_contentThe note to be added to the presence model.
[in]langThe language of the note to be added. Can be NULL if no language is to be specified for the note.
Returns
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.

LINPHONE_PUBLIC int linphone_presence_model_clear_notes ( LinphonePresenceModel model)

Clears all the notes of a presence model.

Parameters
[in]modelThe LinphonePresenceModel for which to clear notes.
Returns
0 if successful, a value < 0 in case of error.
LinphonePresenceActivity* linphone_presence_activity_ref ( LinphonePresenceActivity activity)

Increase the reference count of the LinphonePresenceActivity object.

Parameters
[in]activityThe LinphonePresenceActivity object for which the reference count is to be increased.
Returns
The LinphonePresenceActivity object with the increased reference count.
LinphonePresenceActivity* linphone_presence_activity_unref ( LinphonePresenceActivity activity)

Decrease the reference count of the LinphonePresenceActivity object and destroy it if it reaches 0.

Parameters
[in]activityThe LinphonePresenceActivity object for which the reference count is to be decreased.
Returns
The LinphonePresenceActivity object if the reference count is still positive, NULL if the object has been destroyed.
void linphone_presence_activity_set_user_data ( LinphonePresenceActivity activity,
void *  user_data 
)

Sets the user data of a LinphonePresenceActivity object.

Parameters
[in]activityThe LinphonePresenceActivity object for which to set the user data.
[in]user_dataA pointer to the user data to set.
void* linphone_presence_activity_get_user_data ( LinphonePresenceActivity activity)

Gets the user data of a LinphonePresenceActivity object.

Parameters
[in]activityThe LinphonePresenceActivity object for which to get the user data.
Returns
A pointer to the user data.
LINPHONE_PUBLIC char* linphone_presence_activity_to_string ( const LinphonePresenceActivity activity)

Gets the string representation of a presence activity.

Parameters
[in]activityA pointer to the LinphonePresenceActivity object for which to get a string representation.
Returns
A pointer a dynamically allocated string representing the given activity.

The returned string is to be freed by calling ms_free().

LINPHONE_PUBLIC LinphonePresenceActivityType linphone_presence_activity_get_type ( const LinphonePresenceActivity activity)

Gets the activity type of a presence activity.

Parameters
[in]activityA pointer to the LinphonePresenceActivity for which to get the type.
Returns
The LinphonePresenceActivityType of the activity.
LINPHONE_PUBLIC const char* linphone_presence_activity_get_description ( const LinphonePresenceActivity activity)

Gets the description of a presence activity.

Parameters
[in]activityA pointer to the LinphonePresenceActivity for which to get the description.
Returns
A pointer to the description string of the presence activity, or NULL if no description is specified.
LinphonePresenceNote* linphone_presence_note_ref ( LinphonePresenceNote note)

Increase the reference count of the LinphonePresenceNote object.

Parameters
[in]noteThe LinphonePresenceNote object for which the reference count is to be increased.
Returns
The LinphonePresenceNote object with the increased reference count.
LinphonePresenceNote* linphone_presence_note_unref ( LinphonePresenceNote note)

Decrease the reference count of the LinphonePresenceNote object and destroy it if it reaches 0.

Parameters
[in]noteThe LinphonePresenceNote object for which the reference count is to be decreased.
Returns
The LinphonePresenceNote object if the reference count is still positive, NULL if the object has been destroyed.
void linphone_presence_note_set_user_data ( LinphonePresenceNote note,
void *  user_data 
)

Sets the user data of a LinphonePresenceNote object.

Parameters
[in]noteThe LinphonePresenceNote object for which to set the user data.
[in]user_dataA pointer to the user data to set.
void* linphone_presence_note_get_user_data ( LinphonePresenceNote note)

Gets the user data of a LinphonePresenceNote object.

Parameters
[in]noteThe LinphonePresenceNote object for which to get the user data.
Returns
A pointer to the user data.
LINPHONE_PUBLIC const char* linphone_presence_note_get_content ( const LinphonePresenceNote note)

Gets the content of a presence note.

Parameters
[in]noteA pointer to the LinphonePresenceNote for which to get the content.
Returns
A pointer to the content of the presence note.
LINPHONE_PUBLIC const char* linphone_presence_note_get_lang ( const LinphonePresenceNote note)

Gets the language of a presence note.

Parameters
[in]noteA pointer to the LinphonePresenceNote for which to get the language.
Returns
A pointer to the language string of the presence note, or NULL if no language is specified.