The IRC account registration wizard plugin.

NOTE: This plugin is not yet enabled.
cusax-fix
Yana Stamcheva 19 years ago
parent 190b73736b
commit 6c5619be1a

@ -0,0 +1,465 @@
/*
* 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.ircaccregwizz;
import java.util.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>FirstWizardPage</tt> is the page, where user could enter the user ID
* and the password of the account.
*
* @author Lionel Ferreira & Michael Tarantino
*/
public class FirstWizardPage
extends JPanel
implements WizardPage,
DocumentListener,
ActionListener
{
/**
* The identifier of this wizard page.
*/
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
private JPanel userPassPanel = new JPanel(new BorderLayout(10, 10));
private JPanel serverPanel = new JPanel(new BorderLayout(10, 10));
private JPanel optionsPanel = new JPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new JPanel();
private JPanel valuesPanel = new JPanel();
private JPanel labelsServerPanel = new JPanel();
private JPanel valuesServerPanel = new JPanel();
private JPanel labelsOptionsPanel = new JPanel();
private JPanel valuesOptionsPanel = new JPanel();
private JLabel infoPassword
= new JLabel(Resources.getString("infoPassword"));
private JLabel nick = new JLabel(Resources.getString("nick"));
private JLabel passLabel = new JLabel(Resources.getString("password"));
private JLabel server = new JLabel(Resources.getString("server"));
private JLabel port = new JLabel(Resources.getString("port"));
private JLabel existingAccountLabel
= new JLabel(Resources.getString("existingAccount"));
private JPanel emptyPanel = new JPanel();
private JPanel emptyPanel2 = new JPanel();
private JLabel nickExampleLabel = new JLabel("Ex: ircuser");
private JLabel serverExampleLabel = new JLabel("Ex: irc.quakenet.org");
private JTextField nickField = new JTextField();
private JPasswordField passField = new JPasswordField();
private JTextField serverField = new JTextField();
private JTextField portField = new JTextField();
private JCheckBox rememberPassBox = new JCheckBox(
Resources.getString("rememberPassword"));
private JCheckBox autoNickChange = new JCheckBox(
Resources.getString("autoNickChange"));
private JCheckBox defaultPort = new JCheckBox(
Resources.getString("defaultPort"));
private JCheckBox passwordNotRequired = new JCheckBox(
Resources.getString("passwordNotRequired"));
private JPanel mainPanel = new JPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
private IrcAccountRegistration registration = null;
private WizardContainer wizardContainer;
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
* @param registration the <tt>IrcAccountRegistration</tt>, where
* all data through the wizard are stored
* @param wizardContainer the wizardContainer, where this page will
* be added
*/
public FirstWizardPage(IrcAccountRegistration registration,
WizardContainer wizardContainer)
{
super(new BorderLayout());
this.wizardContainer = wizardContainer;
this.registration = registration;
this.setPreferredSize(new Dimension(200, 150));
mainPanel.setLayout(new BoxLayout(mainPanel, 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));
this.labelsServerPanel.setLayout(
new BoxLayout(labelsServerPanel, BoxLayout.Y_AXIS));
this.valuesServerPanel.setLayout(
new BoxLayout(valuesServerPanel, BoxLayout.Y_AXIS));
this.labelsOptionsPanel.setLayout(
new BoxLayout(labelsOptionsPanel, BoxLayout.Y_AXIS));
this.valuesOptionsPanel.setLayout(
new BoxLayout(valuesOptionsPanel, BoxLayout.Y_AXIS));
this.portField.setEnabled(false);
this.passField.setEnabled(false);
this.rememberPassBox.setEnabled(false);
}
/**
* Initializes all panels, buttons, etc.
*/
private void init()
{
this.nickField.getDocument().addDocumentListener(this);
this.serverField.getDocument().addDocumentListener(this);
this.defaultPort.addActionListener(this);
this.passwordNotRequired.addActionListener(this);
this.rememberPassBox.setSelected(true);
this.autoNickChange.setSelected(true);
this.defaultPort.setSelected(true);
this.passwordNotRequired.setSelected(true);
this.existingAccountLabel.setForeground(Color.RED);
this.nickExampleLabel.setForeground(Color.GRAY);
this.nickExampleLabel.setFont(
nickExampleLabel.getFont().deriveFont(8));
this.serverExampleLabel.setForeground(Color.GRAY);
this.serverExampleLabel.setFont(
serverExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
this.emptyPanel2.setMaximumSize(new Dimension(40, 35));
this.nickExampleLabel.setBorder(
BorderFactory.createEmptyBorder(0, 0, 8,0));
this.serverExampleLabel.setBorder(
BorderFactory.createEmptyBorder(0, 0, 8,0));
labelsPanel.add(nick);
labelsPanel.add(emptyPanel);
labelsPanel.add(passLabel);
// labelsPanel.add(server);
valuesPanel.add(nickField);
valuesPanel.add(nickExampleLabel);
valuesPanel.add(passField);
// valuesPanel.add(serverField);
userPassPanel.add(infoPassword, BorderLayout.NORTH);
userPassPanel.add(labelsPanel, BorderLayout.WEST);
userPassPanel.add(valuesPanel, BorderLayout.CENTER);
userPassPanel.add(passwordNotRequired, BorderLayout.SOUTH);
// userPassPanel.add(autoChangeNick, BorderLayout.SOUTH);
userPassPanel.setBorder(BorderFactory
.createTitledBorder(Resources.getString(
"userAndPassword")));
labelsServerPanel.add(server);
labelsServerPanel.add(emptyPanel2);
labelsServerPanel.add(port);
valuesServerPanel.add(serverField);
valuesServerPanel.add(serverExampleLabel);
valuesServerPanel.add(portField);
serverPanel.add(labelsServerPanel, BorderLayout.WEST);
serverPanel.add(valuesServerPanel, BorderLayout.CENTER);
serverPanel.add(defaultPort, BorderLayout.SOUTH);
serverPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("serverIRC")));
optionsPanel.add(rememberPassBox, BorderLayout.CENTER);
optionsPanel.add(autoNickChange, BorderLayout.SOUTH);
optionsPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("options")));
mainPanel.add(userPassPanel);
mainPanel.add(serverPanel);
mainPanel.add(optionsPanel);
this.add(mainPanel, BorderLayout.NORTH);
// this.add(serverPanel, BorderLayout.SOUTH);
// this.add(optionsPanel, BorderLayout.AFTER_LAST_LINE);
}
/**
* Implements the <code>WizardPage.getIdentifier</code> to return
* this page identifier.
*
* @return the Identifier of the first page in this wizard.
*/
public Object getIdentifier()
{
return FIRST_PAGE_IDENTIFIER;
}
/**
* Implements the <code>WizardPage.getNextPageIdentifier</code> to return
* the next page identifier - the summary page.
*
* @return the identifier of the page following this one.
*/
public Object getNextPageIdentifier()
{
return nextPageIdentifier;
}
/**
* Implements the <code>WizardPage.getBackPageIdentifier</code> to return
* the next back identifier - the default page.
*
* @return the identifier of the default wizard page.
*/
public Object getBackPageIdentifier()
{
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
}
/**
* Implements the <code>WizardPage.getWizardForm</code> to return
* this panel.
*
* @return the component to be displayed in this wizard page.
*/
public Object getWizardForm()
{
return this;
}
/**
* Before this page is displayed enables or disables the "Next" wizard
* button according to whether the UserID field is empty.
*/
public void pageShowing()
{
this.setNextButtonAccordingToUserID();
}
/**
* Saves the user input when the "Next" wizard buttons is clicked.
*/
public void pageNext()
{
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
userPassPanel.remove(existingAccountLabel);
registration.setUserID(nickField.getText());
registration.setPassword(new String(passField.getPassword()));
registration.setServer(new String(serverField.getText()));
registration.setPort(new String(portField.getText()));
registration.setRememberPassword(rememberPassBox.isSelected());
registration.setAutoChangeNick(autoNickChange.isSelected());
registration.setRequiredPassword(!passwordNotRequired.isSelected());
}
/**
* Enables or disables the "Next" wizard button according to whether the
* User ID field is empty.
*/
private void setNextButtonAccordingToUserID()
{
if (nickField.getText() == null
|| nickField.getText().equals("")
|| serverField.getText() == null
|| serverField.getText().equals("")
|| (!passwordNotRequired.isSelected()
&& passField.equals("")))
{
wizardContainer.setNextFinishButtonEnabled(false);
}
else
{
wizardContainer.setNextFinishButtonEnabled(true);
}
}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user types in the
* User ID field. Enables or disables the "Next" wizard button according to
* whether the User ID field is empty.
*
* @param event the event containing the update.
*/
public void insertUpdate(DocumentEvent event)
{
this.setNextButtonAccordingToUserID();
}
/**
* Handles the <tt>DocumentEvent</tt> triggered when user deletes letters
* from the UserID field. Enables or disables the "Next" wizard button
* according to whether the UserID field is empty.
*
* @param event the event containing the update.
*/
public void removeUpdate(DocumentEvent event)
{
this.setNextButtonAccordingToUserID();
}
/**
* Fills the UserID 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 = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.PASSWORD);
String server = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.SERVER_ADDRESS);
String port = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.SERVER_PORT);
String autoNickChange = (String) accountID.getAccountProperties()
.get("AUTO_NICK_CHANGE");
String passwordNotRequired = (String) accountID.getAccountProperties()
.get("PASSWORD_NOT_REQUIRED");
this.nickField.setText(accountID.getUserID());
this.serverField.setText(server);
if (password != null)
{
this.passField.setText(password);
this.rememberPassBox.setSelected(true);
}
if (port != null)
{
this.portField.setText(port);
this.portField.setEnabled(true);
this.defaultPort.setSelected(false);
}
if (autoNickChange.equals("1"))
{
this.autoNickChange.setSelected(true);
}
else this.autoNickChange.setSelected(false);
if (passwordNotRequired.equals("1"))
{
this.passwordNotRequired.setSelected(true);
}
else this.passwordNotRequired.setSelected(false);
}
/**
* Verifies whether there is already an account installed with the same
* details as the one that the user has just entered.
*
* @param userID the name of the user that the account is registered for
* @return true if there is already an account for this userID and false
* otherwise.
*/
private boolean isExistingAccount(String userID)
{
ProtocolProviderFactory factory
= IrcAccRegWizzActivator.getIrcProtocolProviderFactory();
ArrayList registeredAccounts = factory.getRegisteredAccounts();
for (int i = 0; i < registeredAccounts.size(); i++)
{
AccountID accountID = (AccountID) registeredAccounts.get(i);
if (userID.equalsIgnoreCase(accountID.getUserID()))
{
return true;
}
}
return false;
}
/**
* Indicates when the default port check box and the passwordNotRequired
* check box are selected.
*/
public void actionPerformed(ActionEvent event)
{
if (defaultPort.isSelected())
{
portField.setText("");
portField.setEnabled(false);
}
else portField.setEnabled(true);
if (passwordNotRequired.isSelected())
{
passField.setText("");
passField.setEnabled(false);
rememberPassBox.setEnabled(false);
}
else
{
passField.setEnabled(true);
rememberPassBox.setEnabled(true);
}
}
public void changedUpdate(DocumentEvent event){}
public void pageHiding(){}
public void pageShown(){}
public void pageBack(){}
}

