Merge branch 'master' of git://git.linphone.org/linphone into bc_vfs

This commit is contained in:
Sandrine Avakian 2016-04-27 14:53:45 +02:00
commit d3401f705d
8 changed files with 114 additions and 20 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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();

View file

@ -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()){