aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaweldomas <pawel.domas@jitsi.org>2013-06-03 17:43:53 +0200
committerpaweldomas <pawel.domas@jitsi.org>2013-06-03 17:43:53 +0200
commit5728fa3ce7ad864bbd73ed91425320962012d474 (patch)
tree55afda2105a78a3ba11684c24ff0ddbaeaa4e42a
parent1ec286c9e6ed0e9c8ded4b9926b9cb68a80e5db5 (diff)
downloadjitsi-5728fa3ce7ad864bbd73ed91425320962012d474.zip
jitsi-5728fa3ce7ad864bbd73ed91425320962012d474.tar.gz
jitsi-5728fa3ce7ad864bbd73ed91425320962012d474.tar.bz2
Refactor AccountIDs
Created SipAccountID and JabberAccountID from wizard registration objects(work in progress).
-rw-r--r--lib/jitsi-defaults.properties32
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java3
-rw-r--r--[-rwxr-xr-x]src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountIDImpl.java (renamed from src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java)11
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesServiceDiscovery.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java3
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java3
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java20
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java4
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListSipImpl.java54
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListXivoImpl.java60
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/SipAccountIDImpl.java (renamed from src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java)20
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/net/AutoProxyConnection.java7
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/net/ManualProxyConnection.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java8
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/net/SslNetworkLayer.java1
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/sip.provider.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/desktoputil/wizard/EncodingsPanel.java1
-rw-r--r--src/net/java/sip/communicator/plugin/desktoputil/wizard/SecurityPanel.java2
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java1
-rw-r--r--src/net/java/sip/communicator/plugin/facebookaccregwizz/facebookaccregwizz.manifest.mf3
-rw-r--r--src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java1
-rw-r--r--src/net/java/sip/communicator/plugin/googletalkaccregwizz/googletalkaccregwizz.manifest.mf3
-rw-r--r--src/net/java/sip/communicator/plugin/ippiaccregwizz/IppiAccountRegistrationWizard.java13
-rw-r--r--src/net/java/sip/communicator/plugin/ippiaccregwizz/ippiaccregwizz.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/iptelaccregwizz/IptelAccountRegistrationWizard.java3
-rw-r--r--src/net/java/sip/communicator/plugin/iptelaccregwizz/iptelaccregwizz.manifest.mf3
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java63
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java1
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java1484
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java31
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java5
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java2
-rw-r--r--src/net/java/sip/communicator/plugin/sip2sipaccregwizz/sip2sipaccregwizz.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java35
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java8
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java6
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java1371
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java36
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java21
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/sipaccregwizz.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/service/protocol/AccountID.java423
-rw-r--r--src/net/java/sip/communicator/service/protocol/EncodingsRegistrationUtil.java (renamed from src/net/java/sip/communicator/util/wizard/EncodingsRegistrationUtil.java)13
-rw-r--r--src/net/java/sip/communicator/service/protocol/JingleNodeDescriptor.java2
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolProviderActivator.java2
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java5
-rw-r--r--src/net/java/sip/communicator/service/protocol/SecurityAccountRegistration.java (renamed from src/net/java/sip/communicator/util/wizard/SecurityAccountRegistration.java)15
-rw-r--r--src/net/java/sip/communicator/service/protocol/jabber/JabberAccountID.java687
-rw-r--r--src/net/java/sip/communicator/service/protocol/jabber/JabberAccountRegistration.java406
-rw-r--r--src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf3
-rw-r--r--src/net/java/sip/communicator/service/protocol/sip/SIPAccountRegistration.java248
-rw-r--r--src/net/java/sip/communicator/service/protocol/sip/SipAccountID.java599
-rw-r--r--test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java4
-rw-r--r--test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java10
-rw-r--r--test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java6
58 files changed, 2641 insertions, 3124 deletions
diff --git a/lib/jitsi-defaults.properties b/lib/jitsi-defaults.properties
index c20309a..a9e8987 100644
--- a/lib/jitsi-defaults.properties
+++ b/lib/jitsi-defaults.properties
@@ -1 +1,33 @@
org.jitsi.test.default=This is a default property!
+# Properties common for all protocols
+net.java.sip.communicator.service.protocol.DTMF_METHOD=AUTO_DTMF
+net.java.sip.communicator.service.protocol.DTMF_MINIMAL_TONE_DURATION=70
+# SIP specific properties
+net.java.sip.communicator.service.protocol.sip.PORT=5060
+net.java.sip.communicator.service.protocol.sip.TLS_PORT=5061
+net.java.sip.communicator.service.protocol.sip.POLLING_PERIOD=30
+net.java.sip.communicator.service.protocol.sip.SUBSCRIPTION_EXPIRATION=3600
+net.java.sip.communicator.service.protocol.sip.KEEP_ALIVE_INTERVAL=25
+net.java.sip.communicator.service.protocol.sip.SAVP_OPTION=0
+net.java.sip.communicator.service.protocol.sip.KEEP_ALIVE_METHOD=OPTIONS
+net.java.sip.communicator.service.protocol.sip.TRANSPORT=UDP
+net.java.sip.communicator.service.protocol.sip.VOICEMAIL_ENABLED=true
+# Jabber specific properties
+net.java.sip.communicator.service.protocol.jabber.PORT=5222
+net.java.sip.communicator.service.protocol.jabber.IS_SERVER_OVERRIDDEN=false
+net.java.sip.communicator.service.protocol.jabber.AUTO_GENERATE_RESOURCE=true
+net.java.sip.communicator.service.protocol.jabber.RESOURCE=jitsi
+net.java.sip.communicator.service.protocol.jabber.RESOURCE_PRIORITY=30
+net.java.sip.communicator.service.protocol.jabber.SEND_KEEP_ALIVE=true
+net.java.sip.communicator.service.protocol.jabber.ICE_ENABLED=true
+net.java.sip.communicator.service.protocol.jabber.GTALK_ICE_ENABLED=true
+net.java.sip.communicator.service.protocol.jabber.IS_CALLING_DISABLED_FOR_ACCOUNT=false
+net.java.sip.communicator.service.protocol.jabber.AUTO_DISCOVER_STUN=true
+net.java.sip.communicator.service.protocol.jabber.USE_DEFAULT_STUN_SERVER=true
+net.java.sip.communicator.service.protocol.jabber.JINGLE_NODES_ENABLED=true
+net.java.sip.communicator.service.protocol.jabber.AUTO_DISCOVER_JINGLE_NODES=true
+net.java.sip.communicator.service.protocol.jabber.ALLOW_NON_SECURE=false
+net.java.sip.communicator.service.protocol.jabber.GMAIL_NOTIFICATIONS_ENABLED=false
+net.java.sip.communicator.service.protocol.jabber.BYPASS_GTALK_CAPABILITIES=false
+net.java.sip.communicator.service.protocol.jabber.GOOGLE_CONTACTS_ENABLED=true
+
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java
index 88b71a3..b3f877d 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java
@@ -111,7 +111,8 @@ public class IceUdpTransportManager
agent.setControlling(!peer.isInitiator());
//we will now create the harvesters
- JabberAccountID accID = (JabberAccountID)provider.getAccountID();
+ JabberAccountIDImpl accID
+ = (JabberAccountIDImpl)provider.getAccountID();
if (accID.isStunServerDiscoveryEnabled())
{
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java b/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountIDImpl.java
index b817f29..c0cfa72 100755..100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountID.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/JabberAccountIDImpl.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
/**
* The Jabber implementation of a sip-communicator AccountID
@@ -17,19 +18,17 @@ import net.java.sip.communicator.service.protocol.*;
* @author Damian Minkov
* @author Sebastien Vincent
*/
-public class JabberAccountID
- extends AccountID
+public class JabberAccountIDImpl
+ extends JabberAccountID
{
/**
* Creates an account id from the specified id and account properties.
* @param id the id identifying this account
* @param accountProperties any other properties necessary for the account.
*/
- JabberAccountID(String id, Map<String, String> accountProperties )
+ JabberAccountIDImpl(String id, Map<String, String> accountProperties)
{
- super( id, accountProperties,
- ProtocolNames.JABBER,
- getServiceName(accountProperties));
+ super( id, accountProperties );
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesServiceDiscovery.java b/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesServiceDiscovery.java
index 5b9a59b..67e6b12 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesServiceDiscovery.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesServiceDiscovery.java
@@ -62,7 +62,7 @@ public class JingleNodesServiceDiscovery
/**
* Our account.
*/
- private final JabberAccountID accountID;
+ private final JabberAccountIDImpl accountID;
/**
* Creates discovery
@@ -73,7 +73,7 @@ public class JingleNodesServiceDiscovery
*/
JingleNodesServiceDiscovery(SmackServiceNode service,
XMPPConnection connection,
- JabberAccountID accountID,
+ JabberAccountIDImpl accountID,
Object syncRoot)
{
this.jingleNodesSyncRoot = syncRoot;
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
index 1b67ac4..3b80d62 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderFactoryJabberImpl.java
@@ -94,7 +94,8 @@ public class ProtocolProviderFactoryJabberImpl
"5222");
}
- AccountID accountID = new JabberAccountID(userIDStr, accountProperties);
+ AccountID accountID
+ = new JabberAccountIDImpl(userIDStr, accountProperties);
//make sure we haven't seen this account id before.
if( registeredAccounts.containsKey(accountID) )
@@ -123,7 +124,7 @@ public class ProtocolProviderFactoryJabberImpl
protected AccountID createAccountID(String userID,
Map<String, String> accountProperties)
{
- return new JabberAccountID(userID, accountProperties);
+ return new JabberAccountIDImpl(userID, accountProperties);
}
@Override
@@ -160,8 +161,8 @@ public class ProtocolProviderFactoryJabberImpl
throw new NullPointerException(
"The specified Protocol Provider was null");
- JabberAccountID accountID
- = (JabberAccountID) protocolProvider.getAccountID();
+ JabberAccountIDImpl accountID
+ = (JabberAccountIDImpl) protocolProvider.getAccountID();
// If the given accountID doesn't correspond to an existing account
// we return.
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
index 8b1e195..5f47324 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java
@@ -2510,7 +2510,7 @@ public class ProtocolProviderServiceJabberImpl
public void startJingleNodesDiscovery()
{
// Jingle Nodes Service Initialization
- final JabberAccountID accID = (JabberAccountID)getAccountID();
+ final JabberAccountIDImpl accID = (JabberAccountIDImpl)getAccountID();
final SmackServiceNode service = new SmackServiceNode(connection,
60000);
// make sure SmackServiceNode will clean up when connection is closed
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java
index 941620b..a9dd52f 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java
@@ -366,7 +366,8 @@ public class TransportManagerGTalkImpl
List<StunServerDescriptor> servers = null;
boolean atLeastOneStunServer = false;
- JabberAccountID accID = (JabberAccountID)provider.getAccountID();
+ JabberAccountIDImpl accID
+ = (JabberAccountIDImpl)provider.getAccountID();
agent.setControlling(controlling);
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
index d8c4494..1d618cb 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf
@@ -20,6 +20,7 @@ Import-Package: ch.imvs.sdes4j.srtp,
net.java.sip.communicator.service.netaddr,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
+ net.java.sip.communicator.service.protocol.jabber,
net.java.sip.communicator.service.protocol.jabberconstants,
net.java.sip.communicator.service.protocol.media,
net.java.sip.communicator.service.protocol.whiteboardobjects,
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
index 0c59386..3d9e1cc 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
@@ -17,6 +17,7 @@ import javax.sip.message.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import net.java.sip.communicator.util.*;
import org.jitsi.util.xml.XMLUtils;
@@ -274,7 +275,7 @@ public class OperationSetPresenceSipImpl
// and enable xcap, it will check and see its not configure and will
// silently do nothing and leave local storage
if(provider.getAccountID().getAccountPropertyBoolean(
- ServerStoredContactListXivoImpl.XIVO_ENABLE, false))
+ SipAccountID.XIVO_ENABLE, false))
{
this.ssContactList = new ServerStoredContactListXivoImpl(
provider, this);
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
index 0d55499..872466f 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderFactorySipImpl.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -34,7 +35,7 @@ public class ProtocolProviderFactorySipImpl
}
/**
- * Ovverides the original in order not to save the XCAP_PASSWORD field.
+ * Overrides the original in order not to save the OPT_CLIST_PASSWORD field.
*
* @param accountID the account identifier.
*/
@@ -46,7 +47,7 @@ public class ProtocolProviderFactorySipImpl
}
/**
- * Stores XCAP_PASSWORD property.
+ * Stores OPT_CLIST_PASSWORD property.
*
* @param accountID the account identifier.
*/
@@ -57,8 +58,8 @@ public class ProtocolProviderFactorySipImpl
// property in the account properties provided.
// if xcap password property exist, store it through credentialsStorage
// service
- Object password = accountID.getAccountProperty(
- ServerStoredContactListSipImpl.XCAP_PASSWORD);
+ Object password
+ = accountID.getAccountProperty(SipAccountID.OPT_CLIST_PASSWORD);
if (password != null)
{
CredentialsStorageService credentialsStorage
@@ -69,7 +70,7 @@ public class ProtocolProviderFactorySipImpl
credentialsStorage.storePassword(accountPrefix, (String)password);
// remove unsecured property
accountID.removeAccountProperty(
- ServerStoredContactListSipImpl.XCAP_PASSWORD);
+ SipAccountIDImpl.OPT_CLIST_PASSWORD);
}
}
@@ -166,7 +167,8 @@ public class ProtocolProviderFactorySipImpl
throw new NullPointerException(
"The specified Protocol Provider was null");
- SipAccountID accountID = (SipAccountID) protocolProvider.getAccountID();
+ SipAccountIDImpl accountID
+ = (SipAccountIDImpl) protocolProvider.getAccountID();
// If the given accountID doesn't correspond to an existing account
// we return.
@@ -260,7 +262,7 @@ public class ProtocolProviderFactorySipImpl
}
/**
- * Creates a new <code>SipAccountID</code> instance with a specific user
+ * Creates a new <code>SipAccountIDImpl</code> instance with a specific user
* ID to represent a given set of account properties.
*
* @param userID the user ID of the new instance
@@ -275,7 +277,7 @@ public class ProtocolProviderFactorySipImpl
// serverAddress == null is OK because of registrarless support
String serverAddress = accountProperties.get(SERVER_ADDRESS);
- return new SipAccountID(userID, accountProperties, serverAddress);
+ return new SipAccountIDImpl(userID, accountProperties, serverAddress);
}
/**
@@ -298,7 +300,7 @@ public class ProtocolProviderFactorySipImpl
try
{
- service.initialize(userID, (SipAccountID) accountID);
+ service.initialize(userID, (SipAccountIDImpl) accountID);
// We store again the account in order to store all properties added
// during the protocol provider initialization.
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
index 96fd0d8..d31fead 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
@@ -355,7 +355,7 @@ public class ProtocolProviderServiceSipImpl
* @see net.java.sip.communicator.service.protocol.AccountID
*/
protected void initialize(String sipAddress,
- SipAccountID accountID)
+ SipAccountIDImpl accountID)
throws OperationFailedException, IllegalArgumentException
{
synchronized (initializationLock)
@@ -2346,7 +2346,7 @@ public class ProtocolProviderServiceSipImpl
else
{
ProxyConnection tempConn = new AutoProxyConnection(
- (SipAccountID)getAccountID(),
+ (SipAccountIDImpl)getAccountID(),
host,
getDefaultTransport());
try
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListSipImpl.java
index 163c88d..659f5db 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListSipImpl.java
@@ -44,36 +44,6 @@ public class ServerStoredContactListSipImpl
Logger.getLogger(ServerStoredContactListSipImpl.class);
/**
- * The name of the property under which the user may specify whether to use
- * or not XCAP.
- */
- public static final String XCAP_ENABLE = "XCAP_ENABLE";
-
- /**
- * The name of the property under which the user may specify whether to use
- * original sip credentials for the XCAP.
- */
- public static final String XCAP_USE_SIP_CREDETIALS =
- "XCAP_USE_SIP_CREDETIALS";
-
- /**
- * The name of the property under which the user may specify the XCAP server
- * uri.
- */
- public static final String XCAP_SERVER_URI = "XCAP_SERVER_URI";
-
- /**
- * The name of the property under which the user may specify the XCAP user.
- */
- public static final String XCAP_USER = "XCAP_USER";
-
- /**
- * The name of the property under which the user may specify the XCAP user
- * password.
- */
- public static final String XCAP_PASSWORD = "XCAP_PASSWORD";
-
- /**
* Presence content for image.
*/
public static final String PRES_CONTENT_IMAGE_NAME = "sip_communicator";
@@ -626,19 +596,19 @@ public class ServerStoredContactListSipImpl
{
try
{
- AccountID accountID = sipProvider.getAccountID();
- boolean enableXCap =
- accountID.getAccountPropertyBoolean(XCAP_ENABLE, true);
- boolean useSipCredentials =
- accountID.getAccountPropertyBoolean(
- XCAP_USE_SIP_CREDETIALS, true);
- String serverUri =
- accountID.getAccountPropertyString(XCAP_SERVER_URI);
+ SipAccountIDImpl accountID
+ = (SipAccountIDImpl) sipProvider.getAccountID();
+
+ if(!accountID.isXCapEnable())
+ return;
+
+ String serverUri = accountID.getClistOptionServerUri();
+
String username = accountID.getAccountPropertyString(
ProtocolProviderFactory.USER_ID);
Address userAddress = sipProvider.parseAddressString(username);
String password;
- if (useSipCredentials)
+ if (accountID.isClistOptionUseSipCredentials())
{
username = ((SipUri)userAddress.getURI()).getUser();
password = SipActivator.getProtocolProviderFactory().
@@ -646,11 +616,11 @@ public class ServerStoredContactListSipImpl
}
else
{
- username = accountID.getAccountPropertyString(XCAP_USER);
- password = accountID.getAccountPropertyString(XCAP_PASSWORD);
+ username = accountID.getClistOptionUser();
+ password = accountID.getClistOptionPassword();
}
// Connect to xcap server
- if(enableXCap && serverUri != null)
+ if(serverUri != null)
{
URI uri = new URI(serverUri.trim());
if(uri.getHost() != null && uri.getPath() != null)
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListXivoImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListXivoImpl.java
index 76f632e..1bb8fb3 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListXivoImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ServerStoredContactListXivoImpl.java
@@ -40,36 +40,6 @@ public class ServerStoredContactListXivoImpl
Logger.getLogger(ServerStoredContactListXivoImpl.class);
/**
- * The name of the property under which the user may specify whether to use
- * or not xivo.
- */
- public static final String XIVO_ENABLE = "XIVO_ENABLE";
-
- /**
- * The name of the property under which the user may specify whether to use
- * original sip credentials for the xivo.
- */
- public static final String XIVO_USE_SIP_CREDETIALS =
- "XIVO_USE_SIP_CREDETIALS";
-
- /**
- * The name of the property under which the user may specify the xivo server
- * address.
- */
- public static final String XIVO_SERVER_ADDRESS = "XIVO_SERVER_URI";
-
- /**
- * The name of the property under which the user may specify the xivo user.
- */
- public static final String XIVO_USER = "XIVO_USER";
-
- /**
- * The name of the property under which the user may specify the xivo user
- * password.
- */
- public static final String XIVO_PASSWORD = "XIVO_PASSWORD";
-
- /**
* The connection to the xivo server.
*/
private Socket connection;
@@ -112,18 +82,16 @@ public class ServerStoredContactListXivoImpl
{
try
{
- AccountID accountID = sipProvider.getAccountID();
- boolean enableXivo =
- accountID.getAccountPropertyBoolean(XIVO_ENABLE, true);
+ SipAccountIDImpl accountID
+ = (SipAccountIDImpl) sipProvider.getAccountID();
- if(!enableXivo)
+ if(!accountID.isXiVOEnable())
return;
- boolean useSipCredentials =
- accountID.getAccountPropertyBoolean(
- XIVO_USE_SIP_CREDETIALS, true);
- String serverAddress =
- accountID.getAccountPropertyString(XIVO_SERVER_ADDRESS);
+ boolean useSipCredentials
+ = accountID.isClistOptionUseSipCredentials();
+
+ String serverAddress = accountID.getClistOptionServerUri();
String username = accountID.getAccountPropertyString(
ProtocolProviderFactory.USER_ID);
Address userAddress = sipProvider.parseAddressString(username);
@@ -134,7 +102,7 @@ public class ServerStoredContactListXivoImpl
}
else
{
- username = accountID.getAccountPropertyString(XIVO_USER);
+ username = accountID.getClistOptionUser();
}
try
@@ -511,10 +479,12 @@ public class ServerStoredContactListXivoImpl
}
else if (classField.equals("login_id_ok"))
{
- AccountID accountID = sipProvider.getAccountID();
- boolean useSipCredentials =
- accountID.getAccountPropertyBoolean(
- XIVO_USE_SIP_CREDETIALS, true);
+ SipAccountIDImpl accountID
+ = (SipAccountIDImpl) sipProvider.getAccountID();
+
+ boolean useSipCredentials
+ = accountID.isClistOptionUseSipCredentials();
+
String password;
if (useSipCredentials)
{
@@ -523,7 +493,7 @@ public class ServerStoredContactListXivoImpl
}
else
{
- password = accountID.getAccountPropertyString(XIVO_PASSWORD);
+ password = accountID.getClistOptionPassword();
}
if(!authorize((String)incomingObject.get("sessionid"), password))
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java b/src/net/java/sip/communicator/impl/protocol/sip/SipAccountIDImpl.java
index 2c1e9c0..a0512b7 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/SipAccountID.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/SipAccountIDImpl.java
@@ -10,14 +10,15 @@ import java.util.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import net.java.sip.communicator.util.*;
/**
* A SIP extension of the account ID property.
* @author Emil Ivov
*/
-public class SipAccountID
- extends AccountID
+public class SipAccountIDImpl
+ extends SipAccountID
{
/**
* Removes the server part from a sip user id if there is one. Used when
@@ -71,12 +72,11 @@ public class SipAccountID
* @param accountProperties any other properties necessary for the account.
* @param serverName the name of the server that the user belongs to.
*/
- protected SipAccountID(String userID, Map<String, String> accountProperties,
- String serverName)
+ protected SipAccountIDImpl( String userID,
+ Map<String, String> accountProperties,
+ String serverName )
{
- super(stripServerNameFromUserID(userID), accountProperties,
- ProtocolNames.SIP,
- serverName);
+ super(stripServerNameFromUserID(userID), accountProperties, serverName);
}
/**
@@ -161,10 +161,10 @@ public class SipAccountID
// service name can be null when using registerless accounts
// if its null ignore it.
return super.equals(obj)
- && ((SipAccountID)obj).getProtocolName().equals(
+ && ((SipAccountIDImpl)obj).getProtocolName().equals(
getProtocolName())
&& (getService() != null ?
- getService().equals(((SipAccountID)obj).getService()) : true);
+ getService().equals(((SipAccountIDImpl)obj).getService()) : true);
}
/**
@@ -178,7 +178,7 @@ public class SipAccountID
@Override
public String getAccountPropertyString(Object key)
{
- if(key.equals(ServerStoredContactListSipImpl.XCAP_PASSWORD))
+ if(key.equals(SipAccountID.OPT_CLIST_PASSWORD))
{
CredentialsStorageService credentialsStorage
= ServiceUtils.getService(SipActivator.getBundleContext(),
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/net/AutoProxyConnection.java b/src/net/java/sip/communicator/impl/protocol/sip/net/AutoProxyConnection.java
index 72141f0..e62d611 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/net/AutoProxyConnection.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/net/AutoProxyConnection.java
@@ -115,7 +115,8 @@ public class AutoProxyConnection
* @param defaultTransport the default transport to use when DNS does not
* provide a protocol through NAPTR or SRV
*/
- public AutoProxyConnection(SipAccountID account, String defaultTransport)
+ public AutoProxyConnection( SipAccountIDImpl account,
+ String defaultTransport )
{
super(account);
this.defaultTransport = defaultTransport;
@@ -131,8 +132,8 @@ public class AutoProxyConnection
* @param defaultTransport the default transport to use when DNS does not
* provide a protocol through NAPTR or SRV
*/
- public AutoProxyConnection(SipAccountID account, String address,
- String defaultTransport)
+ public AutoProxyConnection( SipAccountIDImpl account, String address,
+ String defaultTransport )
{
super(account);
this.defaultTransport = defaultTransport;
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/net/ManualProxyConnection.java b/src/net/java/sip/communicator/impl/protocol/sip/net/ManualProxyConnection.java
index 52346b6..1ff0eab 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/net/ManualProxyConnection.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/net/ManualProxyConnection.java
@@ -41,7 +41,7 @@ public class ManualProxyConnection
*
* @param account the account of this SIP protocol instance
*/
- public ManualProxyConnection(SipAccountID account)
+ public ManualProxyConnection(SipAccountIDImpl account)
{
super(account);
reset();
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java b/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java
index f21ff0c..a50f9c3 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/net/ProxyConnection.java
@@ -19,13 +19,13 @@ public abstract class ProxyConnection
protected String transport;
protected InetSocketAddress socketAddress;
- protected final SipAccountID account;
+ protected final SipAccountIDImpl account;
/**
* Creates a new instance of this class.
* @param account the account of this SIP protocol instance
*/
- protected ProxyConnection(SipAccountID account)
+ protected ProxyConnection(SipAccountIDImpl account)
{
this.account = account;
}
@@ -155,9 +155,9 @@ public abstract class ProxyConnection
{
if (pps.getAccountID().getAccountPropertyBoolean(PROXY_AUTO_CONFIG,
true))
- return new AutoProxyConnection((SipAccountID) pps.getAccountID(),
+ return new AutoProxyConnection((SipAccountIDImpl) pps.getAccountID(),
pps.getDefaultTransport());
else
- return new ManualProxyConnection((SipAccountID) pps.getAccountID());
+ return new ManualProxyConnection((SipAccountIDImpl) pps.getAccountID());
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/net/SslNetworkLayer.java b/src/net/java/sip/communicator/impl/protocol/sip/net/SslNetworkLayer.java
index af3819b..5bdd166 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/net/SslNetworkLayer.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/net/SslNetworkLayer.java
@@ -18,6 +18,7 @@ import javax.net.ssl.*;
import net.java.sip.communicator.impl.protocol.sip.*;
import net.java.sip.communicator.service.certificate.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/sip.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/sip/sip.provider.manifest.mf
index 7430ef0..6866495 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/sip.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/sip/sip.provider.manifest.mf
@@ -25,6 +25,7 @@ Import-Package: ch.imvs.sdes4j.srtp,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.media,
+ net.java.sip.communicator.service.protocol.sip,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.service.dns,
diff --git a/src/net/java/sip/communicator/plugin/desktoputil/wizard/EncodingsPanel.java b/src/net/java/sip/communicator/plugin/desktoputil/wizard/EncodingsPanel.java
index 214a13e..71aadd7 100644
--- a/src/net/java/sip/communicator/plugin/desktoputil/wizard/EncodingsPanel.java
+++ b/src/net/java/sip/communicator/plugin/desktoputil/wizard/EncodingsPanel.java
@@ -14,7 +14,6 @@ import javax.swing.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
-import net.java.sip.communicator.util.wizard.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.codec.*;
diff --git a/src/net/java/sip/communicator/plugin/desktoputil/wizard/SecurityPanel.java b/src/net/java/sip/communicator/plugin/desktoputil/wizard/SecurityPanel.java
index 93dfc60..9b39493 100644
--- a/src/net/java/sip/communicator/plugin/desktoputil/wizard/SecurityPanel.java
+++ b/src/net/java/sip/communicator/plugin/desktoputil/wizard/SecurityPanel.java
@@ -15,8 +15,8 @@ import javax.swing.border.*;
import javax.swing.table.*;
import javax.swing.event.*;
+import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
-import net.java.sip.communicator.util.wizard.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import org.jitsi.service.neomedia.*;
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
index 4b84fbf..6716214 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FacebookAccountRegistrationWizard.java
@@ -11,6 +11,7 @@ import java.util.*;
import net.java.sip.communicator.plugin.jabberaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
/**
* The <tt>FacebookAccountRegistrationWizard</tt> is an implementation of the
diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/facebookaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/facebookaccregwizz/facebookaccregwizz.manifest.mf
index b83b304..603ce0a 100644
--- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/facebookaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/facebookaccregwizz.manifest.mf
@@ -13,9 +13,10 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
+ net.java.sip.communicator.service.protocol.jabber,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
- net.java.sip.communicator.plugin.desktoputil,
+ net.java.sip.communicator.plugin.desktoputil,
net.java.sip.communicator.plugin.jabberaccregwizz,
javax.accessibility,
javax.imageio,
diff --git a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
index 6c77a4d..8cab4cc 100644
--- a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.plugin.jabberaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
/**
* The <tt>GoogleTalkAccountRegistrationWizard</tt> is an implementation of the
diff --git a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/googletalkaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/googletalkaccregwizz.manifest.mf
index 1d0fcb2..5860531 100644
--- a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/googletalkaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/googletalkaccregwizz.manifest.mf
@@ -15,9 +15,10 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.jabber,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
- net.java.sip.communicator.plugin.desktoputil,
+ net.java.sip.communicator.plugin.desktoputil,
net.java.sip.communicator.plugin.jabberaccregwizz,
javax.naming,
javax.naming.directory,
diff --git a/src/net/java/sip/communicator/plugin/ippiaccregwizz/IppiAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ippiaccregwizz/IppiAccountRegistrationWizard.java
index 21f26bb..c1c0466 100644
--- a/src/net/java/sip/communicator/plugin/ippiaccregwizz/IppiAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/ippiaccregwizz/IppiAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.sip.*;
/**
* The <tt>IppiAccountRegistrationWizard</tt> is an implementation of the
@@ -94,12 +95,12 @@ public class IppiAccountRegistrationWizard
private void setPredefinedProperties(SIPAccountRegistration reg)
{
// set properties common for ippi
- reg.setDefaultServerAddress("ippi.fr");
- reg.setDefaultServerPort("5060");
- reg.setDefaultProxyAutoConfigure(false);
- reg.setDefaultProxy("ippi.fr");
- reg.setDefaultProxyPort("5060");
- reg.setDefaultTransport("TCP");
+ reg.setServerAddress("ippi.fr");
+ reg.setServerPort("5060");
+ reg.setProxyAutoConfigure(false);
+ reg.setProxy("ippi.fr");
+ reg.setProxyPort("5060");
+ reg.setPreferredTransport("TCP");
reg.setDefaultDomain("ippi.fr");
}
diff --git a/src/net/java/sip/communicator/plugin/ippiaccregwizz/ippiaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/ippiaccregwizz/ippiaccregwizz.manifest.mf
index 76acb12..c08d731 100644
--- a/src/net/java/sip/communicator/plugin/ippiaccregwizz/ippiaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/ippiaccregwizz/ippiaccregwizz.manifest.mf
@@ -15,6 +15,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.sip,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.plugin.desktoputil,
diff --git a/src/net/java/sip/communicator/plugin/iptelaccregwizz/IptelAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/iptelaccregwizz/IptelAccountRegistrationWizard.java
index ff86879..c201ad4 100644
--- a/src/net/java/sip/communicator/plugin/iptelaccregwizz/IptelAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/iptelaccregwizz/IptelAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.sip.*;
/**
* The <tt>IptelAccountRegistrationWizard</tt> is an implementation of the
@@ -88,7 +89,7 @@ public class IptelAccountRegistrationWizard
private void setPredefinedProperties(SIPAccountRegistration reg)
{
reg.setDefaultDomain("iptel.org");
- reg.setDefaultTransport("TCP");
+ reg.setPreferredTransport("TCP");
}
/**
diff --git a/src/net/java/sip/communicator/plugin/iptelaccregwizz/iptelaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/iptelaccregwizz/iptelaccregwizz.manifest.mf
index e440dc1..847a9f1 100644
--- a/src/net/java/sip/communicator/plugin/iptelaccregwizz/iptelaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/iptelaccregwizz/iptelaccregwizz.manifest.mf
@@ -15,9 +15,10 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.sip,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
- net.java.sip.communicator.plugin.desktoputil,
+ net.java.sip.communicator.plugin.desktoputil,
net.java.sip.communicator.plugin.sipaccregwizz,
javax.naming,
javax.naming.directory,
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java
index bed8871..383891f 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java
@@ -14,11 +14,14 @@ import javax.swing.event.*;
import net.java.sip.communicator.service.certificate.*;
import net.java.sip.communicator.plugin.desktoputil.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
import org.jitsi.util.*;
/**
*
* @author Yana Stamcheva
+ * @author Pawel Domas
*/
public class ConnectionPanel
extends TransparentPanel
@@ -58,18 +61,23 @@ public class ConnectionPanel
= new JLabel(Resources.getString("plugin.jabberaccregwizz.RESOURCE"));
private final JTextField resourceField
- = new JTextField(JabberAccountRegistration.DEFAULT_RESOURCE);
+ = new JTextField(
+ JabberAccountID.getDefaultStr(
+ ProtocolProviderFactory.RESOURCE));
private final JLabel priorityLabel = new JLabel(
Resources.getString("plugin.jabberaccregwizz.PRIORITY"));
private final JTextField priorityField
- = new JTextField(JabberAccountRegistration.DEFAULT_PRIORITY);
+ = new JTextField(
+ JabberAccountID.getDefaultStr(
+ ProtocolProviderFactory.RESOURCE_PRIORITY));
private final JCheckBox serverAutoCheckBox = new SIPCommCheckBox(
Resources.getString(
"plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"),
- JabberAccountRegistration.DEFAULT_RESOURCE_AUTOGEN);
+ JabberAccountID.getDefaultBool(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN));
private final JLabel serverLabel
= new JLabel(Resources.getString("plugin.jabberaccregwizz.SERVER"));
@@ -80,15 +88,19 @@ public class ConnectionPanel
= new JLabel(Resources.getString("service.gui.PORT"));
private final JTextField portField
- = new JTextField(JabberAccountRegistration.DEFAULT_PORT);
+ = new JTextField(
+ JabberAccountID.getDefaultStr(
+ ProtocolProviderFactory.SERVER_PORT));
private final JCheckBox autoGenerateResource = new SIPCommCheckBox(
Resources.getString("plugin.jabberaccregwizz.AUTORESOURCE"),
- JabberAccountRegistration.DEFAULT_RESOURCE_AUTOGEN);
+ JabberAccountID.getDefaultBool(
+ ProtocolProviderFactory.AUTO_GENERATE_RESOURCE));
JCheckBox allowNonSecureBox = new SIPCommCheckBox(
Resources.getString("plugin.jabberaccregwizz.ALLOW_NON_SECURE"),
- false);
+ JabberAccountID.getDefaultBool(
+ ProtocolProviderFactory.IS_ALLOW_NON_SECURE));
private JComboBox dtmfMethodBox = new JComboBox(new Object []
{
@@ -263,28 +275,24 @@ public class ConnectionPanel
// Values
JPanel dtmfValues = new TransparentPanel(new GridLayout(0, 1, 5, 5));
dtmfMethodBox.addItemListener(new ItemListener()
+ {
+ public void itemStateChanged(ItemEvent e)
+ {
+ boolean isEnabled = false;
+ String selectedItem
+ = (String) dtmfMethodBox.getSelectedItem();
+ if (selectedItem != null
+ && (selectedItem.equals(Resources.getString(
+ "plugin.sipaccregwizz.DTMF_AUTO"))
+ || selectedItem.equals(Resources.getString(
+ "plugin.sipaccregwizz.DTMF_RTP")))
+ )
{
- public void itemStateChanged(ItemEvent e)
- {
- boolean isEnabled = false;
- String selectedItem
- = (String) dtmfMethodBox.getSelectedItem();
- if(selectedItem != null
- && (selectedItem.equals(Resources.getString(
- "plugin.sipaccregwizz.DTMF_AUTO"))
- || selectedItem.equals(Resources.getString(
- "plugin.sipaccregwizz.DTMF_RTP")))
- )
- {
- isEnabled = true;
- }
- dtmfMinimalToneDurationValue.setEnabled(isEnabled);
- }
- });
- dtmfMethodBox.setSelectedItem(
- parentForm.getRegistration().getDefaultDTMFMethod());
- dtmfMinimalToneDurationValue.setText(
- JabberAccountRegistration.DEFAULT_MINIMAL_DTMF_TONE_DURATION);
+ isEnabled = true;
+ }
+ dtmfMinimalToneDurationValue.setEnabled(isEnabled);
+ }
+ });
JLabel dtmfMinimalToneDurationExampleLabel = new JLabel(
Resources.getString(
"plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION_INFO"));
@@ -486,6 +494,7 @@ public class ConnectionPanel
void setAutogenerateResource(boolean value)
{
autoGenerateResource.setSelected(value);
+ resourceField.setEnabled(!value);
}
/**
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
index f8222b8..982c140 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
@@ -11,6 +11,7 @@ import java.awt.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the user
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
deleted file mode 100755
index 186e017..0000000
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
+++ /dev/null
@@ -1,1484 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.sip.communicator.plugin.jabberaccregwizz;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.credentialsstorage.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.*;
-import net.java.sip.communicator.util.wizard.*;
-
-import org.jitsi.service.neomedia.*;
-import org.jitsi.util.*;
-
-import org.osgi.framework.*;
-
-/**
- * The <tt>JabberAccountRegistration</tt> is used to store all user input data
- * through the <tt>JabberAccountRegistrationWizard</tt>.
- *
- * @author Yana Stamcheva
- * @author Boris Grozev
- */
-public class JabberAccountRegistration
-{
- /**
- * The default value of server port for jabber accounts.
- */
- public static final String DEFAULT_PORT = "5222";
-
- /**
- * Account suffix for Google service.
- */
- private static final String GOOGLE_USER_SUFFIX = "gmail.com";
-
- /**
- * XMPP server for Google service.
- */
- private static final String GOOGLE_CONNECT_SRV = "talk.google.com";
-
- /**
- * The default value of the priority property.
- */
- public static final String DEFAULT_PRIORITY = "30";
-
- /**
- * The default value of the resource property.
- */
- public static final String DEFAULT_RESOURCE = "jitsi";
-
- /**
- * The default value of stun server port for jabber accounts.
- */
- public static final String DEFAULT_STUN_PORT = "3478";
-
- /**
- * Default value for resource auto generating.
- */
- public static final boolean DEFAULT_RESOURCE_AUTOGEN = true;
-
- /**
- * The default value for DTMF method.
- */
- private String defaultDTMFMethod = "AUTO_DTMF";
-
- /**
- * The default value of minimale DTMF tone duration.
- */
- public static String DEFAULT_MINIMAL_DTMF_TONE_DURATION = Integer.toString(
- OperationSetDTMF.DEFAULT_DTMF_MINIMAL_TONE_DURATION);
-
- /**
- * The user identifier.
- */
- private String userID;
-
- /**
- * The password.
- */
- private String password;
-
- /**
- * Indicates if the password should be remembered.
- */
- private boolean rememberPassword = true;
-
- /**
- * The server address.
- */
- private String serverAddress;
-
- /**
- * The default domain.
- */
- private String defaultUserSufix;
-
- /**
- * The override domain for phone call.
- *
- * If Jabber account is able to call PSTN number and if domain name of the
- * switch is different than the domain of the account (gw.domain.org vs
- * domain.org), you can use this property to set the switch domain.
- */
- private String overridePhoneSuffix = null;
-
- /**
- * Always call with gtalk property.
- *
- * It is used to bypass capabilities checks: some softwares do not advertise
- * GTalk support (but they support it).
- */
- private boolean bypassGtalkCaps = false;
-
- /**
- * Domain name that will bypass GTalk caps.
- */
- private String domainBypassCaps = null;
-
- /**
- * Is jingle disabled for this account.
- */
- private boolean disableJingle = false;
-
- /**
- * The port.
- */
- private int port = new Integer(DEFAULT_PORT).intValue();
-
- /**
- * The resource property, initialized to the default resource.
- */
- private String resource = DEFAULT_RESOURCE;
-
- /**
- * The priority property.
- */
- private int priority = new Integer(DEFAULT_PRIORITY).intValue();
-
- /**
- * Indicates if keep alive packets should be send.
- */
- private boolean sendKeepAlive = true;
-
- /**
- * Indicates if gmail notifications should be enabled.
- */
- private boolean enableGmailNotification = false;
-
- /**
- * Indicates if Google Contacts should be enabled.
- */
- private boolean enableGoogleContacts = false;
-
- /**
- * Indicates if ICE should be used.
- */
- private boolean isUseIce = false;
-
- /**
- * Indicates if Google ICE should be used.
- */
- private boolean isUseGoogleIce = false;
-
- /**
- * Indicates if STUN server should be automatically discovered.
- */
- private boolean isAutoDiscoverStun = false;
-
- /**
- * Indicates if default STUN server should be used.
- */
- private boolean isUseDefaultStunServer = false;
-
- /**
- * The list of additional STUN servers entered by user.
- */
- private List<StunServerDescriptor> additionalStunServers
- = new ArrayList<StunServerDescriptor>();
-
- /**
- * Indicates if JingleNodes relays should be used.
- */
- private boolean isUseJingleNodes = false;
-
- /**
- * Indicates if JingleNodes relay server should be automatically discovered.
- */
- private boolean isAutoDiscoverJingleNodes = false;
-
- /**
- * The list of additional JingleNodes (tracker or relay) entered by user.
- */
- private List<JingleNodeDescriptor> additionalJingleNodes
- = new ArrayList<JingleNodeDescriptor>();
-
- /**
- * Indicates if UPnP should be used.
- */
- private boolean isUseUPNP = false;
-
- /**
- * If non-TLS connection is allowed.
- */
- private boolean isAllowNonSecure = false;
-
- /**
- * Indicates if the server is overriden.
- */
- private boolean isServerOverridden = false;
-
- /**
- * Is resource auto generate enabled.
- */
- private boolean resourceAutogenerated = DEFAULT_RESOURCE_AUTOGEN;
-
- /**
- * The account display name.
- */
- private String accountDisplayName;
-
- /**
- * The sms default server.
- */
- private String smsServerAddress;
-
- /**
- * DTMF method.
- */
- private String dtmfMethod = null;
-
- /**
- * The minimal DTMF tone duration set.
- */
- private String dtmfMinimalToneDuration = DEFAULT_MINIMAL_DTMF_TONE_DURATION;
-
- /**
- * The client TLS certificate ID.
- */
- private String clientCertificateId = null;
-
- /**
- * The encodings registration object
- */
- private EncodingsRegistrationUtil encodingsRegistration
- = new EncodingsRegistrationUtil();
-
- /**
- * The security registration object
- */
- private SecurityAccountRegistration securityRegistration
- = new SecurityAccountRegistration()
- {
- /**
- * Sets the method used for RTP/SAVP indication.
- */
- @Override
- public void setSavpOption(int savpOption)
- {
- // SAVP option is not useful for XMPP account.
- // Thereby, do nothing.
- }
-
- /**
- * RTP/SAVP is disabled for Jabber protocol.
- *
- * @return Always <tt>ProtocolProviderFactory.SAVP_OFF</tt>.
- */
- @Override
- public int getSavpOption()
- {
- return ProtocolProviderFactory.SAVP_OFF;
- }
- };
-
- /**
- * Initializes a new JabberAccountRegistration.
- */
- public JabberAccountRegistration()
- {
- super();
- }
-
- /**
- * Returns the password of the jabber registration account.
- * @return the password of the jabber registration account.
- */
- public String getPassword()
- {
- return password;
- }
-
- /**
- * Sets the password of the jabber registration account.
- * @param password the password of the jabber registration account.
- */
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- /**
- * Returns TRUE if password has to remembered, FALSE otherwise.
- * @return TRUE if password has to remembered, FALSE otherwise
- */
- public boolean isRememberPassword()
- {
- return rememberPassword;
- }
-
- /**
- * Sets the rememberPassword value of this jabber account registration.
- * @param rememberPassword TRUE if password has to remembered, FALSE
- * otherwise
- */
- public void setRememberPassword(boolean rememberPassword)
- {
- this.rememberPassword = rememberPassword;
- }
-
- /**
- * Returns the User ID of the jabber registration account.
- * @return the User ID of the jabber registration account.
- */
- public String getUserID()
- {
- return userID;
- }
-
- /**
- * Returns the user sufix.
- *
- * @return the user sufix
- */
- public String getDefaultUserSufix()
- {
- return defaultUserSufix;
- }
-
- /**
- * Returns the override phone suffix.
- *
- * @return the phone suffix
- */
- public String getOverridePhoneSuffix()
- {
- return overridePhoneSuffix;
- }
-
- /**
- * Returns the alwaysCallWithGtalk value.
- *
- * @return the alwaysCallWithGtalk value
- */
- public boolean getBypassGtalkCaps()
- {
- return bypassGtalkCaps;
- }
-
- /**
- * Returns telephony domain that bypass GTalk caps.
- *
- * @return telephony domain
- */
- public String getTelephonyDomainBypassCaps()
- {
- return domainBypassCaps;
- }
-
- /**
- * Gets if Jingle is disabled for this account.
- *
- * @return True if jingle is disabled for this account. False otherwise.
- */
- public boolean isJingleDisabled()
- {
- return this.disableJingle;
- }
-
- /**
- * The address of the server we will use for this account
- * @return String
- */
- public String getServerAddress()
- {
- return serverAddress;
- }
-
- /**
- * The port on the specified server
- * @return the server port
- */
- public int getPort()
- {
- return port;
- }
-
- /**
- * Determines whether sending of keep alive packets is enabled.
- *
- * @return <tt>true</tt> if keep alive packets are to be sent for this
- * account and <tt>false</tt> otherwise.
- */
- public boolean isSendKeepAlive()
- {
- return sendKeepAlive;
- }
-
- /**
- * Determines whether SIP Communicator should be querying Gmail servers
- * for unread mail messages.
- *
- * @return <tt>true</tt> if we are to enable Gmail notifications and
- * <tt>false</tt> otherwise.
- */
- public boolean isGmailNotificationEnabled()
- {
- return enableGmailNotification;
- }
-
- /**
- * Determines whether SIP Communicator should use Google Contacts as
- * ContactSource
- *
- * @return <tt>true</tt> if we are to enable Google Contacts and
- * <tt>false</tt> otherwise.
- */
- public boolean isGoogleContactsEnabled()
- {
- return enableGoogleContacts;
- }
-
- /**
- * Sets the User ID of the jabber registration account.
- *
- * @param userID the identifier of the jabber registration account.
- */
- public void setUserID(String userID)
- {
- this.userID = userID;
- }
-
- /**
- * Sets the default value of the user sufix.
- *
- * @param userSufix the user name sufix (the domain name after the @ sign)
- */
- public void setDefaultUserSufix(String userSufix)
- {
- this.defaultUserSufix = userSufix;
- }
-
- /**
- * Sets the override value of the phone suffix.
- *
- * @param phoneSuffix the phone name suffix (the domain name after the @
- * sign)
- */
- public void setOverridePhoneSufix(String phoneSuffix)
- {
- this.overridePhoneSuffix = phoneSuffix;
- }
-
- /**
- * Sets value for alwaysCallWithGtalk.
- *
- * @param bypassGtalkCaps true to enable, false otherwise
- */
- public void setBypassGtalkCaps(boolean bypassGtalkCaps)
- {
- this.bypassGtalkCaps = bypassGtalkCaps;
- }
-
- /**
- * Sets telephony domain that bypass GTalk caps.
- *
- * @param text telephony domain to set
- */
- public void setTelephonyDomainBypassCaps(String text)
- {
- this.domainBypassCaps = text;
- }
-
- /**
- * Sets if Jingle is disabled for this account.
- *
- * @param True if jingle is disabled for this account. False otherwise.
- */
- public void setDisableJingle(boolean disabled)
- {
- this.disableJingle = disabled;
- }
-
- /**
- * Sets the server
- *
- * @param serverAddress the IP address or FQDN of the server.
- */
- public void setServerAddress(String serverAddress)
- {
- this.serverAddress = serverAddress;
- }
-
- /**
- * Indicates if the server address has been overridden.
- *
- * @return <tt>true</tt> if the server address has been overridden,
- * <tt>false</tt> - otherwise.
- */
- public boolean isServerOverridden()
- {
- return isServerOverridden;
- }
-
- /**
- * Sets <tt>isServerOverridden</tt> property.
- * @param isServerOverridden indicates if the server is overridden
- */
- public void setServerOverridden(boolean isServerOverridden)
- {
- this.isServerOverridden = isServerOverridden;
- }
-
- /**
- * Sets the server port number.
- *
- * @param port the server port number
- */
- public void setPort(int port)
- {
- this.port = port;
- }
-
- /**
- * Specifies whether SIP Communicator should send send keep alive packets
- * to keep this account registered.
- *
- * @param sendKeepAlive <tt>true</tt> if we are to send keep alive packets
- * and <tt>false</tt> otherwise.
- */
- public void setSendKeepAlive(boolean sendKeepAlive)
- {
- this.sendKeepAlive = sendKeepAlive;
- }
-
- /**
- * Specifies whether SIP Communicator should be querying Gmail servers
- * for unread mail messages.
- *
- * @param enabled <tt>true</tt> if we are to enable Gmail notification and
- * <tt>false</tt> otherwise.
- */
- public void setGmailNotificationEnabled(boolean enabled)
- {
- this.enableGmailNotification = enabled;
- }
-
- /**
- * Specifies whether SIP Communicator should use Google Contacts as
- * ContactSource.
- *
- * @param enabled <tt>true</tt> if we are to enable Google Contacts and
- * <tt>false</tt> otherwise.
- */
- public void setGoogleContactsEnabled(boolean enabled)
- {
- this.enableGoogleContacts = enabled;
- }
-
- /**
- * Returns the resource.
- * @return the resource
- */
- public String getResource()
- {
- return resource;
- }
-
- /**
- * Sets the resource.
- * @param resource the resource for the jabber account
- */
- public void setResource(String resource)
- {
- this.resource = resource;
- }
-
- /**
- * Returns the priority property.
- * @return priority
- */
- public int getPriority()
- {
- return priority;
- }
-
- /**
- * Sets the priority property.
- * @param priority the priority to set
- */
- public void setPriority(int priority)
- {
- this.priority = priority;
- }
-
- /**
- * Indicates if ice should be used for this account.
- * @return <tt>true</tt> if ICE should be used for this account, otherwise
- * returns <tt>false</tt>
- */
- public boolean isUseIce()
- {
- return isUseIce;
- }
-
- /**
- * Sets the <tt>useIce</tt> property.
- * @param isUseIce <tt>true</tt> to indicate that ICE should be used for
- * this account, <tt>false</tt> - otherwise.
- */
- public void setUseIce(boolean isUseIce)
- {
- this.isUseIce = isUseIce;
- }
-
- /**
- * Indicates if ice should be used for this account.
- * @return <tt>true</tt> if ICE should be used for this account, otherwise
- * returns <tt>false</tt>
- */
- public boolean isUseGoogleIce()
- {
- return isUseGoogleIce;
- }
-
- /**
- * Sets the <tt>useGoogleIce</tt> property.
- * @param isUseIce <tt>true</tt> to indicate that ICE should be used for
- * this account, <tt>false</tt> - otherwise.
- */
- public void setUseGoogleIce(boolean isUseIce)
- {
- this.isUseGoogleIce = isUseIce;
- }
-
- /**
- * Indicates if the stun server should be automatically discovered.
- * @return <tt>true</tt> if the stun server should be automatically
- * discovered, otherwise returns <tt>false</tt>.
- */
- public boolean isAutoDiscoverStun()
- {
- return isAutoDiscoverStun;
- }
-
- /**
- * Sets the <tt>autoDiscoverStun</tt> property.
- * @param isAutoDiscover <tt>true</tt> to indicate that stun server should
- * be auto-discovered, <tt>false</tt> - otherwise.
- */
- public void setAutoDiscoverStun(boolean isAutoDiscover)
- {
- this.isAutoDiscoverStun = isAutoDiscover;
- }
-
- /**
- * Indicates if the stun server should be automatically discovered.
- * @return <tt>true</tt> if the stun server should be automatically
- * discovered, otherwise returns <tt>false</tt>.
- */
- public boolean isUseDefaultStunServer()
- {
- return isUseDefaultStunServer;
- }
-
- /**
- * Sets the <tt>useDefaultStunServer</tt> property.
- * @param isUseDefaultStunServer <tt>true</tt> to indicate that default
- * stun server should be used if no others are available, <tt>false</tt>
- * otherwise.
- */
- public void setUseDefaultStunServer(boolean isUseDefaultStunServer)
- {
- this.isUseDefaultStunServer = isUseDefaultStunServer;
- }
-
- /**
- * Adds the given <tt>stunServer</tt> to the list of additional stun servers.
- *
- * @param stunServer the <tt>StunServer</tt> to add
- */
- public void addStunServer(StunServerDescriptor stunServer)
- {
- additionalStunServers.add(stunServer);
- }
-
- /**
- * Returns the <tt>List</tt> of all additional stun servers entered by the
- * user. The list is guaranteed not to be <tt>null</tt>.
- *
- * @return the <tt>List</tt> of all additional stun servers entered by the
- * user.
- */
- public List<StunServerDescriptor> getAdditionalStunServers()
- {
- return additionalStunServers;
- }
-
- /**
- * Sets the <tt>autoDiscoverJingleNodes</tt> property.
- *
- * @param isAutoDiscover <tt>true</tt> to indicate that relay server should
- * be auto-discovered, <tt>false</tt> - otherwise.
- */
- public void setAutoDiscoverJingleNodes(boolean isAutoDiscover)
- {
- this.isAutoDiscoverJingleNodes = isAutoDiscover;
- }
-
- /**
- * Indicates if the JingleNodes relay server should be automatically
- * discovered.
- *
- * @return <tt>true</tt> if the relay server should be automatically
- * discovered, otherwise returns <tt>false</tt>.
- */
- public boolean isAutoDiscoverJingleNodes()
- {
- return isAutoDiscoverJingleNodes;
- }
-
- /**
- * Sets the <tt>useJingleNodes</tt> property.
- *
- * @param isUseJingleNodes <tt>true</tt> to indicate that Jingle Nodes
- * should be used for this account, <tt>false</tt> - otherwise.
- */
- public void setUseJingleNodes(boolean isUseJingleNodes)
- {
- this.isUseJingleNodes = isUseJingleNodes;
- }
-
- /**
- * Sets the <tt>useJingleNodes</tt> property.
- *
- * @param isUseJingleNodes <tt>true</tt> to indicate that JingleNodes relays
- * should be used for this account, <tt>false</tt> - otherwise.
- */
- public void isUseJingleNodes(boolean isUseJingleNodes)
- {
- this.isUseJingleNodes = isUseJingleNodes;
- }
-
- /**
- * Indicates if JingleNodes relay should be used.
- *
- * @return <tt>true</tt> if JingleNodes should be used, <tt>false</tt>
- * otherwise
- */
- public boolean isUseJingleNodes()
- {
- return isUseJingleNodes;
- }
-
- /**
- * Adds the given <tt>node</tt> to the list of additional JingleNodes.
- *
- * @param node the <tt>node</tt> to add
- */
- public void addJingleNodes(JingleNodeDescriptor node)
- {
- additionalJingleNodes.add(node);
- }
-
- /**
- * Returns the <tt>List</tt> of all additional stun servers entered by the
- * user. The list is guaranteed not to be <tt>null</tt>.
- *
- * @return the <tt>List</tt> of all additional stun servers entered by the
- * user.
- */
- public List<JingleNodeDescriptor> getAdditionalJingleNodes()
- {
- return additionalJingleNodes;
- }
-
- /**
- * Indicates if UPnP should be used for this account.
- * @return <tt>true</tt> if UPnP should be used for this account, otherwise
- * returns <tt>false</tt>
- */
- public boolean isUseUPNP()
- {
- return isUseUPNP;
- }
-
- /**
- * Sets the <tt>useUPNP</tt> property.
- * @param isUseUPNP <tt>true</tt> to indicate that UPnP should be used for
- * this account, <tt>false</tt> - otherwise.
- */
- public void setUseUPNP(boolean isUseUPNP)
- {
- this.isUseUPNP = isUseUPNP;
- }
-
- /**
- * Indicates if non-TLS is allowed for this account
- * @return <tt>true</tt> if non-TLS is allowed for this account, otherwise
- * returns <tt>false</tt>
- */
- public boolean isAllowNonSecure()
- {
- return isAllowNonSecure;
- }
-
- /**
- * Sets the <tt>isAllowNonSecure</tt> property.
- * @param isAllowNonSecure <tt>true</tt> to indicate that non-TLS is allowed
- * for this account, <tt>false</tt> - otherwise.
- */
- public void setAllowNonSecure(boolean isAllowNonSecure)
- {
- this.isAllowNonSecure = isAllowNonSecure;
- }
-
- /**
- * Is resource auto generate enabled.
- *
- * @return true if resource is auto generated
- */
- public boolean isResourceAutogenerated()
- {
- return resourceAutogenerated;
- }
-
- /**
- * Set whether resource autogenerate is enabled.
- * @param resourceAutogenerated
- */
- public void setResourceAutogenerated(boolean resourceAutogenerated)
- {
- this.resourceAutogenerated = resourceAutogenerated;
- }
-
- /**
- * Returns the account display name.
- *
- * @return the account display name
- */
- public String getAccountDisplayName()
- {
- return accountDisplayName;
- }
-
- /**
- * Sets the account display name.
- *
- * @param accountDisplayName the account display name
- */
- public void setAccountDisplayName(String accountDisplayName)
- {
- this.accountDisplayName = accountDisplayName;
- }
-
- /**
- * Returns the default sms server.
- *
- * @return the account default sms server
- */
- public String getSmsServerAddress()
- {
- return smsServerAddress;
- }
-
- /**
- * Sets the default sms server.
- *
- * @param serverAddress the sms server to set as default
- */
- public void setSmsServerAddress(String serverAddress)
- {
- this.smsServerAddress = serverAddress;
- }
-
- /**
- * Returns the DTMF method.
- *
- * @return the DTMF method.
- */
- public String getDTMFMethod()
- {
- return dtmfMethod;
- }
-
- /**
- * Sets the DTMF method.
- *
- * @param dtmfMethod the DTMF method to set
- */
- public void setDTMFMethod(String dtmfMethod)
- {
- this.dtmfMethod = dtmfMethod;
- }
-
- /**
- * @return the defaultDTMFMethod
- */
- public String getDefaultDTMFMethod()
- {
- return defaultDTMFMethod;
- }
-
- /**
- * @param defaultDTMFMethod the defaultDTMFMethod to set
- */
- public void setDefaultDTMFMethod(String defaultDTMFMethod)
- {
- this.defaultDTMFMethod = defaultDTMFMethod;
- }
-
- /**
- * Returns the minimal DTMF tone duration.
- *
- * @return The minimal DTMF tone duration.
- */
- public String getDtmfMinimalToneDuration()
- {
- return dtmfMinimalToneDuration;
- }
-
- /**
- * Sets the minimal DTMF tone duration.
- *
- * @param dtmfMinimalToneDuration The minimal DTMF tone duration to set.
- */
- public void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration)
- {
- this.dtmfMinimalToneDuration = dtmfMinimalToneDuration;
- }
-
- /**
- * Returns <tt>EncodingsRegistrationUtil</tt> object which stores encodings
- * configuration.
- * @return <tt>EncodingsRegistrationUtil</tt> object which stores encodings
- * configuration.
- */
- public EncodingsRegistrationUtil getEncodingsRegistration()
- {
- return encodingsRegistration;
- }
-
- /**
- * Returns <tt>SecurityAccountRegistration</tt> object which stores security
- * settings.
- * @return <tt>SecurityAccountRegistration</tt> object which stores security
- * settings.
- */
- public SecurityAccountRegistration getSecurityRegistration()
- {
- return securityRegistration;
- }
-
- /**
- * Sets the client certificate configuration entry ID.
- * @param clientCertificateId the client certificate configuration entry ID.
- */
- public void setClientCertificateId(String clientCertificateId)
- {
- this.clientCertificateId = clientCertificateId;
- }
-
- /**
- * Gets the client certificate configuration entry ID.
- * @returns the client certificate configuration entry ID.
- */
- public String getClientCertificateId()
- {
- return clientCertificateId;
- }
-
- /**
- * Stores Jabber account configuration held by this registration object into
- * given<tt>accountProperties</tt> map.
- *
- * @param userName the user name that will be used.
- * @param passwd the password for this account.
- * @param protocolIconPath the path to protocol icon if used, or
- * <tt>null</tt> otherwise.
- * @param accountIconPath the path to account icon if used, or
- * <tt>null</tt> otherwise.
- * @param accountProperties the map used for storings account properties.
- *
- * @throws OperationFailedException if properties are invalid.
- */
- public void storeProperties(String userName, String passwd,
- String protocolIconPath,
- String accountIconPath,
- Map<String, String> accountProperties)
- throws OperationFailedException
- {
- if (protocolIconPath != null)
- accountProperties.put( ProtocolProviderFactory.PROTOCOL_ICON_PATH,
- protocolIconPath);
-
- if (accountIconPath != null)
- accountProperties.put( ProtocolProviderFactory.ACCOUNT_ICON_PATH,
- accountIconPath);
-
- if (isRememberPassword())
- {
- accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
- }
-
- //accountProperties.put("SEND_KEEP_ALIVE",
- // String.valueOf(isSendKeepAlive()));
-
- accountProperties.put("GMAIL_NOTIFICATIONS_ENABLED",
- String.valueOf(isGmailNotificationEnabled()));
- accountProperties.put("GOOGLE_CONTACTS_ENABLED",
- String.valueOf(isGoogleContactsEnabled()));
-
- String serverName = null;
- if (getServerAddress() != null
- && getServerAddress().length() > 0)
- {
- serverName = getServerAddress();
- }
- else
- {
- serverName = getServerFromUserName(userName);
- }
-
- if(isServerOverridden())
- {
- accountProperties.put(
- ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
- Boolean.toString(true));
- }
- else
- {
- accountProperties.put(
- ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
- Boolean.toString(false));
- }
-
- if (serverName == null || serverName.length() <= 0)
- throw new OperationFailedException(
- "Should specify a server for user name " + userName + ".",
- OperationFailedException.SERVER_NOT_SPECIFIED);
-
- if(userName.indexOf('@') < 0 && getDefaultUserSufix() != null)
- userName = userName + '@' + getDefaultUserSufix();
-
- if(getOverridePhoneSuffix() != null)
- {
- accountProperties.put("OVERRIDE_PHONE_SUFFIX",
- getOverridePhoneSuffix());
- }
-
- accountProperties.put(
- ProtocolProviderFactory.IS_CALLING_DISABLED_FOR_ACCOUNT,
- Boolean.toString(isJingleDisabled()));
-
- accountProperties.put("BYPASS_GTALK_CAPABILITIES",
- String.valueOf(getBypassGtalkCaps()));
-
- if(getTelephonyDomainBypassCaps() != null)
- {
- accountProperties.put("TELEPHONY_BYPASS_GTALK_CAPS",
- getTelephonyDomainBypassCaps());
- }
-
- accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
- serverName);
-
- String smsServerAddress = getSmsServerAddress();
-
- String clientCertId = getClientCertificateId();
- if(clientCertId != null)
- {
- accountProperties.put(
- ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE,
- clientCertId);
- }
- else
- {
- accountProperties.remove(
- ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE);
- }
-
- if (smsServerAddress != null)
- {
- accountProperties.put( ProtocolProviderFactory.SMS_SERVER_ADDRESS,
- smsServerAddress);
- }
-
- accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
- String.valueOf(getPort()));
-
- accountProperties.put(ProtocolProviderFactory.AUTO_GENERATE_RESOURCE,
- String.valueOf(isResourceAutogenerated()));
-
- accountProperties.put(ProtocolProviderFactory.RESOURCE,
- getResource());
-
- accountProperties.put(ProtocolProviderFactory.RESOURCE_PRIORITY,
- String.valueOf(getPriority()));
-
- accountProperties.put(ProtocolProviderFactory.IS_USE_ICE,
- String.valueOf(isUseIce()));
-
- accountProperties.put(ProtocolProviderFactory.IS_USE_GOOGLE_ICE,
- String.valueOf(isUseGoogleIce()));
-
- accountProperties.put(ProtocolProviderFactory.AUTO_DISCOVER_STUN,
- String.valueOf(isAutoDiscoverStun()));
-
- accountProperties.put(ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER,
- String.valueOf(isUseDefaultStunServer()));
-
- String accountDisplayName = getAccountDisplayName();
-
- if (accountDisplayName != null && accountDisplayName.length() > 0)
- accountProperties.put( ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME,
- accountDisplayName);
-
- List<StunServerDescriptor> stunServers = getAdditionalStunServers();
-
- int serverIndex = -1;
-
- for(StunServerDescriptor stunServer : stunServers)
- {
- serverIndex ++;
-
- stunServer.storeDescriptor(
- accountProperties,
- ProtocolProviderFactory.STUN_PREFIX + serverIndex);
- }
-
- accountProperties.put(ProtocolProviderFactory.IS_USE_JINGLE_NODES,
- String.valueOf(isUseJingleNodes()));
-
- accountProperties.put(
- ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES,
- String.valueOf(isAutoDiscoverJingleNodes()));
-
- List<JingleNodeDescriptor> jnRelays = getAdditionalJingleNodes();
-
- serverIndex = -1;
- for(JingleNodeDescriptor jnRelay : jnRelays)
- {
- serverIndex ++;
-
- jnRelay.storeDescriptor(accountProperties,
- JingleNodeDescriptor.JN_PREFIX + serverIndex);
- }
-
- accountProperties.put(ProtocolProviderFactory.IS_USE_UPNP,
- String.valueOf(isUseUPNP()));
-
- accountProperties.put(ProtocolProviderFactory.IS_ALLOW_NON_SECURE,
- String.valueOf(isAllowNonSecure()));
-
- if(getDTMFMethod() != null)
- accountProperties.put("DTMF_METHOD",
- getDTMFMethod());
- else
- accountProperties.put("DTMF_METHOD",
- getDefaultDTMFMethod());
-
- accountProperties.put(
- ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION,
- getDtmfMinimalToneDuration());
-
- securityRegistration.storeProperties(accountProperties);
-
- encodingsRegistration.storeProperties(accountProperties);
- }
-
- /**
- * Fills this registration object with configuration properties from given
- * <tt>account</tt>.
- * @param account the account object that will be used.
- * @param bundleContext the OSGi bundle context required for some
- * operations.
- */
- public void loadAccount(AccountID account, BundleContext bundleContext)
- {
- Map<String, String> accountProperties = account.getAccountProperties();
-
- String password
- = ProtocolProviderFactory.getProtocolProviderFactory(
- bundleContext,
- ProtocolNames.JABBER).loadPassword(account);
-
- setRememberPassword(false);
- setUserID(account.getUserID());
-
- if (password != null)
- {
- setPassword(password);
- setRememberPassword(true);
- }
-
- String serverAddress
- = accountProperties.get(ProtocolProviderFactory.SERVER_ADDRESS);
-
- setServerAddress(serverAddress);
-
- setClientCertificateId(
- account.getAccountPropertyString(
- ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE));
-
- String serverPort
- = accountProperties.get(ProtocolProviderFactory.SERVER_PORT);
-
- if(StringUtils.isNullOrEmpty(serverPort))
- serverPort = JabberAccountRegistration.DEFAULT_PORT;
-
- setPort(new Integer(serverPort));
-
- boolean keepAlive
- = Boolean.parseBoolean(accountProperties.get("SEND_KEEP_ALIVE"));
-
- setSendKeepAlive(keepAlive);
-
- boolean gmailNotificationEnabled
- = Boolean.parseBoolean(
- accountProperties.get("GMAIL_NOTIFICATIONS_ENABLED"));
-
- setGmailNotificationEnabled(gmailNotificationEnabled);
-
- String useGC = accountProperties.get("GOOGLE_CONTACTS_ENABLED");
-
- boolean googleContactsEnabled = Boolean.parseBoolean(
- (useGC != null && useGC.length() != 0) ? useGC : "true");
-
- setGoogleContactsEnabled(googleContactsEnabled);
-
- String resource
- = accountProperties.get(ProtocolProviderFactory.RESOURCE);
-
- setResource(resource);
-
- String autoGenerateResourceValue = accountProperties.get(
- ProtocolProviderFactory.AUTO_GENERATE_RESOURCE);
-
- boolean autoGenerateResource =
- JabberAccountRegistration.DEFAULT_RESOURCE_AUTOGEN;
-
- if(autoGenerateResourceValue != null)
- autoGenerateResource = Boolean.parseBoolean(
- autoGenerateResourceValue);
-
- setResourceAutogenerated(autoGenerateResource);
-
- String priority
- = accountProperties.get(ProtocolProviderFactory.RESOURCE_PRIORITY);
-
- if(StringUtils.isNullOrEmpty(priority))
- priority = JabberAccountRegistration.DEFAULT_PRIORITY;
-
- setPriority(new Integer(priority));
-
- String dtmfMethod = account.getAccountPropertyString("DTMF_METHOD");
-
- setDTMFMethod(dtmfMethod);
-
- String dtmfMinimalToneDuration
- = account.getAccountPropertyString("DTMF_MINIMAL_TONE_DURATION");
- setDtmfMinimalToneDuration(dtmfMinimalToneDuration);
-
- //Security properties
- securityRegistration.loadAccount(account);
-
- // ICE
- String useIce =
- accountProperties.get(ProtocolProviderFactory.IS_USE_ICE);
- boolean isUseIce = Boolean.parseBoolean(
- (useIce != null && useIce.length() != 0) ? useIce : "true");
-
- setUseIce(isUseIce);
-
- String useGoogleIce =
- accountProperties.get(ProtocolProviderFactory.IS_USE_GOOGLE_ICE);
- boolean isUseGoogleIce = Boolean.parseBoolean(
- (useGoogleIce != null && useGoogleIce.length() != 0) ?
- useGoogleIce : "true");
-
- setUseGoogleIce(isUseGoogleIce);
-
- String useAutoDiscoverStun
- = accountProperties.get(
- ProtocolProviderFactory.AUTO_DISCOVER_STUN);
- boolean isUseAutoDiscoverStun = Boolean.parseBoolean(
- (useAutoDiscoverStun != null &&
- useAutoDiscoverStun.length() != 0) ?
- useAutoDiscoverStun : "true");
-
- setAutoDiscoverStun(isUseAutoDiscoverStun);
-
- String useDefaultStun
- = accountProperties.get(
- ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER);
- boolean isUseDefaultStun = Boolean.parseBoolean(
- (useDefaultStun != null &&
- useDefaultStun.length() != 0) ?
- useDefaultStun : "true");
-
- setUseDefaultStunServer(isUseDefaultStun);
-
- this.additionalStunServers.clear();
- for (int i = 0; i < StunServerDescriptor.MAX_STUN_SERVER_COUNT; i ++)
- {
- StunServerDescriptor stunServer
- = StunServerDescriptor.loadDescriptor(
- accountProperties, ProtocolProviderFactory.STUN_PREFIX + i);
-
- // If we don't find a stun server with the given index, it means
- // that there're no more servers left in the table so we've nothing
- // more to do here.
- if (stunServer == null)
- break;
-
- String stunPassword = loadStunPassword(
- bundleContext,
- account,
- ProtocolProviderFactory.STUN_PREFIX + i);
-
- if(stunPassword != null)
- {
- stunServer.setPassword(stunPassword);
- }
-
- addStunServer(stunServer);
- }
-
- String useJN =
- accountProperties.get(ProtocolProviderFactory.IS_USE_JINGLE_NODES);
- boolean isUseJN = Boolean.parseBoolean(
- (useJN != null && useJN.length() != 0) ? useJN : "true");
-
- setUseJingleNodes(isUseJN);
-
- String useAutoDiscoverJN
- = accountProperties.get(
- ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES);
- boolean isUseAutoDiscoverJN = Boolean.parseBoolean(
- (useAutoDiscoverJN != null &&
- useAutoDiscoverJN.length() != 0) ?
- useAutoDiscoverJN : "true");
-
- setAutoDiscoverJingleNodes(isUseAutoDiscoverJN);
-
- this.additionalJingleNodes.clear();
- for (int i = 0; i < JingleNodeDescriptor.MAX_JN_RELAY_COUNT ; i ++)
- {
- JingleNodeDescriptor jn
- = JingleNodeDescriptor.loadDescriptor(
- accountProperties, JingleNodeDescriptor.JN_PREFIX + i);
-
- // If we don't find a stun server with the given index, it means
- // that there're no more servers left in the table so we've nothing
- // more to do here.
- if (jn == null)
- break;
-
- addJingleNodes(jn);
- }
-
- String useUPNP =
- accountProperties.get(ProtocolProviderFactory.IS_USE_UPNP);
- boolean isUseUPNP = Boolean.parseBoolean(
- (useUPNP != null && useUPNP.length() != 0) ? useUPNP : "true");
-
- setUseUPNP(isUseUPNP);
-
- String allowNonSecure =
- accountProperties.get(ProtocolProviderFactory.IS_ALLOW_NON_SECURE);
- boolean isAllowNonSecure = Boolean.parseBoolean(
- (allowNonSecure != null && allowNonSecure.length() != 0)
- ? allowNonSecure : "false");
-
- setAllowNonSecure(isAllowNonSecure);
-
- boolean isServerOverriden =
- account.getAccountPropertyBoolean(
- ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
- false);
-
- setServerOverridden(isServerOverriden);
-
- boolean disabledJingle = Boolean.parseBoolean(accountProperties.get(
- ProtocolProviderFactory.IS_CALLING_DISABLED_FOR_ACCOUNT));
- setDisableJingle(disabledJingle);
-
- String overridePhoneSuffix =
- accountProperties.get("OVERRIDE_PHONE_SUFFIX");
- setOverridePhoneSufix(overridePhoneSuffix);
-
- String bypassCapsDomain = accountProperties.get(
- "TELEPHONY_BYPASS_GTALK_CAPS");
- setTelephonyDomainBypassCaps(bypassCapsDomain);
-
- // Encodings
- encodingsRegistration.loadAccount(
- account,
- ServiceUtils.getService(bundleContext, MediaService.class));
- }
-
- /**
- * Load password for this STUN descriptor.
- *
- * @param accountID account ID
- * @param namePrefix name prefix
- * @return password or null if empty
- */
- private static String loadStunPassword(BundleContext bundleContext,
- AccountID accountID,
- String namePrefix)
- {
- ProtocolProviderFactory providerFactory
- = ProtocolProviderFactory.getProtocolProviderFactory(
- bundleContext,
- ProtocolNames.JABBER);
-
- String password = null;
- String className = providerFactory.getClass().getName();
- String packageSourceName
- = className.substring(0, className.lastIndexOf('.'));
-
- String accountPrefix = ProtocolProviderFactory.findAccountPrefix(
- bundleContext,
- accountID, packageSourceName);
-
- CredentialsStorageService credentialsService
- = ServiceUtils.getService(
- bundleContext,
- CredentialsStorageService.class);
-
- try
- {
- password = credentialsService.
- loadPassword(accountPrefix + "." + namePrefix);
- }
- catch(Exception e)
- {
- return null;
- }
-
- return password;
- }
-
- /**
- * Parse the server part from the jabber id and set it to server as default
- * value. If Advanced option is enabled Do nothing.
- *
- * @param userName the full JID that we'd like to parse.
- *
- * @return returns the server part of a full JID
- */
- protected String getServerFromUserName(String userName)
- {
- int delimIndex = userName.indexOf("@");
- if (delimIndex != -1)
- {
- String newServerAddr = userName.substring(delimIndex + 1);
- if (newServerAddr.equals(GOOGLE_USER_SUFFIX))
- {
- return GOOGLE_CONNECT_SRV;
- }
- else
- {
- return newServerAddr;
- }
- }
-
- return null;
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
index 9034a79..16ebaba 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
@@ -16,6 +16,7 @@ import net.java.sip.communicator.plugin.desktoputil.wizard.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
import org.jitsi.util.*;
/**
@@ -295,9 +296,13 @@ public class JabberAccountRegistrationForm
}
registration.setUserID(userID);
- registration.setPassword(new String(password));
- registration.setRememberPassword(accountPanel.isRememberPassword());
- registration.setClientCertificateId(
+
+ if(accountPanel.isRememberPassword())
+ registration.setPassword(new String(password));
+ else
+ registration.setPassword(null);
+
+ registration.setTlsClientCertificate(
connectionPanel.getClientTlsCertificateId());
registration.setServerAddress(serverAddress);
registration.setServerOverridden(connectionPanel.isServerOverridden());
@@ -311,7 +316,7 @@ public class JabberAccountRegistrationForm
registration.setResource(connectionPanel.getResource());
if (serverPort != null)
- registration.setPort(Integer.parseInt(serverPort));
+ registration.setServerPort(serverPort);
String priority = connectionPanel.getPriority();
if (priority != null)
@@ -381,6 +386,10 @@ public class JabberAccountRegistrationForm
accountPanel.setPassword(password);
accountPanel.setRememberPassword(true);
}
+ else
+ {
+ accountPanel.setPassword(null);
+ }
String serverAddress = accountReg.getServerAddress();
@@ -389,9 +398,9 @@ public class JabberAccountRegistrationForm
connectionPanel.setServerAddress(serverAddress);
connectionPanel.setClientTlsCertificateId(
- accountReg.getClientCertificateId());
+ accountReg.getTlsClientCertificate());
- String serverPort = String.valueOf(accountReg.getPort());
+ String serverPort = String.valueOf(accountReg.getServerPort());
connectionPanel.setServerPort(serverPort);
@@ -403,9 +412,7 @@ public class JabberAccountRegistrationForm
connectionPanel.setGoogleContactsEnabled(
accountReg.isGoogleContactsEnabled());
- String resource = accountReg.getResource();
-
- connectionPanel.setResource(resource);
+ connectionPanel.setResource(accountReg.getResource());
connectionPanel.setAutogenerateResource(
accountReg.isResourceAutogenerated());
@@ -414,10 +421,8 @@ public class JabberAccountRegistrationForm
connectionPanel.setDTMFMethod(accountReg.getDTMFMethod());
- String dtmfMinimalToneDuration
- = accountReg.getDtmfMinimalToneDuration();
- if(!StringUtils.isNullOrEmpty(dtmfMinimalToneDuration))
- connectionPanel.setDtmfMinimalToneDuration(dtmfMinimalToneDuration);
+ connectionPanel.setDtmfMinimalToneDuration(
+ accountReg.getDtmfMinimalToneDuration());
securityPanel.loadAccount(accountReg.getSecurityRegistration());
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
index cf6238b..83afa19 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
@@ -11,6 +11,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.jabber.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -160,7 +161,7 @@ public class JabberAccountRegistrationWizard
summaryTable.put(
Resources.getString("service.gui.REMEMBER_PASSWORD"),
- Boolean.toString(registration.isRememberPassword()));
+ Boolean.toString(registration.getPassword() != null));
summaryTable.put(
Resources.getString("plugin.jabberaccregwizz.SERVER"),
@@ -168,7 +169,7 @@ public class JabberAccountRegistrationWizard
summaryTable.put(
Resources.getString("service.gui.PORT"),
- String.valueOf(registration.getPort()));
+ String.valueOf(registration.getServerPort()));
summaryTable.put(
Resources.getString("plugin.jabberaccregwizz.ENABLE_KEEP_ALIVE"),
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
index 8c6d9a7..08f5aa2 100755
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
@@ -19,6 +19,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.jabber,
org.jitsi.service.resources,
net.java.sip.communicator.service.resources,
org.jitsi.util,
diff --git a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java
index b86a5c5..ea26f02 100644
--- a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/Sip2SipAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.protocol.sip.*;
/**
* The <tt>Sip2SipAccountRegistrationWizard</tt> is an implementation of the
@@ -94,7 +95,6 @@ public class Sip2SipAccountRegistrationWizard
{
// set properties common for sip2sip
reg.setKeepAliveMethod("NONE");
- reg.setDefaultKeepAliveMethod("NONE");
reg.setDefaultDomain("sip2sip.info");
reg.setXCapEnable(true);
reg.setClistOptionServerUri(
diff --git a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/sip2sipaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/sip2sipaccregwizz.manifest.mf
index 5df1e81..c583368 100644
--- a/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/sip2sipaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/sip2sipaccregwizz/sip2sipaccregwizz.manifest.mf
@@ -15,6 +15,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.sip,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.plugin.desktoputil,
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java
index a5602ad..e5e2429 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java
@@ -20,6 +20,7 @@ import org.jitsi.util.*;
* The panel containing information about the connection.
*
* @author Yana Stamcheva
+ * @author Pawel Domas
*/
public class ConnectionPanel
extends TransparentPanel
@@ -113,7 +114,7 @@ public class ConnectionPanel
this.transportCombo.addItemListener(this);
transportCombo.setSelectedItem(
- regform.getRegistration().getDefaultTransport());
+ regform.getRegistration().getPreferredTransport());
JPanel mainPanel = new TransparentPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
@@ -143,14 +144,8 @@ public class ConnectionPanel
labelsPanel.add(authNameLabel);
labelsPanel.add(certLabel);
- if(!StringUtils.isNullOrEmpty(
- regform.getRegistration().getDefaultServerAddress()))
- serverField.setText(regform.getRegistration()
- .getDefaultServerAddress());
- if(!StringUtils.isNullOrEmpty(
- regform.getRegistration().getDefaultServerPort()))
- serverPortField.setText(regform.getRegistration()
- .getDefaultServerPort());
+ serverField.setText(regform.getRegistration().getServerAddress());
+ serverPortField.setText(regform.getRegistration().getServerPort());
JPanel serverPanel = new TransparentPanel(new BorderLayout(5, 5));
serverPanel.add(serverField, BorderLayout.CENTER);
@@ -173,15 +168,13 @@ public class ConnectionPanel
mainPanel.add(registrarMainPanel);
proxyAutoCheckBox.setSelected(
- regform.getRegistration().isDefaultProxyAutoConfigure());
+ regform.getRegistration().isProxyAutoConfigure());
if(!StringUtils.isNullOrEmpty(
- regform.getRegistration().getDefaultProxy()))
- proxyField.setText(regform.getRegistration()
- .getDefaultProxy());
+ regform.getRegistration().getProxy()))
+ proxyField.setText(regform.getRegistration().getProxy());
if(!StringUtils.isNullOrEmpty(
- regform.getRegistration().getDefaultProxyPort()))
- proxyPortField.setText(regform.getRegistration()
- .getDefaultProxyPort());
+ regform.getRegistration().getProxyPort()))
+ proxyPortField.setText(regform.getRegistration().getProxyPort());
JLabel proxyLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY"));
@@ -356,12 +349,6 @@ public class ConnectionPanel
keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
- keepAliveIntervalValue
- .setText(SIPAccountRegistration.DEFAULT_KEEP_ALIVE_INTERVAL);
-
- keepAliveMethodBox.setSelectedItem(
- regform.getRegistration().getDefaultKeepAliveMethod());
-
keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel);
@@ -416,9 +403,9 @@ public class ConnectionPanel
}
});
dtmfMethodBox.setSelectedItem(
- regform.getRegistration().getDefaultDTMFMethod());
+ regform.getRegistration().getDTMFMethod());
dtmfMinimalToneDurationValue
- .setText(SIPAccountRegistration.DEFAULT_MINIMAL_DTMF_TONE_DURATION);
+ .setText(regform.getRegistration().getDtmfMinimalToneDuration());
JLabel dtmfMinimalToneDurationExampleLabel = new JLabel(
Resources.getString(
"plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION_INFO"));
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
index 72819c1..93fb4fb 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
@@ -129,14 +129,8 @@ public class FirstWizardPage
{
registrationForm.setModification(wizard.isModification());
- // Loads account properties into registration object
- SIPAccountRegistration sipAccReg = new SIPAccountRegistration();
- sipAccReg.loadAccount(
- protocolProvider.getAccountID(),
- SIPAccRegWizzActivator.bundleContext);
-
// Initialize registration form
- registrationForm.loadAccount(sipAccReg);
+ registrationForm.loadAccount(wizard.getRegistration());
}
/**
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java
index c5d3fe7..5e2fc2b 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java
@@ -51,11 +51,9 @@ public class PresencePanel
private JLabel subscribeExpiresLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
- private JTextField pollPeriodField
- = new JTextField(SIPAccountRegistration.DEFAULT_POLL_PERIOD);
+ private JTextField pollPeriodField = new JTextField();
- private JTextField subscribeExpiresField =
- new JTextField(SIPAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
+ private JTextField subscribeExpiresField = new JTextField();
private JTextField clistOptionServerUriValue = new JTextField();
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
deleted file mode 100644
index 96b0f08..0000000
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
+++ /dev/null
@@ -1,1371 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license. See terms of license at gnu.org.
- */
-package net.java.sip.communicator.plugin.sipaccregwizz;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.*;
-import net.java.sip.communicator.util.wizard.*;
-
-import org.jitsi.service.neomedia.*;
-import org.jitsi.util.*;
-
-import org.osgi.framework.*;
-
-/**
- * The <tt>SIPAccountRegistration</tt> is used to store all user input data
- * through the <tt>SIPAccountRegistrationWizard</tt>.
- *
- * @author Yana Stamcheva
- * @author Grigorii Balutsel
- * @author Boris Grozev
- */
-public class SIPAccountRegistration
-{
- public static String DEFAULT_PORT = "5060";
-
- public static String DEFAULT_TLS_PORT = "5061";
-
- public static String DEFAULT_POLL_PERIOD = "30";
-
- public static String DEFAULT_SUBSCRIBE_EXPIRES = "3600";
-
- private String defaultKeepAliveMethod = "OPTIONS";
-
- public static String DEFAULT_KEEP_ALIVE_INTERVAL = "25";
-
- /**
- * The default value for DTMF method.
- */
- private String defaultDTMFMethod = "AUTO_DTMF";
-
- /**
- * The default value of minimale DTMF tone duration.
- */
- public static String DEFAULT_MINIMAL_DTMF_TONE_DURATION = Integer.toString(
- OperationSetDTMF.DEFAULT_DTMF_MINIMAL_TONE_DURATION);
-
- private String id;
-
- private String password;
-
- private boolean rememberPassword = true;
-
- private String tlsClientCertificate;
-
- private String defaultServerAddress = null;
-
- private String serverAddress;
-
- private String displayName;
-
- private String authorizationName;
-
- private String defaultServerPort = null;
-
- private String serverPort = null;
-
- private boolean defaultProxyAutoConfigure = true;
-
- private boolean proxyAutoConfigure = defaultProxyAutoConfigure;
-
- private String defaultProxyPort = null;
-
- private String proxyPort = null;
-
- private String defaultProxy = null;
-
- private String proxy;
-
- private String defaultTransport = "UDP";
-
- private String preferredTransport = defaultTransport;
-
- private boolean enablePresence = true;
-
- private boolean forceP2PMode = false;
-
- private int savpOption = 0;
-
- private String pollingPeriod = DEFAULT_POLL_PERIOD;
-
- private String subscriptionExpiration = DEFAULT_SUBSCRIBE_EXPIRES;
-
- private String keepAliveMethod = null;
-
- private String keepAliveInterval = DEFAULT_KEEP_ALIVE_INTERVAL;
-
- /**
- * DTMF method.
- */
- private String dtmfMethod = null;
-
- /**
- * The minimal DTMF tone duration set.
- */
- private String dtmfMinimalToneDuration = DEFAULT_MINIMAL_DTMF_TONE_DURATION;
-
- private String defaultDomain = null;
-
- private boolean xCapEnable = false;
-
- private boolean xivoEnable = false;
-
- private boolean clistOptionUseSipCredentials = true;
-
- private String clistOptionServerUri;
-
- private String clistOptionUser;
-
- private String clistOptionPassword;
-
- /**
- * The voicemail uri if any.
- */
- private String voicemailURI;
-
- /**
- * The voicemail check uri if any.
- */
- private String voicemailCheckURI;
-
- /**
- * Whether message waiting indications is enabled.
- */
- private boolean messageWaitingIndications = true;
-
- /**
- * Flag holding info if server was overriden.
- */
- private boolean isServerOverriden;
-
- /**
- * The encodings registration object.
- */
- private EncodingsRegistrationUtil encodingsRegistration
- = new EncodingsRegistrationUtil();
-
- /**
- * The security registration object.
- */
- private SecurityAccountRegistration securityAccountRegistration
- = new SecurityAccountRegistration()
- {
- /**
- * Sets the method used for RTP/SAVP indication.
- */
- @Override
- public void setSavpOption(int savpOption)
- {
- SIPAccountRegistration.this.savpOption = savpOption;
- }
-
- /**
- * Returns the method used for RTP/SAVP indication.
- * @return the method used for RTP/SAVP indication.
- */
- @Override
- public int getSavpOption()
- {
- return savpOption;
- }
- };
-
- /**
- * Initializes a new SIPAccountRegistration.
- */
- public SIPAccountRegistration()
- {
- super();
- }
-
- public String getPreferredTransport()
- {
- return preferredTransport;
- }
-
- public void setPreferredTransport(String preferredTransport)
- {
- this.preferredTransport = preferredTransport;
- }
-
- public String getDefaultProxy()
- {
- return defaultProxy;
- }
-
- public void setDefaultProxy(String proxy)
- {
- if(proxy != null && proxy.length() == 0)
- this.defaultProxy = null;
- else
- this.defaultProxy = proxy;
- }
-
- public String getProxy()
- {
- return proxy;
- }
-
- public void setProxy(String proxy)
- {
- if(proxy != null && proxy.length() == 0)
- this.proxy = null;
- else
- this.proxy = proxy;
- }
-
- /**
- * Returns the password of the sip registration account.
- *
- * @return the password of the sip registration account.
- */
- public String getPassword()
- {
- return password;
- }
-
- /**
- * Sets the password of the sip registration account.
- *
- * @param password the password of the sip registration account.
- */
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- /**
- * Returns TRUE if password has to remembered, FALSE otherwise.
- *
- * @return TRUE if password has to remembered, FALSE otherwise
- */
- public boolean isRememberPassword()
- {
- return rememberPassword;
- }
-
- /**
- * Sets the rememberPassword value of this sip account registration.
- *
- * @param rememberPassword TRUE if password has to remembered, FALSE
- * otherwise
- */
- public void setRememberPassword(boolean rememberPassword)
- {
- this.rememberPassword = rememberPassword;
- }
-
- /**
- * Gets the ID of the client certificate configuration.
- * @return the ID of the client certificate configuration.
- */
- public String getTlsClientCertificate()
- {
- return tlsClientCertificate;
- }
-
- /**
- * Sets the ID of the client certificate configuration.
- * @param id the client certificate configuration template ID.
- */
- public void setTlsClientCertificate(String id)
- {
- tlsClientCertificate = id;
- }
-
- /**
- * Returns the UIN of the sip registration account.
- *
- * @return the UIN of the sip registration account.
- */
- public String getId()
- {
- return id;
- }
-
- /**
- * The default value of address of the server we will use for this account
- *
- * @return String
- */
- public String getDefaultServerAddress()
- {
- return defaultServerAddress;
- }
-
- /**
- * The port on the specified server
- *
- * @return int
- */
- public String getDefaultServerPort()
- {
- return defaultServerPort;
- }
-
- /**
- * The address of the server we will use for this account
- *
- * @return String
- */
- public String getServerAddress()
- {
- return serverAddress;
- }
-
- /**
- * The port on the specified server
- *
- * @return int
- */
- public String getServerPort()
- {
- return serverPort;
- }
-
- /**
- * The display name
- *
- * @return String display name
- */
- public String getDisplayName()
- {
- return displayName;
- }
-
- /**
- * The authorization name
- *
- * @return String auth name
- */
- public String getAuthorizationName()
- {
- return authorizationName;
- }
-
- /**
- * The port on the specified proxy
- *
- * @return int
- */
- public String getProxyPort()
- {
- return proxyPort;
- }
-
- /**
- * The default port on the specified proxy
- *
- * @return int
- */
- public String getDefaultProxyPort()
- {
- return defaultProxyPort;
- }
-
- /**
- * Sets the identifier of the sip registration account.
- *
- * @param id the identifier of the sip registration account.
- */
- public void setUserID(String id)
- {
- this.id = id;
- }
-
- /**
- * Sets default the server
- *
- * @param serverAddress String
- */
- public void setDefaultServerAddress(String serverAddress)
- {
- if(serverAddress != null && serverAddress.length() == 0)
- this.defaultServerAddress = null;
- else
- this.defaultServerAddress = serverAddress;
- }
-
- /**
- * Sets the server port.
- *
- * @param port int
- */
- public void setDefaultServerPort(String port)
- {
- if(port != null && port.length() == 0)
- this.defaultServerPort = null;
- else
- this.defaultServerPort = port;
- }
-
- /**
- * Sets the server
- *
- * @param serverAddress String
- */
- public void setServerAddress(String serverAddress)
- {
- if(serverAddress != null && serverAddress.length() == 0)
- this.serverAddress = null;
- else
- this.serverAddress = serverAddress;
- }
-
- /**
- * Sets the server port.
- *
- * @param port int
- */
- public void setServerPort(String port)
- {
- if(port != null && port.length() == 0)
- this.serverPort = null;
- else
- this.serverPort = port;
- }
-
- /**
- * Sets the display name.
- *
- * @param displayName String
- */
- public void setDisplayName(String displayName)
- {
- if(displayName != null && displayName.length() == 0)
- this.displayName = null;
- else
- this.displayName = displayName;
- }
-
- /**
- * Sets authorization name.
- *
- * @param authName String
- */
- public void setAuthorizationName(String authName)
- {
- if(authName != null && authName.length() == 0)
- this.authorizationName = null;
- else
- this.authorizationName = authName;
- }
-
- /**
- * Sets the proxy port.
- *
- * @param port int
- */
- public void setProxyPort(String port)
- {
- if(port != null && port.length() == 0)
- this.proxyPort = null;
- else
- this.proxyPort = port;
- }
-
- /**
- * Sets the default proxy port.
- *
- * @param port int
- */
- public void setDefaultProxyPort(String port)
- {
- if(port != null && port.length() == 0)
- this.defaultProxyPort = null;
- else
- this.defaultProxyPort = port;
- }
-
- /**
- * If the presence is enabled
- *
- * @return If the presence is enabled
- */
- public boolean isEnablePresence()
- {
- return enablePresence;
- }
-
- /**
- * If the p2p mode is forced
- *
- * @return If the p2p mode is forced
- */
- public boolean isForceP2PMode()
- {
- return forceP2PMode;
- }
-
- /**
- * The offline contact polling period
- *
- * @return the polling period
- */
- public String getPollingPeriod()
- {
- return pollingPeriod;
- }
-
- /**
- * The default expiration of subscriptions
- *
- * @return the subscription expiration
- */
- public String getSubscriptionExpiration()
- {
- return subscriptionExpiration;
- }
-
- /**
- * Sets if the presence is enabled
- *
- * @param enablePresence if the presence is enabled
- */
- public void setEnablePresence(boolean enablePresence)
- {
- this.enablePresence = enablePresence;
- }
-
- /**
- * Sets if we have to force the p2p mode
- *
- * @param forceP2PMode if we have to force the p2p mode
- */
- public void setForceP2PMode(boolean forceP2PMode)
- {
- this.forceP2PMode = forceP2PMode;
- }
-
- /**
- * Sets the offline contacts polling period
- *
- * @param pollingPeriod the offline contacts polling period
- */
- public void setPollingPeriod(String pollingPeriod)
- {
- this.pollingPeriod = pollingPeriod;
- }
-
- /**
- * Sets the subscription expiration value
- *
- * @param subscriptionExpiration the subscription expiration value
- */
- public void setSubscriptionExpiration(String subscriptionExpiration)
- {
- this.subscriptionExpiration = subscriptionExpiration;
- }
-
- /**
- * Returns the keep alive method.
- *
- * @return the keep alive method.
- */
- public String getKeepAliveMethod()
- {
- return keepAliveMethod;
- }
-
- /**
- * Sets the keep alive method.
- *
- * @param keepAliveMethod the keep alive method to set
- */
- public void setKeepAliveMethod(String keepAliveMethod)
- {
- this.keepAliveMethod = keepAliveMethod;
- }
-
- /**
- * Returns the keep alive interval.
- *
- * @return the keep alive interval
- */
- public String getKeepAliveInterval()
- {
- return keepAliveInterval;
- }
-
- /**
- * Sets the keep alive interval.
- *
- * @param keepAliveInterval the keep alive interval to set
- */
- public void setKeepAliveInterval(String keepAliveInterval)
- {
- this.keepAliveInterval = keepAliveInterval;
- }
-
- /**
- * Returns the DTMF method.
- *
- * @return the DTMF method.
- */
- public String getDTMFMethod()
- {
- return dtmfMethod;
- }
-
- /**
- * Sets the DTMF method.
- *
- * @param dtmfMethod the DTMF method to set
- */
- public void setDTMFMethod(String dtmfMethod)
- {
- this.dtmfMethod = dtmfMethod;
- }
-
- /**
- * Returns the minimal DTMF tone duration.
- *
- * @return The minimal DTMF tone duration.
- */
- public String getDtmfMinimalToneDuration()
- {
- return dtmfMinimalToneDuration;
- }
-
- /**
- * Sets the minimal DTMF tone duration.
- *
- * @param dtmfMinimalToneDuration The minimal DTMF tone duration to set.
- */
- public void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration)
- {
- this.dtmfMinimalToneDuration = dtmfMinimalToneDuration;
- }
-
- /**
- * Gets the method used for RTP/SAVP indication.
- *
- * @return The method used for RTP/SAVP indication.
- */
- public int getSavpOption()
- {
- return savpOption;
- }
-
- /**
- * Sets the method used for RTP/SAVP indication.
- */
- public void setSavpOption(int savpOption)
- {
- this.savpOption = savpOption;
- }
-
- /**
- * This is the default domain.
- * @return the defaultDomain
- */
- public String getDefaultDomain()
- {
- return defaultDomain;
- }
-
- /**
- * If default domain is set this means we cannot create registerless
- * accounts through this wizard. And every time we write only the username,
- * will will end up with username@defaultDomain.
- *
- * @param defaultDomain the defaultDomain to set
- */
- public void setDefaultDomain(String defaultDomain)
- {
- this.defaultDomain = defaultDomain;
- }
-
- /**
- * @return the defaultKeepAliveMethod
- */
- public String getDefaultKeepAliveMethod()
- {
- return defaultKeepAliveMethod;
- }
-
- /**
- * @param defaultKeepAliveMethod the defaultKeepAliveMethod to set
- */
- public void setDefaultKeepAliveMethod(String defaultKeepAliveMethod)
- {
- this.defaultKeepAliveMethod = defaultKeepAliveMethod;
- }
-
- /**
- * @return the defaultDTMFMethod
- */
- public String getDefaultDTMFMethod()
- {
- return defaultDTMFMethod;
- }
-
- /**
- * @param defaultDTMFMethod the defaultDTMFMethod to set
- */
- public void setDefaultDTMFMethod(String defaultDTMFMethod)
- {
- this.defaultDTMFMethod = defaultDTMFMethod;
- }
-
- /**
- * @return the defaultTransport
- */
- public String getDefaultTransport()
- {
- return defaultTransport;
- }
-
- /**
- * @param defaultTransport the defaultTransport to set
- */
- public void setDefaultTransport(String defaultTransport)
- {
- this.defaultTransport = defaultTransport;
- }
-
- /**
- * Checks if XCAP is enabled.
- *
- * @return true if XCAP is enabled otherwise false.
- */
- public boolean isXCapEnable()
- {
- return xCapEnable;
- }
- /**
- * Sets if XCAP is enable.
- *
- * @param xCapEnable XCAP enable.
- */
- public void setXCapEnable(boolean xCapEnable)
- {
- this.xCapEnable = xCapEnable;
- }
-
- /**
- * Checks if XiVO option is enabled.
- *
- * @return true if XiVO is enabled otherwise false.
- */
- public boolean isXiVOEnable()
- {
- return xivoEnable;
- }
- /**
- * Sets if XiVO option is enable.
- *
- * @param xivoEnable XiVO enable.
- */
- public void setXiVOEnable(boolean xivoEnable)
- {
- this.xivoEnable = xivoEnable;
- }
-
- /**
- * Checks if XCAP has to use SIP account credentials.
- *
- * @return true if XCAP has to use SIP account credentials otherwise false.
- */
- public boolean isClistOptionUseSipCredentials()
- {
- return clistOptionUseSipCredentials;
- }
-
- /**
- * Sets if contact list has to use SIP account credentials.
- *
- * @param clistOptionUseSipCredentials if the clist has
- * to use SIP account credentials.
- */
- public void setClistOptionUseSipCredentials(
- boolean clistOptionUseSipCredentials)
- {
- this.clistOptionUseSipCredentials = clistOptionUseSipCredentials;
- }
-
- /**
- * Gets the contact list server uri.
- *
- * @return the contact list server uri.
- */
- public String getClistOptionServerUri()
- {
- return clistOptionServerUri;
- }
-
- /**
- * Sets the contact list server uri.
- *
- * @param clistOptionServerUri the contact list server uri.
- */
- public void setClistOptionServerUri(String clistOptionServerUri)
- {
- this.clistOptionServerUri = clistOptionServerUri;
- }
-
- /**
- * Gets the contact list user.
- *
- * @return the contact list user.
- */
- public String getClistOptionUser()
- {
- return clistOptionUser;
- }
-
- /**
- * Sets the contact list user.
- *
- * @param clistOptionUser the contact list user.
- */
- public void setClistOptionUser(String clistOptionUser)
- {
- this.clistOptionUser = clistOptionUser;
- }
-
- /**
- * Gets the contact list password.
- *
- * @return the contact list password.
- */
- public String getClistOptionPassword()
- {
- return clistOptionPassword;
- }
-
- /**
- * Sets the contact list password.
- *
- * @param clistOptionPassword the contact list password.
- */
- public void setClistOptionPassword(String clistOptionPassword)
- {
- this.clistOptionPassword = clistOptionPassword;
- }
-
- /**
- * Is proxy auto configured.
- * @return
- */
- public boolean isProxyAutoConfigure()
- {
- return proxyAutoConfigure;
- }
-
- /**
- * Sets auto configuration of proxy enabled or disabled.
- * @param proxyAutoConfigure
- */
- public void setProxyAutoConfigure(boolean proxyAutoConfigure)
- {
- this.proxyAutoConfigure = proxyAutoConfigure;
- }
-
- /**
- * Is proxy auto configured by default.
- * @return
- */
- public boolean isDefaultProxyAutoConfigure()
- {
- return defaultProxyAutoConfigure;
- }
-
- /**
- * Sets default auto configuration of proxy enabled or disabled.
- * @param proxyAutoConfigure
- */
- public void setDefaultProxyAutoConfigure(boolean proxyAutoConfigure)
- {
- this.defaultProxyAutoConfigure = proxyAutoConfigure;
- }
-
- /**
- * The voicemail URI.
- * @return the voicemail URI.
- */
- public String getVoicemailURI()
- {
- return voicemailURI;
- }
-
- /**
- * Sets voicemail URI.
- * @param voicemailURI new URI.
- */
- public void setVoicemailURI(String voicemailURI)
- {
- this.voicemailURI = voicemailURI;
- }
-
- /**
- * The voicemail check URI.
- * @return the voicemail URI.
- */
- public String getVoicemailCheckURI()
- {
- return voicemailCheckURI;
- }
-
- /**
- * Sets voicemail check URI.
- * @param voicemailCheckURI new URI.
- */
- public void setVoicemailCheckURI(String voicemailCheckURI)
- {
- this.voicemailCheckURI = voicemailCheckURI;
- }
-
- /**
- * Check if messageWaitingIndications is enabled
- *
- * @return if messageWaitingIndications is enabled
- */
- public boolean isMessageWaitingIndicationsEnabled()
- {
- return messageWaitingIndications;
- }
-
- /**
- * Sets message waiting indications.
- *
- * @param messageWaitingIndications
- */
- public void setMessageWaitingIndications(boolean messageWaitingIndications)
- {
- this.messageWaitingIndications = messageWaitingIndications;
- }
-
- /**
- * Returns <tt>true</tt> if server was overriden.
- * @return <tt>true</tt> if server was overriden.
- */
- public boolean isServerOverriden()
- {
- return isServerOverriden;
- }
-
- /**
- * Returns encoding registration object holding encodings configuration.
- * @return encoding registration object holding encodings configuration.
- */
- public EncodingsRegistrationUtil getEncodingsRegistration()
- {
- return encodingsRegistration;
- }
-
- /**
- * Returns security registration object holding security configuration.
- * @return <tt>SecurityAccountRegistration</tt> object holding security
- * configuration.
- */
- public SecurityAccountRegistration getSecurityAccountRegistration()
- {
- return securityAccountRegistration;
- }
-
- /**
- * Loads configuration properties from given <tt>accountID</tt>.
- * @param accountID the account identifier that will be used.
- * @param bundleContext the OSGI bundle context required for some
- * operations.
- */
- public void loadAccount(AccountID accountID, BundleContext bundleContext)
- {
- String password = SIPAccRegWizzActivator.getSIPProtocolProviderFactory()
- .loadPassword(accountID);
-
- String serverAddress = accountID.getAccountPropertyString(
- ProtocolProviderFactory.SERVER_ADDRESS);
-
- String displayName = accountID.getAccountPropertyString(
- ProtocolProviderFactory.DISPLAY_NAME);
-
- String authName = accountID.getAccountPropertyString(
- ProtocolProviderFactory.AUTHORIZATION_NAME);
-
- String serverPort = accountID.getAccountPropertyString(
- ProtocolProviderFactory.SERVER_PORT);
-
- String proxyAddress = accountID.getAccountPropertyString(
- ProtocolProviderFactory.PROXY_ADDRESS);
-
- String proxyPort = accountID.getAccountPropertyString(
- ProtocolProviderFactory.PROXY_PORT);
-
- String preferredTransport = accountID.getAccountPropertyString(
- ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- boolean enablePresence = accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.IS_PRESENCE_ENABLED, false);
-
- boolean forceP2P = accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.FORCE_P2P_MODE, false);
-
- String clientTlsCertificateId = accountID.getAccountPropertyString(
- ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE);
-
- boolean proxyAutoConfigureEnabled = accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.PROXY_AUTO_CONFIG, false);
-
- String pollingPeriod = accountID.getAccountPropertyString(
- ProtocolProviderFactory.POLLING_PERIOD);
-
- String subscriptionPeriod = accountID.getAccountPropertyString(
- ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
-
- String keepAliveMethod =
- accountID.getAccountPropertyString(
- ProtocolProviderFactory.KEEP_ALIVE_METHOD);
-
- String keepAliveInterval =
- accountID.getAccountPropertyString(
- ProtocolProviderFactory.KEEP_ALIVE_INTERVAL);
-
- String dtmfMethod =
- accountID.getAccountPropertyString("DTMF_METHOD");
- String dtmfMinimalToneDuration =
- accountID.getAccountPropertyString("DTMF_MINIMAL_TONE_DURATION");
-
- String voicemailURI = accountID.getAccountPropertyString(
- ProtocolProviderFactory.VOICEMAIL_URI);
- String voicemailCheckURI = accountID.getAccountPropertyString(
- ProtocolProviderFactory.VOICEMAIL_CHECK_URI);
-
- boolean xCapEnable = accountID
- .getAccountPropertyBoolean("XCAP_ENABLE", false);
- boolean xivoEnable = accountID
- .getAccountPropertyBoolean("XIVO_ENABLE", false);
-
- boolean isServerOverridden = accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
-
- this.isServerOverriden = isServerOverridden;
-
- String userID = (serverAddress == null) ? accountID.getUserID()
- : accountID.getAccountPropertyString(
- ProtocolProviderFactory.USER_ID);
- setUserID(userID);
-
- if (password != null)
- {
- setPassword(password);
- setRememberPassword(true);
- }
- else
- {
- setRememberPassword(false);
- }
-
- setServerAddress(serverAddress);
-
- setDisplayName(displayName);
-
- setAuthorizationName(authName);
- setTlsClientCertificate(clientTlsCertificateId);
-
- setProxyAutoConfigure(proxyAutoConfigureEnabled);
- setServerPort(serverPort);
- setProxy(proxyAddress);
-
- // The order of the next two fields is important, as a change listener
- // of the transportCombo sets the proxyPortField to its default
- setPreferredTransport(preferredTransport);
- setProxyPort(proxyPort);
-
- securityAccountRegistration.loadAccount(accountID);
-
- setEnablePresence(enablePresence);
- setForceP2PMode(forceP2P);
- setPollingPeriod(pollingPeriod);
- setSubscriptionExpiration(subscriptionPeriod);
-
- setKeepAliveMethod(keepAliveMethod);
- setKeepAliveInterval(keepAliveInterval);
-
- setDTMFMethod(dtmfMethod);
- setDtmfMinimalToneDuration(dtmfMinimalToneDuration);
-
- boolean mwiEnabled = accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.VOICEMAIL_ENABLED, true);
- setMessageWaitingIndications(mwiEnabled);
-
- setVoicemailURI(voicemailURI);
-
- setVoicemailCheckURI(voicemailCheckURI);
-
- if(xCapEnable)
- {
- boolean xCapUseSipCredentials = accountID
- .getAccountPropertyBoolean("XCAP_USE_SIP_CREDETIALS", true);
- setXCapEnable(xCapEnable);
- setClistOptionUseSipCredentials(
- xCapUseSipCredentials);
- setClistOptionServerUri(
- accountID.getAccountPropertyString("XCAP_SERVER_URI"));
- setClistOptionUser(
- accountID.getAccountPropertyString("XCAP_USER"));
- setClistOptionPassword(
- accountID.getAccountPropertyString("XCAP_PASSWORD"));
- }
- else if(xivoEnable)
- {
- boolean xCapUseSipCredentials = accountID
- .getAccountPropertyBoolean("XIVO_USE_SIP_CREDETIALS", true);
-
- setXiVOEnable(xivoEnable);
- setClistOptionUseSipCredentials(
- xCapUseSipCredentials);
- setClistOptionServerUri(
- accountID.getAccountPropertyString("XIVO_SERVER_URI"));
- setClistOptionUser(
- accountID.getAccountPropertyString("XIVO_USER"));
- setClistOptionPassword(
- accountID.getAccountPropertyString("XIVO_PASSWORD"));
- }
-
- encodingsRegistration.loadAccount(
- accountID,
- ServiceUtils.getService(bundleContext, MediaService.class));
- }
-
- /**
- * Stores configuration properties held by this object into given
- * <tt>accountProperties</tt> map.
- * @param userName the user name that will be used.
- * @param passwd the password that will be used.
- * @param protocolIconPath the path to the protocol icon is used
- * @param accountIconPath the path to the account icon if used
- * @param isModification flag indication if it's modification process(has
- * impact on some properties).
- * @param accountProperties the map that will hold the configuration.
- */
- public void storeProperties(String userName, String passwd,
- String protocolIconPath,
- String accountIconPath,
- Boolean isModification,
- Map<String, String> accountProperties)
- {
- accountProperties.put(
- ProtocolProviderFactory.PROTOCOL,
- ProtocolNames.SIP);
-
- if (protocolIconPath != null)
- accountProperties.put( ProtocolProviderFactory.PROTOCOL_ICON_PATH,
- protocolIconPath);
-
- if (accountIconPath != null)
- accountProperties.put( ProtocolProviderFactory.ACCOUNT_ICON_PATH,
- accountIconPath);
-
- if(isRememberPassword())
- {
- accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
- }
- else
- {
- // clear password if requested
- setPassword(null);
- }
-
- String serverAddress = null;
- String serverFromUsername =
- SIPAccountRegistrationForm.getServerFromUserName(userName);
-
- if (getServerAddress() != null)
- serverAddress = getServerAddress();
-
- if(serverFromUsername == null
- && getDefaultDomain() != null)
- {
- // we have only a username and we want to add
- // a default domain
- userName = userName + "@" + getDefaultDomain();
-
- if(serverAddress == null)
- serverAddress = getDefaultDomain();
- }
- else if(serverAddress == null &&
- serverFromUsername != null)
- {
- serverAddress = serverFromUsername;
- }
-
- if (serverAddress != null)
- {
- accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
- serverAddress);
-
- if (userName.indexOf(serverAddress) < 0)
- accountProperties.put(
- ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
- Boolean.toString(true));
- }
-
- accountProperties.put(ProtocolProviderFactory.DISPLAY_NAME,
- getDisplayName());
-
- accountProperties.put(ProtocolProviderFactory.AUTHORIZATION_NAME,
- getAuthorizationName());
-
- accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
- getServerPort());
-
- if(isProxyAutoConfigure())
- {
- accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG,
- Boolean.TRUE.toString());
- }
- else
- {
- accountProperties.put(ProtocolProviderFactory.PROXY_AUTO_CONFIG,
- Boolean.FALSE.toString());
-
- accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
- getProxy());
-
- accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
- getProxyPort());
-
- accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT,
- getPreferredTransport());
- }
-
- accountProperties.put(ProtocolProviderFactory.IS_PRESENCE_ENABLED,
- Boolean.toString(isEnablePresence()));
-
- // when we are creating registerless account make sure that
- // we don't use PA
- if(serverAddress != null)
- {
- accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,
- Boolean.toString(isForceP2PMode()));
- }
- else
- {
- accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,
- Boolean.TRUE.toString());
- }
-
- securityAccountRegistration.storeProperties(accountProperties);
-
- accountProperties.put(ProtocolProviderFactory.POLLING_PERIOD,
- getPollingPeriod());
-
- accountProperties.put(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,
- getSubscriptionExpiration());
-
- accountProperties.put(ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE,
- getTlsClientCertificate());
-
- if(getKeepAliveMethod() != null)
- accountProperties.put(ProtocolProviderFactory.KEEP_ALIVE_METHOD,
- getKeepAliveMethod());
- else
- accountProperties.put(ProtocolProviderFactory.KEEP_ALIVE_METHOD,
- getDefaultKeepAliveMethod());
-
- accountProperties.put(ProtocolProviderFactory.KEEP_ALIVE_INTERVAL,
- getKeepAliveInterval());
-
- if(getDTMFMethod() != null)
- accountProperties.put("DTMF_METHOD",
- getDTMFMethod());
- else
- accountProperties.put("DTMF_METHOD",
- getDefaultDTMFMethod());
-
- accountProperties.put(
- ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION,
- getDtmfMinimalToneDuration());
-
- encodingsRegistration.storeProperties(accountProperties);
-
- accountProperties.put("XIVO_ENABLE",
- Boolean.toString(isXiVOEnable()));
- accountProperties.put("XCAP_ENABLE",
- Boolean.toString(isXCapEnable()));
-
- if(isXCapEnable())
- {
- accountProperties.put(
- "XCAP_USE_SIP_CREDETIALS",
- Boolean.toString(isClistOptionUseSipCredentials()));
- if (getClistOptionServerUri() != null)
- {
- accountProperties.put(
- "XCAP_SERVER_URI",
- getClistOptionServerUri());
- }
- if (getClistOptionUser() != null)
- {
- accountProperties
- .put("XCAP_USER", getClistOptionUser());
- }
- if (getClistOptionPassword() != null)
- {
- accountProperties
- .put("XCAP_PASSWORD", getClistOptionPassword());
- }
- }
- else if(isXiVOEnable())
- {
- accountProperties.put(
- "XIVO_USE_SIP_CREDETIALS",
- Boolean.toString(isClistOptionUseSipCredentials()));
- if (getClistOptionServerUri() != null)
- {
- accountProperties.put(
- "XIVO_SERVER_URI",
- getClistOptionServerUri());
- }
- if (getClistOptionUser() != null)
- {
- accountProperties
- .put("XIVO_USER", getClistOptionUser());
- }
- if (getClistOptionPassword() != null)
- {
- accountProperties
- .put("XIVO_PASSWORD", getClistOptionPassword());
- }
- }
-
- if(isMessageWaitingIndicationsEnabled())
- {
- if(!StringUtils.isNullOrEmpty(getVoicemailURI(), true))
- accountProperties.put(
- ProtocolProviderFactory.VOICEMAIL_URI,
- getVoicemailURI());
- else if(isModification)
- accountProperties.put(ProtocolProviderFactory.VOICEMAIL_URI, "");
-
- if(!StringUtils.isNullOrEmpty(
- getVoicemailCheckURI(), true))
- accountProperties.put(
- ProtocolProviderFactory.VOICEMAIL_CHECK_URI,
- getVoicemailCheckURI());
- else if(isModification)
- accountProperties.put(
- ProtocolProviderFactory.VOICEMAIL_CHECK_URI, "");
-
- if(isModification)
- {
- // remove the property as true is by default,
- // and null removes property
- accountProperties.put(ProtocolProviderFactory.VOICEMAIL_ENABLED,
- null);
- }
- }
- else if(isModification)
- {
- accountProperties.put(ProtocolProviderFactory.VOICEMAIL_ENABLED,
- Boolean.FALSE.toString());
- }
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
index 5a8345e..fc5ae3f 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
@@ -1,3 +1,9 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package net.java.sip.communicator.plugin.sipaccregwizz;
import java.awt.*;
@@ -9,6 +15,7 @@ import javax.swing.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.plugin.desktoputil.wizard.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import org.jitsi.util.*;
/**
@@ -16,6 +23,7 @@ import org.jitsi.util.*;
*
* @author Yana Stamcheva
* @author Grogorii Balutsel
+ * @author Pawel Domas
*/
public class SIPAccountRegistrationForm
extends TransparentPanel
@@ -59,7 +67,7 @@ public class SIPAccountRegistrationForm
accountPanel = new AccountPanel(this);
connectionPanel = new ConnectionPanel(this);
securityPanel = new SecurityPanel(
- this.getRegistration().getSecurityAccountRegistration(),
+ this.getRegistration().getSecurityRegistration(),
true);
presencePanel = new PresencePanel(this);
@@ -120,7 +128,7 @@ public class SIPAccountRegistrationForm
*/
String setServerFieldAccordingToUIN(String userName)
{
- String serverAddress = getServerFromUserName(userName);
+ String serverAddress = SipAccountID.getServerFromUserName(userName);
connectionPanel.setServerFieldAccordingToUIN(serverAddress);
@@ -235,8 +243,7 @@ public class SIPAccountRegistrationForm
else
{
userID = accountPanel.getUserID();
-
- if(getServerFromUserName(userID) == null
+ if(SipAccountID.getServerFromUserName(userID) == null
&& registration.getDefaultDomain() != null)
{
// we have only a username and we want to add
@@ -255,17 +262,18 @@ public class SIPAccountRegistrationForm
registration.setUserID(userID);
- if (password != null)
- registration.setPassword(new String(password));
+ if(!accountPanel.isRememberPassword())
+ password = null;
- registration.setRememberPassword(accountPanel.isRememberPassword());
+ registration.setPassword(
+ password != null ? new String(password) : null );
registration.setServerAddress(serverAddress);
registration.setProxy(proxyAddress);
String displayName = accountPanel.getDisplayName();
- registration.setDisplayName(displayName);
+ registration.setAccountDisplayName(displayName);
String authName = connectionPanel.getAuthenticationName();
if(authName != null && authName.length() > 0)
@@ -308,8 +316,7 @@ public class SIPAccountRegistrationForm
SIPAccRegWizzActivator.getUIService().getAccountRegWizardContainer()
.setBackButtonEnabled(true);
- securityPanel.commitPanel(
- registration.getSecurityAccountRegistration());
+ securityPanel.commitPanel(registration.getSecurityRegistration());
if(xcapRoot != null)
{
@@ -349,7 +356,7 @@ public class SIPAccountRegistrationForm
String serverAddress = sipAccReg.getServerAddress();
- String displayName = sipAccReg.getDisplayName();
+ String displayName = sipAccReg.getAccountDisplayName();
String authName = sipAccReg.getAuthorizationName();
@@ -386,7 +393,7 @@ public class SIPAccountRegistrationForm
boolean xCapEnable = sipAccReg.isXCapEnable();
boolean xivoEnable = sipAccReg.isXiVOEnable();
- boolean isServerOverridden = sipAccReg.isServerOverriden();
+ boolean isServerOverridden = sipAccReg.isServerOverridden();
connectionPanel.setServerOverridden(isServerOverridden);
@@ -422,7 +429,7 @@ public class SIPAccountRegistrationForm
connectionPanel.setSelectedTransport(preferredTransport);
connectionPanel.setProxyPort(proxyPort);
- securityPanel.loadAccount(sipAccReg.getSecurityAccountRegistration());
+ securityPanel.loadAccount(sipAccReg.getSecurityRegistration());
presencePanel.reinit();
presencePanel.setPresenceEnabled(enablePresence);
@@ -439,8 +446,7 @@ public class SIPAccountRegistrationForm
connectionPanel.setKeepAliveInterval(keepAliveInterval);
connectionPanel.setDTMFMethod(dtmfMethod);
- if(!StringUtils.isNullOrEmpty(dtmfMinimalToneDuration))
- connectionPanel.setDtmfMinimalToneDuration(dtmfMinimalToneDuration);
+ connectionPanel.setDtmfMinimalToneDuration(dtmfMinimalToneDuration);
boolean mwiEnabled = sipAccReg.isMessageWaitingIndicationsEnabled();
connectionPanel.setMessageWaitingIndications(mwiEnabled);
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
index 65632f0..735bb9b 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
@@ -11,9 +11,9 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import net.java.sip.communicator.util.Logger;
-import net.java.sip.communicator.util.wizard.*;
import org.jitsi.util.*;
import org.osgi.framework.*;
@@ -115,7 +115,7 @@ public class SIPAccountRegistrationWizard
@Override
public Iterator<WizardPage> getPages()
{
- // create new registration, our container needs the pages
+ // create new accountID, our container needs the pages
// this means this is a new wizard and we must reset all data
// it will be invoked and when the wizard cleans and unregister
// our pages, but this fix don't hurt in this situation.
@@ -153,10 +153,10 @@ public class SIPAccountRegistrationWizard
LinkedHashMap<String, String> summaryTable
= new LinkedHashMap<String, String>();
- boolean rememberPswd = registration.isRememberPassword();
+ boolean rememberPswd = registration.getPassword() != null;
String rememberPswdString = Resources.getString(
rememberPswd ? "service.gui.YES" : "service.gui.NO");
- String displayName = registration.getDisplayName();
+ String displayName = registration.getAccountDisplayName();
if(displayName != null && displayName.length() > 0)
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.DISPLAY_NAME"),
@@ -231,7 +231,7 @@ public class SIPAccountRegistrationWizard
}
SecurityAccountRegistration securityReg
- = registration.getSecurityAccountRegistration();
+ = registration.getSecurityRegistration();
if (securityReg.isDefaultEncryption())
{
@@ -447,6 +447,17 @@ public class SIPAccountRegistrationWizard
setRegistration(new SIPAccountRegistration());
+ AccountID currentAccountID = protocolProvider.getAccountID();
+
+ String password = SIPAccRegWizzActivator.getSIPProtocolProviderFactory()
+ .loadPassword(currentAccountID);
+
+ // Loads account properties into accountID object
+ registration.loadAccount(
+ protocolProvider.getAccountID(),
+ password,
+ SIPAccRegWizzActivator.bundleContext);
+
this.firstWizardPage.loadAccount(protocolProvider);
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/sipaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/sipaccregwizz/sipaccregwizz.manifest.mf
index 595db2d..c7f83db 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/sipaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/sipaccregwizz.manifest.mf
@@ -17,6 +17,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.sip,
org.jitsi.service.resources,
net.java.sip.communicator.service.resources,
org.jitsi.util,
diff --git a/src/net/java/sip/communicator/service/protocol/AccountID.java b/src/net/java/sip/communicator/service/protocol/AccountID.java
index a95ec2c..f29dc6e 100644
--- a/src/net/java/sip/communicator/service/protocol/AccountID.java
+++ b/src/net/java/sip/communicator/service/protocol/AccountID.java
@@ -30,6 +30,7 @@ import net.java.sip.communicator.util.*;
*
* @author Emil Ivov
* @author Lubomir Marinov
+ * @author Pawel Domas
*/
public abstract class AccountID
{
@@ -40,6 +41,12 @@ public abstract class AccountID
private static final Logger logger = Logger.getLogger(AccountID.class);
/**
+ * The default properties key prefix used in lib/jitsi-defaults.properties
+ */
+ protected static final String DEFAULTS_PREFIX
+ = "net.java.sip.communicator.service.protocol.";
+
+ /**
* The protocol display name. In the case of overridden protocol name this
* would be the new name.
*/
@@ -262,6 +269,8 @@ public abstract class AccountID
public boolean getAccountPropertyBoolean(Object key, boolean defaultValue)
{
String value = getAccountPropertyString(key);
+ if(value == null)
+ value = getDefaultString(key.toString());
return (value == null) ? defaultValue : Boolean.parseBoolean(value);
}
@@ -290,6 +299,11 @@ public abstract class AccountID
String stringValue = getAccountPropertyString(key);
int intValue = defaultValue;
+ if ((stringValue == null) || (stringValue.isEmpty()))
+ {
+ stringValue = getDefaultString(key.toString());
+ }
+
if ((stringValue != null) && (stringValue.length() > 0))
{
try
@@ -314,8 +328,24 @@ public abstract class AccountID
*/
public String getAccountPropertyString(Object key)
{
+ return getAccountPropertyString(key, null);
+ }
+
+ /**
+ * Returns the account property string corresponding to the given key.
+ *
+ * @param key the key, corresponding to the property string we're looking
+ * for
+ * @param defValue the default value returned when given <tt>key</tt>
+ * is not present
+ * @return the account property string corresponding to the given key
+ */
+ public String getAccountPropertyString(Object key, String defValue)
+ {
Object value = getAccountProperty(key);
- return (value == null) ? null : value.toString();
+ if(value == null)
+ value = getDefaultString(key.toString());
+ return (value == null) ? defValue : value.toString();
}
/**
@@ -330,6 +360,17 @@ public abstract class AccountID
}
/**
+ * Adds property to the map of properties for this account
+ * identifier.
+ * @param key the key of the property
+ * @param value the property value
+ */
+ public void putAccountProperty(String key, Object value)
+ {
+ accountProperties.put(key, String.valueOf(value));
+ }
+
+ /**
* Removes specified account property.
* @param key the key to remove.
*/
@@ -429,6 +470,245 @@ public abstract class AccountID
}
/**
+ * The address of the server we will use for this account
+ *
+ * @return String
+ */
+ public String getServerAddress()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
+ }
+
+ /**
+ * Get the {@link ProtocolProviderFactory#ACCOUNT_DISPLAY_NAME} property.
+ *
+ * @return the {@link ProtocolProviderFactory#ACCOUNT_DISPLAY_NAME}
+ * property value.
+ */
+ public String getAccountDisplayName()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME);
+ }
+
+ /**
+ * Sets {@link ProtocolProviderFactory#ACCOUNT_DISPLAY_NAME} property value.
+ *
+ * @param displayName the account display name value to set.
+ */
+ public void setAccountDisplayName(String displayName)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME,
+ displayName);
+ }
+
+ /**
+ * Returns the password of the account.
+ *
+ * @return the password of the account.
+ */
+ public String getPassword()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.PASSWORD);
+ }
+
+ /**
+ * Sets the password of the account.
+ *
+ * @param password the password of the account.
+ */
+ public void setPassword(String password)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.PASSWORD, password);
+ }
+
+ /**
+ * The authorization name
+ *
+ * @return String auth name
+ */
+ public String getAuthorizationName()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.AUTHORIZATION_NAME);
+ }
+
+ /**
+ * Sets authorization name.
+ *
+ * @param authName String
+ */
+ public void setAuthorizationName(String authName)
+ {
+ setOrRemoveIfEmpty(
+ ProtocolProviderFactory.AUTHORIZATION_NAME,
+ authName);
+ }
+
+ /**
+ * The port on the specified server
+ *
+ * @return int
+ */
+ public String getServerPort()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT);
+ }
+
+ /**
+ * Sets the server port.
+ *
+ * @param port int
+ */
+ public void setServerPort(String port)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.SERVER_PORT, port);
+ }
+
+ /**
+ * Sets the server
+ *
+ * @param serverAddress String
+ */
+ public void setServerAddress(String serverAddress)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.SERVER_ADDRESS,
+ serverAddress);
+ }
+
+ /**
+ * Returns <tt>true</tt> if server was overriden.
+ * @return <tt>true</tt> if server was overriden.
+ */
+ public boolean isServerOverridden()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
+ }
+
+ /**
+ * Sets <tt>isServerOverridden</tt> property.
+ * @param isServerOverridden indicates if the server is overridden
+ */
+ public void setServerOverridden(boolean isServerOverridden)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
+ isServerOverridden);
+ }
+
+ /**
+ * Returns the protocol icon path stored under
+ * {@link ProtocolProviderFactory#PROTOCOL_ICON_PATH} key.
+ *
+ * @return the protocol icon path.
+ */
+ public String getProtocolIconPath()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.PROTOCOL_ICON_PATH);
+ }
+
+ /**
+ * Sets the protocl icon path that will be held under
+ * {@link ProtocolProviderFactory#PROTOCOL_ICON_PATH} key.
+ *
+ * @param iconPath a path to the protocol icon to set.
+ */
+ public void setProtocolIconPath(String iconPath)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.PROTOCOL_ICON_PATH,
+ iconPath);
+ }
+
+ /**
+ * Returns the protocol icon path stored under
+ * {@link ProtocolProviderFactory#ACCOUNT_ICON_PATH} key.
+ *
+ * @return the protocol icon path.
+ */
+ public String getAccountIconPath()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.ACCOUNT_ICON_PATH);
+ }
+
+ /**
+ * Sets the account icon path that will be held under
+ * {@link ProtocolProviderFactory#ACCOUNT_ICON_PATH} key.
+ *
+ * @param iconPath a path to the account icon to set.
+ */
+ public void setAccountIconPath(String iconPath)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.ACCOUNT_ICON_PATH,
+ iconPath);
+ }
+
+ /**
+ * Returns the DTMF method.
+ *
+ * @return the DTMF method.
+ */
+ public String getDTMFMethod()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.DTMF_METHOD);
+ }
+
+ /**
+ * Sets the DTMF method.
+ *
+ * @param dtmfMethod the DTMF method to set
+ */
+ public void setDTMFMethod(String dtmfMethod)
+ {
+ putAccountProperty(ProtocolProviderFactory.DTMF_METHOD, dtmfMethod);
+ }
+
+ /**
+ * Returns the minimal DTMF tone duration.
+ *
+ * @return The minimal DTMF tone duration.
+ */
+ public String getDtmfMinimalToneDuration()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION);
+ }
+
+ /**
+ * Sets the minimal DTMF tone duration.
+ *
+ * @param dtmfMinimalToneDuration The minimal DTMF tone duration to set.
+ */
+ public void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration)
+ {
+ putAccountProperty( ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION,
+ dtmfMinimalToneDuration );
+ }
+
+ /**
+ * Gets the ID of the client certificate configuration.
+ * @return the ID of the client certificate configuration.
+ */
+ public String getTlsClientCertificate()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE);
+ }
+
+ /**
+ * Sets the ID of the client certificate configuration.
+ * @param id the client certificate configuration template ID.
+ */
+ public void setTlsClientCertificate(String id)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE, id);
+ }
+
+ /**
* Set the account properties.
*
* @param accountProperties the properties of the account
@@ -470,9 +750,9 @@ public abstract class AccountID
true);
Map<String, Boolean> encryptionProtocolStatus
= getBooleanPropertiesByPrefix(
- ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS,
- true,
- false);
+ ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS,
+ true,
+ false);
// If the account is not yet configured, then ZRTP is activated by
// default.
@@ -698,4 +978,139 @@ public abstract class AccountID
return resultKeySet;
}
+
+ /**
+ * Sets the property a new value, but only if it's not <tt>null</tt> or
+ * the property is removed from the map.
+ *
+ * @param key the property key
+ * @param value the property value
+ */
+ public void placePropertyIfNotNull(String key, String value)
+ {
+ if(value != null)
+ {
+ putAccountProperty(key, value);
+ }
+ else
+ {
+ removeAccountProperty(key);
+ }
+ }
+
+ /**
+ * Puts the new property value if it's not <tt>null</tt> nor empty.
+ * @param key the property key
+ * @param value the property value
+ */
+ public void setOrRemoveIfEmpty(String key, String value)
+ {
+ setOrRemoveIfEmpty(key, value, false);
+ }
+
+ /**
+ * Puts the new property value if it's not <tt>null</tt> nor empty. If
+ * <tt>trim</tt> parameter is set to <tt>true</tt> the string will be
+ * trimmed, before checked for emptiness.
+ *
+ * @param key the property key
+ * @param value the property value
+ * @param trim <tt>true</tt> if the value will be trimmed, before
+ * <tt>isEmpty()</tt> is called.
+ */
+ public void setOrRemoveIfEmpty(String key, String value, boolean trim)
+ {
+ if( value != null
+ && (trim ? !value.trim().isEmpty() : !value.isEmpty()) )
+ {
+ putAccountProperty(key, value);
+ }
+ else
+ {
+ removeAccountProperty(key);
+ }
+ }
+
+ /**
+ * Stores configuration properties held by this object into given
+ * <tt>accountProperties</tt> map.
+ *
+ * @param protocolIconPath the path to the protocol icon is used
+ * @param accountIconPath the path to the account icon if used
+ * @param accountProperties output properties map
+ */
+ public void storeProperties( String protocolIconPath,
+ String accountIconPath,
+ Map<String, String> accountProperties )
+ {
+ putAccountProperty(ProtocolProviderFactory.PROTOCOL, getProtocolName());
+
+ if(protocolIconPath != null)
+ setProtocolIconPath(protocolIconPath);
+
+ if(accountIconPath != null)
+ setAccountIconPath(accountIconPath);
+
+ ensureDefaultValuePresent(ProtocolProviderFactory.DTMF_METHOD);
+
+ ensureDefaultValuePresent(
+ ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION);
+
+ mergeProperties(this.accountProperties, accountProperties);
+ }
+
+ /**
+ * Ensures that there is value bound to given property key. If there isn't
+ * the default one will be used.
+ *
+ * @param key the property key
+ */
+ public void ensureDefaultValuePresent(String key)
+ {
+ String value = accountProperties.get(key);
+
+ if(value != null && value.trim().isEmpty())
+ value = null;
+
+ if(value == null)
+ accountProperties.put(key, getDefaultString(key));
+ }
+
+ /**
+ * Gets default property value for given <tt>key</tt>.
+ *
+ * @param key the property key
+ * @return default property value for given<tt>key</tt>
+ */
+ protected String getDefaultString(String key)
+ {
+ return getDefaultStr(key);
+ }
+
+ /**
+ * Gets default property value for given <tt>key</tt>.
+ *
+ * @param key the property key
+ * @return default property value for given<tt>key</tt>
+ */
+ public static String getDefaultStr(String key)
+ {
+ return ProtocolProviderActivator
+ .getConfigurationService()
+ .getString(DEFAULTS_PREFIX +key);
+ }
+
+ /**
+ * Copies all properties from <tt>input</tt> map to <tt>output</tt> map.
+ * @param input source properties map
+ * @param output destination properties map
+ */
+ public static void mergeProperties( Map<String, String> input,
+ Map<String, String> output )
+ {
+ for(String key : input.keySet())
+ {
+ output.put(key, input.get(key));
+ }
+ }
}
diff --git a/src/net/java/sip/communicator/util/wizard/EncodingsRegistrationUtil.java b/src/net/java/sip/communicator/service/protocol/EncodingsRegistrationUtil.java
index dbacc9f..5e4ea87 100644
--- a/src/net/java/sip/communicator/util/wizard/EncodingsRegistrationUtil.java
+++ b/src/net/java/sip/communicator/service/protocol/EncodingsRegistrationUtil.java
@@ -4,12 +4,11 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.util.wizard;
+package net.java.sip.communicator.service.protocol;
+import java.io.*;
import java.util.*;
-import net.java.sip.communicator.service.protocol.*;
-
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.codec.*;
@@ -20,6 +19,7 @@ import org.jitsi.service.neomedia.codec.*;
* @author Pawel Domas
*/
public class EncodingsRegistrationUtil
+ implements Serializable
{
/**
* Whether to override global encoding settings.
@@ -75,9 +75,10 @@ public class EncodingsRegistrationUtil
/**
* Loads encoding properties from given <tt>accountID</tt> into this
* encodings registration object.
+ *
* @param accountID the <tt>AccountID</tt> to be loaded.
* @param mediaService the <tt>MediaService</tt> that will be used to create
- * <tt>EncodingConfiguration</tt>.
+ * <tt>EncodingConfiguration</tt>.
*/
public void loadAccount(AccountID accountID, MediaService mediaService)
{
@@ -117,9 +118,9 @@ public class EncodingsRegistrationUtil
* Creates new instance of <tt>EncodingConfiguration</tt> reflecting this
* object's encoding configuration state.
* @param mediaService the <tt>MediaService</tt> that will be used to create
- * new instance of <tt>EncodingConfiguration</tt>.
+ * new instance of <tt>EncodingConfiguration</tt>.
* @return <tt>EncodingConfiguration</tt> reflecting this object's encoding
- * configuration state.
+ * configuration state.
*/
public EncodingConfiguration createEncodingConfig(MediaService mediaService)
{
diff --git a/src/net/java/sip/communicator/service/protocol/JingleNodeDescriptor.java b/src/net/java/sip/communicator/service/protocol/JingleNodeDescriptor.java
index bedea2e..0c1d097 100644
--- a/src/net/java/sip/communicator/service/protocol/JingleNodeDescriptor.java
+++ b/src/net/java/sip/communicator/service/protocol/JingleNodeDescriptor.java
@@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.service.protocol;
+import java.io.*;
import java.util.*;
/**
@@ -20,6 +21,7 @@ import java.util.*;
* @author Sebastien Vincent
*/
public class JingleNodeDescriptor
+ implements Serializable
{
/**
* JingleNodes prefix to store configuration.
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderActivator.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderActivator.java
index 1c291e4..3c4fa0b 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderActivator.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderActivator.java
@@ -78,7 +78,7 @@ public class ProtocolProviderActivator
* in the bundle represented by
* <code>ProtocolProviderActivator</code>
*/
- static ConfigurationService getConfigurationService()
+ public static ConfigurationService getConfigurationService()
{
if (configurationService == null)
{
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
index 20ab494..7b3f5e3 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
@@ -442,6 +442,11 @@ public abstract class ProtocolProviderFactory
public static final String KEEP_ALIVE_INTERVAL = "KEEP_ALIVE_INTERVAL";
/**
+ * The name of the property holding DTMF method.
+ */
+ public static final String DTMF_METHOD = "DTMF_METHOD";
+
+ /**
* The minimal DTMF tone duration.
*/
public static final String DTMF_MINIMAL_TONE_DURATION
diff --git a/src/net/java/sip/communicator/util/wizard/SecurityAccountRegistration.java b/src/net/java/sip/communicator/service/protocol/SecurityAccountRegistration.java
index b15b56d..768f76b 100644
--- a/src/net/java/sip/communicator/util/wizard/SecurityAccountRegistration.java
+++ b/src/net/java/sip/communicator/service/protocol/SecurityAccountRegistration.java
@@ -3,10 +3,9 @@
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
-package net.java.sip.communicator.util.wizard;
-
-import net.java.sip.communicator.service.protocol.*;
+package net.java.sip.communicator.service.protocol;
+import java.io.*;
import java.util.*;
/**
@@ -15,8 +14,10 @@ import java.util.*;
* SecurityPanel.
*
* @author Vincent Lucas
+ * @author Pawel Domas
*/
public abstract class SecurityAccountRegistration
+ implements Serializable
{
/**
* The encryption protocols managed by this SecurityPanel.
@@ -142,8 +143,8 @@ public abstract class SecurityAccountRegistration
/**
* Sets the list of cipher suites enabled for SDES.
*
- * @param The list of cipher suites enabled for SDES. Null if no cipher
- * suite is enabled.
+ * @param cipherSuites The list of cipher suites enabled for SDES.
+ * Null if no cipher suite is enabled.
*/
public void setSDesCipherSuites(String cipherSuites)
{
@@ -198,8 +199,8 @@ public abstract class SecurityAccountRegistration
/**
* Sets the map between the encryption protocols and their status.
*
- * @param encryptionProtocols The map between the encryption protocols and
- * their status.
+ * @param encryptionProtocolStatus The map between the encryption protocols
+ * and their status.
*/
public void setEncryptionProtocolStatus(
Map<String, Boolean> encryptionProtocolStatus)
diff --git a/src/net/java/sip/communicator/service/protocol/jabber/JabberAccountID.java b/src/net/java/sip/communicator/service/protocol/jabber/JabberAccountID.java
new file mode 100644
index 0000000..26acbde
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/jabber/JabberAccountID.java
@@ -0,0 +1,687 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol.jabber;
+
+import net.java.sip.communicator.service.protocol.*;
+
+import java.util.*;
+
+/**
+ * The Jabber implementation of a sip-communicator AccountID
+ *
+ * @author Damian Minkov
+ * @author Sebastien Vincent
+ * @author Pawel Domas
+ */
+public class JabberAccountID
+ extends AccountID
+{
+ /**
+ * Default properties prefix used in jitsi-defaults.properties file
+ * for Jabber protocol.
+ */
+ private static final String JBR_DEFAULTS_PREFIX
+ = AccountID.DEFAULTS_PREFIX +"jabber.";
+
+ /**
+ * Account suffix for Google service.
+ */
+ public static final String GOOGLE_USER_SUFFIX = "gmail.com";
+
+ /**
+ * XMPP server for Google service.
+ */
+ public static final String GOOGLE_CONNECT_SRV = "talk.google.com";
+
+ /**
+ * The default value of stun server port for jabber accounts.
+ */
+ public static final String DEFAULT_STUN_PORT = "3478";
+
+ /**
+ * Indicates if keep alive packets should be send.
+ */
+ public static final String SEND_KEEP_ALIVE = "SEND_KEEP_ALIVE";
+
+ /**
+ * Indicates if gmail notifications should be enabled.
+ */
+ public static final String GMAIL_NOTIFICATIONS_ENABLED
+ = "GMAIL_NOTIFICATIONS_ENABLED";
+
+ /**
+ * Always call with gtalk property.
+ *
+ * It is used to bypass capabilities checks: some softwares do not advertise
+ * GTalk support (but they support it).
+ */
+ public static final String BYPASS_GTALK_CAPABILITIES
+ = "BYPASS_GTALK_CAPABILITIES";
+
+ /**
+ * Indicates if Google Contacts should be enabled.
+ */
+ public static final String GOOGLE_CONTACTS_ENABLED
+ = "GOOGLE_CONTACTS_ENABLED";
+ /**
+ * Domain name that will bypass GTalk caps.
+ */
+ public static final String TELEPHONY_BYPASS_GTALK_CAPS
+ = "TELEPHONY_BYPASS_GTALK_CAPS";
+ /**
+ * The override domain for phone call.
+ *
+ * If Jabber account is able to call PSTN number and if domain name of the
+ * switch is different than the domain of the account (gw.domain.org vs
+ * domain.org), you can use this property to set the switch domain.
+ */
+ public static final String OVERRIDE_PHONE_SUFFIX
+ = "OVERRIDE_PHONE_SUFFIX";
+
+ /**
+ * Creates an account id from the specified id and account properties.
+ * @param id the id identifying this account
+ * @param accountProperties any other properties necessary for the account.
+ */
+ public JabberAccountID(String id, Map<String, String> accountProperties)
+ {
+ super( id, accountProperties,
+ ProtocolNames.JABBER,
+ getServiceName(accountProperties));
+ }
+
+ /**
+ * Returns the override phone suffix.
+ *
+ * @return the phone suffix
+ */
+ public String getOverridePhoneSuffix()
+ {
+ return getAccountPropertyString(OVERRIDE_PHONE_SUFFIX);
+ }
+
+ /**
+ * Returns the alwaysCallWithGtalk value.
+ *
+ * @return the alwaysCallWithGtalk value
+ */
+ public boolean getBypassGtalkCaps()
+ {
+ return getAccountPropertyBoolean(BYPASS_GTALK_CAPABILITIES, false);
+ }
+
+ /**
+ * Returns telephony domain that bypass GTalk caps.
+ *
+ * @return telephony domain
+ */
+ public String getTelephonyDomainBypassCaps()
+ {
+ return getAccountPropertyString(TELEPHONY_BYPASS_GTALK_CAPS);
+ }
+
+ /**
+ * Gets if Jingle is disabled for this account.
+ *
+ * @return True if jingle is disabled for this account. False otherwise.
+ */
+ public boolean isJingleDisabled()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_CALLING_DISABLED_FOR_ACCOUNT, false);
+ }
+
+ /**
+ * Determines whether sending of keep alive packets is enabled.
+ *
+ * @return <tt>true</tt> if keep alive packets are to be sent for this
+ * account and <tt>false</tt> otherwise.
+ */
+ public boolean isSendKeepAlive()
+ {
+ return getAccountPropertyBoolean(SEND_KEEP_ALIVE, true);
+ }
+
+ /**
+ * Determines whether SIP Communicator should be querying Gmail servers
+ * for unread mail messages.
+ *
+ * @return <tt>true</tt> if we are to enable Gmail notifications and
+ * <tt>false</tt> otherwise.
+ */
+ public boolean isGmailNotificationEnabled()
+ {
+ return getAccountPropertyBoolean(GMAIL_NOTIFICATIONS_ENABLED, false);
+ }
+
+ /**
+ * Determines whether SIP Communicator should use Google Contacts as
+ * ContactSource
+ *
+ * @return <tt>true</tt> if we are to enable Google Contacts and
+ * <tt>false</tt> otherwise.
+ */
+ public boolean isGoogleContactsEnabled()
+ {
+ return getAccountPropertyBoolean(GOOGLE_CONTACTS_ENABLED, true);
+ }
+
+ /**
+ * Sets the override value of the phone suffix.
+ *
+ * @param phoneSuffix the phone name suffix (the domain name after the @
+ * sign)
+ */
+ public void setOverridePhoneSufix(String phoneSuffix)
+ {
+ setOrRemoveIfEmpty(OVERRIDE_PHONE_SUFFIX, phoneSuffix);
+ }
+
+ /**
+ * Sets value for alwaysCallWithGtalk.
+ *
+ * @param bypassGtalkCaps true to enable, false otherwise
+ */
+ public void setBypassGtalkCaps(boolean bypassGtalkCaps)
+ {
+ putAccountProperty(BYPASS_GTALK_CAPABILITIES, bypassGtalkCaps);
+ }
+
+ /**
+ * Sets telephony domain that bypass GTalk caps.
+ *
+ * @param text telephony domain to set
+ */
+ public void setTelephonyDomainBypassCaps(String text)
+ {
+ setOrRemoveIfEmpty(TELEPHONY_BYPASS_GTALK_CAPS, text);
+ }
+
+ /**
+ * Sets if Jingle is disabled for this account.
+ *
+ * @param disabled True if jingle is disabled for this account.
+ * False otherwise.
+ */
+ public void setDisableJingle(boolean disabled)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.IS_CALLING_DISABLED_FOR_ACCOUNT,
+ disabled );
+ }
+
+ /**
+ * Specifies whether SIP Communicator should send send keep alive packets
+ * to keep this account registered.
+ *
+ * @param sendKeepAlive <tt>true</tt> if we are to send keep alive packets
+ * and <tt>false</tt> otherwise.
+ */
+ public void setSendKeepAlive(boolean sendKeepAlive)
+ {
+ putAccountProperty(SEND_KEEP_ALIVE, sendKeepAlive);
+ }
+
+ /**
+ * Specifies whether SIP Communicator should be querying Gmail servers
+ * for unread mail messages.
+ *
+ * @param enabled <tt>true</tt> if we are to enable Gmail notification and
+ * <tt>false</tt> otherwise.
+ */
+ public void setGmailNotificationEnabled(boolean enabled)
+ {
+ putAccountProperty(GMAIL_NOTIFICATIONS_ENABLED, enabled);
+ }
+
+ /**
+ * Specifies whether SIP Communicator should use Google Contacts as
+ * ContactSource.
+ *
+ * @param enabled <tt>true</tt> if we are to enable Google Contacts and
+ * <tt>false</tt> otherwise.
+ */
+ public void setGoogleContactsEnabled(boolean enabled)
+ {
+ putAccountProperty(GOOGLE_CONTACTS_ENABLED, enabled);
+ }
+
+ /**
+ * Returns the resource.
+ * @return the resource
+ */
+ public String getResource()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.RESOURCE);
+ }
+
+ /**
+ * Sets the resource.
+ * @param resource the resource for the jabber account
+ */
+ public void setResource(String resource)
+ {
+ putAccountProperty(ProtocolProviderFactory.RESOURCE, resource);
+ }
+
+ /**
+ * Returns the priority property.
+ * @return priority
+ */
+ public int getPriority()
+ {
+ return getAccountPropertyInt(
+ ProtocolProviderFactory.RESOURCE_PRIORITY, 30);
+ }
+
+ /**
+ * Sets the priority property.
+ * @param priority the priority to set
+ */
+ public void setPriority(int priority)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.RESOURCE_PRIORITY, priority);
+ }
+
+ /**
+ * Indicates if ice should be used for this account.
+ * @return <tt>true</tt> if ICE should be used for this account, otherwise
+ * returns <tt>false</tt>
+ */
+ public boolean isUseIce()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_USE_ICE, true);
+ }
+
+ /**
+ * Sets the <tt>useIce</tt> property.
+ * @param isUseIce <tt>true</tt> to indicate that ICE should be used for
+ * this account, <tt>false</tt> - otherwise.
+ */
+ public void setUseIce(boolean isUseIce)
+ {
+ putAccountProperty(ProtocolProviderFactory.IS_USE_ICE, isUseIce);
+ }
+
+ /**
+ * Indicates if ice should be used for this account.
+ * @return <tt>true</tt> if ICE should be used for this account, otherwise
+ * returns <tt>false</tt>
+ */
+ public boolean isUseGoogleIce()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_USE_GOOGLE_ICE, true);
+ }
+
+ /**
+ * Sets the <tt>useGoogleIce</tt> property.
+ * @param isUseIce <tt>true</tt> to indicate that ICE should be used for
+ * this account, <tt>false</tt> - otherwise.
+ */
+ public void setUseGoogleIce(boolean isUseIce)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.IS_USE_GOOGLE_ICE, isUseIce);
+ }
+
+ /**
+ * Indicates if the stun server should be automatically discovered.
+ * @return <tt>true</tt> if the stun server should be automatically
+ * discovered, otherwise returns <tt>false</tt>.
+ */
+ public boolean isAutoDiscoverStun()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.AUTO_DISCOVER_STUN, true);
+ }
+
+ /**
+ * Sets the <tt>autoDiscoverStun</tt> property.
+ * @param isAutoDiscover <tt>true</tt> to indicate that stun server should
+ * be auto-discovered, <tt>false</tt> - otherwise.
+ */
+ public void setAutoDiscoverStun(boolean isAutoDiscover)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.AUTO_DISCOVER_STUN, isAutoDiscover);
+ }
+
+ /**
+ * Sets the <tt>useDefaultStunServer</tt> property.
+ * @param isUseDefaultStunServer <tt>true</tt> to indicate that default
+ * stun server should be used if no others are available, <tt>false</tt>
+ * otherwise.
+ */
+ public void setUseDefaultStunServer(boolean isUseDefaultStunServer)
+ {
+ putAccountProperty( ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER,
+ isUseDefaultStunServer );
+ }
+
+ /**
+ * Sets the <tt>autoDiscoverJingleNodes</tt> property.
+ *
+ * @param isAutoDiscover <tt>true</tt> to indicate that relay server should
+ * be auto-discovered, <tt>false</tt> - otherwise.
+ */
+ public void setAutoDiscoverJingleNodes(boolean isAutoDiscover)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES,
+ isAutoDiscover );
+ }
+
+ /**
+ * Indicates if the JingleNodes relay server should be automatically
+ * discovered.
+ *
+ * @return <tt>true</tt> if the relay server should be automatically
+ * discovered, otherwise returns <tt>false</tt>.
+ */
+ public boolean isAutoDiscoverJingleNodes()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES, true);
+ }
+
+ /**
+ * Sets the <tt>useJingleNodes</tt> property.
+ *
+ * @param isUseJingleNodes <tt>true</tt> to indicate that Jingle Nodes
+ * should be used for this account, <tt>false</tt> - otherwise.
+ */
+ public void setUseJingleNodes(boolean isUseJingleNodes)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.IS_USE_JINGLE_NODES, isUseJingleNodes);
+ }
+
+ /**
+ * Indicates if JingleNodes relay should be used.
+ *
+ * @return <tt>true</tt> if JingleNodes should be used, <tt>false</tt>
+ * otherwise
+ */
+ public boolean isUseJingleNodes()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_USE_JINGLE_NODES, true);
+ }
+
+ /**
+ * Indicates if UPnP should be used for this account.
+ * @return <tt>true</tt> if UPnP should be used for this account, otherwise
+ * returns <tt>false</tt>
+ */
+ public boolean isUseUPNP()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_USE_UPNP, true);
+ }
+
+ /**
+ * Sets the <tt>useUPNP</tt> property.
+ * @param isUseUPNP <tt>true</tt> to indicate that UPnP should be used for
+ * this account, <tt>false</tt> - otherwise.
+ */
+ public void setUseUPNP(boolean isUseUPNP)
+ {
+ putAccountProperty(ProtocolProviderFactory.IS_USE_UPNP, isUseUPNP);
+ }
+
+ /**
+ * Indicates if non-TLS is allowed for this account
+ * @return <tt>true</tt> if non-TLS is allowed for this account, otherwise
+ * returns <tt>false</tt>
+ */
+ public boolean isAllowNonSecure()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_ALLOW_NON_SECURE, false);
+ }
+
+ /**
+ * Sets the <tt>isAllowNonSecure</tt> property.
+ * @param isAllowNonSecure <tt>true</tt> to indicate that non-TLS is allowed
+ * for this account, <tt>false</tt> - otherwise.
+ */
+ public void setAllowNonSecure(boolean isAllowNonSecure)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.IS_ALLOW_NON_SECURE, isAllowNonSecure);
+ }
+
+ /**
+ * Is resource auto generate enabled.
+ *
+ * @return true if resource is auto generated
+ */
+ public boolean isResourceAutogenerated()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.AUTO_GENERATE_RESOURCE, true );
+ }
+
+ /**
+ * Set whether resource autogenerate is enabled.
+ * @param resourceAutogenerated
+ */
+ public void setResourceAutogenerated(boolean resourceAutogenerated)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.AUTO_GENERATE_RESOURCE,
+ resourceAutogenerated );
+ }
+
+ /**
+ * Returns the default sms server.
+ *
+ * @return the account default sms server
+ */
+ public String getSmsServerAddress()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.SMS_SERVER_ADDRESS);
+ }
+
+ /**
+ * Sets the default sms server.
+ *
+ * @param serverAddress the sms server to set as default
+ */
+ public void setSmsServerAddress(String serverAddress)
+ {
+ setOrRemoveIfEmpty(
+ ProtocolProviderFactory.SMS_SERVER_ADDRESS, serverAddress);
+ }
+
+ /**
+ * Returns the service name - the server we are logging to
+ * if it is null which is not supposed to be - we return for compatibility
+ * the string we used in the first release for creating AccountID
+ * (Using this string is wrong, but used for compatibility for now)
+ * @param accountProperties Map
+ * @return String
+ */
+ private static String getServiceName(Map<String, String> accountProperties)
+ {
+ return accountProperties.get(ProtocolProviderFactory.SERVER_ADDRESS);
+ }
+
+ /**
+ * Determines whether this account's provider is supposed to auto discover
+ * STUN and TURN servers.
+ *
+ * @return <tt>true</tt> if this provider would need to discover STUN/TURN
+ * servers and false otherwise.
+ */
+ public boolean isStunServerDiscoveryEnabled()
+ {
+ return
+ getAccountPropertyBoolean(
+ ProtocolProviderFactory.AUTO_DISCOVER_STUN,
+ true);
+ }
+
+ /**
+ * Determines whether this account's provider uses the default STUN server
+ * provided by SIP Communicator if there is no other STUN/TURN server
+ * discovered/configured.
+ *
+ * @return <tt>true</tt> if this provider would use the default STUN server,
+ * <tt>false</tt> otherwise
+ */
+ public boolean isUseDefaultStunServer()
+ {
+ return
+ getAccountPropertyBoolean(
+ ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER,
+ true);
+ }
+
+ /**
+ * Returns the list of JingleNodes trackers/relays that this account is
+ * currently configured to use.
+ *
+ * @return the list of JingleNodes trackers/relays that this account is
+ * currently configured to use.
+ */
+ public List<JingleNodeDescriptor> getJingleNodes()
+ {
+ Map<String, String> accountProperties = getAccountProperties();
+ List<JingleNodeDescriptor> serList
+ = new ArrayList<JingleNodeDescriptor>();
+
+ for (int i = 0; i < JingleNodeDescriptor.MAX_JN_RELAY_COUNT; i ++)
+ {
+ JingleNodeDescriptor node
+ = JingleNodeDescriptor.loadDescriptor(
+ accountProperties,
+ JingleNodeDescriptor.JN_PREFIX + i);
+
+ // If we don't find a relay server with the given index, it means
+ // that there're no more servers left in the table so we've nothing
+ // more to do here.
+ if (node == null)
+ break;
+
+ serList.add(node);
+ }
+
+ return serList;
+ }
+
+ /**
+ * Determines whether this account's provider is supposed to auto discover
+ * JingleNodes relay.
+ *
+ * @return <tt>true</tt> if this provider would need to discover JingleNodes
+ * relay, <tt>false</tt> otherwise
+ */
+ public boolean isJingleNodesAutoDiscoveryEnabled()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES,
+ true);
+ }
+
+ /**
+ * Determines whether this account's provider is supposed to auto discover
+ * JingleNodes relay by searching our contacts.
+ *
+ * @return <tt>true</tt> if this provider would need to discover JingleNodes
+ * relay by searching buddies, <tt>false</tt> otherwise
+ */
+ public boolean isJingleNodesSearchBuddiesEnabled()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.JINGLE_NODES_SEARCH_BUDDIES,
+ false);
+ }
+
+ /**
+ * Determines whether this account's provider uses JingleNodes relay (if
+ * available).
+ *
+ * @return <tt>true</tt> if this provider would use JingleNodes relay (if
+ * available), <tt>false</tt> otherwise
+ */
+ public boolean isJingleNodesRelayEnabled()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_USE_JINGLE_NODES,
+ true);
+ }
+
+ /**
+ * Determines whether this account's provider uses UPnP (if available).
+ *
+ * @return <tt>true</tt> if this provider would use UPnP (if available),
+ * <tt>false</tt> otherwise
+ */
+ public boolean isUPNPEnabled()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_USE_UPNP,
+ true);
+ }
+
+ /**
+ * Determines whether this account's provider allow non-secure connection
+ *
+ * @return <tt>true</tt> if this provider would allow non-secure connection,
+ * <tt>false</tt> otherwise
+ */
+ public boolean allowNonSecureConnection()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_ALLOW_NON_SECURE,
+ false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getDefaultString(String key)
+ {
+ return JabberAccountID.getDefaultStr(key);
+ }
+
+ /**
+ * Gets default property value for given <tt>key</tt>.
+ *
+ * @param key the property key
+ * @return default property value for given<tt>key</tt>
+ */
+ public static String getDefaultStr(String key)
+ {
+ String value = ProtocolProviderActivator
+ .getConfigurationService()
+ .getString(JBR_DEFAULTS_PREFIX +key);
+
+ if(value == null)
+ value = AccountID.getDefaultStr(key);
+
+ return value;
+ }
+
+ /**
+ * Gets default boolean property value for given <tt>key</tt>.
+ *
+ * @param key the property key
+ * @return default property value for given<tt>key</tt>
+ */
+ public static boolean getDefaultBool(String key)
+ {
+ return Boolean.getBoolean(getDefaultStr(key));
+ }
+
+
+}
diff --git a/src/net/java/sip/communicator/service/protocol/jabber/JabberAccountRegistration.java b/src/net/java/sip/communicator/service/protocol/jabber/JabberAccountRegistration.java
new file mode 100644
index 0000000..2a5bce0
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/jabber/JabberAccountRegistration.java
@@ -0,0 +1,406 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol.jabber;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.credentialsstorage.*;
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+
+import org.jitsi.service.neomedia.*;
+
+import org.osgi.framework.*;
+
+/**
+ * The <tt>JabberAccountRegistration</tt> is used to store all user input data
+ * through the <tt>JabberAccountRegistrationWizard</tt>.
+ *
+ * @author Yana Stamcheva
+ * @author Boris Grozev
+ */
+public class JabberAccountRegistration
+ extends JabberAccountID
+{
+ /**
+ * The default domain.
+ */
+ private String defaultUserSufix;
+
+ /**
+ * The list of additional STUN servers entered by user.
+ */
+ private List<StunServerDescriptor> additionalStunServers
+ = new ArrayList<StunServerDescriptor>();
+
+ /**
+ * The list of additional JingleNodes (tracker or relay) entered by user.
+ */
+ private List<JingleNodeDescriptor> additionalJingleNodes
+ = new ArrayList<JingleNodeDescriptor>();
+
+ /**
+ * The encodings registration object
+ */
+ private EncodingsRegistrationUtil encodingsRegistration
+ = new EncodingsRegistrationUtil();
+
+ /**
+ * The security registration object
+ */
+ private SecurityAccountRegistration securityRegistration
+ = new SecurityAccountRegistration()
+ {
+ /**
+ * Sets the method used for RTP/SAVP indication.
+ */
+ @Override
+ public void setSavpOption(int savpOption)
+ {
+ // SAVP option is not useful for XMPP account.
+ // Thereby, do nothing.
+ }
+
+ /**
+ * RTP/SAVP is disabled for Jabber protocol.
+ *
+ * @return Always <tt>ProtocolProviderFactory.SAVP_OFF</tt>.
+ */
+ @Override
+ public int getSavpOption()
+ {
+ return ProtocolProviderFactory.SAVP_OFF;
+ }
+ };
+
+ /**
+ * Initializes a new JabberAccountRegistration.
+ */
+ public JabberAccountRegistration()
+ {
+ super(null, new HashMap<String, String>());
+ }
+
+ /**
+ * Returns the user sufix.
+ *
+ * @return the user sufix
+ */
+ public String getDefaultUserSufix()
+ {
+ return defaultUserSufix;
+ }
+
+ /**
+ * Sets the User ID of the jabber registration account.
+ *
+ * @param userID the identifier of the jabber registration account.
+ */
+ public void setUserID(String userID)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.USER_ID, userID);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getUserID()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.USER_ID);
+ }
+
+ /**
+ * Sets the default value of the user sufix.
+ *
+ * @param userSufix the user name sufix (the domain name after the @ sign)
+ */
+ public void setDefaultUserSufix(String userSufix)
+ {
+ this.defaultUserSufix = userSufix;
+ }
+
+ /**
+ * Adds the given <tt>stunServer</tt> to the list of additional stun servers.
+ *
+ * @param stunServer the <tt>StunServer</tt> to add
+ */
+ public void addStunServer(StunServerDescriptor stunServer)
+ {
+ additionalStunServers.add(stunServer);
+ }
+
+ /**
+ * Returns the <tt>List</tt> of all additional stun servers entered by the
+ * user. The list is guaranteed not to be <tt>null</tt>.
+ *
+ * @return the <tt>List</tt> of all additional stun servers entered by the
+ * user.
+ */
+ public List<StunServerDescriptor> getAdditionalStunServers()
+ {
+ return additionalStunServers;
+ }
+
+ /**
+ * Adds the given <tt>node</tt> to the list of additional JingleNodes.
+ *
+ * @param node the <tt>node</tt> to add
+ */
+ public void addJingleNodes(JingleNodeDescriptor node)
+ {
+ additionalJingleNodes.add(node);
+ }
+
+ /**
+ * Returns the <tt>List</tt> of all additional stun servers entered by the
+ * user. The list is guaranteed not to be <tt>null</tt>.
+ *
+ * @return the <tt>List</tt> of all additional stun servers entered by the
+ * user.
+ */
+ public List<JingleNodeDescriptor> getAdditionalJingleNodes()
+ {
+ return additionalJingleNodes;
+ }
+
+ /**
+ * Returns <tt>EncodingsRegistrationUtil</tt> object which stores encodings
+ * configuration.
+ * @return <tt>EncodingsRegistrationUtil</tt> object which stores encodings
+ * configuration.
+ */
+ public EncodingsRegistrationUtil getEncodingsRegistration()
+ {
+ return encodingsRegistration;
+ }
+
+ /**
+ * Returns <tt>SecurityAccountRegistration</tt> object which stores security
+ * settings.
+ * @return <tt>SecurityAccountRegistration</tt> object which stores security
+ * settings.
+ */
+ public SecurityAccountRegistration getSecurityRegistration()
+ {
+ return securityRegistration;
+ }
+
+ /**
+ * Stores Jabber account configuration held by this registration object into
+ * given<tt>accountProperties</tt> map.
+ *
+ * @param userName the user name that will be used.
+ * @param passwd the password for this account.
+ * @param protocolIconPath the path to protocol icon if used, or
+ * <tt>null</tt> otherwise.
+ * @param accountIconPath the path to account icon if used, or
+ * <tt>null</tt> otherwise.
+ * @param accountProperties the map used for storings account properties.
+ *
+ * @throws OperationFailedException if properties are invalid.
+ */
+ public void storeProperties(String userName, String passwd,
+ String protocolIconPath,
+ String accountIconPath,
+ Map<String, String> accountProperties)
+ throws OperationFailedException
+ {
+ setPassword(passwd);
+
+ String serverName = null;
+ if (getServerAddress() != null
+ && getServerAddress().length() > 0)
+ {
+ serverName = getServerAddress();
+ }
+ else
+ {
+ serverName = getServerFromUserName(userName);
+ }
+
+ if (serverName == null || serverName.length() <= 0)
+ throw new OperationFailedException(
+ "Should specify a server for user name " + userName + ".",
+ OperationFailedException.SERVER_NOT_SPECIFIED);
+
+ if(userName.indexOf('@') < 0 && getDefaultUserSufix() != null)
+ userName = userName + '@' + getDefaultUserSufix();
+
+ List<StunServerDescriptor> stunServers = getAdditionalStunServers();
+
+ int serverIndex = -1;
+
+ for(StunServerDescriptor stunServer : stunServers)
+ {
+ serverIndex ++;
+
+ stunServer.storeDescriptor(
+ accountProperties,
+ ProtocolProviderFactory.STUN_PREFIX + serverIndex);
+ }
+
+ List<JingleNodeDescriptor> jnRelays = getAdditionalJingleNodes();
+
+ serverIndex = -1;
+ for(JingleNodeDescriptor jnRelay : jnRelays)
+ {
+ serverIndex ++;
+
+ jnRelay.storeDescriptor(accountProperties,
+ JingleNodeDescriptor.JN_PREFIX + serverIndex);
+ }
+
+ securityRegistration.storeProperties(accountProperties);
+
+ encodingsRegistration.storeProperties(accountProperties);
+
+ super.storeProperties(
+ accountIconPath, protocolIconPath, accountProperties);
+ }
+
+ /**
+ * Fills this registration object with configuration properties from given
+ * <tt>account</tt>.
+ * @param account the account object that will be used.
+ * @param bundleContext the OSGi bundle context required for some
+ * operations.
+ */
+ public void loadAccount(AccountID account, BundleContext bundleContext)
+ {
+ mergeProperties(account.getAccountProperties(), accountProperties);
+
+ String password
+ = ProtocolProviderFactory.getProtocolProviderFactory(
+ bundleContext,
+ ProtocolNames.JABBER).loadPassword(account);
+
+ setUserID(account.getUserID());
+
+ setPassword(password);
+
+ //Security properties
+ securityRegistration.loadAccount(account);
+
+ // ICE
+ this.additionalStunServers.clear();
+ for (int i = 0; i < StunServerDescriptor.MAX_STUN_SERVER_COUNT; i ++)
+ {
+ StunServerDescriptor stunServer
+ = StunServerDescriptor.loadDescriptor(
+ accountProperties, ProtocolProviderFactory.STUN_PREFIX + i);
+
+ // If we don't find a stun server with the given index, it means
+ // that there're no more servers left in the table so we've nothing
+ // more to do here.
+ if (stunServer == null)
+ break;
+
+ String stunPassword = loadStunPassword(
+ bundleContext,
+ account,
+ ProtocolProviderFactory.STUN_PREFIX + i);
+
+ if(stunPassword != null)
+ {
+ stunServer.setPassword(stunPassword);
+ }
+
+ addStunServer(stunServer);
+ }
+
+ this.additionalJingleNodes.clear();
+ for (int i = 0; i < JingleNodeDescriptor.MAX_JN_RELAY_COUNT ; i ++)
+ {
+ JingleNodeDescriptor jn
+ = JingleNodeDescriptor.loadDescriptor(
+ accountProperties, JingleNodeDescriptor.JN_PREFIX + i);
+
+ // If we don't find a stun server with the given index, it means
+ // that there're no more servers left in the table so we've nothing
+ // more to do here.
+ if (jn == null)
+ break;
+
+ addJingleNodes(jn);
+ }
+
+ // Encodings
+ encodingsRegistration.loadAccount(
+ account,
+ ServiceUtils.getService(bundleContext, MediaService.class));
+ }
+
+ /**
+ * Load password for this STUN descriptor.
+ *
+ * @param accountID account ID
+ * @param namePrefix name prefix
+ * @return password or null if empty
+ */
+ private static String loadStunPassword(BundleContext bundleContext,
+ AccountID accountID,
+ String namePrefix)
+ {
+ ProtocolProviderFactory providerFactory
+ = ProtocolProviderFactory.getProtocolProviderFactory(
+ bundleContext,
+ ProtocolNames.JABBER);
+
+ String password = null;
+ String className = providerFactory.getClass().getName();
+ String packageSourceName
+ = className.substring(0, className.lastIndexOf('.'));
+
+ String accountPrefix = ProtocolProviderFactory.findAccountPrefix(
+ bundleContext,
+ accountID, packageSourceName);
+
+ CredentialsStorageService credentialsService
+ = ServiceUtils.getService(
+ bundleContext,
+ CredentialsStorageService.class);
+
+ try
+ {
+ password = credentialsService.
+ loadPassword(accountPrefix + "." + namePrefix);
+ }
+ catch(Exception e)
+ {
+ return null;
+ }
+
+ return password;
+ }
+
+ /**
+ * Parse the server part from the jabber id and set it to server as default
+ * value. If Advanced option is enabled Do nothing.
+ *
+ * @param userName the full JID that we'd like to parse.
+ *
+ * @return returns the server part of a full JID
+ */
+ protected String getServerFromUserName(String userName)
+ {
+ int delimIndex = userName.indexOf("@");
+ if (delimIndex != -1)
+ {
+ String newServerAddr = userName.substring(delimIndex + 1);
+ if (newServerAddr.equals(GOOGLE_USER_SUFFIX))
+ {
+ return GOOGLE_CONNECT_SRV;
+ }
+ else
+ {
+ return newServerAddr;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
index ba437d8..93a931c 100644
--- a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
+++ b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
@@ -9,6 +9,7 @@ Import-Package: net.java.sip.communicator.service.credentialsstorage,
net.java.sip.communicator.util,
org.jitsi.service.configuration,
org.jitsi.service.neomedia,
+ org.jitsi.service.neomedia.codec,
org.jitsi.service.protocol.event,
org.jitsi.service.resources,
org.jitsi.util,
@@ -19,7 +20,9 @@ Export-Package: net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.globalstatus,
net.java.sip.communicator.service.protocol.icqconstants,
+ net.java.sip.communicator.service.protocol.jabber,
net.java.sip.communicator.service.protocol.jabberconstants,
net.java.sip.communicator.service.protocol.msnconstants,
+ net.java.sip.communicator.service.protocol.sip,
net.java.sip.communicator.service.protocol.whiteboardobjects,
net.java.sip.communicator.service.protocol.yahooconstants
diff --git a/src/net/java/sip/communicator/service/protocol/sip/SIPAccountRegistration.java b/src/net/java/sip/communicator/service/protocol/sip/SIPAccountRegistration.java
new file mode 100644
index 0000000..286eeb4
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/sip/SIPAccountRegistration.java
@@ -0,0 +1,248 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol.sip;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+
+import org.jitsi.service.neomedia.*;
+
+import org.osgi.framework.*;
+
+/**
+ * The <tt>SIPAccountRegistration</tt> is used to store all user input data
+ * through the <tt>SIPAccountRegistrationWizard</tt>.
+ *
+ * @author Yana Stamcheva
+ * @author Grigorii Balutsel
+ * @author Boris Grozev
+ * @author Pawel Domas
+ */
+public class SIPAccountRegistration
+ extends SipAccountID
+{
+ private String defaultDomain = null;
+
+ /**
+ * The encodings registration object.
+ */
+ private EncodingsRegistrationUtil encodingsRegistration
+ = new EncodingsRegistrationUtil();
+
+ /**
+ * The security registration object.
+ */
+ private SecurityAccountRegistration securityAccountRegistration
+ = new SecurityAccountRegistration()
+ {
+ /**
+ * Sets the method used for RTP/SAVP indication.
+ */
+ @Override
+ public void setSavpOption(int savpOption)
+ {
+ putAccountProperty( ProtocolProviderFactory.SAVP_OPTION,
+ Integer.toString(savpOption) );
+ }
+
+ /**
+ * Returns the method used for RTP/SAVP indication.
+ * @return the method used for RTP/SAVP indication.
+ */
+ @Override
+ public int getSavpOption()
+ {
+ String savpOption
+ = getAccountPropertyString(
+ ProtocolProviderFactory.SAVP_OPTION);
+ return Integer.parseInt(savpOption);
+ }
+ };
+
+ /**
+ * Initializes a new SIPAccountRegistration.
+ */
+ public SIPAccountRegistration()
+ {
+ super();
+ }
+
+ /**
+ * This is the default domain.
+ * @return the defaultDomain
+ */
+ public String getDefaultDomain()
+ {
+ return defaultDomain;
+ }
+
+ /**
+ * If default domain is set this means we cannot create registerless
+ * accounts through this wizard. And every time we write only the username,
+ * will will end up with username@defaultDomain.
+ *
+ * @param defaultDomain the defaultDomain to set
+ */
+ public void setDefaultDomain(String defaultDomain)
+ {
+ this.defaultDomain = defaultDomain;
+ }
+
+ /**
+ * Returns encoding registration object holding encodings configuration.
+ * @return encoding registration object holding encodings configuration.
+ */
+ public EncodingsRegistrationUtil getEncodingsRegistration()
+ {
+ return encodingsRegistration;
+ }
+
+ /**
+ * Returns security registration object holding security configuration.
+ * @return <tt>SecurityAccountRegistration</tt> object holding security
+ * configuration.
+ */
+ public SecurityAccountRegistration getSecurityRegistration()
+ {
+ return securityAccountRegistration;
+ }
+
+ /**
+ * Loads configuration properties from given <tt>accountID</tt>.
+ * @param accountID the account identifier that will be used.
+ * @param bundleContext the OSGI bundle context required for some
+ * operations.
+ */
+ public void loadAccount( AccountID accountID,
+ String password,
+ BundleContext bundleContext )
+ {
+ mergeProperties(accountID.getAccountProperties(), accountProperties);
+
+ String serverAddress = getServerAddress();
+
+ String userID = (serverAddress == null) ? accountID.getUserID()
+ : accountID.getAccountPropertyString(
+ ProtocolProviderFactory.USER_ID);
+ setUserID(userID);
+
+ setPassword(password);
+ // The order of the next two fields is important, as a change listener
+ // of the transportCombo sets the proxyPortField to its default
+ // TODO: have to check why is that(Pawel)
+ //setPreferredTransport(preferredTransport);
+ //setProxyPort(proxyPort);
+
+ securityAccountRegistration.loadAccount(accountID);
+
+ encodingsRegistration.loadAccount(
+ accountID,
+ ServiceUtils.getService(bundleContext, MediaService.class));
+ }
+
+ /**
+ * Stores configuration properties held by this object into given
+ * <tt>accountProperties</tt> map.
+ *
+ * @param userName the user name that will be used.
+ * @param passwd the password that will be used.
+ * @param protocolIconPath the path to the protocol icon is used
+ * @param accountIconPath the path to the account icon if used
+ * @param isModification flag indication if it's modification process(has
+ * impact on some properties).
+ * @param accountProperties the map that will hold the configuration.
+ */
+ public void storeProperties(String userName, String passwd,
+ String protocolIconPath,
+ String accountIconPath,
+ Boolean isModification,
+ Map<String, String> accountProperties)
+ {
+ setPassword(passwd);
+
+ String serverAddress = null;
+ String serverFromUsername = getServerFromUserName(userName);
+
+ if (getServerAddress() != null)
+ serverAddress = getServerAddress();
+
+ if (serverFromUsername == null
+ && getDefaultDomain() != null)
+ {
+ // we have only a username and we want to add
+ // a default domain
+ userName = userName + "@" + getDefaultDomain();
+
+ if (serverAddress == null)
+ serverAddress = getDefaultDomain();
+ }
+ else if(serverAddress == null &&
+ serverFromUsername != null)
+ {
+ serverAddress = serverFromUsername;
+ }
+
+ if (serverAddress != null)
+ {
+ accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
+ serverAddress);
+ if (userName.indexOf(serverAddress) < 0)
+ accountProperties.put(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
+ Boolean.toString(true));
+ }
+
+ if(isProxyAutoConfigure())
+ {
+ removeAccountProperty(ProtocolProviderFactory.PROXY_ADDRESS);
+ removeAccountProperty(ProtocolProviderFactory.PROXY_PORT);
+ removeAccountProperty(ProtocolProviderFactory.PREFERRED_TRANSPORT);
+ }
+
+ // when we are creating registerless account make sure that
+ // we don't use PA
+ if (serverAddress == null)
+ {
+ setForceP2PMode(true);
+ }
+
+ securityAccountRegistration.storeProperties(this.accountProperties);
+
+ ensureDefaultValuePresent(ProtocolProviderFactory.KEEP_ALIVE_METHOD);
+
+ ensureDefaultValuePresent(ProtocolProviderFactory.KEEP_ALIVE_INTERVAL);
+
+ ensureDefaultValuePresent(ProtocolProviderFactory.POLLING_PERIOD);
+
+ ensureDefaultValuePresent(
+ ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
+
+ encodingsRegistration.storeProperties(this.accountProperties);
+
+ if (isModification)
+ {
+ if (isMessageWaitingIndicationsEnabled())
+ {
+ setVoicemailURI("");
+ setVoicemailCheckURI("");
+ // remove the property as true is by default,
+ // and null removes property
+ removeAccountProperty(
+ ProtocolProviderFactory.VOICEMAIL_ENABLED);
+ } else
+ {
+ accountProperties.put(
+ ProtocolProviderFactory.VOICEMAIL_ENABLED,
+ Boolean.FALSE.toString());
+ }
+ }
+
+ super.storeProperties(
+ protocolIconPath, accountIconPath, accountProperties);
+ }
+}
diff --git a/src/net/java/sip/communicator/service/protocol/sip/SipAccountID.java b/src/net/java/sip/communicator/service/protocol/sip/SipAccountID.java
new file mode 100644
index 0000000..dd803d2
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/sip/SipAccountID.java
@@ -0,0 +1,599 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol.sip;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.protocol.*;
+
+/**
+ * A SIP extension of the account ID property.
+ * @author Emil Ivov
+ * @author Pawel Domas
+ */
+public class SipAccountID
+ extends AccountID
+{
+ /**
+ * The name of the property under which the user may specify whether to use
+ * or not XCAP.
+ */
+ public static final String XCAP_ENABLE = "XCAP_ENABLE";
+
+ /**
+ * The name of the property under which the user may specify whether to use
+ * or not xivo.
+ */
+ public static final String XIVO_ENABLE = "XIVO_ENABLE";
+
+ /**
+ * The name of the property under which the user may specify whether to use
+ * original sip credentials for the contact list.
+ */
+ public static final String OPT_CLIST_USE_SIP_CREDETIALS =
+ "OPT_CLIST_USE_SIP_CREDETIALS";
+
+ /**
+ * The name of the property under which the user may specify the contact
+ * list server uri.
+ */
+ public static final String OPT_CLIST_SERVER_URI = "OPT_CLIST_SERVER_URI";
+
+ /**
+ * The name of the property under which the user may specify the XCAP user.
+ */
+ public static final String OPT_CLIST_USER = "OPT_CLIST_USER";
+
+ /**
+ * The name of the property under which the user may specify the XCAP user
+ * password.
+ */
+ public static final String OPT_CLIST_PASSWORD = "OPT_CLIST_PASSWORD";
+
+ /**
+ * Default properties prefix used in jitsi-defaults.properties file
+ * for SIP protocol.
+ */
+ private static final String SIP_DEFAULTS_PREFIX
+ = AccountID.DEFAULTS_PREFIX +"sip.";
+
+ /**
+ * Creates a SIP account id from the specified ide and account properties.
+ *
+ * @param userID the user id part of the SIP uri identifying this contact.
+ * @param accountProperties any other properties necessary for the account.
+ * @param serverName the name of the server that the user belongs to.
+ */
+ protected SipAccountID(String userID, Map<String, String> accountProperties,
+ String serverName)
+ {
+ super(userID, accountProperties,
+ ProtocolNames.SIP,
+ serverName);
+ }
+
+ /**
+ * Default constructor for wizard purposes.
+ */
+ public SipAccountID()
+ {
+ super(null, new HashMap<String, String>(), ProtocolNames.SIP, null);
+ }
+
+ /**
+ * The proxy address
+ * @return the proxy address
+ */
+ public String getProxy()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.PROXY_ADDRESS);
+ }
+
+ /**
+ * Set new proxy address
+ * @param proxy the proxy address to set
+ */
+ public void setProxy(String proxy)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.PROXY_ADDRESS, proxy);
+ }
+
+ /**
+ * Returns the UIN of the sip registration account.
+ *
+ * @return the UIN of the sip registration account.
+ */
+ public String getId()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.USER_ID);
+ }
+
+ /**
+ * Get the preferred transport.
+ * @return the preferred transport for this account identifier.
+ */
+ public String getPreferredTransport()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);
+ }
+
+ /**
+ * Sets the preferred transport for this account identifier.
+ * @param preferredTransport the preferred transport for this account
+ * identifier.
+ */
+ public void setPreferredTransport(String preferredTransport)
+ {
+ putAccountProperty(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT,
+ preferredTransport);
+ }
+
+ /**
+ * The port on the specified proxy
+ *
+ * @return int
+ */
+ public String getProxyPort()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.PROXY_PORT);
+ }
+
+ /**
+ * Sets the identifier of the sip registration account.
+ *
+ * @param id the identifier of the sip registration account.
+ */
+ public void setUserID(String id)
+ {
+ putAccountProperty(ProtocolProviderFactory.USER_ID, id);
+ }
+
+ /**
+ * Is proxy auto configured.
+ * @return <tt>true</tt> if proxy is auto configured.
+ */
+ public boolean isProxyAutoConfigure()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.PROXY_AUTO_CONFIG, true);
+ }
+
+ /**
+ * Sets auto configuration of proxy enabled or disabled.
+ * @param proxyAutoConfigure <tt>true</tt> if the proxy will be
+ * auto configured.
+ */
+ public void setProxyAutoConfigure(boolean proxyAutoConfigure)
+ {
+ putAccountProperty(ProtocolProviderFactory.PROXY_AUTO_CONFIG,
+ proxyAutoConfigure);
+ }
+
+ /**
+ * Sets the proxy port.
+ *
+ * @param port int
+ */
+ public void setProxyPort(String port)
+ {
+ setOrRemoveIfEmpty(ProtocolProviderFactory.PROXY_PORT, port);
+ }
+
+ /**
+ * If the presence is enabled
+ *
+ * @return If the presence is enabled
+ */
+ public boolean isEnablePresence()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_PRESENCE_ENABLED, true);
+ }
+
+ /**
+ * If the p2p mode is forced
+ *
+ * @return If the p2p mode is forced
+ */
+ public boolean isForceP2PMode()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.FORCE_P2P_MODE, false);
+ }
+
+ /**
+ * The offline contact polling period
+ *
+ * @return the polling period
+ */
+ public String getPollingPeriod()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.POLLING_PERIOD);
+ }
+
+ /**
+ * The default expiration of subscriptions
+ *
+ * @return the subscription expiration
+ */
+ public String getSubscriptionExpiration()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
+ }
+
+ /**
+ * Sets if the presence is enabled
+ *
+ * @param enablePresence if the presence is enabled
+ */
+ public void setEnablePresence(boolean enablePresence)
+ {
+ putAccountProperty(ProtocolProviderFactory.IS_PRESENCE_ENABLED,
+ enablePresence);
+ }
+
+ /**
+ * Sets if we have to force the p2p mode
+ *
+ * @param forceP2PMode if we have to force the p2p mode
+ */
+ public void setForceP2PMode(boolean forceP2PMode)
+ {
+ putAccountProperty(ProtocolProviderFactory.FORCE_P2P_MODE,
+ forceP2PMode);
+ }
+
+ /**
+ * Sets the offline contacts polling period
+ *
+ * @param pollingPeriod the offline contacts polling period
+ */
+ public void setPollingPeriod(String pollingPeriod)
+ {
+ putAccountProperty( ProtocolProviderFactory.POLLING_PERIOD,
+ pollingPeriod );
+ }
+
+ /**
+ * Sets the subscription expiration value
+ *
+ * @param subscriptionExpiration the subscription expiration value
+ */
+ public void setSubscriptionExpiration(String subscriptionExpiration)
+ {
+ putAccountProperty( ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,
+ subscriptionExpiration );
+ }
+
+ /**
+ * Returns the keep alive method.
+ *
+ * @return the keep alive method.
+ */
+ public String getKeepAliveMethod()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.KEEP_ALIVE_METHOD);
+ }
+
+ /**
+ * Sets the keep alive method.
+ *
+ * @param keepAliveMethod the keep alive method to set
+ */
+ public void setKeepAliveMethod(String keepAliveMethod)
+ {
+ putAccountProperty( ProtocolProviderFactory.KEEP_ALIVE_METHOD,
+ keepAliveMethod );
+ }
+
+ /**
+ * Returns the keep alive interval.
+ *
+ * @return the keep alive interval
+ */
+ public String getKeepAliveInterval()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.KEEP_ALIVE_INTERVAL);
+ }
+
+ /**
+ * Sets the keep alive interval.
+ *
+ * @param keepAliveInterval the keep alive interval to set
+ */
+ public void setKeepAliveInterval(String keepAliveInterval)
+ {
+ putAccountProperty( ProtocolProviderFactory.KEEP_ALIVE_INTERVAL,
+ keepAliveInterval );
+ }
+
+ /**
+ * Checks if XCAP is enabled.
+ *
+ * @return true if XCAP is enabled otherwise false.
+ */
+ public boolean isXCapEnable()
+ {
+ return getAccountPropertyBoolean(XCAP_ENABLE, false);
+ }
+ /**
+ * Sets if XCAP is enable.
+ *
+ * @param xCapEnable XCAP enable.
+ */
+ public void setXCapEnable(boolean xCapEnable)
+ {
+ putAccountProperty(XCAP_ENABLE, xCapEnable);
+ }
+
+ /**
+ * Checks if XiVO option is enabled.
+ *
+ * @return true if XiVO is enabled otherwise false.
+ */
+ public boolean isXiVOEnable()
+ {
+ return getAccountPropertyBoolean(XIVO_ENABLE, false);
+ }
+ /**
+ * Sets if XiVO option is enable.
+ *
+ * @param xivoEnable XiVO enable.
+ */
+ public void setXiVOEnable(boolean xivoEnable)
+ {
+ putAccountProperty(XIVO_ENABLE, xivoEnable);
+ }
+
+ /**
+ * Checks if contact list has to use SIP account credentials.
+ *
+ * @return <tt>true</tt> if contact list has to use SIP account credentials
+ * otherwise <tt>false</tt>.
+ */
+ public boolean isClistOptionUseSipCredentials()
+ {
+ return getAccountPropertyBoolean(OPT_CLIST_USE_SIP_CREDETIALS, true);
+ }
+
+ /**
+ * Sets if contact list has to use SIP account credentials.
+ *
+ * @param useSipCredentials if the clist has to use SIP account credentials.
+ */
+ public void setClistOptionUseSipCredentials(boolean useSipCredentials)
+ {
+ putAccountProperty( OPT_CLIST_USE_SIP_CREDETIALS,
+ useSipCredentials );
+ }
+
+ /**
+ * Gets the contact list server uri.
+ *
+ * @return the contact list server uri.
+ */
+ public String getClistOptionServerUri()
+ {
+ return getAccountPropertyString(OPT_CLIST_SERVER_URI);
+ }
+
+ /**
+ * Sets the contact list server uri.
+ *
+ * @param clistOptionServerUri the contact list server uri.
+ */
+ public void setClistOptionServerUri(String clistOptionServerUri)
+ {
+ placePropertyIfNotNull(OPT_CLIST_SERVER_URI, clistOptionServerUri);
+ }
+
+ /**
+ * Gets the contact list user.
+ *
+ * @return the contact list user.
+ */
+ public String getClistOptionUser()
+ {
+ String clistUser = getAccountPropertyString(OPT_CLIST_USER);
+ if(clistUser == null)
+ {
+ String oldKey = isXCapEnable() ? "XCAP_USER" : "XIVO_USER";
+ clistUser = getAccountPropertyString(oldKey);
+ if(clistUser != null)
+ {
+ accountProperties.remove(oldKey);
+ // store under new property key
+ setClistOptionUser(clistUser);
+ }
+ }
+ return clistUser;
+ }
+
+ /**
+ * Sets the contact list user.
+ *
+ * @param clistOptionUser the contact list user.
+ */
+ public void setClistOptionUser(String clistOptionUser)
+ {
+ placePropertyIfNotNull(OPT_CLIST_USER, clistOptionUser);
+ }
+
+ /**
+ * Gets the contact list password.
+ *
+ * @return the contact list password.
+ */
+ public String getClistOptionPassword()
+ {
+ String clistPass = getAccountPropertyString(OPT_CLIST_PASSWORD);
+ if(clistPass == null)
+ {
+ String oldKey = isXCapEnable() ? "XCAP_PASSWORD" : "XIVO_PASSWORD";
+ clistPass = getAccountPropertyString(oldKey);
+ if(clistPass != null)
+ {
+ accountProperties.remove(oldKey);
+ // store under new property key
+ setClistOptionUser(clistPass);
+ }
+ }
+ return clistPass;
+ }
+
+ /**
+ * Sets the contact list password.
+ *
+ * @param clistOptionPassword the contact list password.
+ */
+ public void setClistOptionPassword(String clistOptionPassword)
+ {
+ placePropertyIfNotNull(OPT_CLIST_PASSWORD, clistOptionPassword);
+ }
+
+ /**
+ * The voicemail URI.
+ * @return the voicemail URI.
+ */
+ public String getVoicemailURI()
+ {
+ return getAccountPropertyString(ProtocolProviderFactory.VOICEMAIL_URI);
+ }
+
+ /**
+ * Sets voicemail URI.
+ * @param voicemailURI new URI.
+ */
+ public void setVoicemailURI(String voicemailURI)
+ {
+ putAccountProperty( ProtocolProviderFactory.VOICEMAIL_URI,
+ voicemailURI );
+ }
+
+ /**
+ * The voicemail check URI.
+ * @return the voicemail URI.
+ */
+ public String getVoicemailCheckURI()
+ {
+ return getAccountPropertyString(
+ ProtocolProviderFactory.VOICEMAIL_CHECK_URI);
+ }
+
+ /**
+ * Sets voicemail check URI.
+ * @param voicemailCheckURI new URI.
+ */
+ public void setVoicemailCheckURI(String voicemailCheckURI)
+ {
+ putAccountProperty( ProtocolProviderFactory.VOICEMAIL_CHECK_URI,
+ voicemailCheckURI );
+ }
+
+ /**
+ * Check if messageWaitingIndications is enabled
+ *
+ * @return if messageWaitingIndications is enabled
+ */
+ public boolean isMessageWaitingIndicationsEnabled()
+ {
+ return getAccountPropertyBoolean(
+ ProtocolProviderFactory.VOICEMAIL_ENABLED, true);
+ }
+
+ /**
+ * Sets message waiting indications.
+ *
+ * @param messageWaitingIndications <tt>true</tt> to enable message waiting
+ * indications.
+ */
+ public void setMessageWaitingIndications(boolean messageWaitingIndications)
+ {
+
+ putAccountProperty( ProtocolProviderFactory.VOICEMAIL_ENABLED,
+ messageWaitingIndications );
+ }
+
+ /**
+ * Returns the protocol name
+ *
+ * @return the name of the protocol for this registration object
+ */
+ public String getProtocolName()
+ {
+ return ProtocolNames.SIP;
+ }
+
+ /**
+ * Returns a string that could be directly used (or easily converted to) an
+ * address that other users of the procotol can use to communicate with us.
+ * By default this string is set to userid@servicename. Protocol
+ * implementors should override it if they'd need it to respect a different
+ * syntax.
+ *
+ * @return a String in the form of userid@service that other protocol users
+ * should be able to parse into a meaningful address and use it to
+ * communicate with us.
+ */
+ public String getAccountAddress()
+ {
+ StringBuffer accountAddress = new StringBuffer();
+ accountAddress.append("sip:");
+ accountAddress.append(getUserID());
+
+ String service = getService();
+ if (service != null)
+ {
+ accountAddress.append('@');
+ accountAddress.append(service);
+ }
+
+ return accountAddress.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getDefaultString(String key)
+ {
+ return SipAccountID.getDefaultStr(key);
+ }
+
+ public static String getDefaultStr(String key)
+ {
+ String value = ProtocolProviderActivator
+ .getConfigurationService()
+ .getString(SIP_DEFAULTS_PREFIX +key);
+
+ if(value == null)
+ value = AccountID.getDefaultStr(key);
+
+ return value;
+ }
+
+ /**
+ * Return the server part of the sip user name.
+ *
+ * @param userName the username.
+ * @return the server part of the sip user name.
+ */
+ public static String getServerFromUserName(String userName)
+ {
+ int delimIndex = userName.indexOf("@");
+ if (delimIndex != -1)
+ {
+ return userName.substring(delimIndex + 1);
+ }
+
+ return null;
+ }
+}
diff --git a/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java
index daf5be8..9beb088 100644
--- a/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java
+++ b/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java
@@ -10,6 +10,7 @@ import java.util.*;
import junit.framework.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import org.osgi.framework.*;
/**
@@ -53,7 +54,8 @@ public class SipProtocolProviderServiceLick
/**
* The name of the property the value of which is XCAP server uri.
*/
- public static final String XCAP_SERVER_PROPERTY_NAME = "XCAP_SERVER";
+ public static final String XCAP_SERVER_PROPERTY_NAME
+ = SipAccountID.OPT_CLIST_SERVER_URI;
/**
* Initializes and registers all tests that we'll run as a part of this
diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java
index a77a2e8..cc47fad 100644
--- a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java
+++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java
@@ -9,9 +9,9 @@ package net.java.sip.communicator.slick.protocol.sip;
import java.util.*;
import junit.framework.*;
-import net.java.sip.communicator.impl.protocol.sip.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.service.protocol.sip.*;
import org.osgi.framework.*;
public class TestAccountInstallation
@@ -249,13 +249,13 @@ public class TestAccountInstallation
SipProtocolProviderServiceLick.XCAP_SERVER_PROPERTY_NAME, null);
if (xCapServerUri != null)
{
- table.put(ServerStoredContactListSipImpl.XCAP_ENABLE,
+ table.put(SipAccountID.XCAP_ENABLE,
Boolean.TRUE.toString());
- table.put(ServerStoredContactListSipImpl.XCAP_USE_SIP_CREDETIALS,
+ table.put(SipAccountID.OPT_CLIST_USE_SIP_CREDETIALS,
Boolean.TRUE.toString());
- table.put(ServerStoredContactListSipImpl.XCAP_USE_SIP_CREDETIALS,
+ table.put(SipAccountID.OPT_CLIST_USER,
Boolean.TRUE.toString());
- table.put(ServerStoredContactListSipImpl.XCAP_SERVER_URI,
+ table.put(SipAccountID.OPT_CLIST_SERVER_URI,
xCapServerUri);
}
diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java
index a3bad92..00dd8af 100644
--- a/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java
+++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java
@@ -31,7 +31,7 @@ public class TestAutoProxyDetection
{
private static class TestedAutoProxyDetection extends AutoProxyConnection
{
- public TestedAutoProxyDetection(SipAccountID account,
+ public TestedAutoProxyDetection(SipAccountIDImpl account,
String defaultTransport)
{
super(account, defaultTransport);
@@ -48,7 +48,7 @@ public class TestAutoProxyDetection
}
}
- private SipAccountID account;
+ private SipAccountIDImpl account;
private TestedAutoProxyDetection.NetworkUtils nu;
private SRVRecord srv1;
private SRVRecord srv2;
@@ -67,7 +67,7 @@ public class TestAutoProxyDetection
@Override
public void setUp()
{
- account = createMock(SipAccountID.class);
+ account = createMock(SipAccountIDImpl.class);
expect(account.getAccountPropertyString(USER_ID))
.andReturn("unit@" + DOMAIN);
replay(account);