@ -0,0 +1,104 @@
/*
* 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.ircaccregwizz;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
* Registers the <tt>IrcAccountRegistrationWizard</tt> in the UI Service.
*
* @author Lionel Ferreira & Michael Tarantino
*/
public class IrcAccRegWizzActivator
implements BundleActivator
{
private static Logger logger = Logger.getLogger(
IrcAccRegWizzActivator.class.getName());
/**
* A currently valid bundle context.
*/
public static BundleContext bundleContext;
/**
* Starts this bundle.
* @param bc the currently valid <tt>BundleContext</tt>.
*/
public void start(BundleContext bc)
{
logger.info("Loading irc account wizard.");
bundleContext = bc;
ServiceReference uiServiceRef = bundleContext
.getServiceReference(UIService.class.getName());
UIService uiService
= (UIService) bundleContext.getService(uiServiceRef);
AccountRegistrationWizardContainer wizardContainer
= uiService.getAccountRegWizardContainer();
IrcAccountRegistrationWizard ircWizard
= new IrcAccountRegistrationWizard(wizardContainer);
wizardContainer.addAccountRegistrationWizard(ircWizard);
logger.info("IRC account registration wizard [STARTED].");
}
/**
* Called when this bundle is stopped so the Framework can perform the
* bundle-specific activities necessary to stop the bundle.
*
* @param context The execution context of the bundle being stopped.
*/
public void stop(BundleContext context)
{
}
/**
* Returns the <tt>ProtocolProviderFactory</tt> for the IRC protocol.
* @return the <tt>ProtocolProviderFactory</tt> for the IRC protocol
*/
public static ProtocolProviderFactory getIrcProtocolProviderFactory()
{
ServiceReference[] serRefs = null;
String osgiFilter = "("
+ ProtocolProviderFactory.PROTOCOL
+ "=" + "IRC" + ")";
try
{
serRefs = bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
}
catch (InvalidSyntaxException ex)
{
logger.error(ex);
}
return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]);
}
/**
* Returns the bundleContext that we received when we were started.
*
* @return a currently valid instance of a bundleContext.
*/
public BundleContext getBundleContext()
{
return bundleContext;
}
}

