linphonefriend.h 16.6 KB
Newer Older
jehan's avatar
jehan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
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_
22 23

#include "linphonepresence.h"
24
#include "vcard.h"
25

jehan's avatar
jehan committed
26 27 28
#ifdef __cplusplus
extern "C" {
#endif
29

jehan's avatar
jehan committed
30 31 32 33 34 35 36 37
/**
 * @addtogroup buddy_list
 * @{
 */
/**
 * Enum controlling behavior for incoming subscription request.
 * <br> Use by linphone_friend_set_inc_subscribe_policy()
 */
38
typedef enum _LinphoneSubscribePolicy {
jehan's avatar
jehan committed
39 40
	/**
	 * Does not automatically accept an incoming subscription request.
41
	 * This policy implies that a decision has to be taken for each incoming subscription request notified by callback LinphoneCoreVTable.new_subscription_requested
jehan's avatar
jehan committed
42 43 44 45 46 47 48 49 50 51 52
	 *
	 */
	LinphoneSPWait,
	/**
	 * Rejects incoming subscription request.
	 */
	LinphoneSPDeny,
	/**
	 * Automatically accepts a subscription request.
	 */
	LinphoneSPAccept
53
} LinphoneSubscribePolicy;
jehan's avatar
jehan committed
54 55 56

/**
 * Enum describing remote friend status
57
 * @deprecated Use #LinphonePresenceModel and #LinphonePresenceActivity instead
jehan's avatar
jehan committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
 */
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,
104 105 106 107
	/**
	 * Vacation
	 */
	LinphoneStatusVacation,
Simon Morlat's avatar
Simon Morlat committed
108

jehan's avatar
jehan committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122
	LinphoneStatusEnd
}LinphoneOnlineStatus;


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
 */
123
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_new(void);
Ghislain MARY's avatar
Ghislain MARY committed
124

jehan's avatar
jehan committed
125
/**
Ghislain MARY's avatar
Ghislain MARY committed
126
 * Contructor same as linphone_friend_new() + linphone_friend_set_address()
jehan's avatar
jehan committed
127 128 129
 * @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
 */
Ghislain MARY's avatar
Ghislain MARY committed
130 131 132 133 134 135 136
LINPHONE_PUBLIC	LinphoneFriend *linphone_friend_new_with_address(const char *addr);

/**
 * Contructor same as linphone_friend_new() + linphone_friend_set_address()
 * @deprecated Use #linphone_friend_new_with_address instead
 */
#define linphone_friend_new_with_addr linphone_friend_new_with_address
jehan's avatar
jehan committed
137

jehan's avatar
jehan committed
138
/**
139 140 141
 * Destroy a LinphoneFriend.
 * @param lf LinphoneFriend object
 * @deprecated Use linphone_friend_unref() instead.
jehan's avatar
jehan committed
142
 */
Ghislain MARY's avatar
Ghislain MARY committed
143
LINPHONE_PUBLIC void linphone_friend_destroy(LinphoneFriend *lf);
jehan's avatar
jehan committed
144

jehan's avatar
jehan committed
145
/**
146
 * Set #LinphoneAddress for this friend
jehan's avatar
jehan committed
147
 * @param fr #LinphoneFriend object
jehan's avatar
jehan committed
148 149
 * @param address #LinphoneAddress
 */
150 151 152 153 154 155 156
LINPHONE_PUBLIC int linphone_friend_set_address(LinphoneFriend *fr, const LinphoneAddress* address);

/**
 * Set #LinphoneAddress for this friend
 * @deprecated Use #linphone_friend_set_address instead
 */
#define linphone_friend_set_addr linphone_friend_set_address
jehan's avatar
jehan committed
157

158
/**
159 160 161 162 163 164 165 166
 * Get address of this friend
 * @param lf #LinphoneFriend object
 * @return #LinphoneAddress
 */
LINPHONE_PUBLIC	const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);

/**
 * Set the display name for this friend
167 168 169
 * @param lf #LinphoneFriend object
 * @param name 
 */
Ghislain MARY's avatar
Ghislain MARY committed
170
LINPHONE_PUBLIC int linphone_friend_set_name(LinphoneFriend *lf, const char *name);
171

jehan's avatar
jehan committed
172
/**
173
 * Get the display name for this friend
jehan's avatar
jehan committed
174
 * @param lf #LinphoneFriend object
175
 * @return The display name of this friend
jehan's avatar
jehan committed
176
 */
