aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin/sipaccregwizz
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2010-08-10 07:23:45 +0000
committerDamian Minkov <damencho@jitsi.org>2010-08-10 07:23:45 +0000
commit9c1c17dff9ae4b6a803b48e5203311a0f3f94b08 (patch)
tree72fdd92f39cd0012ee2312c9596399a5fd2b07b1 /src/net/java/sip/communicator/plugin/sipaccregwizz
parent411c4d9f013331950967665d41b103be6ebe8cba (diff)
downloadjitsi-9c1c17dff9ae4b6a803b48e5203311a0f3f94b08.zip
jitsi-9c1c17dff9ae4b6a803b48e5203311a0f3f94b08.tar.gz
jitsi-9c1c17dff9ae4b6a803b48e5203311a0f3f94b08.tar.bz2
Merge changes from branch/gsoc10/xcap and patch sent to dev mailinglist with subject "XCAP tests" which represents the work of Grigorii Balutsel on the "XCAP Support" GSoC 2010 project into trunk.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/sipaccregwizz')
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java257
-rwxr-xr-xsrc/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java111
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java28
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java59
4 files changed, 433 insertions, 22 deletions
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java
index a9eea7a..f0c1ccf 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/PresencePanel.java
@@ -16,42 +16,79 @@ import net.java.sip.communicator.util.swing.*;
* The <tt>PresencePanel</tt> is the one containing presence information.
*
* @author Yana Stamcheva
+ * @author Grigorii Balutsel
*/
public class PresencePanel
- extends TransparentPanel
+ extends TransparentPanel
{
private JPanel presenceOpPanel
- = new TransparentPanel(new BorderLayout(10, 10));
+ = new TransparentPanel(new BorderLayout(10, 10));
private JPanel buttonsPresOpPanel =
- new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel labelsPresOpPanel
- = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel valuesPresOpPanel
- = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JCheckBox enablePresOpButton =
- new SIPCommCheckBox(Resources
- .getString("plugin.sipaccregwizz.ENABLE_PRESENCE"), true);
+ new SIPCommCheckBox(Resources
+ .getString("plugin.sipaccregwizz.ENABLE_PRESENCE"), true);
private JCheckBox forceP2PPresOpButton =
- new SIPCommCheckBox(Resources
- .getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"), false);
+ new SIPCommCheckBox(Resources
+ .getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"),
+ false);
private JLabel pollPeriodLabel = new JLabel(
- Resources.getString(
- "plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
+ Resources.getString(
+ "plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
private JLabel subscribeExpiresLabel = new JLabel(
- Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
+ Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
private JTextField pollPeriodField
- = new JTextField(SIPAccountRegistration.DEFAULT_POLL_PERIOD);
+ = new JTextField(SIPAccountRegistration.DEFAULT_POLL_PERIOD);
private JTextField subscribeExpiresField =
- new JTextField(SIPAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
+ new JTextField(SIPAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
+
+ private JPanel xCapPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
+
+ private JPanel xCapButtonsPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private JPanel xCapLabelsPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private JPanel xCapValuesPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+
+ private JLabel xCapServerUriLabel = new JLabel(
+ Resources.getString("plugin.sipaccregwizz.XCAP_SERVER_URI"));
+
+ private JLabel xCapUserLabel = new JLabel(
+ Resources.getString("plugin.sipaccregwizz.XCAP_USER"));
+
+ private JLabel xCapPasswordLabel = new JLabel(
+ Resources.getString("plugin.sipaccregwizz.XCAP_PASSWORD"));
+
+ private JTextField xCapServerUriValue = new JTextField();
+
+ private JTextField xCapUserValue = new JTextField();
+
+ private JPasswordField xCapPasswordValue = new JPasswordField();
+
+ private JCheckBox xCapEnableBox = new SIPCommCheckBox(
+ Resources.getString("plugin.sipaccregwizz.XCAP_ENABLE"),
+ false);
+
+ private JCheckBox xCapUseSipCredetialsBox = new SIPCommCheckBox(
+ Resources.getString("plugin.sipaccregwizz.XCAP_USE_SIP_CREDETIALS"),
+ true);
/**
* Creates an instance of <tt>PresencePanel</tt>.
@@ -85,16 +122,54 @@ public class PresencePanel
presenceOpPanel.add(valuesPresOpPanel, BorderLayout.CENTER);
presenceOpPanel.setBorder(BorderFactory.createTitledBorder(
- Resources.getString("plugin.sipaccregwizz.PRESENCE_OPTIONS")));
+ Resources.getString("plugin.sipaccregwizz.PRESENCE_OPTIONS")));
+
+ xCapEnableBox.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ JCheckBox checkBox = (JCheckBox) evt.getSource();
+ setXCapEnableEnabled(checkBox.isSelected());
+ }
+ });
+ xCapButtonsPanel.add(xCapEnableBox);
+
+ xCapUseSipCredetialsBox.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ JCheckBox checkBox = (JCheckBox) evt.getSource();
+ setXCapUseSipCredetialsEnabled(checkBox.isSelected());
+ }
+ });
+ xCapButtonsPanel.add(xCapUseSipCredetialsBox);
+
+ setXCapEnableEnabled(xCapEnableBox.isSelected());
+
+ xCapLabelsPanel.add(xCapServerUriLabel);
+ xCapLabelsPanel.add(xCapUserLabel);
+ xCapLabelsPanel.add(xCapPasswordLabel);
+
+ xCapValuesPanel.add(xCapServerUriValue);
+ xCapValuesPanel.add(xCapUserValue);
+ xCapValuesPanel.add(xCapPasswordValue);
+
+ xCapPanel.add(xCapButtonsPanel, BorderLayout.NORTH);
+ xCapPanel.add(xCapLabelsPanel, BorderLayout.WEST);
+ xCapPanel.add(xCapValuesPanel, BorderLayout.CENTER);
+
+ xCapPanel.setBorder(BorderFactory.createTitledBorder(
+ Resources.getString("plugin.sipaccregwizz.XCAP_OPTIONS")));
this.add(presenceOpPanel, BorderLayout.NORTH);
+ this.add(xCapPanel, BorderLayout.SOUTH);
}
/**
* Enables or disable all presence related options.
*
* @param isEnabled <code>true</code> to enable the presence related
- * options, <code>false</code> - to disable them.
+ * options, <code>false</code> - to disable them.
*/
void setPresenceOptionsEnabled(boolean isEnabled)
{
@@ -104,9 +179,42 @@ public class PresencePanel
}
/**
+ * Enables or disable XCAP credetials related options.
+ *
+ * @param isEnabled <code>true</code> to enable the credetials related
+ * options, <code>false</code> - to disable them.
+ */
+ void setXCapUseSipCredetialsEnabled(boolean isEnabled)
+ {
+ xCapUserValue.setEnabled(!isEnabled);
+ xCapPasswordValue.setEnabled(!isEnabled);
+ }
+
+ /**
+ * Enables or disable XCAP related options.
+ *
+ * @param isEnabled <code>true</code> to enable the XCAP related
+ * options, <code>false</code> - to disable them.
+ */
+ void setXCapEnableEnabled(boolean isEnabled)
+ {
+ xCapUseSipCredetialsBox.setEnabled(isEnabled);
+ xCapServerUriValue.setEnabled(isEnabled);
+ if(isEnabled)
+ {
+ setXCapUseSipCredetialsEnabled(xCapUseSipCredetialsBox.isSelected());
+ }
+ else
+ {
+ setXCapUseSipCredetialsEnabled(true);
+ }
+ }
+
+ /**
* Indicates if the presence is enabled.
+ *
* @return <tt>true</tt> if the presence is enabled, <tt>false</tt> -
- * otherwise
+ * otherwise
*/
boolean isPresenceEnabled()
{
@@ -115,8 +223,9 @@ public class PresencePanel
/**
* Enables/disables the presence.
+ *
* @param isPresenceEnabled <tt>true</tt> to enable the presence,
- * <tt>false</tt> - otherwise
+ * <tt>false</tt> - otherwise
*/
void setPresenceEnabled(boolean isPresenceEnabled)
{
@@ -125,8 +234,9 @@ public class PresencePanel
/**
* Indicates if the peer-to-peer presence mode is selected.
+ *
* @return <tt>true</tt> if the peer-to-peer presence mode is selected,
- * <tt>false</tt> - otherwise.
+ * <tt>false</tt> - otherwise.
*/
boolean isForcePeerToPeerMode()
{
@@ -135,8 +245,9 @@ public class PresencePanel
/**
* Enables/disables the peer-to-peer presence mode.
+ *
* @param forceP2P <tt>true</tt> to select the peer-to-peer presence mode,
- * <tt>false</tt> - otherwise.
+ * <tt>false</tt> - otherwise.
*/
void setForcePeerToPeerMode(boolean forceP2P)
{
@@ -145,6 +256,7 @@ public class PresencePanel
/**
* Returns the poll period.
+ *
* @return the poll period
*/
String getPollPeriod()
@@ -154,6 +266,7 @@ public class PresencePanel
/**
* Sets the poll period.
+ *
* @param pollPeriod the poll period
*/
void setPollPeriod(String pollPeriod)
@@ -163,6 +276,7 @@ public class PresencePanel
/**
* Returns the subscription expiration information.
+ *
* @return the subscription expiration information
*/
String getSubscriptionExpiration()
@@ -172,10 +286,113 @@ public class PresencePanel
/**
* Sets the subscription expiration information.
+ *
* @param subscExp the subscription expiration information
*/
void setSubscriptionExpiration(String subscExp)
{
subscribeExpiresField.setText(subscExp);
}
+
+ /**
+ * Indicates if XCAP has to use its capabilities.
+ *
+ * @return <tt>true</tt> if XCAP has to use its capabilities,
+ * <tt>false</tt> - otherwise.
+ */
+ boolean isXCapEnable()
+ {
+ return xCapEnableBox.isSelected();
+ }
+
+ /**
+ * Sets if has to use its capabilities.
+ *
+ * @param xCapEnable if has to use its capabilities.
+ */
+ void setXCapEnable(boolean xCapEnable)
+ {
+ xCapEnableBox.setSelected(xCapEnable);
+ }
+
+ /**
+ * Indicates if XCAP has to use SIP account credetials.
+ *
+ * @return <tt>true</tt> if XCAP has to use SIP account credetials,
+ * <tt>false</tt> - otherwise.
+ */
+ boolean isXCapUseSipCredetials()
+ {
+ return xCapUseSipCredetialsBox.isSelected();
+ }
+
+ /**
+ * Sets if XCAP has to use SIP account credetials.
+ *
+ * @param xCapUseSipCredetials if XCAP has to use SIP account credetials.
+ */
+ void setXCapUseSipCredetials(boolean xCapUseSipCredetials)
+ {
+ xCapUseSipCredetialsBox.setSelected(xCapUseSipCredetials);
+ }
+
+ /**
+ * Gets the XCAP server uri.
+ *
+ * @return the XCAP server uri.
+ */
+ String getXCapServerUri()
+ {
+ return xCapServerUriValue.getText();
+ }
+
+ /**
+ * Sets the XCAP server uri.
+ *
+ * @param xCapServerUri the XCAP server uri.
+ */
+ void setXCapServerUri(String xCapServerUri)
+ {
+ xCapServerUriValue.setText(xCapServerUri);
+ }
+
+ /**
+ * Gets the XCAP user.
+ *
+ * @return the XCAP user.
+ */
+ String getXCapUser()
+ {
+ return xCapUserValue.getText();
+ }
+
+ /**
+ * Sets the XCAP user.
+ *
+ * @param xCapUser the XCAP user.
+ */
+ void setXCapUser(String xCapUser)
+ {
+ xCapUserValue.setText(xCapUser);
+ }
+
+ /**
+ * Gets the XCAP password.
+ *
+ * @return the XCAP password.
+ */
+ char[] getXCapPassword()
+ {
+ return xCapPasswordValue.getPassword();
+ }
+
+ /**
+ * Sets the XCAP password.
+ *
+ * @param xCapPassword the XCAP password.
+ */
+ void setXCapPassword(String xCapPassword)
+ {
+ xCapPasswordValue.setText(xCapPassword);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
index acb2bb2..4f3966d 100755
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java
@@ -10,6 +10,7 @@ package net.java.sip.communicator.plugin.sipaccregwizz;
* through the <tt>SIPAccountRegistrationWizard</tt>.
*
* @author Yana Stamcheva
+ * @author Grigorii Balutsel
*/
public class SIPAccountRegistration
{
@@ -65,6 +66,16 @@ public class SIPAccountRegistration
private String defaultDomain = null;
+ private boolean xCapEnable = false;
+
+ private boolean xCapUseSipCredetials = true;
+
+ private String xCapServerUri;
+
+ private String xCapUser;
+
+ private String xCapPassword;
+
public String getPreferredTransport()
{
return preferredTransport;
@@ -457,4 +468,104 @@ public class SIPAccountRegistration
{
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 XCAP has to use SIP account credetials.
+ *
+ * @return true if XCAP has to use SIP account credetials otherwise false.
+ */
+ public boolean isXCapUseSipCredetials()
+ {
+ return xCapUseSipCredetials;
+ }
+
+ /**
+ * Sets if XCAP has to use SIP account credetials.
+ *
+ * @param xCapUseSipCredetials if XCAP has to use SIP account credetials.
+ */
+ public void setXCapUseSipCredetials(boolean xCapUseSipCredetials)
+ {
+ this.xCapUseSipCredetials = xCapUseSipCredetials;
+ }
+
+ /**
+ * Gets the XCAP server uri.
+ *
+ * @return the XCAP server uri.
+ */
+ public String getXCapServerUri()
+ {
+ return xCapServerUri;
+ }
+
+ /**
+ * Sets the XCAP server uri.
+ *
+ * @param xCapServerUri the XCAP server uri.
+ */
+ public void setXCapServerUri(String xCapServerUri)
+ {
+ this.xCapServerUri = xCapServerUri;
+ }
+
+ /**
+ * Gets the XCAP user.
+ *
+ * @return the XCAP user.
+ */
+ public String getXCapUser()
+ {
+ return xCapUser;
+ }
+
+ /**
+ * Sets the XCAP user.
+ *
+ * @param xCapUser the XCAP user.
+ */
+ public void setXCapUser(String xCapUser)
+ {
+ this.xCapUser = xCapUser;
+ }
+
+ /**
+ * Gets the XCAP password.
+ *
+ * @return the XCAP password.
+ */
+ public String getXCapPassword()
+ {
+ return xCapPassword;
+ }
+
+ /**
+ * Sets the XCAP password.
+ *
+ * @param xCapPassword the XCAP password.
+ */
+ public void setXCapPassword(String xCapPassword)
+ {
+ this.xCapPassword = xCapPassword;
+ }
+
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
index 275a79e..b792278 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java
@@ -11,6 +11,7 @@ import net.java.sip.communicator.util.swing.*;
* The <tt>SIPAccountRegistrationForm</tt>.
*
* @author Yana Stamcheva
+ * @author Grogorii Balutsel
*/
public class SIPAccountRegistrationForm
extends TransparentPanel
@@ -237,6 +238,14 @@ public class SIPAccountRegistrationForm
SIPAccRegWizzActivator.getUIService().getAccountRegWizardContainer()
.setBackButtonEnabled(true);
+ registration.setXCapEnable(presencePanel.isXCapEnable());
+ registration.setXCapUseSipCredetials(
+ presencePanel.isXCapUseSipCredetials());
+ registration.setXCapServerUri(presencePanel.getXCapServerUri());
+ registration.setXCapUser(presencePanel.getXCapUser());
+ registration
+ .setXCapPassword(new String(presencePanel.getXCapPassword()));
+
return true;
}
@@ -294,6 +303,17 @@ public class SIPAccountRegistrationForm
String keepAliveInterval =
accountID.getAccountPropertyString("KEEP_ALIVE_INTERVAL");
+ boolean xCapEnable = accountID
+ .getAccountPropertyBoolean("XCAP_ENABLE", false);
+ boolean xCapUseSipCredetials = accountID
+ .getAccountPropertyBoolean("XCAP_USE_SIP_CREDETIALS", true);
+ String xCapServerUri =
+ accountID.getAccountPropertyString("XCAP_SERVER_URI");
+ String xCapUser =
+ accountID.getAccountPropertyString("XCAP_USER");
+ String xCapPassword =
+ accountID.getAccountPropertyString("XCAP_PASSWORD");
+
connectionPanel.setServerOverridden(
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false));
@@ -344,6 +364,14 @@ public class SIPAccountRegistrationForm
connectionPanel.setKeepAliveMethod(keepAliveMethod);
connectionPanel.setKeepAliveInterval(keepAliveInterval);
+
+ presencePanel.setXCapEnable(xCapEnable);
+ presencePanel.setXCapEnableEnabled(xCapEnable);
+ presencePanel.setXCapUseSipCredetials(xCapUseSipCredetials);
+ presencePanel.setXCapUseSipCredetialsEnabled(xCapUseSipCredetials);
+ presencePanel.setXCapServerUri(xCapServerUri);
+ presencePanel.setXCapUser(xCapUser);
+ presencePanel.setXCapPassword(xCapPassword);
}
/**
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
index 4b3786d..d04cda7 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
@@ -21,6 +21,7 @@ import org.osgi.framework.*;
* the user to create and configure a new SIP account.
*
* @author Yana Stamcheva
+ * @author Grigorii Balutsel
*/
public class SIPAccountRegistrationWizard
implements AccountRegistrationWizard
@@ -130,8 +131,8 @@ public class SIPAccountRegistrationWizard
*/
public Iterator<Map.Entry<String, String>> getSummary()
{
- Hashtable<String, String> summaryTable
- = new Hashtable<String, String>();
+ LinkedHashMap<String, String> summaryTable
+ = new LinkedHashMap<String, String>();
boolean rememberPswd = registration.isRememberPassword();
String rememberPswdString = Resources.getString(
@@ -234,6 +235,36 @@ public class SIPAccountRegistrationWizard
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL"),
registration.getKeepAliveInterval());
+ if (registration.isXCapEnable())
+ {
+ summaryTable.put(Resources.getString(
+ "plugin.sipaccregwizz.XCAP_ENABLE"),
+ Resources.getString("service.gui.YES"));
+
+ summaryTable.put(Resources.getString(
+ "plugin.sipaccregwizz.XCAP_SERVER_URI_SUMMARY"),
+ registration.getXCapServerUri());
+
+ if (registration.isXCapUseSipCredetials())
+ {
+ summaryTable.put(Resources.getString(
+ "plugin.sipaccregwizz.XCAP_USE_SIP_CREDETIALS_SUMMARY"),
+ Resources.getString("service.gui.YES"));
+ }
+ else
+ {
+ summaryTable.put(Resources.getString(
+ "plugin.sipaccregwizz.XCAP_USER_SUMMARY"),
+ registration.getXCapUser());
+ }
+ }
+ else
+ {
+ summaryTable.put(Resources.getString(
+ "plugin.sipaccregwizz.XCAP_ENABLE"),
+ Resources.getString("service.gui.NO"));
+ }
+
return summaryTable.entrySet().iterator();
}
@@ -405,6 +436,30 @@ public class SIPAccountRegistrationWizard
accountProperties.put("KEEP_ALIVE_INTERVAL",
registration.getKeepAliveInterval());
+ accountProperties.put("XCAP_ENABLE",
+ Boolean.toString(registration.isXCapEnable()));
+
+ if(registration.isXCapEnable())
+ {
+ accountProperties.put("XCAP_USE_SIP_CREDETIALS",
+ Boolean.toString(registration.isXCapUseSipCredetials()));
+ if (registration.getXCapServerUri() != null)
+ {
+ accountProperties
+ .put("XCAP_SERVER_URI", registration.getXCapServerUri());
+ }
+ if (registration.getXCapUser() != null)
+ {
+ accountProperties
+ .put("XCAP_USER", registration.getXCapUser());
+ }
+ if (registration.getXCapPassword() != null)
+ {
+ accountProperties
+ .put("XCAP_PASSWORD", registration.getXCapPassword());
+ }
+ }
+
if(isModification)
{
accountProperties.put(ProtocolProviderFactory.USER_ID, userName);