mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Allow setting the id of a presence service.
This commit is contained in:
parent
c61dc5a039
commit
3296462b7a
2 changed files with 13 additions and 7 deletions
|
|
@ -389,11 +389,12 @@ 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.
|
||||
* @returns The created presence service, NULL on error.
|
||||
*
|
||||
* The created presence service has the basic status 'closed'.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphonePresenceService * linphone_presence_service_new(void);
|
||||
LINPHONE_PUBLIC LinphonePresenceService * linphone_presence_service_new(const char *id);
|
||||
|
||||
/**
|
||||
* @brief Gets the basic status of a presence service.
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ 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();
|
||||
service = linphone_presence_service_new(NULL);
|
||||
if (service == NULL) return -1;
|
||||
|
||||
if (linphone_presence_service_set_basic_status(service, basic_status) < 0) return -1;
|
||||
|
|
@ -403,7 +403,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();
|
||||
service = linphone_presence_service_new(NULL);
|
||||
if (service == NULL) return -1;
|
||||
linphone_presence_model_add_service(model, service);
|
||||
}
|
||||
|
|
@ -708,11 +708,16 @@ int linphone_presence_model_clear_services(LinphonePresenceModel *model) {
|
|||
* PRESENCE SERVICE FUNCTIONS TO GET ACCESS TO ALL FUNCTIONALITIES *
|
||||
****************************************************************************/
|
||||
|
||||
LinphonePresenceService * linphone_presence_service_new(void) {
|
||||
LinphonePresenceService * linphone_presence_service_new(const char *id) {
|
||||
LinphonePresenceService *service;
|
||||
char *id = generate_presence_id();
|
||||
service = presence_service_new(id, LinphonePresenceBasicStatusClosed);
|
||||
ms_free(id);
|
||||
char *service_id;
|
||||
if (id == NULL)
|
||||
service_id = generate_presence_id();
|
||||
else
|
||||
service_id = ms_strdup(id);
|
||||
service = presence_service_new(service_id, LinphonePresenceBasicStatusClosed);
|
||||
if (service_id != NULL)
|
||||
ms_free(service_id);
|
||||
return service;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue