diff --git a/coreapi/friend.c b/coreapi/friend.c index eb8c017aa..2c3d876c1 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -1005,6 +1005,10 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) { return TRUE; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) { LinphoneAddress* linphone_address = NULL; LinphoneFriend *fr; @@ -1018,14 +1022,7 @@ LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) { name = linphone_vcard_get_full_name(vcard); sipAddresses = linphone_vcard_get_sip_addresses(vcard); -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic push -#endif -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" fr = linphone_friend_new(); -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic pop -#endif // Currently presence takes too much time when dealing with hundreds of friends, so I disabled it for now fr->pol = LinphoneSPDeny; fr->subscribe = FALSE; @@ -1046,6 +1043,9 @@ LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) { return fr; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif /*drops all references to the core and unref*/ void _linphone_friend_release(LinphoneFriend *lf){ @@ -1172,6 +1172,10 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName) return 0; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" /* DB layout: * | 0 | storage_id * | 1 | friend_list_id @@ -1198,14 +1202,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) { } if (!lf) { LinphoneAddress *addr = linphone_address_new(argv[2]); -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic push -#endif -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" lf = linphone_friend_new(); -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic pop -#endif linphone_friend_set_address(lf, addr); linphone_address_unref(addr); } @@ -1219,6 +1216,9 @@ static int create_friend(void *data, int argc, char **argv, char **colName) { linphone_friend_unref(lf); return 0; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif static int linphone_sql_request_friend(sqlite3* db, const char *stmt, MSList **list) { char* errmsg = NULL; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e84f8e5d2..cc39f1d81 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1571,6 +1571,8 @@ void linphone_core_reload_ms_plugins(LinphoneCore *lc, const char *path){ } static void linphone_core_start(LinphoneCore * lc) { + linphone_core_add_friend_list(lc, NULL); + sip_setup_register_all(lc->factory); sound_config_read(lc); net_config_read(lc); @@ -1588,6 +1590,7 @@ static void linphone_core_start(LinphoneCore * lc) { } #endif + linphone_core_notify_display_status(lc,_("Ready")); lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon; linphone_core_set_state(lc,LinphoneGlobalOn,"Ready"); @@ -1726,8 +1729,6 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab lc->data=userdata; lc->ringstream_autorelease=TRUE; - linphone_core_add_friend_list(lc, NULL); - linphone_task_list_init(&lc->hooks); internal_vtable->notify_received = linphone_core_internal_notify_received; @@ -2781,7 +2782,7 @@ void linphone_core_iterate(LinphoneCore *lc){ if (elapsed>lc->sip_conf.inc_timeout){ LinphoneReason decline_reason; ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout); - decline_reason=lc->current_call ? LinphoneReasonBusy : LinphoneReasonDeclined; + decline_reason = (lc->current_call != call) ? LinphoneReasonBusy : LinphoneReasonDeclined; call->log->status=LinphoneCallMissed; sal_error_info_set(&call->non_op_error,SalReasonRequestTimeout,408,"Not answered",NULL); linphone_core_decline_call(lc,call,decline_reason); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index f698874fd..6aa293d78 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2061,6 +2061,10 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_exportFriendsToVCa env->ReleaseStringUTFChars(jpath, path); } +extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_enableSubscriptions(JNIEnv* env, jobject thiz, jlong list, jboolean enable) { + linphone_friend_list_enable_subscriptions((LinphoneFriendList*)list, enable); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriendList(JNIEnv* env ,jobject thiz ,jlong lc diff --git a/coreapi/lpc2xml.c b/coreapi/lpc2xml.c index 605c65297..fbdb471ba 100644 --- a/coreapi/lpc2xml.c +++ b/coreapi/lpc2xml.c @@ -166,6 +166,11 @@ static void processSection_cb(const char *entry, struct __processSectionCtx *ctx ctx->ret = 0; return; } + + if (lp_config_get_skip_flag_for_entry(ctx->ctx->lpc, ctx->section, entry)) { + lpc2xml_log(ctx->ctx, LPC2XML_WARNING, "Skipped entry %s", entry); + return; + } node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"entry", NULL); if(node == NULL) { @@ -200,8 +205,15 @@ struct __processConfigCtx { static void processConfig_cb(const char *section, struct __processConfigCtx *ctx) { if(ctx->ret == 0) { - xmlNode *node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"section", NULL); + xmlNode *node; xmlAttr *name_attr; + + if (lp_config_get_skip_flag_for_section(ctx->ctx->lpc, section)) { + lpc2xml_log(ctx->ctx, LPC2XML_WARNING, "Skipped section %s", section); + return; + } + + node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"section", NULL); if(node == NULL) { lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create \"section\" element"); ctx->ret = -1; diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index c20be15b8..f54306405 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -63,6 +63,7 @@ typedef struct _LpItem{ char *value; int is_comment; bool_t overwrite; // If set to true, will add overwrite=true when converted to xml + bool_t skip; // If set to true, won't be dumped when converted to xml } LpItem; typedef struct _LpSectionParam{ @@ -75,6 +76,7 @@ typedef struct _LpSection{ MSList *items; MSList *params; bool_t overwrite; // If set to true, will add overwrite=true to all items of this section when converted to xml + bool_t skip; // If set to true, won't be dumped when converted to xml } LpSection; struct _LpConfig{ @@ -582,7 +584,7 @@ bool_t lp_config_get_overwrite_flag_for_entry(const LpConfig *lpconfig, const ch item = lp_section_find_item(sec, key); if (item != NULL) return item->overwrite; } - return 0; + return FALSE; } bool_t lp_config_get_overwrite_flag_for_section(const LpConfig *lpconfig, const char *section) { @@ -591,7 +593,27 @@ bool_t lp_config_get_overwrite_flag_for_section(const LpConfig *lpconfig, const if (sec != NULL){ return sec->overwrite; } - return 0; + return FALSE; +} + +bool_t lp_config_get_skip_flag_for_entry(const LpConfig *lpconfig, const char *section, const char *key) { + LpSection *sec; + LpItem *item; + sec = lp_config_find_section(lpconfig, section); + if (sec != NULL){ + item = lp_section_find_item(sec, key); + if (item != NULL) return item->skip; + } + return FALSE; +} + +bool_t lp_config_get_skip_flag_for_section(const LpConfig *lpconfig, const char *section) { + LpSection *sec; + sec = lp_config_find_section(lpconfig, section); + if (sec != NULL){ + return sec->skip; + } + return FALSE; } void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *key, const char *value){ @@ -664,6 +686,24 @@ void lp_config_set_overwrite_flag_for_section(LpConfig *lpconfig, const char *se } } +void lp_config_set_skip_flag_for_entry(LpConfig *lpconfig, const char *section, const char *key, bool_t value) { + LpSection *sec; + LpItem *item; + sec = lp_config_find_section(lpconfig, section); + if (sec != NULL) { + item = lp_section_find_item(sec, key); + if (item != NULL) item->skip = value; + } +} + +void lp_config_set_skip_flag_for_section(LpConfig *lpconfig, const char *section, bool_t value) { + LpSection *sec; + sec = lp_config_find_section(lpconfig, section); + if (sec != NULL) { + sec->skip = value; + } +} + void lp_item_write(LpItem *item, FILE *file){ if (item->is_comment) fprintf(file,"%s\n",item->value); diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index c18af988a..d99264bed 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -348,6 +348,34 @@ LINPHONE_PUBLIC bool_t lp_config_get_overwrite_flag_for_section(const LpConfig * **/ LINPHONE_PUBLIC void lp_config_set_overwrite_flag_for_section(LpConfig *lpconfig, const char *section, bool_t value); +/** + * Retrieves the skip flag for a config item + * + * @ingroup misc +**/ +LINPHONE_PUBLIC bool_t lp_config_get_skip_flag_for_entry(const LpConfig *lpconfig, const char *section, const char *key); + +/** + * Sets the skip flag for a config item (used when dumping config as xml) + * + * @ingroup misc +**/ +LINPHONE_PUBLIC void lp_config_set_skip_flag_for_entry(LpConfig *lpconfig, const char *section, const char *key, bool_t value); + +/** + * Retrieves the skip flag for a config section + * + * @ingroup misc +**/ +LINPHONE_PUBLIC bool_t lp_config_get_skip_flag_for_section(const LpConfig *lpconfig, const char *section); + +/** + * Sets the skip flag for a config section (used when dumping config as xml) + * + * @ingroup misc +**/ +LINPHONE_PUBLIC void lp_config_set_skip_flag_for_section(LpConfig *lpconfig, const char *section, bool_t value); + #ifdef __cplusplus } #endif diff --git a/java/common/org/linphone/core/LinphoneFriendList.java b/java/common/org/linphone/core/LinphoneFriendList.java index a86b2a7f5..57a354e21 100644 --- a/java/common/org/linphone/core/LinphoneFriendList.java +++ b/java/common/org/linphone/core/LinphoneFriendList.java @@ -29,6 +29,7 @@ public interface LinphoneFriendList { public LinphoneFriend[] getFriendList(); public void updateSubscriptions(LinphoneProxyConfig proxyConfig,boolean onlyWhenRegistered); public void closeSubscriptions(); + public void enableSubscriptions(boolean enable); public LinphoneFriend findFriendByUri(String uri); public void setUri(String uri); public void synchronizeFriendsFromServer(); diff --git a/java/impl/org/linphone/core/LinphoneFriendListImpl.java b/java/impl/org/linphone/core/LinphoneFriendListImpl.java index 0f4e197e3..4a531902d 100644 --- a/java/impl/org/linphone/core/LinphoneFriendListImpl.java +++ b/java/impl/org/linphone/core/LinphoneFriendListImpl.java @@ -31,6 +31,7 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable { private native LinphoneFriend[] getFriendList(long nativePtr); private native void updateSubscriptions(long nativePtr, long proxyConfigPtr, boolean onlyWhenRegistered); private native void closeSubscriptions(long nativePtr); + private native void enableSubscriptions(long nativePtr, boolean enable); private native Object getCore(long ptr); private native LinphoneFriend findFriendByUri(long nativePtr, String uri); private native void setListener(long ptr, LinphoneFriendListListener listener); @@ -81,6 +82,13 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable { } } + @Override + public void enableSubscriptions(boolean enable) { + synchronized(getSyncObject()) { + enableSubscriptions(nativePtr, enable); + } + } + @Override public LinphoneFriend findFriendByUri(String uri) { synchronized(getSyncObject()){