Create SIP2SIP info account.

Enhanced SIP account registration form.
cusax-fix
Yana Stamcheva 16 years ago
parent e3b1ad47aa
commit 8a5aed7f39

@ -912,7 +912,8 @@
bundle-plugin-facebookaccregwizz,
bundle-bouncycastle,bundle-plugin-otr,bundle-plugin-iptelaccregwizz,
bundle-contactsource,bundle-plugin-reconnect,
bundle-plugin-securityconfig,bundle-plugin-advancedconfig"/>
bundle-plugin-securityconfig,bundle-plugin-advancedconfig,
bundle-plugin-sip2sipaccregwizz"/>
<!--BUNDLE-SC-LAUNCHER-->
<target name="bundle-sc-launcher">
@ -1569,6 +1570,16 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
<!-- BUNDLE-PLUGIN-SIP2SIPACCREGWIZZ -->
<target name="bundle-plugin-sip2sipaccregwizz">
<!-- Creates a bundle for the plugin Sip2Sip Account Registration Wizard.-->
<jar compress="false" destfile="${bundles.dest}/sip2sipaccregwizz.jar"
manifest="${src}/net/java/sip/communicator/plugin/sip2sipaccregwizz/sip2sipaccregwizz.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/plugin/sip2sipaccregwizz"
prefix="net/java/sip/communicator/plugin/sip2sipaccregwizz"/>
</jar>
</target>
<!-- BUNDLE-PLUGIN-GIBBERISHACCREGWIZZ -->
<target name="bundle-plugin-gibberishaccregwizz">
<!-- Creates a bundle for the plugin Gibberish Account Registration

@ -111,7 +111,6 @@ felix.auto.start.67= \
reference:file:sc-bundles/icqaccregwizz.jar \
reference:file:sc-bundles/aimaccregwizz.jar \
reference:file:sc-bundles/sipaccregwizz.jar \
reference:file:sc-bundles/iptelaccregwizz.jar \
reference:file:sc-bundles/jabberaccregwizz.jar \
reference:file:sc-bundles/googletalkaccregwizz.jar \
reference:file:sc-bundles/msnaccregwizz.jar \
@ -137,7 +136,9 @@ felix.auto.start.67= \
felix.auto.start.70= \
reference:file:sc-bundles/simpleaccreg.jar \
reference:file:sc-bundles/securityconfig.jar
reference:file:sc-bundles/securityconfig.jar \
reference:file:sc-bundles/iptelaccregwizz.jar \
reference:file:sc-bundles/sip2sipaccregwizz.jar
felix.auto.start.75= \
reference:file:sc-bundles/argdelegation.jar

@ -359,6 +359,10 @@ service.protocol.googletalk.GTALK_64x64=resources/images/protocol/googletalk/log
service.protocol.iptel.IPTEL_16x16=resources/images/protocol/iptel/sip16x16.png
service.protocol.iptel.IPTEL_64x64=resources/images/protocol/iptel/sip64x64.png
# sip2sip accregwizz
service.protocol.sip2sip.SIP2SIP_16x16=resources/images/protocol/sip2sip/sip16x16.png
service.protocol.sip2sip.SIP2SIP_64x64=resources/images/protocol/sip2sip/sip64x64.png
# facebook accregwizz
service.protocol.facebook.FACEBOOK_16x16=resources/images/protocol/facebook/facebook-online.png
service.protocol.facebook.FACEBOOK_32x32=resources/images/protocol/facebook/facebook32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

@ -112,6 +112,7 @@ service.gui.COMPARE_WITH_PARTNER=Compare with partner and click the padlock to c
# keep the following string short
service.gui.COMPARE_WITH_PARTNER_SHORT=Compare with partner: {0}
service.gui.CONNECTING=Connecting...
service.gui.CONNECTION=Connection
service.gui.CONNECTION_FAILED_MSG=Connection failed for the following account: User name: {0}, Server name: {1}. Please check your network connection or contact your network administrator for more information.
service.gui.CONNECTION_EXPIRED_MSG=You are currently disconnected from the {0} server.
service.gui.CONTACT_NAME=Contact name
@ -301,6 +302,7 @@ service.gui.OR_ENTER_PHONE_NUMBER=Or enter phone number here...
service.gui.OWNER=owner of the room
service.gui.PASSWORD=Password
service.gui.PASTE=&Paste
service.gui.PRESENCE=Presence
service.gui.PRESS_ENTER_FOR_SUGGESTIONS='Enter' for suggestions
service.gui.PREVIOUS=Previous
service.gui.PREVIOUS_TOOLTIP=Browse older conversations
@ -799,6 +801,12 @@ plugin.iptelaccregwizz.PROTOCOL_DESCRIPTION=iptel.org, the IP Telecommunications
plugin.iptelaccregwizz.USERNAME=Username
plugin.iptelaccregwizz.NEW_ACCOUNT_TITLE=Subscribe to iptel.org
# sip2sip accregwizz
plugin.sip2sipaccregwizz.PROTOCOL_NAME=sip2sip.info
plugin.sip2sipaccregwizz.PROTOCOL_DESCRIPTION=VoIP and chat
plugin.sip2sipaccregwizz.USERNAME=Username
plugin.sip2sipaccregwizz.NEW_ACCOUNT_TITLE=Subscribe to sip2sip.info
# key binding chooser
plugin.keybindings.CHAT_CLOSE=Close Chat Window
plugin.keybindings.CHAT_COPY=Copy

@ -185,7 +185,6 @@ public void registerWizardPage(Object id, WizardPage page)
{
// Add the incoming panel to our JPanel display that is managed by
// the CardLayout layout manager.
Object wizardForm = page.getWizardForm();
if (wizardForm instanceof Component)
cardPanel.add((Component) wizardForm, id);

@ -1,735 +0,0 @@
/*
* SIP Communicator, 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.iptelaccregwizz;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
* and the password of the account.
*
* @author Yana Stamcheva
*/
@SuppressWarnings("serial")
public class FirstWizardPage
extends TransparentPanel
implements WizardPage, DocumentListener, ItemListener
{
private static final Logger logger
= Logger.getLogger(FirstWizardPage.class);
/**
* The identifier of this wizard page.
*/
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
/**
* The example text that guides the user for the format of the username.
*/
public static final String USER_NAME_EXAMPLE
= "Ex: myusername or myusername@iptel.org";
private JPanel firstTabPanel = new TransparentPanel(new BorderLayout());
private JPanel uinPassPanel = new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new TransparentPanel();
private JPanel valuesPanel = new TransparentPanel();
private JLabel uinLabel
= new JLabel(Resources.getString("plugin.iptelaccregwizz.USERNAME"));
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
private JPanel emptyPanel = new TransparentPanel();
private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
private JTextField userIDField = new JTextField();
private JPasswordField passField = new JPasswordField();
private JCheckBox rememberPassBox =
new SIPCommCheckBox(
Resources.getString("service.gui.REMEMBER_PASSWORD"));
private JPanel advancedOpPanel
= new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsAdvOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel valuesAdvOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JLabel serverLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.REGISTRAR"));
private JCheckBox enableDefaultEncryption =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"), true);
private JCheckBox enableSipZrtpAttribute =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"), true);
private JLabel proxyLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY"));
private JLabel authNameLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.AUTH_NAME"));
private JLabel serverPortLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.SERVER_PORT"));
private JLabel proxyPortLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY_PORT"));
private JLabel transportLabel =
new JLabel(Resources.getString(
"plugin.sipaccregwizz.PREFERRED_TRANSPORT"));
private JTextField serverField = new JTextField();
private JTextField proxyField = new JTextField();
private JTextField authNameField = new JTextField();
private JTextField serverPortField
= new JTextField(IptelAccountRegistration.DEFAULT_PORT);
private JTextField proxyPortField
= new JTextField(IptelAccountRegistration.DEFAULT_PORT);
private JComboBox transportCombo = new JComboBox(new Object[]
{ "UDP", "TCP", "TLS" });
private JPanel presenceOpPanel
= new TransparentPanel(new BorderLayout(10, 10));
private JPanel buttonsPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel labelsPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel valuesPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JCheckBox enablePresOpButton =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_PRESENCE"), true);
private JCheckBox forceP2PPresOpButton =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"), false);
private JLabel pollPeriodLabel = new JLabel(
Resources.getString(
"plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
private JLabel subscribeExpiresLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
private JTextField pollPeriodField
= new JTextField(IptelAccountRegistration.DEFAULT_POLL_PERIOD);
private JTextField subscribeExpiresField =
new JTextField(IptelAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
private JPanel keepAlivePanel
= new TransparentPanel(new BorderLayout(10, 10));
private JPanel keepAliveLabels
= new TransparentPanel(new GridLayout(0, 1, 5, 5));
private JPanel keepAliveValues
= new TransparentPanel(new GridLayout(0, 1, 5, 5));
private JLabel keepAliveMethodLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_METHOD"));
private JLabel keepAliveIntervalLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL"));
private JLabel keepAliveIntervalExampleLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL_INFO"));
private JComboBox keepAliveMethodBox
= new JComboBox(new Object []
{
"REGISTER",
"OPTIONS"
});
private JTextField keepAliveIntervalValue = new JTextField();
private JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false);
private JPanel advancedPanel = new TransparentPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
private IptelAccountRegistrationWizard wizard;
private boolean isCommitted = false;
private boolean isServerOverridden = false;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
* @param wizard the parent wizard
*/
public FirstWizardPage(IptelAccountRegistrationWizard wizard)
{
super(new BorderLayout());
this.wizard = wizard;
advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));
this.init();
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.labelsPanel
.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
this.valuesPanel
.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
private void init()
{
this.labelsPanel.setOpaque(false);
this.valuesPanel.setOpaque(false);
this.uinPassPanel.setOpaque(false);
this.emptyPanel.setOpaque(false);
this.userIDField.getDocument().addDocumentListener(this);
this.transportCombo.addItemListener(this);
this.rememberPassBox.setSelected(true);
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8,
0));
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
valuesPanel.add(userIDField);
valuesPanel.add(uinExampleLabel);
valuesPanel.add(passField);
uinPassPanel.add(labelsPanel, BorderLayout.WEST);
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
TransparentPanel southPanel
= new TransparentPanel(new GridLayout(1, 2));
southPanel.add(rememberPassBox);
southPanel.add(createSubscribeLabel());
uinPassPanel.add(southPanel, BorderLayout.SOUTH);
uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.sipaccregwizz.USERNAME_AND_PASSWORD")));
firstTabPanel.add(uinPassPanel, BorderLayout.NORTH);
tabbedPane.addTab( Resources.getString("service.gui.SUMMARY"),
firstTabPanel);
transportCombo
.setSelectedItem(IptelAccountRegistration.DEFAULT_TRANSPORT);
labelsAdvOpPanel.add(serverLabel);
labelsAdvOpPanel.add(authNameLabel);
labelsAdvOpPanel.add(serverPortLabel);
labelsAdvOpPanel.add(proxyLabel);
labelsAdvOpPanel.add(proxyPortLabel);
labelsAdvOpPanel.add(transportLabel);
valuesAdvOpPanel.add(serverField);
valuesAdvOpPanel.add(authNameField);
valuesAdvOpPanel.add(serverPortField);
valuesAdvOpPanel.add(proxyField);
valuesAdvOpPanel.add(proxyPortField);
valuesAdvOpPanel.add(transportCombo);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
JPanel encryptionPanel = new TransparentPanel(new GridLayout(1, 2, 2, 2));
encryptionPanel.add(enableDefaultEncryption, BorderLayout.WEST);
encryptionPanel.add(enableSipZrtpAttribute, BorderLayout.EAST);
enableDefaultEncryption.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
enableSipZrtpAttribute.setEnabled(cb.isSelected());
}
});
advancedOpPanel.add(encryptionPanel, BorderLayout.SOUTH);
advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.aimaccregwizz.ADVANCED_OPTIONS")));
advancedPanel.add(advancedOpPanel);
enablePresOpButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
setPresenceOptionsEnabled(cb.isSelected());
}
});
labelsPresOpPanel.add(pollPeriodLabel);
labelsPresOpPanel.add(subscribeExpiresLabel);
valuesPresOpPanel.add(pollPeriodField);
valuesPresOpPanel.add(subscribeExpiresField);
buttonsPresOpPanel.add(enablePresOpButton);
buttonsPresOpPanel.add(forceP2PPresOpButton);
presenceOpPanel.add(buttonsPresOpPanel, BorderLayout.NORTH);
presenceOpPanel.add(labelsPresOpPanel, BorderLayout.WEST);
presenceOpPanel.add(valuesPresOpPanel, BorderLayout.CENTER);
presenceOpPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.sipaccregwizz.PRESENCE_OPTIONS")));
advancedPanel.add(presenceOpPanel);
JPanel emptyLabelPanel = new TransparentPanel();
emptyLabelPanel.setMaximumSize(new Dimension(40, 35));
keepAliveLabels.add(keepAliveMethodLabel);
keepAliveLabels.add(keepAliveIntervalLabel);
keepAliveLabels.add(emptyLabelPanel);
this.keepAliveIntervalExampleLabel.setForeground(Color.GRAY);
this.keepAliveIntervalExampleLabel
.setFont(uinExampleLabel.getFont().deriveFont(8));
this.keepAliveIntervalExampleLabel
.setMaximumSize(new Dimension(40, 35));
this.keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
keepAliveIntervalValue
.setText(IptelAccountRegistration.DEFAULT_KEEP_ALIVE_INTERVAL);
keepAliveMethodBox.setSelectedItem(
IptelAccountRegistration.DEFAULT_KEEP_ALIVE_METHOD);
keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel);
keepAlivePanel.add(keepAliveLabels, BorderLayout.WEST);
keepAlivePanel.add(keepAliveValues, BorderLayout.CENTER);
keepAlivePanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE")));
advancedPanel.add(keepAlivePanel);
tabbedPane.addTab(
Resources.getString("service.gui.ADVANCED"),
advancedPanel);
this.add(tabbedPane, BorderLayout.NORTH);
}
/**
* Creates the subscribe label.
* @return the newly created subscribe label
*/
private Component createSubscribeLabel()
{
JLabel subscribeLabel =
new JLabel("<html><a href=''>"
+ Resources.getString("plugin.iptelaccregwizz.NEW_ACCOUNT_TITLE")
+ "</a></html>",
JLabel.RIGHT);
subscribeLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
subscribeLabel.setToolTipText(
Resources.getString("plugin.simpleaccregwizz.SPECIAL_SIGNUP"));
subscribeLabel.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
try
{
wizard.webSignup();
}
catch (UnsupportedOperationException ex)
{
// This should not happen, because we check if the
// operation is supported, before adding the sign
// up.
logger.error("The web sign up is not supported.",
ex);
}
}
});
return subscribeLabel;
}
/**
* Implements the <code>WizardPage.getIdentifier</code> to return this
* page identifier.
* @return the identifier of this page
*/
public Object getIdentifier()
{
return FIRST_PAGE_IDENTIFIER;
}
/**
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
* @return the next page identifier
*/
public Object getNextPageIdentifier()
{
return nextPageIdentifier;
}
/**
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the back identifier. In this case it's null because this is the first
* wizard page.
* @return the identifier of the previous wizard page
*/
public Object getBackPageIdentifier()
{
return null;
}
/**
* Implements the <code>WizardPage.getWizardForm</code> to return this
* panel.
* @return the wizard form
*/
public Object getWizardForm()
{
return this;
}
/**
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UIN field is empty.
*/
public void pageShowing()
{
this.setNextButtonAccordingToUIN();
wizard.getWizardContainer().setBackButtonEnabled(false);
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
public void commitPage()
{
String uin = userIDField.getText();
int indexOfSeparator = uin.indexOf('@');
if (indexOfSeparator > -1) {
uin = uin.substring(0, indexOfSeparator);
}
IptelAccountRegistration registration = wizard.getRegistration();
String userID = userIDField.getText();
if(userID == null || userID.trim().length() == 0)
throw new IllegalStateException("No user ID provided.");
registration.setUserID(userID);
if (passField.getPassword() != null)
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
if (serverField.getText() != null && serverField.getText().length() > 0)
registration.setServerAddress(serverField.getText());
String authName = authNameField.getText();
if(authName != null && authName.length() > 0)
registration.setAuthorizationName(authName);
registration.setServerPort(serverPortField.getText());
registration.setProxy(proxyField.getText());
registration.setProxyPort(proxyPortField.getText());
registration.setPreferredTransport(transportCombo.getSelectedItem()
.toString());
registration.setEnablePresence(enablePresOpButton.isSelected());
registration.setForceP2PMode(forceP2PPresOpButton.isSelected());
registration.setDefaultEncryption(enableDefaultEncryption.isSelected());
registration.setSipZrtpAttribute(enableSipZrtpAttribute.isSelected());
registration.setPollingPeriod(pollPeriodField.getText());
registration.setSubscriptionExpiration(subscribeExpiresField
.getText());
registration.setKeepAliveMethod(
keepAliveMethodBox.getSelectedItem().toString());
registration.setKeepAliveInterval(keepAliveIntervalValue.getText());
wizard.getWizardContainer().setBackButtonEnabled(true);
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
this.isCommitted = true;
}
/**
* Enables or disables the "Next" wizard button according to whether the UIN
* field is empty.
*/
private void setNextButtonAccordingToUIN()
{
if (userIDField.getText() == null || userIDField.getText().equals(""))
{
wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
* field. Enables or disables the "Next" wizard button according to whether
* the UIN field is empty.
* @param e the <tt>DocumentEvent</tt> that notified us
*/
public void insertUpdate(DocumentEvent e)
{
this.setNextButtonAccordingToUIN();
this.setServerFieldAccordingToUIN();
}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user deletes letters
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
* @param e the <tt>DocumentEvent</tt>
*/
public void removeUpdate(DocumentEvent e)
{
this.setNextButtonAccordingToUIN();
this.setServerFieldAccordingToUIN();
}
public void changedUpdate(DocumentEvent e) {}
public void pageHiding() {}
public void pageShown() {}
public void pageBack() {}
/**
* Fills the UIN and Password fields in this panel with the data coming from
* the given protocolProvider.
*
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load
* the data from.
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
String password = accountID.getAccountPropertyString(
ProtocolProviderFactory.PASSWORD);
String serverAddress = accountID.getAccountPropertyString(
ProtocolProviderFactory.SERVER_ADDRESS);
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);
boolean enabledDefaultEncryption = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
boolean enabledSipZrtpAttribute = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true);
String pollingPeriod = accountID.getAccountPropertyString(
ProtocolProviderFactory.POLLING_PERIOD);
String subscriptionPeriod = accountID.getAccountPropertyString(
ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
String keepAliveMethod =
accountID.getAccountPropertyString("KEEP_ALIVE_METHOD");
String keepAliveInterval =
accountID.getAccountPropertyString("KEEP_ALIVE_INTERVAL");
this.isServerOverridden = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
userIDField.setEnabled(false);
this.userIDField.setText((serverAddress == null) ? accountID.getUserID()
: (accountID.getUserID() + "@" + serverAddress));
if (password != null)
{
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
serverField.setText(serverAddress);
serverField.setEnabled(false);
if(authName != null && authName.length() > 0)
authNameField.setText(authName);
serverPortField.setText(serverPort);
proxyField.setText(proxyAddress);
// The order of the next two fields is important, as a change listener
// of the transportCombo sets the proxyPortField to its default
transportCombo.setSelectedItem(preferredTransport);
proxyPortField.setText(proxyPort);
enablePresOpButton.setSelected(enablePresence);
forceP2PPresOpButton.setSelected(forceP2P);
enableDefaultEncryption.setSelected(enabledDefaultEncryption);
enableSipZrtpAttribute.setSelected(enabledSipZrtpAttribute);
enableSipZrtpAttribute.setEnabled(enabledDefaultEncryption);
pollPeriodField.setText(pollingPeriod);
subscribeExpiresField.setText(subscriptionPeriod);
if (!enablePresence)
{
setPresenceOptionsEnabled(enablePresence);
}
keepAliveMethodBox.setSelectedItem(keepAliveMethod);
keepAliveIntervalValue.setText(keepAliveInterval);
}
/**
* Parse the server part from the sip id and set it to server as default
* value. If Advanced option is enabled Do nothing.
*/
private void setServerFieldAccordingToUIN()
{
String serverAddress
= wizard.getServerFromUserName(userIDField.getText());
if (!wizard.isModification() || !isServerOverridden)
{
serverField.setText(serverAddress);
proxyField.setText(serverAddress);
}
}
/**
* Enables or disable all presence related options.
*
* @param isEnabled <code>true</code> to enable the presence related
* options, <code>false</code> - to disable them.
*/
private void setPresenceOptionsEnabled(boolean isEnabled)
{
forceP2PPresOpButton.setEnabled(isEnabled);
pollPeriodField.setEnabled(isEnabled);
subscribeExpiresField.setEnabled(isEnabled);
}
/**
* Sets the proxy and server ports depending on the selected transport type.
* @param e the <tt>ItemEvent</tt> that notified us
*/
public void itemStateChanged(ItemEvent e)
{
if (e.getStateChange() == ItemEvent.SELECTED
&& e.getItem().equals("TLS"))
{
serverPortField.setText(IptelAccountRegistration.DEFAULT_TLS_PORT);
proxyPortField.setText(IptelAccountRegistration.DEFAULT_TLS_PORT);
}
else
{
serverPortField.setText(IptelAccountRegistration.DEFAULT_PORT);
proxyPortField.setText(IptelAccountRegistration.DEFAULT_PORT);
}
}
/**
* Returns the simple form shown by default.
* @return the simple form shown by default
*/
public Object getSimpleForm()
{
return uinPassPanel;
}
/**
* Returns <tt>true</tt> if the form is committed, <tt>false</tt> -
* otherwise.
* @return <tt>true</tt> if the form is committed, <tt>false</tt> -
* otherwise
*/
public boolean isCommitted()
{
return isCommitted;
}
}

@ -13,6 +13,7 @@
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
/**
@ -30,6 +31,8 @@ public class IptelAccRegWizzActivator
private static BrowserLauncherService browserLauncherService;
private static ResourceManagementService resourcesService;
private static UIService uiService;
/**
@ -99,23 +102,34 @@ public static UIService getUIService()
{
return uiService;
}
/**
* Returns the <tt>BrowserLauncherService</tt> obtained from the bundle
* context.
* @return the <tt>BrowserLauncherService</tt> obtained from the bundle
* context
*/
public static BrowserLauncherService getBrowserLauncher() {
public static BrowserLauncherService getBrowserLauncher()
{
if (browserLauncherService == null)
{
browserLauncherService =
(BrowserLauncherService) bundleContext
.getService(bundleContext
.getServiceReference(BrowserLauncherService.class
.getName()));
browserLauncherService
= (BrowserLauncherService) bundleContext.getService(
bundleContext.getServiceReference(
BrowserLauncherService.class.getName()));
}
return browserLauncherService;
}
/**
* Returns the service giving access to resources.
* @return the service giving access to resources
*/
public static ResourceManagementService getResources()
{
if (resourcesService == null)
resourcesService = ResourceManagementServiceUtils
.getService(IptelAccRegWizzActivator.bundleContext);
return resourcesService;
}
}

@ -1,433 +0,0 @@
/*
* SIP Communicator, 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.iptelaccregwizz;
/**
* The <tt>IptelAccountRegistration</tt> is used to store all user input data
* through the <tt>IptelAccountRegistrationWizard</tt>.
*
* @author Yana Stamcheva
*/
public class IptelAccountRegistration
{
/**
* The default port.
*/
public static String DEFAULT_PORT = "5060";
/**
* The default TLS port.
*/
public static String DEFAULT_TLS_PORT = "5061";
/**
* The default transport.
*/
public static String DEFAULT_TRANSPORT = "TCP";
/**
* The default poll period.
*/
public static String DEFAULT_POLL_PERIOD = "30";
/**
* The default subscribe expiration time in milliseconds.
*/
public static String DEFAULT_SUBSCRIBE_EXPIRES = "3600";
/**
* The default keep alive method.
*/
public static String DEFAULT_KEEP_ALIVE_METHOD = "REGISTER";
/**
* The default keep alive interval.
*/
public static String DEFAULT_KEEP_ALIVE_INTERVAL = "25";
/**
* The iptel.org default server address.
*/
static final String IPTEL_CONNECT_SRV = "iptel.org";
private String id;
private String password;
private boolean rememberPassword = true;
private String serverAddress = IPTEL_CONNECT_SRV;
private String authorizationName;
private String serverPort = DEFAULT_PORT;
private String proxyPort = DEFAULT_PORT;
private String proxy;
private String preferredTransport = DEFAULT_TRANSPORT;
private boolean enablePresence = true;
private boolean forceP2PMode = false;
private boolean defaultEncryption = false;
private boolean sipZrtpAttribute = false;
private String pollingPeriod = DEFAULT_POLL_PERIOD;
private String subscriptionExpiration = DEFAULT_SUBSCRIBE_EXPIRES;
private String keepAliveMethod = DEFAULT_KEEP_ALIVE_METHOD;
private String keepAliveInterval = DEFAULT_KEEP_ALIVE_INTERVAL;
/**
* Returns the preferred transport to use.
* @return the preferred transport to use
*/
public String getPreferredTransport()
{
return preferredTransport;
}
/**
* Sets the preferred transport to use.
* @param preferredTransport the transport to set
*/
public void setPreferredTransport(String preferredTransport)
{
this.preferredTransport = preferredTransport;
}
/**
* Returns the proxy.
* @return the proxy
*/
public String getProxy()
{
return proxy;
}
/**
* Sets the proxy
* @param proxy the proxy to set
*/
public void setProxy(String proxy)
{
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;
}
/**
* Returns the UIN of the sip registration account.
*
* @return the UIN of the sip registration account.
*/
public String getId()
{
String serverAddress = getServerAddress();
return
((id != null)
&& (id.indexOf('@') < 0)
&& ((serverAddress == null)
|| serverAddress.equals(IPTEL_CONNECT_SRV)))
? (id + '@' + IPTEL_CONNECT_SRV)
: id;
}
/**
* 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 authorization name
*
* @return String auth name
*/
public String getAuthorizationName()
{
return authorizationName;
}
/**
* The port on the specified proxy
*
* @return int
*/
public String getProxyPort()
{
return proxyPort;
}
/**
* 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 the server
*
* @param serverAddress String
*/
public void setServerAddress(String serverAddress)
{
this.serverAddress = serverAddress;
}
/**
* Sets the server port.
*
* @param port int
*/
public void setServerPort(String port)
{
this.serverPort = port;
}
/**
* Sets authorization name.
*
* @param authName String
*/
public void setAuthorizationName(String authName)
{
this.authorizationName = authName;
}
/**
* Sets the proxy port.
*
* @param port int
*/
public void setProxyPort(String port)
{
this.proxyPort = 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;
}
/**
* If default call encryption is enabled
*
* @return If default call encryption is enabled
*/
public boolean isDefaultEncryption()
{
return defaultEncryption;
}
/**
* Sets default call encryption
*
* @param defaultEncryption if we want to set call encryption on as default
*/
public void setDefaultEncryption(boolean defaultEncryption)
{
this.defaultEncryption = defaultEncryption;
}
/**
* Sets SIP ZRTP attribute support
*
* @param sipZrtpAttribute include the ZRTP attribute to SIP/SDP
*/
public void setSipZrtpAttribute(boolean sipZrtpAttribute) {
this.sipZrtpAttribute = sipZrtpAttribute;
}
/**
* Check if to include the ZRTP attribute to SIP/SDP
*
* @return include the ZRTP attribute to SIP/SDP
*/
public boolean isSipZrtpAttribute() {
return sipZrtpAttribute;
}
}

@ -6,73 +6,43 @@
*/
package net.java.sip.communicator.plugin.iptelaccregwizz;
import java.awt.*;
import java.util.*;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
* The <tt>IPPIAccountRegistrationWizard</tt> is an implementation of the
* The <tt>IptelAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the SIP protocol. It should allow
* the user to create and configure a new SIP account.
*
* @author Yana Stamcheva
*/
public class IptelAccountRegistrationWizard
implements AccountRegistrationWizard
extends SIPAccountRegistrationWizard
{
/**
* The protocol name.
*/
public static final String PROTOCOL = "iptel.org";
/**
* The first wizard page.
*/
private FirstWizardPage firstWizardPage;
/**
* Account registration instance holding the data.
* A constant pointing to the IP Tel protocol logo image.
*/
private IptelAccountRegistration registration
= new IptelAccountRegistration();
private static final String PROTOCOL_ICON
= "service.protocol.iptel.IPTEL_16x16";
/**
* The container.
* A constant pointing to the IP Tel protocol wizard page image.
*/
private final WizardContainer wizardContainer;
private static final String PAGE_IMAGE
= "service.protocol.iptel.IPTEL_64x64";
/**
* The protocol provider.
*/
private ProtocolProviderService protocolProvider;
/**
* Is current wizard run as modification of an existing account.
*/
private boolean isModification;
/**
* The logger.
* The protocol name.
*/
private static final Logger logger
= Logger.getLogger(IptelAccountRegistrationWizard.class);
public static final String PROTOCOL = "iptel.org";
/**
* Creates an instance of <tt>IPPIAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container, where this wizard
* is added
* Creates an instance of <tt>IptelAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container
*/
public IptelAccountRegistrationWizard(WizardContainer wizardContainer)
{
this.wizardContainer = wizardContainer;
this.wizardContainer.setFinishButtonText(
Resources.getString("service.gui.SIGN_IN"));
super(wizardContainer);
}
/**
@ -82,7 +52,8 @@ public IptelAccountRegistrationWizard(WizardContainer wizardContainer)
*/
public byte[] getIcon()
{
return Resources.getImage(Resources.PROTOCOL_ICON);
return IptelAccRegWizzActivator.getResources()
.getImageInBytes(PROTOCOL_ICON);
}
/**
@ -93,7 +64,8 @@ public byte[] getIcon()
*/
public byte[] getPageImage()
{
return Resources.getImage(Resources.PAGE_IMAGE);
return IptelAccRegWizzActivator.getResources()
.getImageInBytes(PAGE_IMAGE);
}
@ -104,7 +76,8 @@ public byte[] getPageImage()
*/
public String getProtocolName()
{
return Resources.getString("plugin.iptelaccregwizz.PROTOCOL_NAME");
return Resources.getString(
"plugin.iptelaccregwizz.PROTOCOL_NAME");
}
/**
@ -114,393 +87,8 @@ public String getProtocolName()
*/
public String getProtocolDescription()
{
return Resources.getString("plugin.iptelaccregwizz.PROTOCOL_DESCRIPTION");
}
/**
* Returns the set of pages contained in this wizard.
* @return Iterator
*/
public Iterator<WizardPage> getPages() {
java.util.List<WizardPage> pages = new ArrayList<WizardPage>();
firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
return pages.iterator();
}
/**
* Returns the set of data that user has entered through this wizard.
* @return Iterator
*/
public Iterator<Map.Entry<String, String>> getSummary()
{
Hashtable<String, String> summaryTable
= new Hashtable<String, String>();
boolean rememberPswd = registration.isRememberPassword();
String rememberPswdString = Resources.getString(
rememberPswd ? "service.gui.YES" : "service.gui.NO");
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.USERNAME"),
registration.getId());
summaryTable.put(
Resources.getString("service.gui.REMEMBER_PASSWORD"),
rememberPswdString);
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.REGISTRAR"),
registration.getServerAddress());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.AUTH_NAME"),
registration.getAuthorizationName());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.SERVER_PORT"),
registration.getServerPort());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.PROXY"),
registration.getProxy());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.PROXY_PORT"),
registration.getProxyPort());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.PREFERRED_TRANSPORT"),
registration.getPreferredTransport());
if (registration.isEnablePresence())
{
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.ENABLE_PRESENCE"),
Resources.getString("service.gui.YES"));
}
else
{
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.ENABLE_PRESENCE"),
Resources.getString("service.gui.NO"));
}
if (registration.isForceP2PMode())
{
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"),
Resources.getString("service.gui.YES"));
}
else
{
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"),
Resources.getString("service.gui.NO"));
}
if (registration.isDefaultEncryption())
{
summaryTable.put(Resources.getString(
"plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"),
Resources.getString("service.gui.YES"));
}
else
{
summaryTable.put(Resources.getString(
"plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"),
Resources.getString("service.gui.NO"));
}
if (registration.isSipZrtpAttribute())
{
summaryTable.put(Resources.getString(
"plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"),
Resources.getString("service.gui.YES"));
}
else
{
summaryTable.put(Resources.getString(
"plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"),
Resources.getString("service.gui.NO"));
}
summaryTable.put(Resources.getString(
"plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"),
registration.getPollingPeriod());
summaryTable.put(Resources.getString(
"plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"),
registration.getSubscriptionExpiration());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_METHOD"),
registration.getKeepAliveMethod());
summaryTable.put(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL"),
registration.getKeepAliveInterval());
return summaryTable.entrySet().iterator();
}
/**
* Installs the account created through this wizard.
* @return the created <tt>ProtocolProviderService</tt>
* @throws OperationFailedException if the sign in operation fails
*/
public ProtocolProviderService signin()
throws OperationFailedException
{
firstWizardPage.commitPage();
return signin(registration.getId(), registration.getPassword());
}
/**
* Installs the account with the given user name and password.
* @param username the username to sign in with
* @param password the password used for login
* @return the <tt>ProtocolProviderService</tt> corresponding to the newly
* created account.
* @throws OperationFailedException if the sign in operation fails
*/
public ProtocolProviderService signin(String username, String password)
throws OperationFailedException
{
ProtocolProviderFactory factory
= IptelAccRegWizzActivator.getIptelProtocolProviderFactory();
ProtocolProviderService pps = null;
if (factory != null)
pps = this.installAccount( factory,
username,
password);
return pps;
}
/**
* Creates an account for the given user and password.
*
* @param providerFactory the ProtocolProviderFactory which will create
* the account
* @param userName the user identifier
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
* @throws OperationFailedException if the install account operation fails
*/
private ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String userName,
String passwd)
throws OperationFailedException
{
Hashtable<String, String> accountProperties
= new Hashtable<String, String>();
/* Make the account use the resources specific to iptel.org. */
accountProperties.put(ProtocolProviderFactory.PROTOCOL, PROTOCOL);
accountProperties
.put(ProtocolProviderFactory.PROTOCOL_ICON_PATH,
"resources/images/protocol/iptel");
accountProperties.put(ProtocolProviderFactory.ACCOUNT_ICON_PATH,
"resources/images/protocol/iptel/sip32x32.png");
if(registration.isRememberPassword())
{
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
String serverAddress = null;
if (registration.getServerAddress() != null)
serverAddress = registration.getServerAddress();
else
serverAddress = getServerFromUserName(userName);
if (serverAddress != null)
{
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
serverAddress);
if (userName.indexOf(serverAddress) < 0)
accountProperties.put(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
Boolean.toString(true));
}
if(registration.getAuthorizationName() != null)
accountProperties.put(ProtocolProviderFactory.AUTHORIZATION_NAME,
registration.getAuthorizationName());
accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
registration.getServerPort());
String proxyAddress = null;
if (registration.getProxy() != null)
proxyAddress = registration.getProxy();
else
proxyAddress = getServerFromUserName(userName);
if (proxyAddress != null)
accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
proxyAddress);
accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
registration.getProxyPort());
accountProperties.put(ProtocolProviderFactory.PREFERRED_TRANSPORT,
registration.getPreferredTransport());
accountProperties.put(ProtocolProviderFactory.IS_PRESENCE_ENABLED,
Boolean.toString(registration.isEnablePresence()));
accountProperties.put(ProtocolProviderFactory.FORCE_P2P_MODE,
Boolean.toString(registration.isForceP2PMode()));
accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,
Boolean.toString(registration.isDefaultEncryption()));
accountProperties.put(ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE,
Boolean.toString(registration.isSipZrtpAttribute()));
accountProperties.put(ProtocolProviderFactory.POLLING_PERIOD,
registration.getPollingPeriod());
accountProperties.put(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION,
registration.getSubscriptionExpiration());
accountProperties.put("KEEP_ALIVE_METHOD",
registration.getKeepAliveMethod());
accountProperties.put("KEEP_ALIVE_INTERVAL",
registration.getKeepAliveInterval());
if(isModification)
{
accountProperties.put(ProtocolProviderFactory.USER_ID, userName);
providerFactory.modifyAccount( protocolProvider,
accountProperties);
this.isModification = false;
return protocolProvider;
}
try
{
AccountID accountID = providerFactory.installAccount(
userName, accountProperties);
ServiceReference serRef = providerFactory
.getProviderForAccount(accountID);
protocolProvider
= (ProtocolProviderService) IptelAccRegWizzActivator
.bundleContext.getService(serRef);
}
catch (IllegalStateException exc)
{
logger.warn(exc.getMessage());
throw new OperationFailedException(
"Account already exists.",
OperationFailedException.IDENTIFICATION_CONFLICT);
}
catch (Exception exc)
{
exc.printStackTrace();
throw new OperationFailedException(
exc.getMessage(),
OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
}
/**
* Fills the id and Password fields in this panel with the data coming
* from the given protocolProvider.
* @param protocolProvider The <tt>ProtocolProviderService</tt> to load the
* data from.
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
this.isModification = true;
this.protocolProvider = protocolProvider;
this.registration = new IptelAccountRegistration();
this.firstWizardPage.loadAccount(protocolProvider);
}
/**
* Indicates if this wizard is opened for modification or for creating a
* new account.
*
* @return <code>true</code> if this wizard is opened for modification and
* <code>false</code> otherwise.
*/
public boolean isModification()
{
return isModification;
}
/**
* Returns the wizard container, where all pages are added.
*
* @return the wizard container, where all pages are added
*/
public WizardContainer getWizardContainer()
{
return wizardContainer;
}
/**
* Returns the registration object, which will store all the data through
* the wizard.
*
* @return the registration object, which will store all the data through
* the wizard
*/
public IptelAccountRegistration getRegistration()
{
return registration;
}
/**
* Returns the size of this wizard.
* @return the size of this wizard
*/
public Dimension getSize()
{
return new Dimension(600, 500);
}
/**
* Returns the identifier of the page to show first in the wizard.
* @return the identifier of the page to show first in the wizard.
*/
public Object getFirstPageIdentifier()
{
return firstWizardPage.getIdentifier();
}
/**
* Returns the identifier of the page to show last in the wizard.
* @return the identifier of the page to show last in the wizard.
*/
public Object getLastPageIdentifier()
{
return firstWizardPage.getIdentifier();
}
/**
* Sets the modification property to indicate if this wizard is opened for
* a modification.
*
* @param isModification indicates if this wizard is opened for modification
* or for creating a new account.
*/
public void setModification(boolean isModification)
{
this.isModification = isModification;
return Resources.getString(
"plugin.iptelaccregwizz.PROTOCOL_DESCRIPTION");
}
/**
@ -511,63 +99,53 @@ public void setModification(boolean isModification)
*/
public String getUserNameExample()
{
return FirstWizardPage.USER_NAME_EXAMPLE;
return "Ex: myusername or myusername@iptel.org";
}
/**
* Enables the simple "Sign in" form.
* @return <tt>true</tt> if the simple form is enabled, otherwise returns
* <tt>false</tt>
* Returns the protocol name as listed in "ProtocolNames" or just the name
* of the service.
* @return the protocol name
*/
public boolean isSimpleFormEnabled()
public String getProtocol()
{
return true;
return PROTOCOL;
}
/**
* Return the server part of the sip user name.
*
* @param userName the user name entered by the user
* @return the server part of the sip user name.
* Returns the protocol icon path.
* @return the protocol icon path
*/
protected String getServerFromUserName(String userName)
public String getProtocolIconPath()
{
int delimIndex = userName.indexOf("@");
if (delimIndex != -1)
{
return userName.substring(delimIndex + 1);
}
return null;
return "resources/images/protocol/iptel";
}
/**
* Opens the browser on the page sign up
* Returns the account icon path.
* @return the account icon path
*/
public void webSignup()
public String getAccountIconPath()
{
IptelAccRegWizzActivator.getBrowserLauncher()
.openURL("https://serweb.iptel.org/user/reg/index.php");
return "resources/images/protocol/iptel/sip32x32.png";
}
/**
* Returns <code>true</code> if the web sign up is supported by the current
* implementation, <code>false</code> - otherwise.
* @return <code>true</code> if the web sign up is supported by the current
* implementation, <code>false</code> - otherwise
* Opens the browser on the page sign up
*/
public boolean isWebSignupSupported()
public void webSignup()
{
return true;
IptelAccRegWizzActivator.getBrowserLauncher()
.openURL("https://serweb.iptel.org/user/reg/index.php");
}
/**
* Returns the simple form used in the simple account wizard.
* @return the simple form used in the simple account wizard
* Returns the name of the web sign up link.
* @return the name of the web sign up link
*/
public Object getSimpleForm()
public String getWebSignupLinkName()
{
firstWizardPage = new FirstWizardPage(this);
return firstWizardPage.getSimpleForm();
return IptelAccRegWizzActivator.getResources().getI18NString(
"plugin.iptelaccregwizz.NEW_ACCOUNT_TITLE");
}
}

