Merge branch 'master' of git.linphone.org:linphone

This commit is contained in:
Yann Diorcet 2013-01-16 15:35:15 +01:00
commit 745738409e
8 changed files with 116 additions and 7 deletions

View file

@ -131,7 +131,7 @@ void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, in
sprintf(key,"auth_info_%i",pos);
lp_config_clean_section(config,key);
if (obj==NULL){
if (obj==NULL || lp_config_get_int(config, "sip", "store_auth_info", 1) == 0){
return;
}
if (obj->username!=NULL){

View file

@ -83,7 +83,7 @@ public class TutorialChatRoom implements LinphoneCoreListener {
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {}
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {
write("Message ["+message+"] received from ["+from.asString()+"]");
//Deprecated
}
@ -153,8 +153,7 @@ public class TutorialChatRoom implements LinphoneCoreListener {
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr,
LinphoneChatMessage message) {
// TODO Auto-generated method stub
write("Message [" + message.getMessage() + "] received from [" + message.getFrom().asString() + "]");
}

View file

@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore_utils.h"
#include <ortp/zrtp.h>
#ifdef TUNNEL_ENABLED
#include "linphone_tunnel.h"
#endif
extern "C" {
#include "mediastreamer2/mediastream.h"
@ -34,6 +31,8 @@ extern "C" {
#include "private.h"
#include <cpu-features.h>
#include "lpconfig.h"
#ifdef ANDROID
#include <android/log.h>
extern "C" void libmsilbc_init();
@ -2225,3 +2224,17 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* e
jstring jvalue =env->NewStringUTF(linphone_core_get_version());
return jvalue;
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getConfig(JNIEnv *env, jobject thiz, jlong lc) {
return (jlong) linphone_core_get_config((LinphoneCore *)lc);
}
extern "C" void Java_org_linphone_core_LpConfigImpl_setInt(JNIEnv *env, jobject thiz, jlong lpc,
jstring section, jstring key, jint value) {
const char *csection = env->GetStringUTFChars(section, NULL);
const char *ckey = env->GetStringUTFChars(key, NULL);
lp_config_set_int((LpConfig *)lpc, csection, ckey, (int) value);
env->ReleaseStringUTFChars(section, csection);
env->ReleaseStringUTFChars(key, ckey);
}

View file

@ -237,6 +237,7 @@ static void linphone_gtk_init_liblinphone(const char *config_file,
vtable.transfer_state_changed=linphone_gtk_transfer_state_changed;
the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL);
//lp_config_set_int(linphone_core_get_config(the_core), "sip", "store_auth_info", 0);
linphone_core_set_user_agent(the_core,"Linphone", LINPHONE_VERSION);
linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL);
linphone_core_set_zrtp_secrets_file(the_core,secrets_file);

View file

@ -876,4 +876,10 @@ public interface LinphoneCore {
* Enable/Disable the use of inband DTMFs
*/
void setUseRfc2833ForDtmfs(boolean use);
/**
* @return returns LpConfig object to read/write to the config file: usefull if you wish to extend
* the config file with your own sections
*/
LpConfig getConfig();
}

View file

@ -0,0 +1,48 @@
/*
LPConfig.java
Copyright (C) 2013 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
/**
* The LpConfig object is used to manipulate a configuration file.
*
* <pre>
* The format of the configuration file is a .ini like format:
* - sections are defined in []
* - each section contains a sequence of key=value pairs.
*
* Example:
* [sound]
* echocanceler=1
* playback_dev=ALSA: Default device
*
* [video]
* enabled=1
* </pre>
* }
* @author Guillaume Beraudo
*/
public interface LpConfig {
/**
* Sets an integer config item
* @param key
*/
void setInt(String section, String key, int value);
}

View file

@ -866,4 +866,10 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setUseRfc2833ForDtmfs(boolean use) {
setUseRfc2833ForDtmfs(nativePtr, use);
}
private native long getConfig(long ptr);
public LpConfig getConfig() {
long configPtr=getConfig(nativePtr);
return new LpConfigImpl(configPtr);
}
}

View file

@ -0,0 +1,36 @@
/*
LPConfigImpl.java
Copyright (C) 2013 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
class LpConfigImpl implements LpConfig {
private final long nativePtr;
public LpConfigImpl(long ptr) {
nativePtr=ptr;
}
private native void setInt(long ptr, String section, String key, int value);
public void setInt(String section, String key, int value) {
setInt(nativePtr, section, key, value);
}
}