177 178
LINPHONE_PUBLIC const char * linphone_friend_get_name(const LinphoneFriend *lf);

jehan's avatar
jehan committed
179 180 181 182
/**
 * get subscription flag value
 * @param lf #LinphoneFriend object
 * @return returns true is subscription is activated for this friend
jehan's avatar
jehan committed
183 184
 *
 */
Ghislain MARY's avatar
Ghislain MARY committed
185
LINPHONE_PUBLIC bool_t linphone_friend_subscribes_enabled(const LinphoneFriend *lf);
jehan's avatar
jehan committed
186 187
#define linphone_friend_get_send_subscribe linphone_friend_subscribes_enabled

jehan's avatar
jehan committed
188 189 190 191 192 193
/**
 * Configure #LinphoneFriend to subscribe to presence information
 * @param fr #LinphoneFriend object
 * @param val if TRUE this friend will receive subscription message
 */

194
LINPHONE_PUBLIC	int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val);
jehan's avatar
jehan committed
195
#define linphone_friend_send_subscribe linphone_friend_enable_subscribes
Ghislain MARY's avatar
Ghislain MARY committed
196

jehan's avatar
jehan committed
197 198 199 200 201
/**
 * Configure incoming subscription policy for this friend.
 * @param fr #LinphoneFriend object
 * @param pol #LinphoneSubscribePolicy policy to apply.
 */
Ghislain MARY's avatar
Ghislain MARY committed
202
LINPHONE_PUBLIC int linphone_friend_set_inc_subscribe_policy(LinphoneFriend *fr, LinphoneSubscribePolicy pol);
Ghislain MARY's avatar
Ghislain MARY committed
203

jehan's avatar
jehan committed
204 205 206 207 208 209
/**
 * get current subscription policy for this #LinphoneFriend
 * @param lf #LinphoneFriend object
 * @return #LinphoneSubscribePolicy
 *
 */
Ghislain MARY's avatar
Ghislain MARY committed
210
LINPHONE_PUBLIC LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
jehan's avatar
jehan committed
211

jehan's avatar
jehan committed
212 213 214 215 216
/**
 * Starts editing a friend configuration.
 *
 * Because friend configuration must be consistent, applications MUST
 * call linphone_friend_edit() before doing any attempts to modify
Ghislain MARY's avatar
Ghislain MARY committed
217
 * friend configuration (such as \link linphone_friend_set_address() address \endlink  or \link linphone_friend_set_inc_subscribe_policy() subscription policy\endlink  and so on).
jehan's avatar
jehan committed
218 219 220
 * Once the modifications are done, then the application must call
 * linphone_friend_done() to commit the changes.
**/
221
LINPHONE_PUBLIC	void linphone_friend_edit(LinphoneFriend *fr);
Ghislain MARY's avatar
Ghislain MARY committed
222

jehan's avatar
jehan committed
223 224 225 226
/**
 * Commits modification made to the friend configuration.
 * @param fr #LinphoneFriend object
**/
227
LINPHONE_PUBLIC	void linphone_friend_done(LinphoneFriend *fr);
jehan's avatar
jehan committed
228

jehan's avatar
jehan committed
229
/**
230
 * Get the status of a friend
231
 * @param[in] lf A #LinphoneFriend object
jehan's avatar
jehan committed
232
 * @return #LinphoneOnlineStatus
233
 * @deprecated Use linphone_friend_get_presence_model() instead
jehan's avatar
jehan committed
234
 */
Ghislain MARY's avatar
Ghislain MARY committed
235
LINPHONE_PUBLIC LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
236

237
/**
238
 * Get the presence model of a friend
239
 * @param[in] lf A #LinphoneFriend object
Ghislain MARY's avatar
Ghislain MARY committed
240
 * @return A #LinphonePresenceModel object, or NULL if the friend do not have presence information (in which case he is considered offline)
241
 */
Ghislain MARY's avatar
Ghislain MARY committed
242
LINPHONE_PUBLIC const LinphonePresenceModel * linphone_friend_get_presence_model(LinphoneFriend *lf);
243

244 245 246 247 248 249 250
/**
 * Set the presence model of a friend
 * @param[in] lf A #LinphoneFriend object
 * @param[in] presence The #LinphonePresenceModel object to set for the friend
 */
LINPHONE_PUBLIC void linphone_friend_set_presence_model(LinphoneFriend *lf, LinphonePresenceModel *presence);