@ -1,88 +0,0 @@
/*
* SIP Communicator, 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.iptelaccregwizz;
import net.java.sip.communicator.service.resources.*;
/**
* The <tt>Resources</tt> class manages the access to the internationalization
* properties files and the image resources used in this plugin.
*
* @author Yana Stamcheva
*/
public class Resources
{
private static ResourceManagementService resourcesService;
/**
* A constant pointing to the IP Tel protocol logo image.
*/
public static final ImageID PROTOCOL_ICON
= new ImageID("service.protocol.iptel.IPTEL_16x16");
/**
* A constant pointing to the IP Tel protocol wizard page image.
*/
public static final ImageID PAGE_IMAGE
= new ImageID("service.protocol.iptel.IPTEL_64x64");
/**
* Returns an internationalized string corresponding to the given key.
*
* @param key The key of the string.
* @return An internationalized string corresponding to the given key.
*/
public static String getString(String key)
{
return getResources().getI18NString(key);
}
/**
* Returns an internationalized string corresponding to the given key.
*
* @param key The key of the string.
* @return An internationalized string corresponding to the given key.
*/
public static char getMnemonic(String key)
{
return getResources().getI18nMnemonic(key);
}
/**
* Loads an image from a given image identifier.
*
* @param imageID The identifier of the image.
* @return The image for the given identifier.
*/
public static byte[] getImage(ImageID imageID)
{
return getResources().getImageInBytes(imageID.getId());
}
/**
* Returns the resource for the given key. This could be any resource stored
* in the resources.properties file of this bundle.
*
* @param key the key of the resource to search for
* @return the resource for the given key
*/
public static String getProperty(String key)
{
return getResources().getI18NString(key);
}
/**
* Returns the service giving access to resources.
* @return the service giving access to resources
*/
public static ResourceManagementService getResources()
{
if (resourcesService == null)
resourcesService = ResourceManagementServiceUtils
.getService(IptelAccRegWizzActivator.bundleContext);
return resourcesService;
}
}

