Commit 1a4af622 authored by jehan's avatar jehan

put friend api info linphonefriend.h

parent f0926478
......@@ -599,7 +599,7 @@ main (int argc, char *argv[]) {
#endif
linphonec_vtable.call_state_changed=linphonec_call_state_changed;
linphonec_vtable.notify_presence_recv = linphonec_notify_presence_received;
linphonec_vtable.new_unknown_subscriber = linphonec_new_unknown_subscriber;
linphonec_vtable.new_subscription_request = linphonec_new_unknown_subscriber;
linphonec_vtable.auth_info_requested = linphonec_prompt_for_auth;
linphonec_vtable.display_status = linphonec_display_status;
linphonec_vtable.display_message=linphonec_display_something;
......
......@@ -230,7 +230,7 @@ int linphone_friend_set_name(LinphoneFriend *lf, const char *name){
return 0;
}
int linphone_friend_send_subscribe(LinphoneFriend *fr, bool_t val){
int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val){
fr->subscribe=val;
return 0;
}
......
......@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*Desmonstrating how to initiate a SIP subscription and receive notification from a sip uri identity passed from the command line.
*<br>Argument must be like sip:jehan@sip.linphone.org .
*<br>
*ex registration sip:jehan@sip.linphone.org secret
*ex budy_list sip:jehan@sip.linphone.org
*<br>Subscription is cleared on SIGINT
*<br>
*@include buddy_status.c
......@@ -52,6 +52,16 @@ static void notify_presence_recv_updated (struct _LinphoneCore *lc, LinphoneFri
,linphone_online_status_to_string(linphone_friend_get_status(friend))
,linphone_address_as_string (friend_address));
}
static void new_subscription_request (struct _LinphoneCore *lc, LinphoneFriend *friend, const char* url) {
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
printf(" [%s] wants to see your status, accepting\n"
,linphone_address_as_string (friend_address));
linphone_friend_edit(friend); /* start editing friend */
linphone_friend_set_inc_subscribe_policy(friend,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/
linphone_friend_done(friend); /*commit change*/
linphone_core_add_friend(lc,friend); /* add this new friend to the buddy list*/
}
LinphoneCore *lc;
int main(int argc, char *argv[]){
......@@ -76,6 +86,7 @@ int main(int argc, char *argv[]){
in order to get notifications about the progress of the registration.
*/
vtable.notify_presence_recv=notify_presence_recv_updated;
vtable.new_subscription_request=new_subscription_request;
/*
Instanciate a LinphoneCore object given the LinphoneCoreVTable
......@@ -92,21 +103,30 @@ int main(int argc, char *argv[]){
linphone_friend_enable_subscribes(my_friend,TRUE); /*configure this friend to emit SUBSCRIBE message after being added to LinphoneCore*/
linphone_friend_set_name(my_friend,"My best friend"); /* add a nickname to this buddy */
//linphone_friend_set_inc_subscribe_policy(my_friend,)
linphone_friend_set_inc_subscribe_policy(my_friend,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/
linphone_core_add_friend(lc,my_friend); /* add my friend to the buddy list, initiate SUBSCRIBE message*/
}
/* main loop for receiving notifications and doing background linphonecore work: */
linphone_core_set_presence_info(lc,0,NULL,LinphoneStatusOnline); /*set my status to online*/
/* main loop for receiving notifications and doing background linphone core work: */
while(running){
linphone_core_iterate(lc); /* first iterate initiates registration */
linphone_core_iterate(lc); /* first iterate initiates subscription */
ms_usleep(50000);
}
linphone_core_set_presence_info(lc,0,NULL,LinphoneStatusOffline); /* change my presence status to offline*/
linphone_core_iterate(lc); /* just to make sure new status is initiate message is issued */
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*/
linphone_core_iterate(lc); /* just to make sure unsubscribe message is issued */
end:
printf("Shutting down...\n");
......
......@@ -92,9 +92,9 @@
linphone_proxy_config_edit(proxy_cfg); /*start editing proxy configuration*/
linphone_proxy_config_enable_register(proxy_cfg,FALSE); /*de-activate registration for this proxy config*/
linphone_proxy_config_done(proxy_cfg); /*initiate REGISTER with expire = 0*/
\endcode
\endcode
<br>
For more complete tutorial can be found see : \ref registration_tutorials "Registration tutorial"
A complete tutorial can be found at : \ref registration_tutorials "Registration tutorial"
**/
/**
......@@ -106,7 +106,47 @@
**/
/**
* @defgroup buddy_list Managing Buddies and buddy list
* @defgroup buddy_list Managing Buddies and buddy list and presence
<b>Buddies and buddy list</b>
<br>Each buddy is represented by a #LinphoneFriend object created by function linphone_friend_new().
Buddy configuration parameters like \link linphone_friend_set_sip_addr() sip uri \endlink or \link linphone_friend_set_inc_subscribe_policy status publication \endlink policy for this \link #LinphoneFriend friend \endlink are configurable for each buddy.
<br>Here under a typical buddy creation:
<br>
\code
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_name(my_friend,"My best friend"); /* add a nickname to this buddy */
linphone_friend_set_inc_subscribe_policy(my_friend,LinphoneSPAccept); /* Incoming subscription request for this friend*/
\endcode
\link #LinphoneFriend friends \endlink status changes are reported by callback LinphoneCoreVTable.notify_presence_recv
\code
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_online_status_to_string(linphone_friend_get_status(friend))
,linphone_address_as_string (friend_address));
}
\endcode
<br>Once created a buddy can be added to the buddy list using function linphone_core_add_friend() . Added friends will be notified about \link linphone_core_set_presence_info() local status changes \endlink
<br>
Any subsequente modifications to #LinphoneFriend must be first started by a call to function linphone_friend_config_edit() and validated by function linphone_friend_config_done()
\code
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*/
\endcode
<b> Publishing presence status </b>
<br>Local presence status can be changed using function linphone_core_set_presence_info() .New status is propagated to all friend \link linphone_core_add_friend() previously added \endlink to #LinphoneCore.
<b>Handling incoming subscription request</b>
<br> New incoming subscription requests are process according to \link linphone_friend_set_inc_subscribe_policy() the incoming subscription policy state \endlink for subscription initiated by \link linphone_core_add_friend() members of the buddy list \endlink
<br> For incoming request comming from an unknown buddy, the call back LinphoneCoreVTable.new_subscription_request .
<br> A complete tutorial can be found at : \ref buddy_tutorials "Registration tutorial"
*/
......
/**
* @mainpage
*
* @see http://www.linphone.org
*
* @section what_is_it What is liblinphone
*
* Liblinphone is a high level library for bringing SIP video call functionnality
* into an application. It aims at making easy the integration of the SIP
* video calls into any applications. All variants of linphone are directly based
* on it:
* - linphone (gtk interface)
*
* - linphonec (console interface)
*
* Liblinphone is GPL (see COPYING file). Please understand the licencing details
* before using it!
*
* For any use of this library beyond the rights granted to you by the
* GPL license, please contact Belledonne Communications
* (contact@belledonne-communications.com)
*
*
**/
/**
* @page liblinphone_license COPYING
* @verbinclude COPYING
*/
/**
* @defgroup initializing Initializing liblinphone
**/
/**
* @defgroup call_control Placing and receiving calls
**/
/**
* @defgroup media_parameters Controlling media parameters
**/
/**
* @defgroup proxies Managing proxies
*User registration is control by #LinphoneProxyConfig settings.<br> Each #LinphoneProxyConfig object can be configured with Registration information like proxy address, user id, refresh period, etc
*<br> A created proxy config using linphone_proxy_config_new(void) once configured #LinphoneProxyConfig must be added to #LinphoneCore using function linphone_core_add_proxy_config().
*<br> It is recommanded to set a default proxy config using function linphone_core_set_default_proxy(). Once done, if proxy config has been configured with attribute enable register linphone_proxy_config_enable_register() , next call to linphone_core_iterate() triggers a SIP registration.
*<br> Registration status is reported by #LinphoneRegistrationStateCb.
*<br>
*<br> This pseudo code demonstrte basic registration operation
*<br>
*<br><b>Authentication</b>
*<br>Most of the time, registration requires \ref authentication "authentication" to succed. #LinphoneAuthInfo info must be either added to #LinphoneCore using function linphone_core_add_auth_info() before #LinphoneProxyConfig is added to Linphone core, or on demand from call back #AuthInfoRequested .
*<br>
*<br><b>Unregistration</b>
**/
/**
* @defgroup network_parameters Controlling network parameters (ports, mtu...)
**/
/**
* @defgroup authentication Managing authentication: userid and passwords
**/
/**
* @defgroup call_logs Managing call logs
**/
/**
* @defgroup linphone_address SIP address parser API.
* This api is useful for manipulating SIP addresses ('from' or 'to' headers).
**/
/**
* @defgroup misc Miscenalleous: logs, version strings, config storage
**/
/**
* @defgroup tutorial_liblinphone Tutorial: Placing calls with liblinphone
*
* The minimalist program below illustrates how to initialize liblinphone and place and outgoing call.
* @include helloworld.c
*
**/
......@@ -39,6 +39,11 @@ extern "C" {
struct _MSSndCard;
struct _LinphoneCore;
/**
* Linphone core main object created by function linphone_core_new() .
* @ingroup initializing
*/
typedef struct _LinphoneCore LinphoneCore;
struct SalOp;
struct _LpConfig;
......@@ -68,6 +73,11 @@ typedef struct _LCSipTransports LCSipTransports;
* @var LinphoneAddress
*/
typedef struct SalAddress LinphoneAddress;
#ifdef IN_LINPHONE
#include "linphonefriend.h"
#else
#include "linphone/linphonefriend.h"
#endif
LinphoneAddress * linphone_address_new(const char *uri);
LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri);
......@@ -230,155 +240,7 @@ LinphoneError linphone_call_get_error(const LinphoneCall *call);
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
/**
* @ingroup buddy_list
* Enum controlling behavior for incoming subscription request.
* <br> Use by linphone_friend_set_inc_subscribe_policy()
*/
typedef enum {
/**
* Does not automatically accept an incoming subscription request.
*
*/
LinphoneSPWait,
/**
* Rejects incoming subscription request.
*/
LinphoneSPDeny,
/**
* Automatically accepts a subscription request.
*/
LinphoneSPAccept
}LinphoneSubscribePolicy;
/**
* @ingroup buddy_list
*/
typedef enum _LinphoneOnlineStatus{
LinphoneStatusOffline,
LinphoneStatusOnline,
LinphoneStatusBusy,
LinphoneStatusBeRightBack,
LinphoneStatusAway,
LinphoneStatusOnThePhone,
LinphoneStatusOutToLunch,
LinphoneStatusDoNotDisturb,
LinphoneStatusMoved,
LinphoneStatusAltService,
LinphoneStatusPending,
LinphoneStatusEnd
}LinphoneOnlineStatus;
/**
* @ingroup buddy_list
* return humain readable presence status
* @param ss
*/
const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
/**
* @addtogroup buddy_list
* @{
*/
struct _LinphoneFriend;
/**
* Represents a buddy, all presence actions like subscription and status change notification are performed on this object
*/
typedef struct _LinphoneFriend LinphoneFriend;
/**
* Contructor
* @return a new empty #LinphoneFriend
*/
LinphoneFriend * linphone_friend_new();
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_sip_addr()
* @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink
*/
LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
/**
* Configure #LinphoneFriend with a new address.
* @param uri a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return 0 if succeed
*/
int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
/**
* modify friend nickname
* @param fr #LinphoneFriend object
* @param new name
* @return 0 if succeed
*
*/
int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
/**
* Configure #LinphoneFriend to subscribe to presence information
* @param fr #LinphoneFriend object
* @param val if TRUE this friend will receive subscription message
*/
int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val);
#define linphone_friend_send_subscribe linphone_friend_enable_subscribes
/**
* Configure incoming subscription policy for this friend.
* @param fr #LinphoneFriend object
* @param pol #LinphoneSubscribePolicy policy to apply.
*/
int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
/**
* 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 \link linphone_friend_set_name() nick name \endlink , \link linphone_friend_set_sip_addr() address \endlink and so on).
* Once the modifications are done, then the application must call
* linphone_friend_done() to commit the changes.
**/
void linphone_friend_edit(LinphoneFriend *fr);
/**
* Commits modification made to the friend configuration.
* @param fr #LinphoneFriend object
**/
void linphone_friend_done(LinphoneFriend *fr);
/**
* Destructor
* @param fr #LinphoneFriend object
*/
void linphone_friend_destroy(LinphoneFriend *lf);
/**
* get address of this friend
* @param lf #LinphoneFriend object
* @return #LinphoneAddress
*/
const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
/**
* get subscription flag value
* @param lf #LinphoneFriend object
* @return returns true is subscription is activated for this friend
*
*/
bool_t linphone_friend_subscribes_enabled(const LinphoneFriend *lf);
#define linphone_friend_get_send_subscribe linphone_friend_subscribes_enabled
/**
* get current subscription policy for this #LinphoneFriend
* @param lf #LinphoneFriend object
* @return #LinphoneSubscribePolicy
*
*/
LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
/**
* get friend status
* @return #LinphoneOnlineStatus
*/
LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
bool_t linphone_friend_in_list(const LinphoneFriend *lf);
#define linphone_friend_url(lf) ((lf)->url)
/**
* @}
*/
/**
* @addtogroup proxies
......@@ -586,11 +448,18 @@ typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneCall *call, c
/**
* Report status change for a friend previously \link linphone_core_add_friend() added \endlink to #LinphoneCore.
* @param lc #LinphoneCore object .
* @param fr Updated #LinphoneFriend .
*/
typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fr);
/** Callback prototype */
typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
* @param lf Updated #LinphoneFriend .
*/
typedef void (*NotifyPresenceReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * lf);
/**
* Reports that a new subscription request has been received and wait for a decision.
* <br> Status on this subscription request is notified by \link linphone_friend_set_inc_subscribe_policy() changing policy \endlink for this friend
* @param lc #LinphoneCore object
* @param lf #LinphoneFriend corresponding to the subscriber
* @param url of the subscriber
* Callback prototype
* */
typedef void (*NewSubscribtionRequestCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
/** Callback prototype */
typedef void (*AuthInfoRequested)(struct _LinphoneCore *lc, const char *realm, const char *username);
/** Callback prototype */
......@@ -613,7 +482,7 @@ typedef struct _LinphoneVTable{
LinphoneRegistrationStateCb registration_state_changed;/**<Notifies registration state changes*/
LinphoneCallStateCb call_state_changed;/**<Notifies call state changes*/
NotifyPresenceReceivedCb notify_presence_recv; /**< Notify received presence events*/
NewUnknownSubscriberCb new_unknown_subscriber; /**< Notify about unknown subscriber */
NewSubscribtionRequestCb new_subscription_request; /**< Notify about pending subscription request */
AuthInfoRequested auth_info_requested; /**< Ask the application some authentication information */
CallLogUpdated call_log_updated; /**< Notifies that call log list has been updated */
TextMessageReceived text_received; /**< A text message has been received */
......@@ -652,11 +521,7 @@ typedef enum _LinphoneWaitingState{
LinphoneWaitingFinished
} LinphoneWaitingState;
typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
/**
* Linphone core main object created by function linphone_core_new() .
* @ingroup initializing
*/
typedef struct _LinphoneCore LinphoneCore;
/* THE main API */
......@@ -895,36 +760,7 @@ bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);
bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);
/**
* @addtogroup buddy_list
* @{
*/
void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
/**
* Add a friend to the current buddy list, if \link linphone_friend_enable_subscribes() subscription attribute \endlink is set, a SIP SUBSCRIBE message is sent.
* @param lc #LinphoneCore object
* @param fr #LinphoneFriend to add
*/
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
/**
*
*/
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
/* a list of LinphoneFriend */
const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
/* notify all friends that have subscribed */
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
/**
* @}
*/
/* returns a list of LinphoneCallLog */
const MSList * linphone_core_get_call_logs(LinphoneCore *lc);
void linphone_core_clear_call_logs(LinphoneCore *lc);
......
/*
linphonefriend.h
Copyright (C) 2010 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LINPHONEFRIEND_H_
#define LINPHONEFRIEND_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup buddy_list
* @{
*/
/**
* @ingroup buddy_list
* Enum controlling behavior for incoming subscription request.
* <br> Use by linphone_friend_set_inc_subscribe_policy()
*/
typedef enum {
/**
* Does not automatically accept an incoming subscription request.
* This policy implies that a decision has to be taken for each incoming subscription request notify in callback LinphoneCoreVTable.new_subscription_request
*
*/
LinphoneSPWait,
/**
* Rejects incoming subscription request.
*/
LinphoneSPDeny,
/**
* Automatically accepts a subscription request.
*/
LinphoneSPAccept
}LinphoneSubscribePolicy;
/**
* Enum describing remote friend status
*/
typedef enum _LinphoneOnlineStatus{
/**
* Offline
*/
LinphoneStatusOffline,
/**
* Online
*/
LinphoneStatusOnline,
/**
* Busy
*/
LinphoneStatusBusy,
/**
* Be right back
*/
LinphoneStatusBeRightBack,
/**
* Away
*/
LinphoneStatusAway,
/**
* On the phone
*/
LinphoneStatusOnThePhone,
/**
* Out to lunch
*/
LinphoneStatusOutToLunch,
/**
* Do not disturb
*/
LinphoneStatusDoNotDisturb,
/**
* Moved in this sate, call can be redirected if an alternate contact address has been set using function linphone_core_set_presence_info()
*/
LinphoneStatusMoved,
/**
* Using another messaging service
*/
LinphoneStatusAltService,
/**
* Pending
*/
LinphoneStatusPending,
LinphoneStatusEnd
}LinphoneOnlineStatus;
/**
* return humain readable presence status
* @param ss
*/
const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
struct _LinphoneFriend;
/**
* Represents a buddy, all presence actions like subscription and status change notification are performed on this object
*/
typedef struct _LinphoneFriend LinphoneFriend;
/**
* Contructor
* @return a new empty #LinphoneFriend
*/
LinphoneFriend * linphone_friend_new();
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_sip_addr()
* @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink
*/
LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
/**
* Configure #LinphoneFriend with a new address.
* @param uri a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return 0 if succeed
*/
int linphone_friend_set_sip_addr(LinphoneFriend *fr, const char *uri);
/**
* modify friend nickname
* @param fr #LinphoneFriend object
* @param new name
* @return 0 if succeed
*
*/
int linphone_friend_set_name(LinphoneFriend *fr, const char *name);
/**
* Configure #LinphoneFriend to subscribe to presence information
* @param fr #LinphoneFriend object
* @param val if TRUE this friend will receive subscription message
*/
int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val);
#define linphone_friend_send_subscribe linphone_friend_enable_subscribes
/**
* Configure incoming subscription policy for this friend.
* @param fr #LinphoneFriend object
* @param pol #LinphoneSubscribePolicy policy to apply.
*/
int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
/**
* 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 \link linphone_friend_set_name() nick name \endlink , \link linphone_friend_set_sip_addr() address \endlink and so on).
* Once the modifications are done, then the application must call
* linphone_friend_done() to commit the changes.
**/
void linphone_friend_edit(LinphoneFriend *fr);
/**
* Commits modification made to the friend configuration.
* @param fr #LinphoneFriend object
**/
void linphone_friend_done(LinphoneFriend *fr);
/**
* Destructor
* @param fr #LinphoneFriend object
*/
void linphone_friend_destroy(LinphoneFriend *lf);
/**
* get address of this friend
* @param lf #LinphoneFriend object
* @return #LinphoneAddress
*/
const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
/**
* get subscription flag value
* @param lf #LinphoneFriend object
* @return returns true is subscription is activated for this friend
*
*/
bool_t linphone_friend_subscribes_enabled(const LinphoneFriend *lf);
#define linphone_friend_get_send_subscribe linphone_friend_subscribes_enabled
/**
* get current subscription policy for this #LinphoneFriend
* @param lf #LinphoneFriend object
* @return #LinphoneSubscribePolicy
*
*/
LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
/**
* get friend status
* @return #LinphoneOnlineStatus
*/
LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
bool_t linphone_friend_in_list(const LinphoneFriend *lf);
#define linphone_friend_url(lf) ((lf)->url)
/**
* Set my presence status
* @param lc #LinphoneCore object
* @param minutes_away how long in away
* @param alternative_contact sip uri used to redirect call in state #LinphoneStatusMoved
* @param os #LinphoneOnlineStatus
*/
void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *alternative_contact,LinphoneOnlineStatus os);
/**
* get my presence status
* @param lc #LinphoneCore object
* @return #LinphoneOnlineStatus
*/
LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
/**
* Add a friend to the current buddy list, if \link linphone_friend_enable_subscribes() subscription attribute \endlink is set, a SIP SUBSCRIBE message is sent.
* @param lc #LinphoneCore object
* @param fr #LinphoneFriend to add
*/
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
/**
* remove a friend from the buddy list
* @param lc #LinphoneCore object
* @param fr #LinphoneFriend to add
*/
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
/**
* Black list a friend. same as linphone_friend_set_inc_subscribe_policy() with #LinphoneSPDeny policy;
* @param lc #LinphoneCore object
* @param fr #LinphoneFriend to add
*/
void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
/**
* get Buddy list of LinphoneFriend
* @param lc #LinphoneCore object
* */
const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
/**
* notify all friends that have subscribed
* @param lc #LinphoneCore object
* @param os #LinphoneOnlineStatus to notify
* */
void linphone_core_notify_all_friends(LinphoneCore *lc, LinphoneOnlineStatus os);
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
/**
* @}
*/
#ifdef __cplusplus
}