251 252 253 254 255 256 257
/**
 * Tells whether we already received presence information for a friend.
 * @param[in] lf A #LinphoneFriend object
 * @return TRUE if presence information has been received for the friend, FALSE otherwise.
 */
LINPHONE_PUBLIC bool_t linphone_friend_is_presence_received(const LinphoneFriend *lf);

Simon Morlat's avatar
Simon Morlat committed
258 259 260 261 262 263 264 265 266 267
/**
 * Store user pointer to friend object.
**/
LINPHONE_PUBLIC void linphone_friend_set_user_data(LinphoneFriend *lf, void *data);

/**
 * Retrieve user data associated with friend.
**/
LINPHONE_PUBLIC void* linphone_friend_get_user_data(const LinphoneFriend *lf);

Ghislain MARY's avatar
Ghislain MARY committed
268
LINPHONE_PUBLIC BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
Ghislain MARY's avatar
Ghislain MARY committed
269 270 271 272 273 274

/**
 * Set the reference key of a friend.
 * @param[in] lf #LinphoneFriend object.
 * @param[in] key The reference key to use for the friend.
**/
Ghislain MARY's avatar
Ghislain MARY committed
275
LINPHONE_PUBLIC void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
Ghislain MARY's avatar
Ghislain MARY committed
276 277 278 279

/**
 * Get the reference key of a friend.
 * @param[in] lf #LinphoneFriend object.
280
 * @return The reference key of the friend.
Ghislain MARY's avatar
Ghislain MARY committed
281
**/
Ghislain MARY's avatar
Ghislain MARY committed
282
LINPHONE_PUBLIC const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
Ghislain MARY's avatar
Ghislain MARY committed
283 284 285 286

/**
 * Check that the given friend is in a friend list.
 * @param[in] lf #LinphoneFriend object.
287
 * @return TRUE if the friend is in a friend list, FALSE otherwise.
Ghislain MARY's avatar
Ghislain MARY committed
288
**/
Ghislain MARY's avatar
Ghislain MARY committed
289
LINPHONE_PUBLIC bool_t linphone_friend_in_list(const LinphoneFriend *lf);
jehan's avatar
jehan committed
290 291


jehan's avatar
jehan committed
292
/**
293
 * Return humain readable presence status
jehan's avatar
jehan committed
294
 * @param ss
295
 * @deprecated Use #LinphonePresenceModel, #LinphonePresenceActivity and linphone_presence_activity_to_string() instead.
jehan's avatar
jehan committed
296
 */
Ghislain MARY's avatar
Ghislain MARY committed
297
LINPHONE_PUBLIC const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
jehan's avatar
jehan committed
298 299


jehan's avatar
jehan committed
300
/**
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
 * Create a default LinphoneFriend.
 * @param[in] lc #LinphoneCore object
 * @return The created #LinphoneFriend object
 */
LINPHONE_PUBLIC LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc);

/**
 * Create a LinphoneFriend from the given address.
 * @param[in] lc #LinphoneCore object
 * @param[in] address A string containing the address to create the LinphoneFriend from
 * @return The created #LinphoneFriend object
 */
LINPHONE_PUBLIC LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address);

/**
 * Set my presence status
317 318 319 320 321
 * @param[in] lc #LinphoneCore object
 * @param[in] minutes_away how long in away
 * @param[in] alternative_contact sip uri used to redirect call in state #LinphoneStatusMoved
 * @param[in] os #LinphoneOnlineStatus
 * @deprecated Use linphone_core_set_presence_model() instead
jehan's avatar
jehan committed
322
 */
323
LINPHONE_PUBLIC void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *alternative_contact,LinphoneOnlineStatus os);
324 325

/**
326
 * Set my presence model
327 328
 * @param[in] lc #LinphoneCore object
 * @param[in] presence #LinphonePresenceModel
329
 */
330
LINPHONE_PUBLIC void linphone_core_set_presence_model(LinphoneCore *lc, LinphonePresenceModel *presence);
331

jehan's avatar
jehan committed
332
/**
333
 * Get my presence status
334
 * @param[in] lc #LinphoneCore object
jehan's avatar
jehan committed
335
 * @return #LinphoneOnlineStatus
336
 * @deprecated Use linphone_core_get_presence_model() instead
jehan's avatar
jehan committed
337
 */
Ghislain MARY's avatar
Ghislain MARY committed
338
LINPHONE_PUBLIC LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);
jehan's avatar
jehan committed
339