@ -18,7 +18,8 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.plugin.sipaccregwizz,
javax.naming,
javax.naming.directory,
javax.xml.parsers,

@ -0,0 +1,136 @@
/*
* SIP Communicator, 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.sip2sipaccregwizz;
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.browserlauncher.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
/**
* Registers the <tt>GoogleTalkAccountRegistrationWizard</tt> in the UI Service.
*
* @author Lubomir Marinov
* @author Yana Stamcheva
*/
public class Sip2SipAccRegWizzActivator
implements BundleActivator
{
public static BundleContext bundleContext;
private static final Logger logger = Logger.getLogger(
Sip2SipAccRegWizzActivator.class.getName());
private static BrowserLauncherService browserLauncherService;
private static ResourceManagementService resourcesService;
private static UIService uiService;
/**
* Starts this bundle.
* @param bc BundleContext
* @throws Exception
*/
public void start(BundleContext bc)
throws Exception
{
bundleContext = bc;
uiService =
(UIService) bundleContext.getService(bundleContext
.getServiceReference(UIService.class.getName()));
Sip2SipAccountRegistrationWizard wizard
= new Sip2SipAccountRegistrationWizard(uiService
.getAccountRegWizardContainer());
Hashtable<String, String> containerFilter
= new Hashtable<String, String>();
containerFilter.put(
ProtocolProviderFactory.PROTOCOL,
Sip2SipAccountRegistrationWizard.PROTOCOL);
bundleContext.registerService(
AccountRegistrationWizard.class.getName(),
wizard,
containerFilter);
}
public void stop(BundleContext bundleContext) throws Exception {}
/**
* Returns the <tt>ProtocolProviderFactory</tt> for the IP Tel protocol.
*
* @return the <tt>ProtocolProviderFactory</tt> for the IP Tel protocol
*/
public static ProtocolProviderFactory getIptelProtocolProviderFactory()
{
ServiceReference[] serRefs = null;
String osgiFilter = "("
+ ProtocolProviderFactory.PROTOCOL
+ "=" + ProtocolNames.SIP + ")";
try
{
serRefs = bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
}
catch (InvalidSyntaxException ex)
{
logger.error("IptelAccRegWizzActivator : " + ex);
}
return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
}
/**
* Returns the <tt>UIService</tt>.
*
* @return the <tt>UIService</tt>
*/
public static UIService getUIService()
{
return uiService;
}
/**
* Returns the <tt>BrowserLauncherService</tt> obtained from the bundle
* context.
* @return the <tt>BrowserLauncherService</tt> obtained from the bundle
* context
*/
public static BrowserLauncherService getBrowserLauncher()
{
if (browserLauncherService == null)
{
browserLauncherService
= (BrowserLauncherService) bundleContext.getService(
bundleContext.getServiceReference(
BrowserLauncherService.class.getName()));
}
return browserLauncherService;
}
/**
* Returns the service giving access to resources.
* @return the service giving access to resources
*/
public static ResourceManagementService getResources()
{
if (resourcesService == null)
resourcesService = ResourceManagementServiceUtils
.getService(Sip2SipAccRegWizzActivator.bundleContext);
return resourcesService;
}
}

@ -0,0 +1,150 @@
/*
* SIP Communicator, 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.sip2sipaccregwizz;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
/**
* The <tt>Sip2SipAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the SIP protocol. It should allow
* the user to create and configure a new IP Tel SIP account.
*
* @author Yana Stamcheva
*/
public class Sip2SipAccountRegistrationWizard
extends SIPAccountRegistrationWizard
{
/**
* A constant pointing to the IP Tel protocol logo image.
*/
private static final String PROTOCOL_ICON
= "service.protocol.sip2sip.SIP2SIP_16x16";
/**
* A constant pointing to the IP Tel protocol wizard page image.
*/
private static final String PAGE_IMAGE
= "service.protocol.sip2sip.SIP2SIP_64x64";
/**
* The protocol name.
*/
public static final String PROTOCOL = "sip2sip.info";
/**
* Creates an instance of <tt>IptelAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container
*/
public Sip2SipAccountRegistrationWizard(WizardContainer wizardContainer)
{
super(wizardContainer);
}
/**
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
* @return byte[]
*/
public byte[] getIcon()
{
return Sip2SipAccRegWizzActivator.getResources()
.getImageInBytes(PROTOCOL_ICON);
}
/**
* Implements the <code>AccountRegistrationWizard.getPageImage</code> method.
* Returns the image used to decorate the wizard page
*
* @return byte[] the image used to decorate the wizard page
*/
public byte[] getPageImage()
{
return Sip2SipAccRegWizzActivator.getResources()
.getImageInBytes(PAGE_IMAGE);
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
* @return String
*/
public String getProtocolName()
{
return Resources.getString(
"plugin.sip2sipaccregwizz.PROTOCOL_NAME");
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolDescription
* </code> method. Returns the description of the protocol for this wizard.
* @return String
*/
public String getProtocolDescription()
{
return Resources.getString(
"plugin.sip2sipaccregwizz.PROTOCOL_DESCRIPTION");
}
/**
* Returns an example string, which should indicate to the user how the
* user name should look like.
* @return an example string, which should indicate to the user how the
* user name should look like.
*/
public String getUserNameExample()
{
return "Ex: myusername or myusername@sip2sip.info";
}
/**
* Returns the protocol name as listed in "ProtocolNames" or just the name
* of the service.
* @return the protocol name
*/
public String getProtocol()
{
return PROTOCOL;
}
/**
* Returns the protocol icon path.
* @return the protocol icon path
*/
public String getProtocolIconPath()
{
return "resources/images/protocol/sip2sip";
}
/**
* Returns the account icon path.
* @return the account icon path
*/
public String getAccountIconPath()
{
return "resources/images/protocol/sip2sip/sip32x32.png";
}
/**
* Opens the browser on the page sign up
*/
public void webSignup()
{
Sip2SipAccRegWizzActivator.getBrowserLauncher()
.openURL("https://secure.dns-hosting.info/register_sip_account.phtml");
}
/**
* Returns the name of the web sign up link.
* @return the name of the web sign up link
*/
public String getWebSignupLinkName()
{
return Resources.getString("plugin.sip2sipaccregwizz.NEW_ACCOUNT_TITLE");
}
}

@ -0,0 +1,42 @@
Bundle-Activator: net.java.sip.communicator.plugin.sip2sipaccregwizz.Sip2SipAccRegWizzActivator
Bundle-Name: Sip 2 Sip account registration wizard
Bundle-Description: Sip 2 Sip account registration wizard.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.browserlauncher,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.contactlist.event,
net.java.sip.communicator.service.fileaccess,
net.java.sip.communicator.service.gui,
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.icqconstants,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.plugin.sipaccregwizz,
javax.naming,
javax.naming.directory,
javax.xml.parsers,
org.w3c.dom,
org.xml.sax,
javax.swing,
javax.swing.event,
javax.swing.table,
javax.swing.text,
javax.swing.text.html,
javax.accessibility,
javax.swing.plaf,
javax.swing.plaf.metal,
javax.swing.plaf.basic,
javax.imageio,
javax.swing.filechooser,
javax.swing.tree,
javax.swing.undo,
javax.swing.border,
org.jivesoftware.smack

@ -0,0 +1,271 @@
/*
* SIP Communicator, 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.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* The panel containing all account related information like user name and
* password.
*
* @author Yana Stamcheva
*/
public class AccountPanel
extends TransparentPanel
implements DocumentListener
{
private final Logger logger = Logger.getLogger(AccountPanel.class);
private final JPanel labelsPanel
= new TransparentPanel(new GridLayout(0, 1));
private JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1));
private JPanel emptyPanel = new TransparentPanel();
private JTextField userIDField = new JTextField();
private JPasswordField passField = new JPasswordField();
private final JTextField displayNameField = new JTextField();
private JCheckBox rememberPassBox
= new SIPCommCheckBox(
Resources.getString("service.gui.REMEMBER_PASSWORD"));
private final JLabel displayNameLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.DISPLAY_NAME"));
private final SIPAccountRegistrationForm regform;
/**
* Creates an instance of the <tt>AccountPanel</tt>.
* @param regform the parent registration form
*/
public AccountPanel(SIPAccountRegistrationForm regform)
{
super (new BorderLayout());
this.regform = regform;
this.userIDField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
JLabel uinExampleLabel = new JLabel(regform.getUsernameExample());
uinExampleLabel.setForeground(Color.GRAY);
uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
emptyPanel.setMaximumSize(new Dimension(40, 35));
uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
JPanel uinPassPanel
= new TransparentPanel(new BorderLayout(10, 10));
JLabel uinLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.USERNAME"));
JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
valuesPanel.add(userIDField);
valuesPanel.add(uinExampleLabel);
valuesPanel.add(passField);
TransparentPanel southPanel
= new TransparentPanel(new GridLayout(1, 2));
uinPassPanel.add(labelsPanel, BorderLayout.WEST);
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(southPanel, BorderLayout.SOUTH);
southPanel.add(rememberPassBox);
String webSignup = regform.getWebSignupLinkName();
if (webSignup != null)
{
southPanel.add(createSubscribeLabel(webSignup));
}
uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.sipaccregwizz.USERNAME_AND_PASSWORD")));
this.add(uinPassPanel, BorderLayout.NORTH);
}
/**
* Initializes the advanced account panel.
*/
void initAdvancedForm()
{
// If it's not yet added.
if (displayNameLabel.getParent() == null)
labelsPanel.add(displayNameLabel);
// If it's not yet added.
if (displayNameField.getParent() == null)
valuesPanel.add(displayNameField);
}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
* field. Enables or disables the "Next" wizard button according to whether
* the UIN field is empty.
* @param e the <tt>DocumentEvent</tt> that notified us
*/
public void insertUpdate(DocumentEvent e)
{
regform.setNextFinishButtonEnabled(userIDField.getText() == null
|| userIDField.getText().equals(""));
regform.setServerFieldAccordingToUIN(userIDField.getText());
}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user deletes letters
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
* @param e the <tt>DocumentEvent</tt> that notified us
*/
public void removeUpdate(DocumentEvent e)
{
regform.setNextFinishButtonEnabled(userIDField.getText() == null
|| userIDField.getText().equals(""));
regform.setServerFieldAccordingToUIN(userIDField.getText());
}
public void changedUpdate(DocumentEvent e) {}
/**
* Returns the user identifier entered by the user.
* @return the user identifier
*/
String getUserID()
{
return userIDField.getText();
}
/**
* Returns the password entered by the user.
* @return the password
*/
char[] getPassword()
{
return passField.getPassword();
}
/**
* Indicates if the "remember password" check box is selected.
* @return <tt>true</tt> if the "remember password" check box is selected,
* otherwise returns <tt>false</tt>
*/
boolean isRememberPassword()
{
return rememberPassBox.isSelected();
}
/**
* Returns the display name of the account.
* @return the display name of the account
*/
String getDisplayName()
{
return displayNameField.getText();
}
/**
* Sets the display name of the account.
* @param displayName the display name of the account
*/
void setDisplayName(String displayName)
{
displayNameField.setText(displayName);
}
/**
* Enables/disables the user id text field.
* @param isEnabled <tt>true</tt> to enable the user id text field,
* <tt>false</tt> - otherwise
*/
void setUserIDEnabled(boolean isEnabled)
{
userIDField.setEnabled(isEnabled);
}
/**
* Sets the user id.
* @param userID the user id to set
*/
void setUserID(String userID)
{
userIDField.setText(userID);
}
/**
* Sets the password
* @param password the password
*/
void setPassword(String password)
{
this.passField.setText(password);
}
/**
* Sets the password remember check box.
* @param isRememberPassword <tt>true</tt> to select the remember password
* check box, <tt>false</tt> - otherwise
*/
void setRememberPassword(boolean isRememberPassword)
{
rememberPassBox.setSelected(isRememberPassword);
}
/**
* Creates the subscribe label.
* @param linkName the link name
* @return the newly created subscribe label
*/
private Component createSubscribeLabel(String linkName)
{
JLabel subscribeLabel =
new JLabel("<html><a href=''>"
+ linkName
+ "</a></html>",
JLabel.RIGHT);
subscribeLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
subscribeLabel.setToolTipText(
Resources.getString("plugin.simpleaccregwizz.SPECIAL_SIGNUP"));
subscribeLabel.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
try
{
regform.webSignup();
}
catch (UnsupportedOperationException ex)
{
// This should not happen, because we check if the
// operation is supported, before adding the sign
// up.
logger.error("The web sign up is not supported.",
ex);
}
}
});
return subscribeLabel;
}
}

@ -0,0 +1,453 @@
/*
* SIP Communicator, 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.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.swing.*;
/**
* The panel containing information about the connection.
*
* @author Yana Stamcheva
*/
public class ConnectionPanel
extends TransparentPanel
implements ItemListener
{
private final JCheckBox enableDefaultEncryption =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"), true);
private final JCheckBox enableSipZrtpAttribute =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"), true);
private final JTextField serverField = new JTextField();
private final JTextField proxyField = new JTextField();
private final JTextField authNameField = new JTextField();
private final JTextField serverPortField
= new JTextField(SIPAccountRegistration.DEFAULT_PORT);
private final JTextField proxyPortField
= new JTextField(SIPAccountRegistration.DEFAULT_PORT);
private JComboBox transportCombo = new JComboBox(new Object[]
{ "UDP", "TCP", "TLS" });
private JComboBox keepAliveMethodBox
= new JComboBox(new Object []
{
"REGISTER",
"OPTIONS"
});
private JTextField keepAliveIntervalValue = new JTextField();
private boolean isServerOverridden = false;
private SIPAccountRegistrationForm regform;
/**
* Creates an instance of the <tt>ConnectionPanel</tt>.
* @param regform the parent registration form
*/
public ConnectionPanel(SIPAccountRegistrationForm regform)
{
super(new BorderLayout());
this.regform = regform;
this.transportCombo.addItemListener(this);
transportCombo.setSelectedItem(
SIPAccountRegistration.DEFAULT_TRANSPORT);
JPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10));
JPanel labelsPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
JPanel valuesPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
JLabel serverLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.REGISTRAR"));
JLabel proxyLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY"));
JLabel authNameLabel
= new JLabel(Resources.getString(
"plugin.sipaccregwizz.AUTH_NAME"));
JLabel serverPortLabel
= new JLabel(Resources.getString(
"plugin.sipaccregwizz.SERVER_PORT"));
JLabel proxyPortLabel
= new JLabel(Resources.getString(
"plugin.sipaccregwizz.PROXY_PORT"));
JLabel transportLabel
= new JLabel(Resources.getString(
"plugin.sipaccregwizz.PREFERRED_TRANSPORT"));
labelsPanel.add(serverLabel);
labelsPanel.add(authNameLabel);
labelsPanel.add(serverPortLabel);
labelsPanel.add(proxyLabel);
labelsPanel.add(proxyPortLabel);
labelsPanel.add(transportLabel);
valuesPanel.add(serverField);
valuesPanel.add(authNameField);
valuesPanel.add(serverPortField);
valuesPanel.add(proxyField);
valuesPanel.add(proxyPortField);
valuesPanel.add(transportCombo);
mainPanel.add(labelsPanel, BorderLayout.WEST);
mainPanel.add(valuesPanel, BorderLayout.CENTER);
JPanel encryptionPanel
= new TransparentPanel(new GridLayout(1, 2, 2, 2));
encryptionPanel.add(enableDefaultEncryption, BorderLayout.WEST);
encryptionPanel.add(enableSipZrtpAttribute, BorderLayout.EAST);
enableDefaultEncryption.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
enableSipZrtpAttribute.setEnabled(cb.isSelected());
}
});
mainPanel.add(encryptionPanel, BorderLayout.SOUTH);
mainPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.sipaccregwizz.ADVANCED_OPTIONS")));
this.add(mainPanel, BorderLayout.NORTH);
this.add(createKeepAlivePanel(), BorderLayout.SOUTH);
}
/**
* Parse the server part from the sip id and set it to server as default
* value. If Advanced option is enabled Do nothing.
* @param serverAddress the address of the server
*/
public void setServerFieldAccordingToUIN(String serverAddress)
{
if (!regform.isModification() || !isServerOverridden)
{
serverField.setText(serverAddress);
proxyField.setText(serverAddress);
}
}
/**
* Indicates that the state of the item has changed.
* @param e the <tt>ItemEvent</tt> that notified us
*/
public void itemStateChanged(ItemEvent e)
{
if (e.getStateChange() == ItemEvent.SELECTED
&& e.getItem().equals("TLS"))
{
serverPortField.setText(SIPAccountRegistration.DEFAULT_TLS_PORT);
proxyPortField.setText(SIPAccountRegistration.DEFAULT_TLS_PORT);
}
else
{
serverPortField.setText(SIPAccountRegistration.DEFAULT_PORT);
proxyPortField.setText(SIPAccountRegistration.DEFAULT_PORT);
}
}
/**
* Creates the keep alive panel.
* @return the created keep alive panel
*/
private Component createKeepAlivePanel()
{
JPanel emptyLabelPanel = new TransparentPanel();
emptyLabelPanel.setMaximumSize(new Dimension(40, 35));
JPanel keepAlivePanel
= new TransparentPanel(new BorderLayout(10, 10));
JPanel keepAliveLabels
= new TransparentPanel(new GridLayout(0, 1, 5, 5));
JPanel keepAliveValues
= new TransparentPanel(new GridLayout(0, 1, 5, 5));
JLabel keepAliveMethodLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_METHOD"));
JLabel keepAliveIntervalLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL"));
JLabel keepAliveIntervalExampleLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL_INFO"));
keepAliveLabels.add(keepAliveMethodLabel);
keepAliveLabels.add(keepAliveIntervalLabel);
keepAliveLabels.add(emptyLabelPanel);
keepAliveIntervalExampleLabel.setForeground(Color.GRAY);
keepAliveIntervalExampleLabel
.setFont(keepAliveIntervalExampleLabel.getFont().deriveFont(8));
keepAliveIntervalExampleLabel
.setMaximumSize(new Dimension(40, 35));
keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
keepAliveIntervalValue
.setText(SIPAccountRegistration.DEFAULT_KEEP_ALIVE_INTERVAL);
keepAliveMethodBox.setSelectedItem(
SIPAccountRegistration.DEFAULT_KEEP_ALIVE_METHOD);
keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel);
keepAlivePanel.add(keepAliveLabels, BorderLayout.WEST);
keepAlivePanel.add(keepAliveValues, BorderLayout.CENTER);
keepAlivePanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE")));
return keepAlivePanel;
}
/**
* Returns the server address.
* @return the server address
*/
String getServerAddress()
{
return serverField.getText();
}
/**
* Sets the server address.
* @param serverAddress the server address
*/
void setServerAddress(String serverAddress)
{
serverField.setText(serverAddress);
}
/**
* Enables/disables the server text field.
* @param isEnabled <tt>true</tt> to enable the server text field,
* <tt>false</tt> - otherwise
*/
void setServerEnabled(boolean isEnabled)
{
serverField.setEnabled(isEnabled);
}
/**
* Returns the authentication name.
* @return the authentication name
*/
String getAuthenticationName()
{
return authNameField.getText();
}
/**
* Sets the authentication name.
* @param authName the authentication name
*/
void setAuthenticationName(String authName)
{
authNameField.setText(authName);
}
/**
* Returns the server port.
* @return the server port
*/
String getServerPort()
{
return serverPortField.getText();
}
/**
* Sets the server port.
* @param serverPort the server port
*/
void setServerPort(String serverPort)
{
serverPortField.setText(serverPort);
}
/**
* Returns the proxy.
* @return the proxy
*/
String getProxy()
{
return proxyField.getText();
}
/**
* Sets the proxy address.
* @param proxyAddress the proxy address
*/
void setProxy(String proxyAddress)
{
proxyField.setText(proxyAddress);
}
/**
* Return the proxy port.
* @return the proxy port
*/
String getProxyPort()
{
return proxyPortField.getText();
}
/**
* Sets the proxy port.
* @param proxyPort the proxy port
*/
void setProxyPort(String proxyPort)
{
proxyPortField.setText(proxyPort);
}
/**
* Returns the selected transport.
* @return the selected transport
*/
String getSelectedTransport()
{
//Emil: it appears that sometimes the selected item may be null even
//though the combo box does not allow a null selection.
Object selectedItem = transportCombo.getSelectedItem();
if(selectedItem == null)
selectedItem = transportCombo.getItemAt(0);
return selectedItem.toString();
}
/**
* Sets the selected transport.
* @param preferredTransport the transport to select
*/
void setSelectedTransport(String preferredTransport)
{
transportCombo.setSelectedItem(preferredTransport);
}
/**
* Indicates if the default encryption is enabled.
* @return <tt>true</tt> if the default encryption is enabled,
* <tt>false</tt> - otherwise
*/
boolean isDefaultEncryptionEnabled()
{
return enableDefaultEncryption.isSelected();
}
/**
* Enables/disables the default encryption.
* @param isEnable <tt>true</tt> to enable the default encryption,
* <tt>false</tt> - otherwise
*/
void enablesDefaultEncryption(boolean isEnable)
{
enableDefaultEncryption.setSelected(isEnable);
}
/**
* Indicates if the ZRTP encryption is enabled.
* @return <tt>true</tt> if <tt>ZRTP</tt> is enabled, <tt>false</tt> -
* otherwise
*/
boolean isSipZrtpEnabled()
{
return enableSipZrtpAttribute.isSelected();
}
/**
* Enables/disables and selects/deselects the sip zrtp checkbox.
* @param isSipZrtpEnabled indicates if the sip zrtp is enabled
* @param isDefaultEncryptionEnabled indicates if the default encryption is
* enabled
*/
void setSipZrtpEnabled( boolean isSipZrtpEnabled,
boolean isDefaultEncryptionEnabled)
{
enableSipZrtpAttribute.setSelected(isSipZrtpEnabled);
enableSipZrtpAttribute.setEnabled(isDefaultEncryptionEnabled);
}
/**
* Returns the keep alive method.
* @return the keep alive method
*/
String getKeepAliveMethod()
{
return keepAliveMethodBox.getSelectedItem().toString();
}
/**
* Sets the keep alive method.
* @param keepAliveMethod the keep alive method
*/
void setKeepAliveMethod(String keepAliveMethod)
{
keepAliveMethodBox.setSelectedItem(keepAliveMethod);
}
/**
* Returns the keep alive interval
* @return the keep alive interval
*/
String getKeepAliveInterval()
{
return keepAliveIntervalValue.getText();
}
/**
* Sets the keep alive interval
* @param keepAliveInterval the keep alive interval
*/
void setKeepAliveInterval(String keepAliveInterval)
{
keepAliveIntervalValue.setText(keepAliveInterval);
}
/**
* Sets the <tt>serverOverridden</tt> property.
* @param isServerOverridden <tt>true</tt> to indicate that the server is
* overridden, <tt>false</tt> - otherwise
*/
void setServerOverridden(boolean isServerOverridden)
{
this.isServerOverridden = isServerOverridden;
}
}

