Extended IRC account dialog to include options for contact and chat room presence.

cefexperiments
Danny van Heumen 12 years ago
parent 8df3ca4793
commit bb0fd0660e

@ -1086,6 +1086,8 @@ plugin.ircaccregwizz.HOST=Hostname:
plugin.ircaccregwizz.IRC_SERVER=Server
plugin.ircaccregwizz.EXAMPLE_SERVER=Ex: chat.freenode.net
plugin.ircaccregwizz.USE_SECURE_CONNECTION=Use secure connection
plugin.ircaccregwizz.ENABLE_CONTACT_PRESENCE=Enable contact presence
plugin.ircaccregwizz.ENABLE_CHAT_ROOM_PRESENCE=Enable chat room presence
# jabber accregwizz
plugin.jabberaccregwizz.PROTOCOL_NAME=XMPP

@ -26,16 +26,13 @@ public class ProtocolProviderFactoryIrcImpl
/**
* Property indicating whether or not to enable a periodic task for querying
* channel member presence (available, away).
*
* TODO add configuration option in account wizard
*/
public static final String CHANNEL_PRESENCE_TASK = "CHANNEL_PRESENCE_TASK";
public static final String CHAT_ROOM_PRESENCE_TASK =
"CHAT_ROOM_PRESENCE_TASK";
/**
* Property indicating whether or not to enable a periodic task for querying
* contact presence (offline, online).
*
* TODO add configuration option in account wizard
*/
public static final String CONTACT_PRESENCE_TASK = "CONTACT_PRESENCE_TASK";

@ -255,7 +255,7 @@ public void register(final SecurityAuthority authority)
ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
boolean channelPresenceTask =
accountID.getAccountPropertyBoolean(
ProtocolProviderFactoryIrcImpl.CHANNEL_PRESENCE_TASK, true);
ProtocolProviderFactoryIrcImpl.CHAT_ROOM_PRESENCE_TASK, true);
boolean contactPresenceTask =
accountID.getAccountPropertyBoolean(
ProtocolProviderFactoryIrcImpl.CONTACT_PRESENCE_TASK, true);

@ -22,6 +22,7 @@
* and the password of the account.
*
* @author Lionel Ferreira & Michael Tarantino
* @author Danny van Heumen
*/
public class FirstWizardPage
extends TransparentPanel
@ -120,6 +121,12 @@ public class FirstWizardPage
private JCheckBox useSecureConnection = new SIPCommCheckBox(
Resources.getString("plugin.ircaccregwizz.USE_SECURE_CONNECTION"));
private JCheckBox enableContactPresenceTask = new SIPCommCheckBox(
Resources.getString("plugin.ircaccregwizz.ENABLE_CONTACT_PRESENCE"));
private JCheckBox enableChatRoomPresenceTask = new SIPCommCheckBox(
Resources.getString("plugin.ircaccregwizz.ENABLE_CHAT_ROOM_PRESENCE"));
private JPanel mainPanel = new TransparentPanel();
private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
@ -193,6 +200,8 @@ private void init(String userId, String server)
this.defaultPort.setSelected(true);
this.passwordNotRequired.setSelected(true);
this.useSecureConnection.setSelected(true);
this.enableContactPresenceTask.setSelected(true);
this.enableChatRoomPresenceTask.setSelected(true);
this.portField
.setText(this.useSecureConnection.isSelected() ? DEFAULT_SECURE_PORT
: DEFAULT_PLAINTEXT_PORT);
@ -251,8 +260,13 @@ private void init(String userId, String server)
serverPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.ircaccregwizz.IRC_SERVER")));
optionsPanel.add(rememberPassBox, BorderLayout.CENTER);
optionsPanel.add(autoNickChange, BorderLayout.SOUTH);
optionsPanel.add(rememberPassBox, BorderLayout.NORTH);
optionsPanel.add(autoNickChange, BorderLayout.CENTER);
JPanel partition = new TransparentPanel();
optionsPanel.add(partition);
partition.setLayout(new BorderLayout());
partition.add(enableContactPresenceTask, BorderLayout.WEST);
partition.add(enableChatRoomPresenceTask, BorderLayout.EAST);
optionsPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("service.gui.OPTIONS")));
@ -345,6 +359,11 @@ public void commitPage()
registration.setAutoChangeNick(autoNickChange.isSelected());
registration.setRequiredPassword(!passwordNotRequired.isSelected());
registration.setSecureConnection(useSecureConnection.isSelected());
registration
.setContactPresenceTaskEnabled(this.enableContactPresenceTask
.isSelected());
registration.setChatRoomPresenceTaskEnabled(enableChatRoomPresenceTask
.isSelected());
isCommitted = true;
}
@ -448,6 +467,14 @@ public void loadAccount(ProtocolProviderService protocolProvider)
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.DEFAULT_ENCRYPTION, true);
boolean contactPresenceTaskEnabled =
accountID.getAccountPropertyBoolean(
IrcAccountRegistrationWizard.CONTACT_PRESENCE_TASK, true);
boolean chatRoomPresenceTaskEnabled =
accountID.getAccountPropertyBoolean(
IrcAccountRegistrationWizard.CHAT_ROOM_PRESENCE_TASK, true);
this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
this.serverField.setText(server);
@ -486,6 +513,9 @@ public void loadAccount(ProtocolProviderService protocolProvider)
}
this.useSecureConnection.setSelected(useSecureConnection);
this.enableContactPresenceTask.setSelected(contactPresenceTaskEnabled);
this.enableChatRoomPresenceTask
.setSelected(chatRoomPresenceTaskEnabled);
}
/**

@ -109,9 +109,7 @@ public static ProtocolProviderFactory getIrcProtocolProviderFactory()
{
ServiceReference<?>[] serRefs = null;
String osgiFilter = "("
+ ProtocolProviderFactory.PROTOCOL
+ "=" + "IRC" + ")";
String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL + "=IRC)";
try
{

@ -11,6 +11,7 @@
* through the <tt>IrcAccountRegistrationWizard</tt>.
*
* @author Lionel Ferreira & Michael Tarantino
* @author Danny van Heumen
*/
public class IrcAccountRegistration
{
@ -23,6 +24,16 @@ public class IrcAccountRegistration
private boolean isRequiredPassword;
private boolean secureConnection;
/**
* Option for activating contact presence task.
*/
private boolean contactPresenceTaskEnabled;
/**
* Option for activating chat room members presence task.
*/
private boolean chatroomPresenceTaskEnabled;
/**
* Returns the User ID of the IRC registration account.
*
@ -191,4 +202,44 @@ public void setSecureConnection(boolean secureConnection)
{
this.secureConnection = secureConnection;
}
/**
* Get contact presence task enabled.
*
* @return returns <tt>true</tt> if task should be enabled
*/
public boolean isContactPresenceTaskEnabled()
{
return this.contactPresenceTaskEnabled;
}
/**
* Set contact presence task.
*
* @param value value
*/
public void setContactPresenceTaskEnabled(final boolean value)
{
this.contactPresenceTaskEnabled = value;
}
/**
* Get chat room presence task.
*
* @return returns <tt>true</tt> if task should be enabled
*/
public boolean isChatRoomPresenceTaskEnabled()
{
return this.chatroomPresenceTaskEnabled;
}
/**
* Set chat room presence task.
*
* @param value value
*/
public void setChatRoomPresenceTaskEnabled(final boolean value)
{
this.chatroomPresenceTaskEnabled = value;
}
}