340
/**
341
 * Get my presence model
342 343
 * @param[in] lc #LinphoneCore object
 * @return A #LinphonePresenceModel object, or NULL if no presence model has been set.
344
 */
Ghislain MARY's avatar
Ghislain MARY committed
345
LINPHONE_PUBLIC LinphonePresenceModel * linphone_core_get_presence_model(const LinphoneCore *lc);
346

Ghislain MARY's avatar
Ghislain MARY committed
347 348 349
/**
 * @deprecated Use linphone_core_interpret_url() instead
 */
Ghislain MARY's avatar
Ghislain MARY committed
350
LINPHONE_PUBLIC void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result);
Ghislain MARY's avatar
Ghislain MARY committed
351

jehan's avatar
jehan committed
352 353 354 355
/**
 * 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
356
 * @deprecated use linphone_friend_list_add_friend() instead.
jehan's avatar
jehan committed
357
 */
358
LINPHONE_PUBLIC	void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
Ghislain MARY's avatar
Ghislain MARY committed
359

jehan's avatar
jehan committed
360
/**
361
 * Removes a friend from the buddy list
jehan's avatar
jehan committed
362
 * @param lc #LinphoneCore object
363
 * @param fr #LinphoneFriend to remove
364
 * @deprecated use linphone_friend_list_remove_friend() instead.
jehan's avatar
jehan committed
365
 */
Ghislain MARY's avatar
Ghislain MARY committed
366
LINPHONE_PUBLIC void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend *fr);
Ghislain MARY's avatar
Ghislain MARY committed
367

jehan's avatar
jehan committed
368 369 370
/**
 * Black list a friend. same as linphone_friend_set_inc_subscribe_policy() with #LinphoneSPDeny policy;
 * @param lc #LinphoneCore object
jehan's avatar
jehan committed
371
 * @param lf #LinphoneFriend to add
jehan's avatar
jehan committed
372
 */
Ghislain MARY's avatar
Ghislain MARY committed
373
LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
Ghislain MARY's avatar
Ghislain MARY committed
374

jehan's avatar
jehan committed
375
/**
Ghislain MARY's avatar
Ghislain MARY committed
376
 * Get Buddy list of LinphoneFriend
377 378
 * @param[in] lc #LinphoneCore object
 * @return \mslist{LinphoneFriend}
379
 * @deprecated use linphone_core_get_friends_lists() or linphone_friend_list_get_friends() instead.
Ghislain MARY's avatar
Ghislain MARY committed
380
 */
381
LINPHONE_PUBLIC	const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
Ghislain MARY's avatar
Ghislain MARY committed
382

jehan's avatar
jehan committed
383
/**
Ghislain MARY's avatar
Ghislain MARY committed
384
 * Notify all friends that have subscribed
jehan's avatar
jehan committed
385
 * @param lc #LinphoneCore object
Ghislain MARY's avatar
Ghislain MARY committed
386
 * @param presence #LinphonePresenceModel to notify
Ghislain MARY's avatar
Ghislain MARY committed
387
 */
Ghislain MARY's avatar
Ghislain MARY committed
388
LINPHONE_PUBLIC void linphone_core_notify_all_friends(LinphoneCore *lc, LinphonePresenceModel *presence);
Ghislain MARY's avatar
Ghislain MARY committed
389

Ghislain MARY's avatar
Ghislain MARY committed
390 391 392 393
/**
 * Search a LinphoneFriend by its address.
 * @param[in] lc #LinphoneCore object.
 * @param[in] addr The address to use to search the friend.
394
 * @return The #LinphoneFriend object corresponding to the given address.
Simon Morlat's avatar
Simon Morlat committed
395
 * @deprecated use linphone_core_find_friend() instead.
Ghislain MARY's avatar
Ghislain MARY committed
396
 */
Ghislain MARY's avatar
Ghislain MARY committed
397
LINPHONE_PUBLIC LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *addr);
Ghislain MARY's avatar
Ghislain MARY committed
398

Simon Morlat's avatar
Simon Morlat committed
399 400 401 402
/**
 * Search a LinphoneFriend by its address.
 * @param[in] lc #LinphoneCore object.
 * @param[in] addr The address to use to search the friend.
403
 * @return The #LinphoneFriend object corresponding to the given address.
Simon Morlat's avatar
Simon Morlat committed
404 405 406
 */
