diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 6e8549458..ed0484b6f 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -454,7 +454,14 @@ void linphone_friend_list_set_display_name(LinphoneFriendList *list, const char const LinphoneAddress * linphone_friend_list_get_rls_address(const LinphoneFriendList *list){ return list->rls_addr; } - +const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFriendList *list) { + if (list->rls_addr) + return list->rls_addr; + else if (list->lc) + return list->lc->default_rls_addr; + else + return NULL; +} void linphone_friend_list_set_rls_address(LinphoneFriendList *list, const LinphoneAddress *rls_addr){ LinphoneAddress *new_rls_addr = rls_addr ? linphone_address_clone(rls_addr) : NULL; @@ -783,20 +790,18 @@ static void linphone_friend_list_send_list_subscription(LinphoneFriendList *list void linphone_friend_list_update_subscriptions(LinphoneFriendList *list){ LinphoneProxyConfig *cfg = NULL; - const LinphoneAddress *address = linphone_friend_list_get_rls_address(list); + const LinphoneAddress *address = _linphone_friend_list_get_rls_address(list); bool_t only_when_registered = FALSE; bool_t should_send_list_subscribe = FALSE; - bool_t use_rls_presence = FALSE; if (list->lc){ if (address) cfg = linphone_core_lookup_known_proxy(list->lc, address); only_when_registered = linphone_core_should_subscribe_friends_only_when_registered(list->lc); should_send_list_subscribe = (!only_when_registered || !cfg || cfg->state == LinphoneRegistrationOk); - use_rls_presence = lp_config_get_int(list->lc->config, "sip", "use_rls_presence", 0); } - if (use_rls_presence && (list->rls_addr != NULL)) { + if (address != NULL) { if (list->enable_subscriptions) { if (should_send_list_subscribe){ linphone_friend_list_send_list_subscription(list); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 440e119a9..0ad4bb216 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1057,6 +1057,8 @@ static void sip_config_read(LinphoneCore *lc) linphone_core_set_sip_transport_timeout(lc, lp_config_get_int(lc->config, "sip", "transport_timeout", 63000)); sal_set_supported_tags(lc->sal,lp_config_get_string(lc->config,"sip","supported","replaces, outbound")); lc->sip_conf.save_auth_info = lp_config_get_int(lc->config, "sip", "save_auth_info", 1); + if (lp_config_get_string(lc->config, "sip", "rls_uri", NULL)) + lc->default_rls_addr = linphone_address_new(lp_config_get_string(lc->config, "sip", "rls_uri", NULL)); } static void rtp_config_read(LinphoneCore *lc) @@ -2071,8 +2073,6 @@ void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list } void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) { - const char *rls_uri = lp_config_get_string(lc->config, "sip", "rls_uri", NULL); - if (!list->lc) { list->lc = lc; } @@ -2081,9 +2081,6 @@ void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) { linphone_core_store_friends_list_in_db(lc, list); #endif linphone_core_notify_friend_list_created(lc, list); - if (!linphone_friend_list_get_rls_uri(list) && rls_uri && lp_config_get_int(lc->config, "sip", "use_rls_presence", 0)) { - linphone_friend_list_set_rls_uri(list, rls_uri); - } } void linphone_core_enable_audio_adaptive_jittcomp(LinphoneCore* lc, bool_t val) @@ -6548,6 +6545,8 @@ void sip_config_uninit(LinphoneCore *lc) ms_free(lc->sip_conf.guessed_contact); if (config->contact) ms_free(config->contact); + if (lc->default_rls_addr) + linphone_address_destroy(lc->default_rls_addr); } diff --git a/coreapi/private.h b/coreapi/private.h index fa627e823..942f4d9c7 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -423,6 +423,9 @@ void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list); void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, LinphoneEvent *lev, const LinphoneContent *body); void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state); void _linphone_friend_list_release(LinphoneFriendList *list); +/*get rls either from list or core if any*/ +const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFriendList *list); + void linphone_friend_invalidate_subscription(LinphoneFriend *lf); void linphone_friend_close_subscriptions(LinphoneFriend *lf); void _linphone_friend_release(LinphoneFriend *lf); @@ -1058,6 +1061,9 @@ struct _LinphoneCore /* string for TLS auth instead of path to files */ char *tls_cert; char *tls_key; + + /*default resource list server*/ + LinphoneAddress *default_rls_addr; }; diff --git a/coreapi/vtables.c b/coreapi/vtables.c index 72ff3f888..df386f9c5 100644 --- a/coreapi/vtables.c +++ b/coreapi/vtables.c @@ -143,10 +143,6 @@ void linphone_core_notify_new_subscription_requested(LinphoneCore *lc, LinphoneF cleanup_dead_vtable_refs(lc); } -void linphone_core_notify_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) { - NOTIFY_IF_EXIST(auth_info_requested, lc, realm, username, domain); - cleanup_dead_vtable_refs(lc); -} void linphone_core_notify_authentication_requested(LinphoneCore *lc, LinphoneAuthInfo *ai, LinphoneAuthMethod method) { NOTIFY_IF_EXIST(authentication_requested, lc, ai, method); @@ -166,6 +162,11 @@ void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *ne #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif +void linphone_core_notify_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) { + NOTIFY_IF_EXIST(auth_info_requested, lc, realm, username, domain); + cleanup_dead_vtable_refs(lc); +} + void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message){ NOTIFY_IF_EXIST(text_received, lc,room,from,message); cleanup_dead_vtable_refs(lc);