From 80b369728c84e3ed09af9c0f0e73e0bc0425f784 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 13 Apr 2018 17:06:40 +0200 Subject: [PATCH] Added a setting in proxy config to tell the app whether or not to set push notification informations --- coreapi/private_structs.h | 2 ++ coreapi/proxy.c | 11 +++++++++++ include/linphone/proxy_config.h | 14 ++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/coreapi/private_structs.h b/coreapi/private_structs.h index 81dafc688..9a7da002a 100644 --- a/coreapi/private_structs.h +++ b/coreapi/private_structs.h @@ -132,6 +132,8 @@ struct _LinphoneProxyConfig char *refkey; char *sip_etag; /*publish context*/ char *conference_factory_uri; + + bool_t push_notification_allowed; }; BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneProxyConfig); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index b797e1d0b..ea6bfd0fc 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -143,6 +143,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cf cfg->avpf_rr_interval = lc ? !!lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5; cfg->publish_expires= lc ? lp_config_get_default_int(lc->config, "proxy", "publish_expires", -1) : -1; cfg->publish = lc ? !!lp_config_get_default_int(lc->config, "proxy", "publish", FALSE) : FALSE; + cfg->push_notification_allowed = lc ? !!lp_config_get_default_int(lc->config, "proxy", "push_notification_allowed", TRUE) : TRUE; cfg->refkey = refkey ? ms_strdup(refkey) : NULL; if (nat_policy_ref) { LinphoneNatPolicy *policy = linphone_config_create_nat_policy_from_section(lc->config,nat_policy_ref); @@ -1190,6 +1191,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC lp_config_set_int(config,key,"dial_escape_plus",cfg->dial_escape_plus); lp_config_set_string(config,key,"dial_prefix",cfg->dial_prefix); lp_config_set_int(config,key,"privacy",(int)cfg->privacy); + lp_config_set_int(config,key,"push_notification_allowed",(int)cfg->push_notification_allowed); if (cfg->refkey) lp_config_set_string(config,key,"refkey",cfg->refkey); lp_config_set_int(config, key, "publish_expires", cfg->publish_expires); @@ -1250,6 +1252,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc CONFIGURE_INT_VALUE(cfg,config,key,expires,"reg_expires", int) CONFIGURE_BOOL_VALUE(cfg,config,key,register,"reg_sendregister") CONFIGURE_BOOL_VALUE(cfg,config,key,publish,"publish") + CONFIGURE_BOOL_VALUE(cfg,config,key,publish,"push_notification_allowed") linphone_proxy_config_set_avpf_mode(cfg,static_cast(lp_config_get_int(config,key,"avpf",linphone_proxy_config_get_avpf_mode(cfg)))); CONFIGURE_INT_VALUE(cfg,config,key,avpf_rr_interval,"avpf_rr_interval",uint8_t) CONFIGURE_INT_VALUE(cfg,config,key,dial_escape_plus,"dial_escape_plus",bool_t) @@ -1579,3 +1582,11 @@ void linphone_proxy_config_set_conference_factory_uri(LinphoneProxyConfig *cfg, const char * linphone_proxy_config_get_conference_factory_uri(const LinphoneProxyConfig *cfg) { return cfg->conference_factory_uri; } + +bool_t linphone_proxy_config_is_push_notification_allowed(const LinphoneProxyConfig *cfg) { + return cfg->push_notification_allowed; +} + +void linphone_proxy_config_set_push_notification_allowed(LinphoneProxyConfig *cfg, bool_t is_allowed) { + cfg->push_notification_allowed = is_allowed; +} \ No newline at end of file diff --git a/include/linphone/proxy_config.h b/include/linphone/proxy_config.h index 7214b5aa0..e65ac0803 100644 --- a/include/linphone/proxy_config.h +++ b/include/linphone/proxy_config.h @@ -617,6 +617,20 @@ void linphone_proxy_config_set_conference_factory_uri(LinphoneProxyConfig *cfg, */ const char * linphone_proxy_config_get_conference_factory_uri(const LinphoneProxyConfig *cfg); +/** + * Indicates whether to add to the contact parameters the push notification information. + * @param[in] cfg #LinphoneProxyConfig object. + * @param[in] allow True to allow push notification information, false otherwise. + */ +LINPHONE_PUBLIC void linphone_proxy_config_set_push_notification_allowed(LinphoneProxyConfig *cfg, bool_t allow); + +/** + * Indicates whether to add to the contact parameters the push notification information. + * @param[in] cfg #LinphoneProxyConfig object. + * @return True if push notification informations should be added, false otherwise. + */ +LINPHONE_PUBLIC bool_t linphone_proxy_config_is_push_notification_allowed(LinphoneProxyConfig *cfg); + /** * @} */