LINPHONE_PUBLIC LinphoneFriend *linphone_core_find_friend(const LinphoneCore *lc, const LinphoneAddress *addr);

Ghislain MARY's avatar
Ghislain MARY committed
407 408 409 410
/**
 * Search a LinphoneFriend by its reference key.
 * @param[in] lc #LinphoneCore object.
 * @param[in] key The reference key to use to search the friend.
411
 * @return The #LinphoneFriend object corresponding to the given reference key.
Ghislain MARY's avatar
Ghislain MARY committed
412
 */
Ghislain MARY's avatar
Ghislain MARY committed
413
LINPHONE_PUBLIC LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key);
jehan's avatar
jehan committed
414

415 416 417 418 419 420 421 422 423
/**
 * Acquire a reference to the linphone friend.
 * @param[in] lf LinphoneFriend object
 * @return The same LinphoneFriend object
**/
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_ref(LinphoneFriend *lf);

/**
 * Release a reference to the linphone friend.
424
 * @param[in] lf LinphoneFriend object
425 426
**/
LINPHONE_PUBLIC void linphone_friend_unref(LinphoneFriend *lf);
427 428 429

/**
 * Returns the LinphoneCore object managing this friend, if any.
430
 * @param[in] fr LinphoneFriend object
431 432
 */
LINPHONE_PUBLIC LinphoneCore *linphone_friend_get_core(const LinphoneFriend *fr);
433 434

/**
435
 * Returns the vCard object associated to this friend, if any
436
 * @param[in] fr LinphoneFriend object
437 438 439 440
 */
LINPHONE_PUBLIC LinphoneVCard* linphone_friend_get_vcard(LinphoneFriend *fr);

/**
441
 * Binds a vCard object to a friend
442
 * @param[in] fr LinphoneFriend object
443
 * @param[in] vcard The vCard object to bind
444 445
 */
LINPHONE_PUBLIC void linphone_friend_set_vcard(LinphoneFriend *fr, LinphoneVCard *vcard);
446 447

/**
448
 * 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
449 450 451 452 453
 * @param[in] fr LinphoneFriend object
 * @param[in] name The full name of the friend or NULL to use the one from the friend's SIP URI
 * @return 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
 */
LINPHONE_PUBLIC bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name);
454 455 456

/**
 * Contructor same as linphone_friend_new() + linphone_friend_set_address()
457 458
 * @param vcard a vCard object
 * @return a new #LinphoneFriend with \link linphone_friend_get_vcard() vCard initialized \endlink
459 460 461 462
 */
LINPHONE_PUBLIC	LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVCard *vcard);

/**
463
 * Creates and adds LinphoneFriend objects to LinphoneCore from a file that contains the vCard(s) to parse
464
 * @param[in] lc the LinphoneCore object
465
 * @param[in] vcard_file the path to a file that contains the vCard(s) to parse
466 467 468 469
 * @return the amount of linphone friends created
 */
LINPHONE_PUBLIC int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char *vcard_file);

470 471 472 473 474 475 476 477
/**
 * Creates and adds LinphoneFriend objects to LinphoneCore from a buffer that contains the vCard(s) to parse
 * @param[in] lc the LinphoneCore object
 * @param[in] vcard_buffer the buffer that contains the vCard(s) to parse
 * @return the amount of linphone friends created
 */
LINPHONE_PUBLIC int linphone_core_import_friends_from_vcard4_buffer(LinphoneCore *lc, const char *vcard_buffer);

478 479 480 481 482 483 484
/**
 * Creates and export LinphoneFriend objects from LinphoneCore to a file using vCard 4 format
 * @param[in] lc the LinphoneCore object
 * @param[in] vcard_file the path to a file that will contain the vCards
 */
LINPHONE_PUBLIC void linphone_core_export_friends_as_vcard4_file(LinphoneCore *lc, const char *vcard_file);

485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
/**
 * Sets the database filename where friends will be stored.
 * If the file does not exist, it will be created.
 * @ingroup initializing
 * @param lc the linphone core
 * @param path filesystem path
**/
LINPHONE_PUBLIC void linphone_core_set_friends_database_path(LinphoneCore *lc, const char *path);

/**
 * Migrates the friends from the linphonerc to the database if not done yet
 * @ingroup initializing
 * @param lc the linphone core
**/
LINPHONE_PUBLIC void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc);

jehan's avatar
jehan committed
501 502 503 504 505 506 507 508 509
/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* LINPHONEFRIEND_H_ */