diff --git a/coreapi/linphonepresence.h b/coreapi/linphonepresence.h index 9e650c6ce..b4cef5252 100644 --- a/coreapi/linphonepresence.h +++ b/coreapi/linphonepresence.h @@ -390,11 +390,13 @@ LINPHONE_PUBLIC int linphone_presence_model_clear_services(LinphonePresenceModel /** * @brief Creates a presence service. * @param[in] id The id of the presence service to be created. Can be NULL to generate it automatically. + * @param[in] basic_status The #LinphonePresenceBasicStatus to set for the #LinphonePresenceService object. + * @param[in] contact The contact string to set. * @returns The created presence service, NULL on error. * * The created presence service has the basic status 'closed'. */ -LINPHONE_PUBLIC LinphonePresenceService * linphone_presence_service_new(const char *id); +LINPHONE_PUBLIC LinphonePresenceService * linphone_presence_service_new(const char *id, LinphonePresenceBasicStatus, const char *contact); /** * @brief Gets the basic status of a presence service. diff --git a/coreapi/presence.c b/coreapi/presence.c index 52724bdfc..16c8bdcd2 100644 --- a/coreapi/presence.c +++ b/coreapi/presence.c @@ -354,10 +354,9 @@ int linphone_presence_model_set_basic_status(LinphonePresenceModel *model, Linph if (model == NULL) return -1; linphone_presence_model_clear_services(model); - service = linphone_presence_service_new(NULL); + service = linphone_presence_service_new(NULL, basic_status, NULL); if (service == NULL) return -1; - if (linphone_presence_service_set_basic_status(service, basic_status) < 0) return -1; if (linphone_presence_model_add_service(model, service) < 0) return -1; return 0; } @@ -403,7 +402,7 @@ int linphone_presence_model_set_contact(LinphonePresenceModel *model, const char service = linphone_presence_model_get_nth_service(model, 0); if (service == NULL) { - service = linphone_presence_service_new(NULL); + service = linphone_presence_service_new(NULL, LinphonePresenceBasicStatusClosed, NULL); if (service == NULL) return -1; linphone_presence_model_add_service(model, service); } @@ -708,14 +707,15 @@ int linphone_presence_model_clear_services(LinphonePresenceModel *model) { * PRESENCE SERVICE FUNCTIONS TO GET ACCESS TO ALL FUNCTIONALITIES * ****************************************************************************/ -LinphonePresenceService * linphone_presence_service_new(const char *id) { +LinphonePresenceService * linphone_presence_service_new(const char *id, LinphonePresenceBasicStatus basic_status, const char *contact) { LinphonePresenceService *service; char *service_id; if (id == NULL) service_id = generate_presence_id(); else service_id = ms_strdup(id); - service = presence_service_new(service_id, LinphonePresenceBasicStatusClosed); + service = presence_service_new(service_id, basic_status); + linphone_presence_service_set_contact(service, contact); if (service_id != NULL) ms_free(service_id); return service;