@ -0,0 +1,171 @@
/*
* 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.ircaccregwizz;
/**
* The <tt>IrcAccountRegistration</tt> is used to store all user input data
* through the <tt>IrcAccountRegistrationWizard</tt>.
*
* @author Lionel Ferreira & Michael Tarantino
*/
public class IrcAccountRegistration
{
private String userID;
private String password;
private String server;
private String port;
private boolean rememberPassword;
private boolean autoChangeNick;
private boolean isRequiredPassword;
/**
* Returns the User ID of the IRC registration account.
*
* @return the User ID of the IRC registration account.
*/
public String getUserID()
{
return userID;
}
/**
* Sets the user ID of the IRC registration account.
*
* @param userID the userID of the IRC registration account.
*/
public void setUserID(String userID)
{
this.userID = userID;
}
/**
* Returns the password of the IRC registration account.
*
* @return the password of the IRC registration account.
*/
public String getPassword()
{
return password;
}
/**
* Sets the password of the IRC registration account.
*
* @param password the password of the IRC registration account.
*/
public void setPassword(String password)
{
this.password = password;
}
/**
* Returns the server address.
*
* @return the server address.
*/
public String getServer()
{
return server;
}
/**
* Sets the server address.
*
* @param server the address of the server
*/
public void setServer(String server)
{
this.server = server;
}
/**
* Returns the port to use.
*
* @return the port to use
*/
public String getPort()
{
return this.port;
}
/**
* Sets the port to use.
*
* @param port the port to use
*/
public void setPort(String port)
{
this.port = port;
}
/**
* Returns <tt>true</tt> if password has to remembered, <tt>false</tt>
* otherwise.
*
* @return <tt>true</tt> if password has to remembered, <tt>false</tt>
* otherwise.
*/
public boolean isRememberPassword()
{
return rememberPassword;
}
/**
* Indicates if the nick should be changed automatically in case of nick
* collision.
*
* @return <code>true</code> if the nick should be changed,
* <code>false</code> - otherwise.
*/
public boolean isAutoChangeNick()
{
return autoChangeNick;
}
/**
* Sets the property indicating if the nick should be changed automatically
* in case of nick collision.
* @param autoChangeNick <code>true</code> to indicate that the nick could
* be changed, <code>false</code> - otherwise.
*/
public void setAutoChangeNick(boolean autoChangeNick)
{
this.autoChangeNick = autoChangeNick;
}
/**
* Indicates if the password is required or not.
* @return <code>true</code> to indicate that the password is required,*
* <code>false</code> - otherwise.
*/
public boolean isRequiredPassword()
{
return isRequiredPassword;
}
/**
* Sets the <tt>isRequiredPassword</tt> property.
*
* @param isRequiredPassword <code>true</code> to indicate that the password
* is required, <code>false</code> - otherwise.
*/
public void setRequiredPassword(boolean isRequiredPassword)
{
this.isRequiredPassword = isRequiredPassword;
}
/**
* Sets the rememberPassword value of this IRC account registration.
*
* @param rememberPassword <tt>true</tt> if password has to remembered,
* <tt>false</tt> otherwise.
*/
public void setRememberPassword(boolean rememberPassword)
{
this.rememberPassword = rememberPassword;
}
}

@ -0,0 +1,225 @@
/*
* 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.ircaccregwizz;
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.plugin.ircaccregwizz.Resources;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>IrcAccountRegistrationWizard</tt> is an implementation of the
* <tt>AccountRegistrationWizard</tt> for the IRC protocol. It allows
* the user to create and configure a new IRC account.
*
* @author Lionel Ferreira & Michael Tarantino
*/
public class IrcAccountRegistrationWizard
implements AccountRegistrationWizard
{
/**
* The first page of the IRC account registration wizard.
*/
private FirstWizardPage firstWizardPage;
/**
* The object that we use to store details on an account that we will be
* creating.
*/
private IrcAccountRegistration registration
= new IrcAccountRegistration();
private WizardContainer wizardContainer;
private ProtocolProviderService protocolProvider;
/**
* Creates an instance of <tt>IrcAccountRegistrationWizard</tt>.
* @param wizardContainer the wizard container, where this wizard
* is added
*/
public IrcAccountRegistrationWizard(WizardContainer wizardContainer)
{
this.wizardContainer = wizardContainer;
}
/**
* Implements the <code>AccountRegistrationWizard.getIcon</code> method.
* Returns the icon to be used for this wizard.
* @return byte[]
*/
public byte[] getIcon()
{
return Resources.getImage(Resources.IRC_LOGO);
}
/**
* 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 Resources.getImage(Resources.PAGE_IMAGE);
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolName</code>
* method. Returns the protocol name for this wizard.
* @return String
*/
public String getProtocolName()
{
return Resources.getString("protocolName");
}
/**
* Implements the <code>AccountRegistrationWizard.getProtocolDescription
* </code> method. Returns the description of the protocol for this wizard.
* @return String
*/
public String getProtocolDescription()
{
return Resources.getString("protocolDescription");
}
/**
* Returns the set of pages contained in this wizard.
* @return Iterator
*/
public Iterator getPages()
{
ArrayList pages = new ArrayList();
firstWizardPage = new FirstWizardPage(registration, wizardContainer);
pages.add(firstWizardPage);
return pages.iterator();
}
/**
* Returns the set of data that user has entered through this wizard.
* @return Iterator
*/
public Iterator getSummary()
{
Hashtable summaryTable = new Hashtable();
String pass = new String();
String port = new String();
if (registration.isRequiredPassword())
pass = "required";
else
pass = "not required";
if (!(port = registration.getPort()).equals(""))
port = ":" + port;
summaryTable.put("Password", pass);
summaryTable.put("Nickname", registration.getUserID());
summaryTable.put("Server IRC", registration.getServer() + port);
return summaryTable.entrySet().iterator();
}
/**
* Installs the account created through this wizard.
* @return ProtocolProviderService
*/
public ProtocolProviderService finish()
{
firstWizardPage = null;
ProtocolProviderFactory factory
= IrcAccRegWizzActivator.getIrcProtocolProviderFactory();
return this.installAccount(factory,
registration.getUserID());
}
/**
* Creates an account for the given user and password.
* @param providerFactory the ProtocolProviderFactory which will create
* the account
* @param user the user identifier
* @param passwd the password
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String user)
{
Hashtable accountProperties = new Hashtable();
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
registration.getServer());
if (registration.isRememberPassword()
&& registration.isRequiredPassword()
&& !registration.getPassword().equals(""))
{
accountProperties.put(
ProtocolProviderFactory.PASSWORD, registration.getPassword());
}
if (!registration.getPort().equals(""))
{
accountProperties.put(
ProtocolProviderFactory.SERVER_PORT, registration.getPort());
}
accountProperties.put(
ProtocolProviderFactory.AUTO_CHANGE_USER_NAME,
new Boolean(registration.isAutoChangeNick()).toString());
accountProperties.put(
ProtocolProviderFactory.PASSWORD_REQUIRED,
new Boolean(registration.isRequiredPassword()).toString());
try
{
AccountID accountID = providerFactory.installAccount(
user, accountProperties);
ServiceReference serRef = providerFactory
.getProviderForAccount(accountID);
protocolProvider = (ProtocolProviderService)
IrcAccRegWizzActivator.bundleContext
.getService(serRef);
}
catch (IllegalArgumentException exc)
{
new ErrorDialog(null, exc.getMessage(), exc).showDialog();
}
catch (IllegalStateException exc)
{
new ErrorDialog(null, exc.getMessage(), exc).showDialog();
}
return protocolProvider;
}
/**
* Fills the UserID 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.protocolProvider = protocolProvider;
this.firstWizardPage.loadAccount(protocolProvider);
}
}

@ -0,0 +1,95 @@
/*
* 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.ircaccregwizz;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.util.*;
/**
* The Messages class manages the access to the internationalization
* properties files.
*
* @author Lionel Ferreira & Michael Tarantino
*/
public class Resources
{
private static Logger log = Logger.getLogger(Resources.class);
private static final String BUNDLE_NAME
= "net.java.sip.communicator.plugin.ircaccregwizz.resources";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
public static ImageID IRC_LOGO = new ImageID("protocolIcon");
public static ImageID PAGE_IMAGE = new ImageID("pageImage");
/**
* 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)
{
try
{
return RESOURCE_BUNDLE.getString(key);
}
catch (MissingResourceException exc)
{
return '!' + 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)
{
byte[] image = new byte[100000];
String path = Resources.getString(imageID.getId());
try
{
Resources.class.getClassLoader()
.getResourceAsStream(path).read(image);
}
catch (IOException exc)
{
log.error("Failed to load image:" + path, exc);
}
return image;
}
/**
* Represents the Image Identifier.
*/
public static class ImageID
{
private String id;
private ImageID(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
}
}

@ -0,0 +1,23 @@
Bundle-Activator: net.java.sip.communicator.plugin.ircaccregwizz.IrcAccRegWizzActivator
Bundle-Name: IRC account registration wizard
Bundle-Description: IRC account registration wizard.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Import-Package: org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.browserlauncher,
javax.swing,
javax.swing.event,
javax.swing.table,
javax.swing.text,
javax.swing.text.html,
javax.accessibility,
javax.imageio,
javax.swing.undo,
javax.swing.border

@ -0,0 +1,17 @@
protocolName=IRC
protocolDescription=IRC protocol.
nick=Nickname:
password=Password:
infoPassword=Most IRC server didn't required password.
rememberPassword=Remember password
autoNickChange=Automatically change nick when it's already used
defaultPort=Use default port
passwordNotRequired=The server didn't required a password
server=Hostname:
port=Port:
userAndPassword=Identification
serverIRC=Server
options=Options
existingAccount=* The account you entered is already installed.
protocolIcon=resources/images/irc/cr16-action-irc_online.png
pageImage=resources/images/irc/cr64-app-irc_protocol.png
Loading…
Cancel
Save