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

This commit is contained in:
Guillaume BIENKOWSKI 2013-11-08 16:36:40 +01:00
commit 7ca70575d4
6 changed files with 26 additions and 7 deletions

View file

@ -14,3 +14,8 @@ size=vga
[app]
sharing_server=https://www.linphone.org:444/upload.php
tunnel=disabled
[tunnel]
host=
port=443

View file

@ -13,3 +13,8 @@ size=qvga
[app]
sharing_server=https://www.linphone.org:444/upload.php
tunnel=disabled
[tunnel]
host=
port=443

View file

@ -92,7 +92,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
mPrefs.setAccountProxy(n, newValue.toString());
preference.setSummary(newValue.toString());
preference.setSummary(mPrefs.getAccountProxy(n));
return true;
}
};

View file

@ -492,10 +492,12 @@ public class LinphoneManager implements LinphoneCoreListener {
NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
mLc.tunnelCleanServers();
String host = mPrefs.getTunnelHost();
if (host != null) {
int port = mPrefs.getTunnelPort();
mLc.tunnelAddServerAndMirror(host, port, 12345, 500);
manageTunnelServer(info);
}
}
private boolean isTunnelNeeded(NetworkInfo info) {
if (info == null) {

View file

@ -272,9 +272,13 @@ public class LinphonePreferences {
}
public void setAccountProxy(int n, String proxy) {
if (proxy == null || proxy.length() <= 0) {
proxy = getAccountDomain(n);
}
if (!proxy.startsWith("sip:")) {
proxy = "sip:" + proxy;
}
try {
LinphoneProxyConfig prxCfg = getProxyConfig(n);
prxCfg.setProxy(proxy);
@ -769,7 +773,7 @@ public class LinphonePreferences {
// Tunnel settings
public String getTunnelMode() {
return getConfig().getString("app", "tunnel", getString(R.string.default_tunnel_mode_entry_value));
return getConfig().getString("app", "tunnel", null);
}
public void setTunnelMode(String mode) {
@ -777,7 +781,7 @@ public class LinphonePreferences {
}
public String getTunnelHost() {
return getConfig().getString("tunnel", "host", getString(R.string.tunnel_host));
return getConfig().getString("tunnel", "host", null);
}
public void setTunnelHost(String host) {

View file

@ -229,7 +229,7 @@ public class SettingsFragment extends PreferencesListFragment implements EcCalib
private void initTunnelSettings() {
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, mPrefs.getTunnelHost());
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort()));
setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_mode_key, mPrefs.getTunnelMode());
}
@ -239,6 +239,7 @@ public class SettingsFragment extends PreferencesListFragment implements EcCalib
public boolean onPreferenceChange(Preference preference, Object newValue) {
String host = newValue.toString();
mPrefs.setTunnelHost(host);
preference.setSummary(host);
return true;
}
});
@ -248,6 +249,7 @@ public class SettingsFragment extends PreferencesListFragment implements EcCalib
try {
int port = Integer.parseInt(newValue.toString());
mPrefs.setTunnelPort(port);
preference.setSummary(String.valueOf(port));
return true;
} catch (NumberFormatException nfe) {
return false;
@ -259,6 +261,7 @@ public class SettingsFragment extends PreferencesListFragment implements EcCalib
public boolean onPreferenceChange(Preference preference, Object newValue) {
String mode = newValue.toString();
mPrefs.setTunnelMode(mode);
preference.setSummary(mode);
return true;
}
});