Commit 70163d16 authored by Ghislain MARY's avatar Ghislain MARY

Fix wrong event ref handling for long term event of presence.

parent 79b3427a
...@@ -2085,6 +2085,20 @@ static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc, ...@@ -2085,6 +2085,20 @@ static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc,
} }
} }
static void linphone_core_internal_publish_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphonePublishState state) {
if (strcasecmp(linphone_event_get_name(lev), "Presence") == 0) {
const bctbx_list_t *cfgs = linphone_core_get_proxy_config_list(lc);
const bctbx_list_t *item;
for (item = cfgs; item != NULL; item = bctbx_list_next(item)) {
LinphoneProxyConfig *cfg = (LinphoneProxyConfig *)bctbx_list_get_data(item);
if (cfg->long_term_event == lev) {
linphone_proxy_config_notify_publish_state_changed(cfg, state);
break;
}
}
}
}
static void _linphone_core_init_account_creator_service(LinphoneCore *lc) { static void _linphone_core_init_account_creator_service(LinphoneCore *lc) {
LinphoneAccountCreatorService *service = linphone_account_creator_service_new(); LinphoneAccountCreatorService *service = linphone_account_creator_service_new();
service->account_creator_service_constructor_cb = linphone_account_creator_constructor_linphone; service->account_creator_service_constructor_cb = linphone_account_creator_constructor_linphone;
...@@ -2121,6 +2135,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig ...@@ -2121,6 +2135,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
linphone_core_cbs_set_notify_received(internal_cbs, linphone_core_internal_notify_received); linphone_core_cbs_set_notify_received(internal_cbs, linphone_core_internal_notify_received);
linphone_core_cbs_set_subscription_state_changed(internal_cbs, linphone_core_internal_subscription_state_changed); linphone_core_cbs_set_subscription_state_changed(internal_cbs, linphone_core_internal_subscription_state_changed);
linphone_core_cbs_set_publish_state_changed(internal_cbs, linphone_core_internal_publish_state_changed);
_linphone_core_add_callbacks(lc, internal_cbs, TRUE); _linphone_core_add_callbacks(lc, internal_cbs, TRUE);
belle_sip_object_unref(internal_cbs); belle_sip_object_unref(internal_cbs);
......
...@@ -453,6 +453,7 @@ void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj); ...@@ -453,6 +453,7 @@ void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj);
void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc); void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc);
void _linphone_proxy_config_release(LinphoneProxyConfig *cfg); void _linphone_proxy_config_release(LinphoneProxyConfig *cfg);
void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj); void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj);
void linphone_proxy_config_notify_publish_state_changed(LinphoneProxyConfig *cfg, LinphonePublishState state);
/* /*
* returns service route as defined in as defined by rfc3608, might be a list instead of just one. * returns service route as defined in as defined by rfc3608, might be a list instead of just one.
......
...@@ -824,8 +824,6 @@ LinphoneStatus linphone_proxy_config_done(LinphoneProxyConfig *cfg) ...@@ -824,8 +824,6 @@ LinphoneStatus linphone_proxy_config_done(LinphoneProxyConfig *cfg)
} }
/*publish is terminated*/ /*publish is terminated*/
linphone_event_terminate(cfg->long_term_event); linphone_event_terminate(cfg->long_term_event);
linphone_event_unref(cfg->long_term_event);
cfg->long_term_event = NULL;
} }
if (cfg->publish) cfg->send_publish=TRUE; if (cfg->publish) cfg->send_publish=TRUE;
} else { } else {
...@@ -1461,3 +1459,10 @@ void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatP ...@@ -1461,3 +1459,10 @@ void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatP
if (cfg->nat_policy != NULL) linphone_nat_policy_unref(cfg->nat_policy); if (cfg->nat_policy != NULL) linphone_nat_policy_unref(cfg->nat_policy);
cfg->nat_policy = policy; cfg->nat_policy = policy;
} }
void linphone_proxy_config_notify_publish_state_changed(LinphoneProxyConfig *cfg, LinphonePublishState state) {
if ((cfg->long_term_event != NULL) && ((state == LinphonePublishCleared) || (state == LinphonePublishError))) {
linphone_event_unref(cfg->long_term_event);
cfg->long_term_event = NULL;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment