mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 20:46:28 +00:00
Fix wrong event ref handling for long term event of presence.
This commit is contained in:
parent
79b3427a13
commit
70163d163a
3 changed files with 23 additions and 2 deletions
|
|
@ -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) {
|
||||
LinphoneAccountCreatorService *service = linphone_account_creator_service_new();
|
||||
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
|
|||
|
||||
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_publish_state_changed(internal_cbs, linphone_core_internal_publish_state_changed);
|
||||
_linphone_core_add_callbacks(lc, internal_cbs, TRUE);
|
||||
belle_sip_object_unref(internal_cbs);
|
||||
|
||||
|
|
|
|||
|
|
@ -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_release(LinphoneProxyConfig *cfg);
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -824,8 +824,6 @@ LinphoneStatus linphone_proxy_config_done(LinphoneProxyConfig *cfg)
|
|||
}
|
||||
/*publish is terminated*/
|
||||
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;
|
||||
} else {
|
||||
|
|
@ -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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue