Add ippi account creation wizard.

cusax-fix
Damian Minkov 15 years ago
parent 043d85e72e
commit 84ec1f582a

@ -916,7 +916,7 @@
bundle-plugin-googletalkaccregwizz,bundle-argdelegation-service,
bundle-argdelegation,bundle-zrtp4j,bundle-json,
bundle-filehistory,bundle-metahistory,bundle-metahistory-slick,
bundle-plugin-facebookaccregwizz,
bundle-plugin-facebookaccregwizz,bundle-plugin-ippiaccregwizz,
bundle-bouncycastle,bundle-plugin-otr,bundle-plugin-iptelaccregwizz,
bundle-contactsource,bundle-plugin-reconnect,bundle-plugin-securityconfig,
bundle-plugin-advancedconfig,
@ -1711,6 +1711,16 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
<!-- BUNDLE-PLUGIN-IPPIACCREGWIZZ -->
<target name="bundle-plugin-ippiaccregwizz">
<!-- Creates a bundle for the plugin ippi Account Registration Wizard.-->
<jar compress="false" destfile="${bundles.dest}/ippiaccregwizz.jar"
manifest="${src}/net/java/sip/communicator/plugin/ippiaccregwizz/ippiaccregwizz.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/plugin/ippiaccregwizz"
prefix="net/java/sip/communicator/plugin/ippiaccregwizz"/>
</jar>
</target>
<!-- BUNDLE-PLUGIN-GIBBERISHACCREGWIZZ -->
<target name="bundle-plugin-gibberishaccregwizz">
<!-- Creates a bundle for the plugin Gibberish Account Registration

@ -159,6 +159,7 @@ felix.auto.start.67= \
felix.auto.start.70= \
reference:file:sc-bundles/simpleaccreg.jar \
reference:file:sc-bundles/securityconfig.jar \
reference:file:sc-bundles/ippiaccregwizz.jar \
reference:file:sc-bundles/iptelaccregwizz.jar
felix.auto.start.75= \

@ -65,6 +65,9 @@ plugin.jabberaccregwizz.SERVER_COMMENTS=net/java/sip/communicator/plugin/jabbera
# protocol order for the simple initial account registration wizard
plugin.simpleaccreg.PROTOCOL_ORDER=SIP|MSN|Yahoo|ICQ|AIM|Jabber
# ippi account wizard create accoutns link
plugin.ippiaccregwizz.REGISTER_LINK=https://soap.ippi.fr/subscription/jitsi.php?login={0}&password={1}&email={2}
# Default provisioning method
plugin.provisioning.DEFAULT_PROVISIONING_METHOD=

@ -396,6 +396,10 @@ service.protocol.iptel.IPTEL_64x64=resources/images/protocol/iptel/sip64x64.png
service.protocol.sip2sip.SIP2SIP_16x16=resources/images/protocol/sip2sip/sip16x16.png
service.protocol.sip2sip.SIP2SIP_64x64=resources/images/protocol/sip2sip/sip64x64.png
# ippi accregwizz
service.protocol.ippi.IPPI_16x16=resources/images/protocol/ippi/sip16x16.png
service.protocol.ippi.IPPI_64x64=resources/images/protocol/ippi/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
@ -523,4 +527,4 @@ plugin.spellcheck.PERSONAL_DIR=resources/images/plugin/spellchecker/personalDict
plugin.spellcheck.WORD_INCLUDE=resources/images/plugin/spellchecker/wordInclude.png
plugin.spellcheck.WORD_EXCLUDE=resources/images/plugin/spellchecker/wordExclude.png
plugin.spellcheck.ENABLE=resources/images/plugin/spellchecker/enableSpellchecker.png
plugin.spellcheck.DISABLE=resources/images/plugin/spellchecker/disableSpellchecker.png
plugin.spellcheck.DISABLE=resources/images/plugin/spellchecker/disableSpellchecker.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -969,6 +969,18 @@ plugin.sip2sipaccregwizz.INFO_NOTE=<html>For help about this service visit <a hr
plugin.sip2sipaccregwizz.EXISTING_ACCOUNT=Existing sip2sip.info account
plugin.sip2sipaccregwizz.CREATE_ACCOUNT=Create a free sip2sip.info account
# ippi accregwizz
plugin.ippiaccregwizz.PROTOCOL_NAME=ippi
plugin.ippiaccregwizz.PROTOCOL_DESCRIPTION=VoIP && Instant Messaging
plugin.ippiaccregwizz.USERNAME=Username
plugin.ippiaccregwizz.RETYPE_PASSWORD=Retype password
plugin.ippiaccregwizz.EMAIL=Email address
plugin.ippiaccregwizz.NEW_ACCOUNT_TITLE=For help about this service visit<br>http://ippi.fr
plugin.ippiaccregwizz.EMAIL_NOTE=<html>The email address is used to send voicemail messages, <br>missed calls notifications and to recover a lost password</html>
plugin.ippiaccregwizz.INFO_NOTE=<html>For help about this service visit <a href=''>http://ippi.fr</a></html>
plugin.ippiaccregwizz.EXISTING_ACCOUNT=Existing ippi account
plugin.ippiaccregwizz.CREATE_ACCOUNT=Create a free ippi account
# key binding chooser
plugin.keybindings.CHAT_CLOSE=Close Chat Window
plugin.keybindings.CHAT_COPY=Copy