@ -6,9 +6,6 @@
package net.java.sip.communicator.plugin.sipaccregwizz;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@ -24,165 +21,17 @@
@SuppressWarnings("serial")
public class FirstWizardPage
extends TransparentPanel
implements WizardPage, DocumentListener, ItemListener
implements WizardPage
{
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
public static final String USER_NAME_EXAMPLE
= "Ex: john@voiphone.net or simply \"john\" for no server";
private JPanel firstTabPanel = new TransparentPanel(new BorderLayout());
private JPanel uinPassPanel = new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new TransparentPanel();
private JPanel valuesPanel = new TransparentPanel();
private JLabel uinLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.USERNAME"));
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
private JPanel emptyPanel = new TransparentPanel();
private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
private JTextField userIDField = new JTextField();
private JPasswordField passField = new JPasswordField();
private JCheckBox rememberPassBox =
new SIPCommCheckBox(
Resources.getString("service.gui.REMEMBER_PASSWORD"));
private JPanel advancedOpPanel
= new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsAdvOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel valuesAdvOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JLabel serverLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.REGISTRAR"));
private JCheckBox enableDefaultEncryption =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"), true);
private JCheckBox enableSipZrtpAttribute =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"), true);
private JLabel proxyLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY"));
private JLabel displayNameLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.DISPLAY_NAME"));
private JLabel authNameLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.AUTH_NAME"));
private JLabel serverPortLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.SERVER_PORT"));
private JLabel proxyPortLabel =
new JLabel(Resources.getString("plugin.sipaccregwizz.PROXY_PORT"));
private JLabel transportLabel =
new JLabel(Resources.getString(
"plugin.sipaccregwizz.PREFERRED_TRANSPORT"));
private JTextField serverField = new JTextField();
private JTextField proxyField = new JTextField();
private JTextField displayNameField = new JTextField();
private JTextField authNameField = new JTextField();
private JTextField serverPortField
= new JTextField(SIPAccountRegistration.DEFAULT_PORT);
private JTextField proxyPortField
= new JTextField(SIPAccountRegistration.DEFAULT_PORT);
private JComboBox transportCombo = new JComboBox(new Object[]
{ "UDP", "TCP", "TLS" });
private JPanel presenceOpPanel = new TransparentPanel(new BorderLayout(10, 10));
private JPanel buttonsPresOpPanel =
new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel labelsPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel valuesPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JCheckBox enablePresOpButton =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_PRESENCE"), true);
private JCheckBox forceP2PPresOpButton =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"), false);
private JLabel pollPeriodLabel = new JLabel(
Resources.getString(
"plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
private JLabel subscribeExpiresLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
private JTextField pollPeriodField
= new JTextField(SIPAccountRegistration.DEFAULT_POLL_PERIOD);
private JTextField subscribeExpiresField =
new JTextField(SIPAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
private JPanel keepAlivePanel
= new TransparentPanel(new BorderLayout(10, 10));
private JPanel keepAliveLabels
= new TransparentPanel(new GridLayout(0, 1, 5, 5));
private JPanel keepAliveValues
= new TransparentPanel(new GridLayout(0, 1, 5, 5));
private JLabel keepAliveMethodLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_METHOD"));
private JLabel keepAliveIntervalLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL"));
private JLabel keepAliveIntervalExampleLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL_INFO"));
private JComboBox keepAliveMethodBox
= new JComboBox(new Object []
{
"REGISTER",
"OPTIONS"
});
private JTextField keepAliveIntervalValue = new JTextField();
private JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false);
private JPanel advancedPanel = new TransparentPanel();
static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
private SIPAccountRegistrationWizard wizard;
private boolean isCommitted = false;
private final SIPAccountRegistrationForm registrationForm;
private boolean isServerOverridden = false;
private boolean isCommitted = false;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
@ -195,175 +44,15 @@ public FirstWizardPage(SIPAccountRegistrationWizard wizard)
this.wizard = wizard;
advancedPanel.setLayout(new BoxLayout(advancedPanel, BoxLayout.Y_AXIS));
this.init();
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.labelsPanel
.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
this.valuesPanel
.setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
}
/**
* Initializes all panels, buttons, etc.
*/
private void init()
{
this.labelsPanel.setOpaque(false);
this.valuesPanel.setOpaque(false);
this.uinPassPanel.setOpaque(false);
this.emptyPanel.setOpaque(false);
this.userIDField.getDocument().addDocumentListener(this);
this.transportCombo.addItemListener(this);
this.rememberPassBox.setSelected(true);
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
this.uinExampleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8,
0));
labelsPanel.add(uinLabel);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
valuesPanel.add(userIDField);
valuesPanel.add(uinExampleLabel);
valuesPanel.add(passField);
uinPassPanel.add(labelsPanel, BorderLayout.WEST);
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.sipaccregwizz.USERNAME_AND_PASSWORD")));
firstTabPanel.add(uinPassPanel, BorderLayout.NORTH);
tabbedPane.addTab( Resources.getString("service.gui.SUMMARY"),
firstTabPanel);
transportCombo
.setSelectedItem(SIPAccountRegistration.DEFAULT_TRANSPORT);
labelsAdvOpPanel.add(serverLabel);
labelsAdvOpPanel.add(displayNameLabel);
labelsAdvOpPanel.add(authNameLabel);
labelsAdvOpPanel.add(serverPortLabel);
labelsAdvOpPanel.add(proxyLabel);
labelsAdvOpPanel.add(proxyPortLabel);
labelsAdvOpPanel.add(transportLabel);
valuesAdvOpPanel.add(serverField);
valuesAdvOpPanel.add(displayNameField);
valuesAdvOpPanel.add(authNameField);
valuesAdvOpPanel.add(serverPortField);
valuesAdvOpPanel.add(proxyField);
valuesAdvOpPanel.add(proxyPortField);
valuesAdvOpPanel.add(transportCombo);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
JPanel encryptionPanel = new TransparentPanel(new GridLayout(1, 2, 2, 2));
encryptionPanel.add(enableDefaultEncryption, BorderLayout.WEST);
encryptionPanel.add(enableSipZrtpAttribute, BorderLayout.EAST);
enableDefaultEncryption.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
enableSipZrtpAttribute.setEnabled(cb.isSelected());
}
});
advancedOpPanel.add(encryptionPanel, BorderLayout.SOUTH);
advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.sipaccregwizz.ADVANCED_OPTIONS")));
advancedPanel.add(advancedOpPanel);
enablePresOpButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
setPresenceOptionsEnabled(cb.isSelected());
}
});
labelsPresOpPanel.add(pollPeriodLabel);
labelsPresOpPanel.add(subscribeExpiresLabel);
valuesPresOpPanel.add(pollPeriodField);
valuesPresOpPanel.add(subscribeExpiresField);
buttonsPresOpPanel.add(enablePresOpButton);
buttonsPresOpPanel.add(forceP2PPresOpButton);
presenceOpPanel.add(buttonsPresOpPanel, BorderLayout.NORTH);
presenceOpPanel.add(labelsPresOpPanel, BorderLayout.WEST);
presenceOpPanel.add(valuesPresOpPanel, BorderLayout.CENTER);
presenceOpPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.sipaccregwizz.PRESENCE_OPTIONS")));
advancedPanel.add(presenceOpPanel);
JPanel emptyLabelPanel = new TransparentPanel();
emptyLabelPanel.setMaximumSize(new Dimension(40, 35));
keepAliveLabels.add(keepAliveMethodLabel);
keepAliveLabels.add(keepAliveIntervalLabel);
keepAliveLabels.add(emptyLabelPanel);
this.keepAliveIntervalExampleLabel.setForeground(Color.GRAY);
this.keepAliveIntervalExampleLabel
.setFont(uinExampleLabel.getFont().deriveFont(8));
this.keepAliveIntervalExampleLabel
.setMaximumSize(new Dimension(40, 35));
this.keepAliveIntervalExampleLabel
.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
this.registrationForm = new SIPAccountRegistrationForm(wizard);
keepAliveIntervalValue
.setText(SIPAccountRegistration.DEFAULT_KEEP_ALIVE_INTERVAL);
keepAliveMethodBox.setSelectedItem(
SIPAccountRegistration.DEFAULT_KEEP_ALIVE_METHOD);
keepAliveValues.add(keepAliveMethodBox);
keepAliveValues.add(keepAliveIntervalValue);
keepAliveValues.add(keepAliveIntervalExampleLabel);
keepAlivePanel.add(keepAliveLabels, BorderLayout.WEST);
keepAlivePanel.add(keepAliveValues, BorderLayout.CENTER);
keepAlivePanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE")));
advancedPanel.add(keepAlivePanel);
tabbedPane.addTab(
Resources.getString("service.gui.ADVANCED"),
advancedPanel);
this.add(tabbedPane, BorderLayout.NORTH);
this.add(registrationForm);
}
/**
* Implements the <code>WizardPage.getIdentifier</code> to return this
* page identifier.
* @return the page identifier
*/
public Object getIdentifier()
{
@ -373,6 +62,7 @@ public Object getIdentifier()
/**
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
* @return the next page identifier
*/
public Object getNextPageIdentifier()
{
@ -393,9 +83,12 @@ public Object getBackPageIdentifier()
/**
* Implements the <code>WizardPage.getWizardForm</code> to return this
* panel.
* @return the wizard form
*/
public Object getWizardForm()
{
registrationForm.init();
return this;
}
@ -405,7 +98,6 @@ public Object getWizardForm()
*/
public void pageShowing()
{
this.setNextButtonAccordingToUIN();
wizard.getWizardContainer().setBackButtonEnabled(false);
}
@ -414,119 +106,18 @@ public void pageShowing()
*/
public void commitPage()
{
String uin = userIDField.getText();
int indexOfSeparator = uin.indexOf('@');
if (indexOfSeparator > -1) {
uin = uin.substring(0, indexOfSeparator);
}
SIPAccountRegistration registration = wizard.getRegistration();
String userID = userIDField.getText();
if(userID == null || userID.trim().length() == 0)
throw new IllegalStateException("No user ID provided.");
registration.setUserID(userID);
if (passField.getPassword() != null)
registration.setPassword(new String(passField.getPassword()));
registration.setRememberPassword(rememberPassBox.isSelected());
registration.setServerAddress(serverField.getText());
String displayName = displayNameField.getText();
registration.setDisplayName(displayName);
String authName = authNameField.getText();
if(authName != null && authName.length() > 0)
registration.setAuthorizationName(authName);
registration.setServerPort(serverPortField.getText());
registration.setProxy(proxyField.getText());
registration.setProxyPort(proxyPortField.getText());
//Emil: it appears that sometimes the selected item may be null even
//though the combo box does not allow a null selection.
Object selectedItem = transportCombo.getSelectedItem();
if(selectedItem == null)
selectedItem = transportCombo.getItemAt(0);
registration.setPreferredTransport(selectedItem.toString());
registration.setEnablePresence(enablePresOpButton.isSelected());
registration.setForceP2PMode(forceP2PPresOpButton.isSelected());
registration.setDefaultEncryption(enableDefaultEncryption.isSelected());
registration.setSipZrtpAttribute(enableSipZrtpAttribute.isSelected());
registration.setPollingPeriod(pollPeriodField.getText());
registration.setSubscriptionExpiration(subscribeExpiresField
.getText());
registration.setKeepAliveMethod(
keepAliveMethodBox.getSelectedItem().toString());
registration.setKeepAliveInterval(keepAliveIntervalValue.getText());
wizard.getWizardContainer().setBackButtonEnabled(true);
registrationForm.commitPage(wizard.getRegistration());
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
this.isCommitted = true;
}
/**
* Enables or disables the "Next" wizard button according to whether the UIN
* field is empty.
*/
private void setNextButtonAccordingToUIN()
{
if (userIDField.getText() == null || userIDField.getText().equals(""))
{
wizard.getWizardContainer().setNextFinishButtonEnabled(false);
}
else
{
wizard.getWizardContainer().setNextFinishButtonEnabled(true);
}
}
public void pageHiding() {}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
* field. Enables or disables the "Next" wizard button according to whether
* the UIN field is empty.
*/
public void insertUpdate(DocumentEvent e)
{
this.setNextButtonAccordingToUIN();
this.setServerFieldAccordingToUIN();
}
public void pageShown() {}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user deletes letters
* from the UIN field. Enables or disables the "Next" wizard button
* according to whether the UIN field is empty.
*/
public void removeUpdate(DocumentEvent e)
{
this.setNextButtonAccordingToUIN();
this.setServerFieldAccordingToUIN();
}
public void changedUpdate(DocumentEvent e)
{
}
public void pageHiding()
{
}
public void pageShown()
{
}
public void pageBack()
{
}
public void pageBack() {}
/**
* Fills the UIN and Password fields in this panel with the data coming from
@ -537,152 +128,13 @@ public void pageBack()
*/
public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
String password = accountID.getAccountPropertyString(
ProtocolProviderFactory.PASSWORD);
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);
boolean enabledDefaultEncryption = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
boolean enabledSipZrtpAttribute = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true);
String pollingPeriod = accountID.getAccountPropertyString(
ProtocolProviderFactory.POLLING_PERIOD);
String subscriptionPeriod = accountID.getAccountPropertyString(
ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
String keepAliveMethod =
accountID.getAccountPropertyString("KEEP_ALIVE_METHOD");
String keepAliveInterval =
accountID.getAccountPropertyString("KEEP_ALIVE_INTERVAL");
this.isServerOverridden = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
userIDField.setEnabled(false);
this.userIDField.setText((serverAddress == null) ? accountID.getUserID()
: (accountID.getUserID() + "@" + serverAddress));
if (password != null)
{
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
serverField.setText(serverAddress);
serverField.setEnabled(false);
if (displayName != null && displayName.length() > 0)
displayNameField.setText(displayName);
if(authName != null && authName.length() > 0)
authNameField.setText(authName);
serverPortField.setText(serverPort);
proxyField.setText(proxyAddress);
// The order of the next two fields is important, as a change listener
// of the transportCombo sets the proxyPortField to its default
transportCombo.setSelectedItem(preferredTransport);
proxyPortField.setText(proxyPort);
enablePresOpButton.setSelected(enablePresence);
forceP2PPresOpButton.setSelected(forceP2P);
enableDefaultEncryption.setSelected(enabledDefaultEncryption);
enableSipZrtpAttribute.setSelected(enabledSipZrtpAttribute);
enableSipZrtpAttribute.setEnabled(enabledDefaultEncryption);
pollPeriodField.setText(pollingPeriod);
subscribeExpiresField.setText(subscriptionPeriod);
if (!enablePresence)
{
setPresenceOptionsEnabled(enablePresence);
}
keepAliveMethodBox.setSelectedItem(keepAliveMethod);
keepAliveIntervalValue.setText(keepAliveInterval);
}
/**
* Parse the server part from the sip id and set it to server as default
* value. If Advanced option is enabled Do nothing.
*/
private void setServerFieldAccordingToUIN()
{
String serverAddress
= wizard.getServerFromUserName(userIDField.getText());
if (!wizard.isModification() || !isServerOverridden)
{
serverField.setText(serverAddress);
proxyField.setText(serverAddress);
}
}
/**
* Enables or disable all presence related options.
*
* @param isEnabled <code>true</code> to enable the presence related
* options, <code>false</code> - to disable them.
*/
private void setPresenceOptionsEnabled(boolean isEnabled)
{
forceP2PPresOpButton.setEnabled(isEnabled);
pollPeriodField.setEnabled(isEnabled);
subscribeExpiresField.setEnabled(isEnabled);
}
public void itemStateChanged(ItemEvent e)
{
if (e.getStateChange() == ItemEvent.SELECTED
&& e.getItem().equals("TLS"))
{
serverPortField.setText(SIPAccountRegistration.DEFAULT_TLS_PORT);
proxyPortField.setText(SIPAccountRegistration.DEFAULT_TLS_PORT);
}
else
{
serverPortField.setText(SIPAccountRegistration.DEFAULT_PORT);
proxyPortField.setText(SIPAccountRegistration.DEFAULT_PORT);
}
registrationForm.setModification(wizard.isModification());
registrationForm.loadAccount(protocolProvider.getAccountID());
}
public Object getSimpleForm()
{
return uinPassPanel;
return registrationForm.getSimpleForm();
}
public boolean isCommitted()

@ -0,0 +1,181 @@
/*
* SIP Communicator, 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.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>PresencePanel</tt> is the one containing presence information.
*
* @author Yana Stamcheva
*/
public class PresencePanel
extends TransparentPanel
{
private JPanel presenceOpPanel
= new TransparentPanel(new BorderLayout(10, 10));
private JPanel buttonsPresOpPanel =
new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel labelsPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JPanel valuesPresOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JCheckBox enablePresOpButton =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.ENABLE_PRESENCE"), true);
private JCheckBox forceP2PPresOpButton =
new SIPCommCheckBox(Resources
.getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"), false);
private JLabel pollPeriodLabel = new JLabel(
Resources.getString(
"plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
private JLabel subscribeExpiresLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
private JTextField pollPeriodField
= new JTextField(SIPAccountRegistration.DEFAULT_POLL_PERIOD);
private JTextField subscribeExpiresField =
new JTextField(SIPAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
/**
* Creates an instance of <tt>PresencePanel</tt>.
*/
public PresencePanel()
{
super(new BorderLayout());
enablePresOpButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
setPresenceOptionsEnabled(cb.isSelected());
}
});
labelsPresOpPanel.add(pollPeriodLabel);
labelsPresOpPanel.add(subscribeExpiresLabel);
valuesPresOpPanel.add(pollPeriodField);
valuesPresOpPanel.add(subscribeExpiresField);
buttonsPresOpPanel.add(enablePresOpButton);
buttonsPresOpPanel.add(forceP2PPresOpButton);
presenceOpPanel.add(buttonsPresOpPanel, BorderLayout.NORTH);
presenceOpPanel.add(labelsPresOpPanel, BorderLayout.WEST);
presenceOpPanel.add(valuesPresOpPanel, BorderLayout.CENTER);
presenceOpPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.sipaccregwizz.PRESENCE_OPTIONS")));
this.add(presenceOpPanel, BorderLayout.NORTH);
}
/**
* Enables or disable all presence related options.
*
* @param isEnabled <code>true</code> to enable the presence related
* options, <code>false</code> - to disable them.
*/
void setPresenceOptionsEnabled(boolean isEnabled)
{
forceP2PPresOpButton.setEnabled(isEnabled);
pollPeriodField.setEnabled(isEnabled);
subscribeExpiresField.setEnabled(isEnabled);
}
/**
* Indicates if the presence is enabled.
* @return <tt>true</tt> if the presence is enabled, <tt>false</tt> -
* otherwise
*/
boolean isPresenceEnabled()
{
return enablePresOpButton.isSelected();
}
/**
* Enables/disables the presence.
* @param isPresenceEnabled <tt>true</tt> to enable the presence,
* <tt>false</tt> - otherwise
*/
void setPresenceEnabled(boolean isPresenceEnabled)
{
enablePresOpButton.setSelected(isPresenceEnabled);
}
/**
* 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.
*/
boolean isForcePeerToPeerMode()
{
return forceP2PPresOpButton.isSelected();
}
/**
* 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.
*/
void setForcePeerToPeerMode(boolean forceP2P)
{
forceP2PPresOpButton.setSelected(forceP2P);
}
/**
* Returns the poll period.
* @return the poll period
*/
String getPollPeriod()
{
return pollPeriodField.getText();
}
/**
* Sets the poll period.
* @param pollPeriod the poll period
*/
void setPollPeriod(String pollPeriod)
{
pollPeriodField.setText(pollPeriod);
}
/**
* Returns the subscription expiration information.
* @return the subscription expiration information
*/
String getSubscriptionExpiration()
{
return subscribeExpiresField.getText();
}
/**
* Sets the subscription expiration information.
* @param subscExp the subscription expiration information
*/
void setSubscriptionExpiration(String subscExp)
{
subscribeExpiresField.setText(subscExp);
}
}

@ -0,0 +1,331 @@
package net.java.sip.communicator.plugin.sipaccregwizz;
import java.awt.*;
import javax.swing.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>SIPAccountRegistrationForm</tt>.
*
* @author Yana Stamcheva
*/
public class SIPAccountRegistrationForm
extends TransparentPanel
{
private final AccountPanel accountPanel;
private final ConnectionPanel connectionPanel;
private final PresencePanel presencePanel;
private boolean isModification;
private final SIPAccountRegistrationWizard wizard;
private final JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false);
/**
* Creates an instance of <tt>SIPAccountRegistrationForm</tt>.
* @param wizard the parent wizard
*/
public SIPAccountRegistrationForm(SIPAccountRegistrationWizard wizard)
{
super(new BorderLayout());
this.wizard = wizard;
accountPanel = new AccountPanel(this);
connectionPanel = new ConnectionPanel(this);
presencePanel = new PresencePanel();
}
/**
* Initializes all panels, buttons, etc.
*/
void init()
{
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
accountPanel.initAdvancedForm();
if (accountPanel.getParent() != tabbedPane)
tabbedPane.addTab( Resources.getString("service.gui.ACCOUNT"),
accountPanel);
if (connectionPanel.getParent() != tabbedPane)
tabbedPane.addTab(Resources.getString("service.gui.CONNECTION"),
connectionPanel);
if (presencePanel.getParent() != tabbedPane)
tabbedPane.addTab(Resources.getString("service.gui.PRESENCE"),
presencePanel);
if (tabbedPane.getParent() != this)
this.add(tabbedPane, BorderLayout.NORTH);
tabbedPane.setSelectedIndex(0);
}
/**
* Parse the server part from the sip id and set it to server as default
* value. If Advanced option is enabled Do nothing.
* @param userName the account user name
*/
void setServerFieldAccordingToUIN(String userName)
{
String serverAddress = getServerFromUserName(userName);
connectionPanel.setServerFieldAccordingToUIN(serverAddress);
}
/**
* Enables/disables the next/finish button of the parent wizard.
* @param isEnabled <tt>true</tt> to enable the next button, <tt>false</tt>
* otherwise
*/
void setNextFinishButtonEnabled(boolean isEnabled)
{
SIPAccRegWizzActivator.getUIService().getAccountRegWizardContainer()
.setNextFinishButtonEnabled(isEnabled);
}
/**
* Return the server part of the sip user name.
*
* @param userName the username.
* @return the server part of the sip user name.
*/
private String getServerFromUserName(String userName)
{
int delimIndex = userName.indexOf("@");
if (delimIndex != -1)
{
return userName.substring(delimIndex + 1);
}
return null;
}
/**
* Indicates if this wizard is modifying an existing account or is creating
* a new one.
*
* @return <code>true</code> to indicate that this wizard is currently in
* modification mode, <code>false</code> - otherwise.
*/
public boolean isModification()
{
return isModification;
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
* @param registration the SIPAccountRegistration
*/
public void commitPage(SIPAccountRegistration registration)
{
String userID = accountPanel.getUserID();
if(userID == null || userID.trim().length() == 0)
throw new IllegalStateException("No user ID provided.");
registration.setUserID(userID);
char[] password = accountPanel.getPassword();
if (password != null)
registration.setPassword(new String(password));
registration.setRememberPassword(accountPanel.isRememberPassword());
registration.setServerAddress(connectionPanel.getServerAddress());
String displayName = accountPanel.getDisplayName();
registration.setDisplayName(displayName);
String authName = connectionPanel.getAuthenticationName();
if(authName != null && authName.length() > 0)
registration.setAuthorizationName(authName);
registration.setServerPort(connectionPanel.getServerPort());
registration.setProxy(connectionPanel.getProxy());
registration.setProxyPort(connectionPanel.getProxyPort());
registration.setPreferredTransport(
connectionPanel.getSelectedTransport());
registration.setEnablePresence(
presencePanel.isPresenceEnabled());
registration.setForceP2PMode(
presencePanel.isForcePeerToPeerMode());
registration.setDefaultEncryption(
connectionPanel.isDefaultEncryptionEnabled());
registration.setSipZrtpAttribute(
connectionPanel.isSipZrtpEnabled());
registration.setPollingPeriod(
presencePanel.getPollPeriod());
registration.setSubscriptionExpiration(
presencePanel.getSubscriptionExpiration());
registration.setKeepAliveMethod(
connectionPanel.getKeepAliveMethod());
registration.setKeepAliveInterval(
connectionPanel.getKeepAliveInterval());
SIPAccRegWizzActivator.getUIService().getAccountRegWizardContainer()
.setBackButtonEnabled(true);
}
/**
* Loads the account with the given identifier.
* @param accountID the account identifier
*/
public void loadAccount(AccountID accountID)
{
String password = accountID.getAccountPropertyString(
ProtocolProviderFactory.PASSWORD);
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);
boolean enabledDefaultEncryption = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
boolean enabledSipZrtpAttribute = accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true);
String pollingPeriod = accountID.getAccountPropertyString(
ProtocolProviderFactory.POLLING_PERIOD);
String subscriptionPeriod = accountID.getAccountPropertyString(
ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
String keepAliveMethod =
accountID.getAccountPropertyString("KEEP_ALIVE_METHOD");
String keepAliveInterval =
accountID.getAccountPropertyString("KEEP_ALIVE_INTERVAL");
connectionPanel.setServerOverridden(
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false));
accountPanel.setUserIDEnabled(false);
accountPanel.setUserID((serverAddress == null) ? accountID.getUserID()
: (accountID.getUserID() + "@" + serverAddress));
setNextFinishButtonEnabled(accountPanel.getUserID() != null);
if (password != null)
{
accountPanel.setPassword(password);
accountPanel.setRememberPassword(true);
}
connectionPanel.setServerAddress(serverAddress);
connectionPanel.setServerEnabled(false);
if (displayName != null && displayName.length() > 0)
accountPanel.setDisplayName(displayName);
if(authName != null && authName.length() > 0)
connectionPanel.setAuthenticationName(authName);
connectionPanel.setServerPort(serverPort);
connectionPanel.setProxy(proxyAddress);
// The order of the next two fields is important, as a change listener
// of the transportCombo sets the proxyPortField to its default
connectionPanel.setSelectedTransport(preferredTransport);
connectionPanel.setProxyPort(proxyPort);
presencePanel.setPresenceEnabled(enablePresence);
presencePanel.setForcePeerToPeerMode(forceP2P);
connectionPanel.enablesDefaultEncryption(enabledDefaultEncryption);
connectionPanel.setSipZrtpEnabled( enabledSipZrtpAttribute,
enabledDefaultEncryption);
presencePanel.setPollPeriod(pollingPeriod);
presencePanel.setSubscriptionExpiration(subscriptionPeriod);
if (!enablePresence)
{
presencePanel.setPresenceOptionsEnabled(enablePresence);
}
connectionPanel.setKeepAliveMethod(keepAliveMethod);
connectionPanel.setKeepAliveInterval(keepAliveInterval);
}
/**
* Returns a simple version of this registration form.
* @return the simple form component
*/
public Component getSimpleForm()
{
return accountPanel;
}
/**
* Sets the isModification property.
* @param isModification indicates if this form is created for modification
*/
public void setModification(boolean isModification)
{
this.isModification = isModification;
}
/**
* Returns the username example.
* @return the username example string
*/
public String getUsernameExample()
{
return wizard.getUserNameExample();
}
/**
* Sign ups through the web.
*/
public void webSignup()
{
wizard.webSignup();
}
/**
* Returns the sign up link name.
* @return the sign up link name
*/
public String getWebSignupLinkName()
{
return wizard.getWebSignupLinkName();
}
}

@ -90,7 +90,6 @@ public byte[] getPageImage()
return Resources.getImage(Resources.PAGE_IMAGE);
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
@ -115,7 +114,10 @@ public String getProtocolDescription() {
*/
public Iterator<WizardPage> getPages() {
java.util.List<WizardPage> pages = new ArrayList<WizardPage>();
firstWizardPage = new FirstWizardPage(this);
// If the first wizard page was already created
if (firstWizardPage == null)
firstWizardPage = new FirstWizardPage(this);
pages.add(firstWizardPage);
@ -250,6 +252,8 @@ public ProtocolProviderService signin()
/**
* Installs the account with the given user name and password.
* @param userName the account user name
* @param password the password
* @return the <tt>ProtocolProviderService</tt> corresponding to the newly
* created account.
* @throws OperationFailedException problem signing in.
@ -288,6 +292,17 @@ private ProtocolProviderService installAccount(
Hashtable<String, String> accountProperties
= new Hashtable<String, String>();
accountProperties.put(ProtocolProviderFactory.PROTOCOL, getProtocol());
String protocolIconPath = getProtocolIconPath();
if (protocolIconPath != null)
accountProperties.put( ProtocolProviderFactory.PROTOCOL_ICON_PATH,
protocolIconPath);
String accountIconPath = getAccountIconPath();
if (accountIconPath != null)
accountProperties.put( ProtocolProviderFactory.ACCOUNT_ICON_PATH,
accountIconPath);
if(registration.isRememberPassword())
{
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
@ -296,8 +311,6 @@ private ProtocolProviderService installAccount(
String serverAddress = null;
if (registration.getServerAddress() != null)
serverAddress = registration.getServerAddress();
else
serverAddress = getServerFromUserName(userName);
if (serverAddress != null)
{
@ -324,8 +337,6 @@ private ProtocolProviderService installAccount(
String proxyAddress = null;
if (registration.getProxy() != null)
proxyAddress = registration.getProxy();
else
proxyAddress = getServerFromUserName(userName);
if (proxyAddress != null)
accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
@ -512,11 +523,12 @@ public void setModification(boolean isModification)
*/
public String getUserNameExample()
{
return FirstWizardPage.USER_NAME_EXAMPLE;
return "Ex: john@voiphone.net or simply \"john\" for no server";
}
/**
* Enables the simple "Sign in" form.
* @return <tt>true</tt> to indicate that the simple form is enabled
*/
public boolean isSimpleFormEnabled()
{
@ -524,26 +536,17 @@ public boolean isSimpleFormEnabled()
}
/**
* Return the server part of the sip user name.
*
* @param userName the username.
* @return the server part of the sip user name.
* Sign ups through the web.
*/
protected String getServerFromUserName(String userName)
{
int delimIndex = userName.indexOf("@");
if (delimIndex != -1)
{
return userName.substring(delimIndex + 1);
}
return null;
}
public void webSignup() {}
public void webSignup()
/**
* Returns the name of the web sign up link.
* @return the name of the web sign up link
*/
public String getWebSignupLinkName()
{
SIPAccRegWizzActivator.getBrowserLauncher()
.openURL("http://serweb.iptel.org/user/reg/index.php");
return null;
}
/**
@ -557,9 +560,41 @@ public boolean isWebSignupSupported()
return true;
}
/**
* Returns the simple form.
* @return the simple form
*/
public Object getSimpleForm()
{
firstWizardPage = new FirstWizardPage(this);
return firstWizardPage.getSimpleForm();
}
/**
* Returns the protocol name as listed in "ProtocolNames" or just the name
* of the service.
* @return the protocol name
*/
public String getProtocol()
{
return ProtocolNames.SIP;
}
/**
* Returns the protocol icon path.
* @return the protocol icon path
*/
public String getProtocolIconPath()
{
return null;
}
/**
* Returns the account icon path.
* @return the account icon path
*/
public String getAccountIconPath()
{
return null;
}
}

@ -4,6 +4,7 @@ Bundle-Description: SIP account registration wizard.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Export-package: net.java.sip.communicator.plugin.sipaccregwizz
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.browserlauncher,
net.java.sip.communicator.service.configuration,

Loading…
Cancel
Save