@ -17,8 +17,8 @@
/**
* 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.
* <tt>AccountRegistrationWizard</tt> for the IRC protocol. It allows the user
* to create and configure a new IRC account.
*
* @author Lionel Ferreira & Michael Tarantino
* @author Danny van Heumen
@ -30,6 +30,23 @@ public class IrcAccountRegistrationWizard
private static final int WIZARD_DIALOG_WIDTH = 600;
/**
* Repeated contact presence task configuration key from
* ProtocolProviderFactoryIrcImpl here to avoid having to import irc
* protocol package directly. See
* ProtocolProviderFactoryIrcImpl.CONTACT_PRESENCE_TASK.
*/
public static final String CONTACT_PRESENCE_TASK = "CONTACT_PRESENCE_TASK";
/**
* Repeated chat room presence task configuration key from
* ProtocolProviderFactoryIrcImpl here to avoid having to import irc
* protocol package directly. See
* ProtocolProviderFactoryIrcImpl.CHAT_ROOM_PRESENCE_TASK.
*/
public static final String CHAT_ROOM_PRESENCE_TASK =
"CHAT_ROOM_PRESENCE_TASK";
private final Logger logger
= Logger.getLogger(IrcAccountRegistrationWizard.class);
@ -154,11 +171,16 @@ public Iterator<Map.Entry<String, String>> getSummary()
port = ":" + port;
}
// FIXME i18n
summaryTable.put("Password", pass);
summaryTable.put("Nickname", registration.getUserID());
summaryTable.put("Server IRC", registration.getServer() + port);
summaryTable.put("Secure connection",
registration.isSecureConnection() ? "yes" : "no");
summaryTable.put("Contact presence",
"" + registration.isContactPresenceTaskEnabled());
summaryTable.put("Chat room presence",
"" + registration.isChatRoomPresenceTaskEnabled());
return summaryTable.entrySet().iterator();
}
@ -251,6 +273,11 @@ private ProtocolProviderService installAccount(
accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,
new Boolean(registration.isSecureConnection()).toString());
accountProperties.put(CONTACT_PRESENCE_TASK,
Boolean.toString(registration.isContactPresenceTaskEnabled()));
accountProperties.put(CHAT_ROOM_PRESENCE_TASK,
Boolean.toString(registration.isChatRoomPresenceTaskEnabled()));
if (isModification())
{
providerFactory.modifyAccount(this.protocolProvider,

Loading…
Cancel
Save