@ -577,6 +577,12 @@ public void run()
}
});
}
else
{
// no provider, maybe an error, stop connecting
// so we can proceed with the actions
stopConnecting(wizardContainer);
}
}
catch (OperationFailedException e)
{

@ -0,0 +1,298 @@
/*
* 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.ippiaccregwizz;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import javax.swing.*;
import javax.swing.text.*;
import org.json.*;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* @author Yana Stamcheva
* @author Damian Minkov
*/
public class CreateIppiAccountForm
extends TransparentPanel
implements SIPAccountCreationFormService
{
/**
* The logger.
*/
private static final Logger logger
= Logger.getLogger(CreateIppiAccountForm.class);
/**
* The user name text field.
*/
private final JTextField usernameField = new TrimTextField();
/**
* The password field.
*/
private final JPasswordField passField = new JPasswordField();
/**
* The retype password field.
*/
private final JPasswordField retypePassField = new JPasswordField();
/**
* The email field.
*/
private final JTextField emailField = new JTextField();
/**
* The error text pane.
*/
private final JTextPane errorPane = new JTextPane();
/**
* The register link.
*/
private final static String registerLink
= IppiAccRegWizzActivator.getResources().getSettingsString(
"plugin.ippiaccregwizz.REGISTER_LINK");
/**
* Creates an instance of <tt>RegisterIppiAccountForm</tt>.
*/
public CreateIppiAccountForm()
{
super(new BorderLayout());
this.init();
}
/**
* Initializes this panel.
*/
private void init()
{
JPanel mainPanel = new TransparentPanel(new BorderLayout());
mainPanel.setBorder(BorderFactory.createTitledBorder(
IppiAccRegWizzActivator.getResources()
.getI18NString("plugin.sipaccregwizz.CREATE_ACCOUNT_TITLE")));
JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1));
JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1));
JLabel usernameLabel
= new JLabel(IppiAccRegWizzActivator.getResources()
.getI18NString("plugin.ippiaccregwizz.USERNAME"));
JLabel passLabel
= new JLabel(IppiAccRegWizzActivator.getResources()
.getI18NString("service.gui.PASSWORD"));
JLabel retypePasswordLabel
= new JLabel(IppiAccRegWizzActivator.getResources()
.getI18NString("plugin.ippiaccregwizz.RETYPE_PASSWORD"));
JLabel emailLabel
= new JLabel(IppiAccRegWizzActivator.getResources()
.getI18NString("plugin.ippiaccregwizz.EMAIL"));
labelsPanel.add(usernameLabel);
labelsPanel.add(passLabel);
labelsPanel.add(retypePasswordLabel);
labelsPanel.add(emailLabel);
valuesPanel.add(usernameField);
valuesPanel.add(passField);
valuesPanel.add(retypePassField);
valuesPanel.add(emailField);
JLabel emailDescriptionLabel
= new JLabel(IppiAccRegWizzActivator.getResources()
.getI18NString("plugin.ippiaccregwizz.EMAIL_NOTE"),
SwingConstants.CENTER);
emailDescriptionLabel.setForeground(Color.GRAY);
emailDescriptionLabel.setFont(emailDescriptionLabel.getFont().deriveFont(8));
emailDescriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 8, 10));
initErrorArea();
mainPanel.add(labelsPanel, BorderLayout.WEST);
mainPanel.add(valuesPanel, BorderLayout.CENTER);
mainPanel.add(emailDescriptionLabel, BorderLayout.SOUTH);
this.add(mainPanel, BorderLayout.CENTER);
JLabel infoLabel
= new JLabel(IppiAccRegWizzActivator.getResources()
.getI18NString("plugin.ippiaccregwizz.INFO_NOTE"),
SwingConstants.RIGHT);
infoLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
infoLabel.setForeground(Color.GRAY);
infoLabel.setFont(emailDescriptionLabel.getFont().deriveFont(8));
infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
infoLabel.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
IppiAccRegWizzActivator.getBrowserLauncher()
.openURL("http://ippi.fr");
}
});
this.add(infoLabel, BorderLayout.SOUTH);
}
/**
* Creates the error area component.
*/
private void initErrorArea()
{
SimpleAttributeSet attribs = new SimpleAttributeSet();
StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_RIGHT);
StyleConstants.setFontFamily(attribs, errorPane.getFont().getFamily());
StyleConstants.setForeground(attribs, Color.RED);
errorPane.setParagraphAttributes(attribs, true);
errorPane.setPreferredSize(new Dimension(100, 50));
errorPane.setMinimumSize(new Dimension(100, 50));
errorPane.setOpaque(false);
}
/**
* Creates this account on the server.
* @return the created account
*/
public NewAccount createAccount()
{
NewAccount newAccount = null;
try
{
String registerLinkFilled = MessageFormat.format(registerLink,
URLEncoder.encode(usernameField.getText(), "UTF-8"),
URLEncoder.encode(new String(passField.getPassword()), "UTF-8"),
URLEncoder.encode(emailField.getText(), "UTF-8"));
URL url = new URL(registerLinkFilled);
URLConnection conn = url.openConnection();
// If this is not an http connection we have nothing to do here.
if (!(conn instanceof HttpURLConnection))
{
return null;
}
HttpURLConnection httpConn = (HttpURLConnection) conn;
int responseCode = httpConn.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK)
{
// Read all the text returned by the server
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String str;
StringBuffer stringBuffer = new StringBuffer();
while ((str = in.readLine()) != null)
{
stringBuffer.append(str);
}
if (logger.isInfoEnabled())
logger.info("JSON response to create account request: "
+ stringBuffer.toString());
newAccount = parseHttpResponse(stringBuffer.toString());
}
}
catch (MalformedURLException e1)
{
if (logger.isInfoEnabled())
logger.info("Failed to create URL with string: "
+ registerLink, e1);
}
catch (IOException e1)
{
if (logger.isInfoEnabled())
logger.info("Failed to open connection.", e1);
}
return newAccount;
}
/**
* Returns the form, which would be used by the user to create a new
* account.
* @return the component of the form
*/
public Component getForm()
{
return this;
}
/**
* Clears all the data previously entered in the form.
*/
public void clear()
{
usernameField.setText("");
passField.setText("");
retypePassField.setText("");
emailField.setText("");
errorPane.setText("");
remove(errorPane);
}
/**
* Parses the given http response.
* @param response the http response to parse
* @return the new account
*/
private NewAccount parseHttpResponse(String response)
{
NewAccount newAccount = null;
try
{
JSONObject jsonObject = new JSONObject(response);
boolean isSuccess = jsonObject.getBoolean("success");
if (isSuccess)
{
newAccount = new NewAccount(
usernameField.getText() + "@ippi.fr",
passField.getPassword(),
null,
"ippi.fr");
}
else
{
String errorMessage
= jsonObject.getString("error_message");
errorPane.setText(errorMessage);
add(errorPane, BorderLayout.NORTH);
SwingUtilities.getWindowAncestor(
CreateIppiAccountForm.this).pack();
}
}
catch (JSONException e1)
{
if (logger.isInfoEnabled())
logger.info("Failed Json parsing.", e1);
}
return newAccount;
}
}

@ -0,0 +1,125 @@
/*
* 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.ippiaccregwizz;
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.*;
/**
* Registers the <tt>IppiAccountRegistrationWizard</tt> in the UI Service.
*
* @author Lubomir Marinov
* @author Yana Stamcheva
* @author Damian Minkov
*/
public class IppiAccRegWizzActivator
implements BundleActivator
{
/**
* The bundle context.
*/
public static BundleContext bundleContext;
/**
* The browser launcher service.
*/
private static BrowserLauncherService browserLauncherService;
/**
* The resources service.
*/
private static ResourceManagementService resourcesService;
/**
* The ui service.
*/
private static UIService uiService;
/**
* Starts this bundle.
* @param bc BundleContext
* @throws Exception
*/
public void start(BundleContext bc)
throws Exception
{
bundleContext = bc;
System.setProperty(
"http.agent",
System.getProperty("sip-communicator.application.name")
+ "/"
+ System.getProperty("sip-communicator.version"));
uiService =
(UIService) bundleContext.getService(bundleContext
.getServiceReference(UIService.class.getName()));
IppiAccountRegistrationWizard wizard
= new IppiAccountRegistrationWizard(uiService
.getAccountRegWizardContainer());
Hashtable<String, String> containerFilter
= new Hashtable<String, String>();
containerFilter.put(
ProtocolProviderFactory.PROTOCOL,
IppiAccountRegistrationWizard.PROTOCOL);
bundleContext.registerService(
AccountRegistrationWizard.class.getName(),
wizard,
containerFilter);
}
public void stop(BundleContext bundleContext) throws Exception {}
/**
* 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(IppiAccRegWizzActivator.bundleContext);
return resourcesService;
}
}

@ -0,0 +1,235 @@
/*
* 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.ippiaccregwizz;
import java.util.*;
import net.java.sip.communicator.plugin.sipaccregwizz.*;
import net.java.sip.communicator.service.gui.*;
/**
* The <tt>IppiAccountRegistrationWizard</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
* @author Damian Minkov
*/
public class IppiAccountRegistrationWizard
extends SIPAccountRegistrationWizard
{
/**
* A constant pointing to the IP Tel protocol logo image.
*/
private static final String PROTOCOL_ICON
= "service.protocol.ippi.IPPI_16x16";
/**
* A constant pointing to the IP Tel protocol wizard page image.
*/
private static final String PAGE_IMAGE
= "service.protocol.ippi.IPPI_64x64";
/**
* The protocol name.
*/
public static final String PROTOCOL = "ippi";
/**
* The create account form.
*/
CreateIppiAccountForm createAccountForm = new CreateIppiAccountForm();
/**
* Creates an instance of <tt>IptelAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container
*/
public IppiAccountRegistrationWizard(WizardContainer wizardContainer)
{
super(wizardContainer);
}
/**
* Returns the set of pages contained in this wizard.
* @return Iterator
*/
public Iterator<WizardPage> getPages()
{
SIPAccountRegistration reg = new SIPAccountRegistration();
setPredefinedProperties(reg);
return getPages(reg);
}
/**
* Returns the simple form.
* @return the simple form
*/
public Object getSimpleForm()
{
SIPAccountRegistration reg = new SIPAccountRegistration();
setPredefinedProperties(reg);
return getSimpleForm(reg);
}
/**
* Sets all predefined properties specific for this account wizard.
*
* @param reg the registration object
*/
private void setPredefinedProperties(SIPAccountRegistration reg)
{
// set default proxy, common for ippi
reg.setProxy("ippi.fr");
reg.setDefaultTransport("TCP");
reg.setDefaultDomain("ippi.fr");
}
/**
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
* @return byte[]
*/
public byte[] getIcon()
{
return IppiAccRegWizzActivator.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 IppiAccRegWizzActivator.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.ippiaccregwizz.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.ippiaccregwizz.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@ippi.fr";
}
/**
* 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/ippi";
}
/**
* Returns the account icon path.
* @return the account icon path
*/
public String getAccountIconPath()
{
return "resources/images/protocol/ippi/sip32x32.png";
}
/**
* Opens the browser on the page sign up
*/
public void webSignup()
{
IppiAccRegWizzActivator.getBrowserLauncher()
.openURL("https://www.ippi.fr/index.php?page=sp-offer");
}
/**
* 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.ippiaccregwizz.NEW_ACCOUNT_TITLE");
}
/**
* Returns an instance of <tt>CreateAccountService</tt> through which the
* user could create an account. This method is meant to be implemented by
* specific protocol provider wizards.
* @return an instance of <tt>CreateAccountService</tt>
*/
protected SIPAccountCreationFormService getCreateAccountService()
{
return createAccountForm;
}
/**
* Returns the display label used for the sip id field.
* @return the sip id display label string.
*/
protected String getUsernameLabel()
{
return Resources.getString("plugin.ippiaccregwizz.USERNAME");
}
/**
* Return the string for add existing account button.
* @return the string for add existing account button.
*/
protected String getExistingAccountLabel()
{
return Resources.getString("plugin.ippiaccregwizz.EXISTING_ACCOUNT");
}
/**
* Return the string for create new account button.
* @return the string for create new account button.
*/
protected String getCreateAccountLabel()
{
return Resources.getString("plugin.ippiaccregwizz.CREATE_ACCOUNT");
}
}

@ -0,0 +1,42 @@
Bundle-Activator: net.java.sip.communicator.plugin.ippiaccregwizz.IppiAccRegWizzActivator
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.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,
org.json,
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
Loading…
Cancel
Save