Introduce configuration form types and allow forms to be registered for the security section.

cusax-fix
Yana Stamcheva 16 years ago
parent 1bc5bfe3fa
commit ef52ece410

@ -2184,6 +2184,7 @@ org.apache.http.util"/>
<jar compress="false" destfile="${bundles.dest}/otr.jar" manifest="${src}/net/java/sip/communicator/plugin/otr/otr.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/plugin/otr"
prefix="net/java/sip/communicator/plugin/otr"/>
<zipfileset src="${lib.noinst}/otr4j.jar"/>
</jar>
</target>
<!--BUNDLE-METAHISTORY-SLICK-->

@ -19,10 +19,7 @@ org.osgi.framework.system.packages.extra= \
sun.awt.shell; \
sun.misc; \
sun.net.util; \
sun.security.action; \
net.java.otr4j; \
net.java.otr4j.crypto; \
net.java.otr4j.session;
sun.security.action;
felix.auto.start.10= \
reference:file:lib/bundle/org.apache.felix.bundlerepository-1.4.2.jar

@ -83,13 +83,18 @@ public ConfigurationFrame(MainFrame mainFrame)
GuiActivator.bundleContext.addServiceListener(this);
// General configuration forms only.
String osgiFilter = "("
+ ConfigurationForm.FORM_TYPE
+ "="+ConfigurationForm.GENERAL_TYPE+")";
ServiceReference[] confFormsRefs = null;
try
{
confFormsRefs = GuiActivator.bundleContext
.getServiceReferences(
ConfigurationForm.class.getName(),
null);
osgiFilter);
}
catch (InvalidSyntaxException ex)
{}
@ -102,8 +107,7 @@ public ConfigurationFrame(MainFrame mainFrame)
= (ConfigurationForm) GuiActivator.bundleContext
.getService(confFormsRefs[i]);
if (!form.isAdvanced())
this.addConfigurationForm(form);
this.addConfigurationForm(form);
}
}
}
@ -183,8 +187,17 @@ public void serviceChanged(ServiceEvent event)
{
if(!GuiActivator.isStarted)
return;
Object sService =
GuiActivator.bundleContext.getService(event.getServiceReference());
ServiceReference serRef = event.getServiceReference();
Object property = serRef.getProperty(ConfigurationForm.FORM_TYPE);
if (property != ConfigurationForm.GENERAL_TYPE)
return;
Object sService
= GuiActivator.bundleContext.getService(
event.getServiceReference());
// we don't care if the source service is not a configuration form
if (!(sService instanceof ConfigurationForm))

@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.impl.neomedia;
import java.util.*;
import net.java.sip.communicator.service.audionotifier.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.fileaccess.*;
@ -111,7 +113,11 @@ public void start(BundleContext bundleContext)
if (logger.isDebugEnabled())
logger.debug("Media Service ... [REGISTERED]");
// MediaConfigurationForm
Dictionary<String, String> mediaProps = new Hashtable<String, String>();
mediaProps.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.GENERAL_TYPE);
// AudioConfigurationForm
bundleContext
.registerService(
ConfigurationForm.class.getName(),
@ -122,7 +128,7 @@ public void start(BundleContext bundleContext)
"plugin.mediaconfig.AUDIO_ICON",
"impl.neomedia.configform.AUDIO",
3),
null);
mediaProps);
// VideoConfigurationForm
bundleContext
@ -135,7 +141,23 @@ public void start(BundleContext bundleContext)
"plugin.mediaconfig.VIDEO_ICON",
"impl.neomedia.configform.VIDEO",
4),
null);
mediaProps);
// ZRTPConfiguration panel
Dictionary<String, String> securityProps
= new Hashtable<String, String>();
securityProps.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.SECURITY_TYPE);
bundleContext
.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
"net.java.sip.communicator.impl.neomedia.ZrtpConfigurePanel",
getClass().getClassLoader(),
"impl.media.security.zrtp.CONF_ICON",
"service.gui.CALL",
1100),
securityProps);
GatherEntropy entropy
= new GatherEntropy(mediaServiceImpl.getDeviceConfiguration());
@ -289,4 +311,4 @@ public static ResourceManagementService getResources()
= ResourceManagementServiceUtils.getService(bundleContext);
return resources;
}
}
}

@ -3,7 +3,7 @@
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.securityconfig.call;
package net.java.sip.communicator.impl.neomedia;
import gnu.java.zrtp.ZrtpConfigure;
import gnu.java.zrtp.ZrtpConstants;
@ -17,7 +17,6 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import net.java.sip.communicator.plugin.securityconfig.*;
import net.java.sip.communicator.util.swing.*;
@SuppressWarnings("serial")
@ -49,17 +48,17 @@ public ZrtpConfigurePanel()
JPanel mainPanel = new TransparentPanel(new BorderLayout(0, 10));
final JButton stdButton = new JButton(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.STANDARD"));
stdButton.setOpaque(false);
final JButton mandButton = new JButton(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.MANDATORY"));
mandButton.setOpaque(false);
final JButton saveButton = new JButton(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("service.gui.SAVE"));
saveButton.setOpaque(false);
@ -70,18 +69,18 @@ public ZrtpConfigurePanel()
buttonBar.add(saveButton);
boolean trusted
= SecurityConfigActivator.getConfigurationService()
= NeomediaActivator.getConfigurationService()
.getBoolean(TRUSTED_PROP, false);
boolean sasSign
= SecurityConfigActivator.getConfigurationService()
= NeomediaActivator.getConfigurationService()
.getBoolean(SASSIGN_PROP, false);
JPanel checkBar = new TransparentPanel(new GridLayout(1,2));
final JCheckBox trustedMitM
= new JCheckBox(SecurityConfigActivator.getResources()
= new JCheckBox(NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.TRUSTED"), trusted);
final JCheckBox sasSignature
= new JCheckBox(SecurityConfigActivator.getResources()
= new JCheckBox(NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.SASSIGNATURE"), sasSign);
checkBar.add(trustedMitM);
checkBar.add(sasSignature);
@ -116,9 +115,9 @@ else if (source == saveButton)
{
Boolean t = new Boolean(active.isTrustedMitM());
Boolean s = new Boolean(active.isSasSignature());
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(TRUSTED_PROP, t);
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(SASSIGN_PROP, s);
pkc.saveConfig();
hc.saveConfig();
@ -151,19 +150,19 @@ public void itemStateChanged(ItemEvent e) {
JTabbedPane algorithmsPane = new JTabbedPane();
algorithmsPane.addTab(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.PUB_KEYS"), pkc);
algorithmsPane.addTab(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.HASHES"), hc);
algorithmsPane.addTab(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.SYM_CIPHERS"), cc);
algorithmsPane.addTab(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.SAS_TYPES"), sc);
algorithmsPane.addTab(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.SRTP_LENGTHS"), lc);
algorithmsPane.setMinimumSize(new Dimension(400, 100));
@ -195,7 +194,7 @@ class PublicKeyControls extends TransparentPanel
String id = getPropertyID(ZrtpConstants.SupportedPubKeys.DH2K);
String savedConf
= SecurityConfigActivator.getConfigurationService().getString(id);
= NeomediaActivator.getConfigurationService().getString(id);
if (savedConf == null)
savedConf = "";
@ -206,7 +205,7 @@ class PublicKeyControls extends TransparentPanel
inActive,
savedConf);
createControls(this, dataModel,
SecurityConfigActivator.getResources().getI18NString(
NeomediaActivator.getResources().getI18NString(
"impl.media.security.zrtp.PUB_KEY_ALGORITHMS"));
}
@ -220,7 +219,7 @@ void saveConfig()
String value = getPropertyValue(ZrtpConstants.SupportedPubKeys.DH2K);
String id = getPropertyID(ZrtpConstants.SupportedPubKeys.DH2K);
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(id, value);
}
}
@ -236,7 +235,7 @@ class HashControls extends TransparentPanel
String id = getPropertyID(ZrtpConstants.SupportedHashes.S256);
String savedConf
= SecurityConfigActivator.getConfigurationService()
= NeomediaActivator.getConfigurationService()
.getString(id);
if (savedConf == null)
savedConf = "";
@ -248,7 +247,7 @@ class HashControls extends TransparentPanel
inActive,
savedConf);
createControls(this, dataModel,
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString(
"impl.media.security.zrtp.HASH_ALGORITHMS"));
}
@ -262,7 +261,7 @@ void saveConfig()
{
String value = getPropertyValue(ZrtpConstants.SupportedHashes.S256);
String id = getPropertyID(ZrtpConstants.SupportedHashes.S256);
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(id, value);
}
}
@ -277,7 +276,7 @@ class CipherControls
{
String id = getPropertyID(ZrtpConstants.SupportedSymCiphers.AES1);
String savedConf
= SecurityConfigActivator.getConfigurationService().getString(id);
= NeomediaActivator.getConfigurationService().getString(id);
if (savedConf == null)
savedConf = "";
@ -288,7 +287,7 @@ class CipherControls
inActive,
savedConf);
createControls(this, dataModel,
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString(
"impl.media.security.zrtp.SYM_CIPHER_ALGORITHMS"));
}
@ -303,7 +302,7 @@ void saveConfig()
String value
= getPropertyValue(ZrtpConstants.SupportedSymCiphers.AES1);
String id = getPropertyID(ZrtpConstants.SupportedSymCiphers.AES1);
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(id, value);
}
}
@ -317,7 +316,7 @@ class SasControls extends TransparentPanel
{
String id = getPropertyID(ZrtpConstants.SupportedSASTypes.B32);
String savedConf
= SecurityConfigActivator.getConfigurationService()
= NeomediaActivator.getConfigurationService()
.getString(id);
if (savedConf == null)
savedConf = "";
@ -329,7 +328,7 @@ class SasControls extends TransparentPanel
inActive,
savedConf);
createControls(this, dataModel,
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.SAS_TYPES"));
}
@ -342,7 +341,7 @@ void saveConfig()
{
String value = getPropertyValue(ZrtpConstants.SupportedSASTypes.B32);
String id = getPropertyID(ZrtpConstants.SupportedSASTypes.B32);
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(id, value);
}
}
@ -357,7 +356,7 @@ class LengthControls
{
String id = getPropertyID(ZrtpConstants.SupportedAuthLengths.HS32);
String savedConf
= SecurityConfigActivator.getConfigurationService().getString(id);
= NeomediaActivator.getConfigurationService().getString(id);
if (savedConf == null)
savedConf = "";
@ -368,7 +367,7 @@ class LengthControls
inActive,
savedConf);
createControls(this, dataModel,
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.security.zrtp.SRTP_LENGTHS"));
}
@ -382,7 +381,7 @@ void saveConfig()
String value
= getPropertyValue(ZrtpConstants.SupportedAuthLengths.HS32);
String id = getPropertyID(ZrtpConstants.SupportedAuthLengths.HS32);
SecurityConfigActivator.getConfigurationService()
NeomediaActivator.getConfigurationService()
.setProperty(id, value);
}
}
@ -391,12 +390,12 @@ private <T extends Enum<T>> void createControls(JPanel panel,
ZrtpConfigureTableModel<T> model, String title)
{
final JButton upButton = new JButton(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.configform.UP"));
upButton.setOpaque(false);
final JButton downButton = new JButton(
SecurityConfigActivator.getResources()
NeomediaActivator.getResources()
.getI18NString("impl.media.configform.DOWN"));
downButton.setOpaque(false);

@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.securityconfig.call;
package net.java.sip.communicator.impl.neomedia;
import java.util.*;

@ -1,5 +1,7 @@
package net.java.sip.communicator.plugin.advancedconfig;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
@ -39,6 +41,9 @@ public void start(BundleContext bc)
{
bundleContext = bc;
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.GENERAL_TYPE);
bundleContext
.registerService(
ConfigurationForm.class.getName(),
@ -48,7 +53,7 @@ public void start(BundleContext bc)
"plugin.advancedconfig.PLUGIN_ICON",
"service.gui.ADVANCED",
300),
null);
properties);
if (logger.isInfoEnabled())
logger.info("ADVANCED CONFIG PLUGIN... [REGISTERED]");

@ -11,12 +11,12 @@
import javax.swing.*;
import javax.swing.event.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
/**
* The advanced configuration panel.
*
@ -77,11 +77,15 @@ private void initList()
add(configScrollList, BorderLayout.WEST);
String osgiFilter = "("
+ ConfigurationForm.FORM_TYPE
+ "="+ConfigurationForm.ADVANCED_TYPE+")";
ServiceReference[] confFormsRefs = null;
try
{
confFormsRefs = AdvancedConfigActivator.bundleContext
.getServiceReferences(ConfigurationForm.class.getName(), null);
.getServiceReferences( ConfigurationForm.class.getName(),
osgiFilter);
}
catch (InvalidSyntaxException ex)
{}

@ -1,83 +0,0 @@
package net.java.sip.communicator.plugin.chatconfig;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
*
* @author Yana Stamcheva
*/
public class ChatConfigActivator
implements BundleActivator
{
/**
* The logger.
*/
private static final Logger logger
= Logger.getLogger(ChatConfigActivator.class);
/**
* The bundle context.
*/
protected static BundleContext bundleContext;
/**
* The resource management service.
*/
private static ResourceManagementService resourceService;
/**
* The configuration service.
*/
private static ConfigurationService configService;
/**
* Starts this bundle.
* @param bc the bundle context
* @throws Exception if something goes wrong
*/
public void start(BundleContext bc)
throws Exception
{
bundleContext = bc;
bundleContext
.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
"net.java.sip.communicator.plugin.generalconfig.GeneralConfigurationPanel",
getClass().getClassLoader(),
"plugin.generalconfig.PLUGIN_ICON",
"service.gui.GENERAL",
30),
null);
if (logger.isInfoEnabled())
logger.info("PREFERENCES PLUGIN... [REGISTERED]");
}
/**
* Stops this bundle.
* @param bc the bundle context
* @throws Exception if something goes wrong
*/
public void stop(BundleContext bc) throws Exception
{
}
/**
* Returns the <tt>ResourceManagementService</tt> implementation.
* @return the <tt>ResourceManagementService</tt> implementation
*/
public static ResourceManagementService getResources()
{
if (resourceService == null)
resourceService
= ResourceManagementServiceUtils.getService(bundleContext);
return resourceService;
}
}

@ -1,222 +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.chatconfig;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.util.swing.*;
/**
*
* @author Yana Stamcheva
*/
public class ChatConfigPanel
extends TransparentPanel
{
public ChatConfigPanel()
{
super(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
TransparentPanel mainPanel = new TransparentPanel();
BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
mainPanel.setLayout(boxLayout);
this.add(mainPanel, BorderLayout.NORTH);
// mainPanel.add(createGroupMessagesCheckbox());
// mainPanel.add(Box.createVerticalStrut(10));
//
// mainPanel.add(createHistoryPanel());
// mainPanel.add(Box.createVerticalStrut(10));
//
// mainPanel.add(createSendMessagePanel());
// mainPanel.add(Box.createVerticalStrut(10));
}
/**
* Initializes the group messages check box.
* @return the created check box
*/
// private Component createGroupMessagesCheckbox()
// {
// final JCheckBox groupMessagesCheckBox = new SIPCommCheckBox();
// groupMessagesCheckBox.setText(
// ChatConfigActivator.getResources().getI18NString(
// "plugin.generalconfig.GROUP_CHAT_MESSAGES"));
//
// groupMessagesCheckBox.setSelected(
// ConfigurationManager.isMultiChatWindowEnabled());
//
// groupMessagesCheckBox.setAlignmentX(JCheckBox.CENTER_ALIGNMENT);
// groupMessagesCheckBox.addActionListener(new ActionListener()
// {
// public void actionPerformed(ActionEvent e)
// {
// ConfigurationManager.setMultiChatWindowEnabled(
// groupMessagesCheckBox.isSelected());
// }
// });
//
// return groupMessagesCheckBox;
// }
//
// /**
// * Initializes the history panel.
// * @return the created history panel
// */
// private Component createHistoryPanel()
// {
// TransparentPanel logHistoryPanel = new TransparentPanel();
//
// logHistoryPanel.setLayout(null);
// logHistoryPanel.setPreferredSize(new Dimension(250, 57));
// logHistoryPanel.setAlignmentX(JPanel.CENTER_ALIGNMENT);
//
// // Log history check box.
// final JCheckBox logHistoryCheckBox = new SIPCommCheckBox();
// logHistoryPanel.add(logHistoryCheckBox);
// logHistoryCheckBox.setText(
// ChatConfigActivator.getResources()
// .getI18NString("plugin.generalconfig.LOG_HISTORY"));
// logHistoryCheckBox.setBounds(0, 0, 200, 19);
// logHistoryCheckBox.setSelected(
// ConfigurationManager.isHistoryLoggingEnabled());
//
// logHistoryCheckBox.addActionListener(new ActionListener()
// {
// public void actionPerformed(ActionEvent e)
// {
// ConfigurationManager.setHistoryLoggingEnabled(
// logHistoryCheckBox.isSelected());
// }
// });
//
// // Show history check box.
// final JCheckBox showHistoryCheckBox = new SIPCommCheckBox();
// logHistoryPanel.add(showHistoryCheckBox);
// showHistoryCheckBox.setText(
// ChatConfigActivator.getResources()
// .getI18NString("plugin.generalconfig.SHOW_HISTORY"));
// showHistoryCheckBox.setBounds(17, 25, 200, 19);
// showHistoryCheckBox.setSelected(
// ConfigurationManager.isHistoryShown());
//
// showHistoryCheckBox.addActionListener(new ActionListener()
// {
// public void actionPerformed(ActionEvent e)
// {
// ConfigurationManager.setHistoryShown(
// showHistoryCheckBox.isSelected());
// }
// });
//
// // History size.
// SpinnerNumberModel historySizeSpinnerModel =
// new SpinnerNumberModel(0, 0, 140, 1);
// final JSpinner historySizeSpinner = new JSpinner();
// logHistoryPanel.add(historySizeSpinner);
// historySizeSpinner.setModel(historySizeSpinnerModel);
// historySizeSpinner.setBounds(150, 23, 47, 22);
// historySizeSpinner.setValue(
// ConfigurationManager.getChatHistorySize());
//
// logHistoryCheckBox.addChangeListener(new ChangeListener()
// {
// public void stateChanged(ChangeEvent e)
// {
// showHistoryCheckBox.setEnabled(
// logHistoryCheckBox.isSelected());
// historySizeSpinner.setEnabled(
// logHistoryCheckBox.isSelected());
// }
// });
//
// showHistoryCheckBox.addChangeListener(new ChangeListener()
// {
// public void stateChanged(ChangeEvent e)
// {
// historySizeSpinner.setEnabled(
// showHistoryCheckBox.isSelected());
// }
// });
//
// historySizeSpinnerModel.addChangeListener(
// new ChangeListener()
// {
// public void stateChanged(ChangeEvent e)
// {
// ConfigurationManager.setChatHistorySize(
// ((Integer) historySizeSpinner
// .getValue()).intValue());
// }
// });
//
// JLabel historySizeLabel = new JLabel();
// logHistoryPanel.add(historySizeLabel);
// historySizeLabel.setText(
// ChatConfigActivator.getResources()
// .getI18NString("plugin.generalconfig.HISTORY_SIZE"));
// historySizeLabel.setBounds(205, 27, 220, 15);
//
// if (!ConfigurationManager.isHistoryLoggingEnabled())
// {
// showHistoryCheckBox.setEnabled(false);
// historySizeSpinner.setEnabled(false);
// }
//
// if (!ConfigurationManager.isHistoryShown())
// {
// historySizeSpinner.setEnabled(false);
// }
//
// return logHistoryPanel;
// }
//
// /**
// * Initializes the send message configuration panel.
// * @return the created message config panel
// */
// private Component createSendMessagePanel()
// {
// TransparentPanel sendMessagePanel
// = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
//
// JLabel sendMessageLabel = new JLabel();
// sendMessagePanel.add(sendMessageLabel);
// sendMessageLabel.setText(
// ChatConfigActivator.getResources()
// .getI18NString("plugin.generalconfig.SEND_MESSAGES_WITH"));
//
// ComboBoxModel sendMessageComboBoxModel =
// new DefaultComboBoxModel(
// new String[] {
// ConfigurationManager.ENTER_COMMAND,
// ConfigurationManager.CTRL_ENTER_COMMAND });
// final JComboBox sendMessageComboBox = new JComboBox();
// sendMessagePanel.add(sendMessageComboBox);
// sendMessageComboBox.setModel(sendMessageComboBoxModel);
// sendMessageComboBox.setSelectedItem(
// ConfigurationManager.getSendMessageCommand());
//
// sendMessageComboBox.addItemListener(new ItemListener()
// {
// public void itemStateChanged(ItemEvent arg0)
// {
// ConfigurationManager.setSendMessageCommand(
// (String)sendMessageComboBox.getSelectedItem());
// }
// });
//
// return sendMessagePanel;
// }
}

@ -1,31 +0,0 @@
Bundle-Activator: net.java.sip.communicator.plugin.chatconfig.ChatConfigActivator
Bundle-Name: Chat config plugin
Bundle-Description: The plugin offering chat configuration page.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.contactlist,
net.java.sip.communicator.service.contactlist.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.systray,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
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

@ -95,6 +95,9 @@ public void start(BundleContext bc)
ConfigurationManager.loadGuiConfigurations();
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.GENERAL_TYPE);
bundleContext
.registerService(
ConfigurationForm.class.getName(),
@ -104,7 +107,7 @@ public void start(BundleContext bc)
"plugin.generalconfig.PLUGIN_ICON",
"service.gui.GENERAL",
0),
null);
properties);
/*
* Wait for the first ProtocolProviderService to register in order to

@ -7,6 +7,8 @@
package net.java.sip.communicator.plugin.globalproxyconfig;
import java.net.*;
import java.util.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@ -46,6 +48,9 @@ public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.ADVANCED_TYPE);
bundleContext.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
@ -54,7 +59,7 @@ public void start(BundleContext bc) throws Exception
"plugin.globalproxy.PLUGIN_ICON",
"plugin.globalproxy.GLOBAL_PROXY_CONFIG",
51, true),
null);
properties);
initProperties();

@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.plugin.keybindingchooser;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
@ -49,6 +51,9 @@ public void start(BundleContext bc)
if (logger.isDebugEnabled())
logger.debug("Service Impl: " + getClass().getName() + " [ STARTED ]");
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.ADVANCED_TYPE);
bc.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
@ -57,7 +62,7 @@ public void start(BundleContext bc)
"plugin.keybinding.PLUGIN_ICON",
"plugin.keybindings.PLUGIN_NAME",
900, true),
null);
properties);
}
/**

@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.plugin.notificationconfiguration;
import java.util.*;
import net.java.sip.communicator.service.audionotifier.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.notification.*;
@ -35,6 +37,9 @@ public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.GENERAL_TYPE);
bundleContext
.registerService(
ConfigurationForm.class.getName(),
@ -44,7 +49,7 @@ public void start(BundleContext bc) throws Exception
"plugin.notificationconfig.PLUGIN_ICON",
"service.gui.EVENTS",
30),
null);
properties);
if (logger.isTraceEnabled())
logger.trace("Notification Configuration: [ STARTED ]");

@ -1,4 +1,4 @@
package net.java.sip.communicator.plugin.securityconfig.chat;
package net.java.sip.communicator.plugin.otr;
import java.awt.*;
import java.awt.event.*;
@ -7,7 +7,6 @@
import javax.swing.border.*;
import javax.swing.event.*;
import net.java.sip.communicator.plugin.securityconfig.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
@ -40,7 +39,7 @@ private void initComponents()
{
this.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
SecurityConfigActivator.getResources()
OtrActivator.resourceService
.getI18NString("plugin.otr.configform.KNOWN_FINGERPRINTS")));
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
@ -72,14 +71,14 @@ public void valueChanged(ListSelectionEvent e)
this.add(pnlButtons);
btnVerifyFingerprint = new JButton();
btnVerifyFingerprint.setText(SecurityConfigActivator.getResources()
btnVerifyFingerprint.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.VERIFY_FINGERPRINT"));
btnVerifyFingerprint.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
SecurityConfigActivator.getOtrKeyManagerService()
OtrActivator.scOtrKeyManager
.verify(getSelectedContact());
}
});
@ -87,13 +86,13 @@ public void actionPerformed(ActionEvent arg0)
pnlButtons.add(btnVerifyFingerprint);
btnForgetFingerprint = new JButton();
btnForgetFingerprint.setText(SecurityConfigActivator.getResources()
btnForgetFingerprint.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.FORGET_FINGERPRINT"));
btnForgetFingerprint.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
SecurityConfigActivator.getOtrKeyManagerService()
OtrActivator.scOtrKeyManager
.unverify(getSelectedContact());
}
});
@ -133,7 +132,7 @@ private void openContact(Contact contact)
else
{
boolean verified
= SecurityConfigActivator.getOtrKeyManagerService()
= OtrActivator.scOtrKeyManager
.isVerified(contact);
btnForgetFingerprint.setEnabled(verified);

@ -1,11 +1,10 @@
package net.java.sip.communicator.plugin.securityconfig.chat;
package net.java.sip.communicator.plugin.otr;
import java.awt.*;
import java.util.*;
import javax.swing.table.*;
import net.java.sip.communicator.plugin.securityconfig.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*;
@ -35,7 +34,7 @@ public KnownFingerprintsTableModel()
try
{
protocolProviderRefs =
SecurityConfigActivator.bundleContext
OtrActivator.bundleContext
.getServiceReferences(
ProtocolProviderService.class.getName(), null);
}
@ -50,19 +49,19 @@ public KnownFingerprintsTableModel()
// Get the metacontactlist service.
ServiceReference ref =
SecurityConfigActivator.bundleContext
OtrActivator.bundleContext
.getServiceReference(MetaContactListService.class
.getName());
MetaContactListService service
= (MetaContactListService) SecurityConfigActivator
= (MetaContactListService) OtrActivator
.bundleContext.getService(ref);
// Populate contacts.
for (int i = 0; i < protocolProviderRefs.length; i++)
{
ProtocolProviderService provider
= (ProtocolProviderService) SecurityConfigActivator
= (ProtocolProviderService) OtrActivator
.bundleContext
.getService(protocolProviderRefs[i]);
@ -88,15 +87,15 @@ public String getColumnName(int column)
switch (column)
{
case CONTACTNAME_INDEX:
return SecurityConfigActivator.getResources()
return OtrActivator.resourceService
.getI18NString(
"plugin.otr.configform.COLUMN_NAME_CONTACT");
case VERIFIED_INDEX:
return SecurityConfigActivator.getResources()
return OtrActivator.resourceService
.getI18NString(
"plugin.otr.configform.COLUMN_NAME_VERIFIED_STATUS");
case FINGERPRINT_INDEX:
return SecurityConfigActivator.getResources()
return OtrActivator.resourceService
.getI18NString(
"plugin.otr.configform.FINGERPRINT");
default:
@ -119,14 +118,14 @@ public Object getValueAt(int row, int column)
return contact.getDisplayName();
case VERIFIED_INDEX:
// TODO: Maybe use a CheckBoxColumn?
return (SecurityConfigActivator.getOtrKeyManagerService()
return (OtrActivator.scOtrKeyManager
.isVerified(contact))
? SecurityConfigActivator.getResources().getI18NString(
? OtrActivator.resourceService.getI18NString(
"plugin.otr.configform.COLUMN_VALUE_VERIFIED_TRUE")
: SecurityConfigActivator.getResources().getI18NString(
: OtrActivator.resourceService.getI18NString(
"plugin.otr.configform.COLUMN_VALUE_VERIFIED_FALSE");
case FINGERPRINT_INDEX:
return SecurityConfigActivator.getOtrKeyManagerService()
return OtrActivator.scOtrKeyManager
.getRemoteFingerprint(contact);
default:
return null;

@ -29,15 +29,14 @@ public class OtrActivator
private OtrTransformLayer otrTransformLayer;
/**
* The {@link OtrEngineService} of the {@link OtrActivator}.
* The {@link ScOtrEngine} of the {@link OtrActivator}.
*/
public static OtrEngineService scOtrEngine;
public static ScOtrEngine scOtrEngine;
/**
* The {@link OtrKeyManagerService} of the {@link OtrActivator}.
* The {@link ScOtrKeyManager} of the {@link OtrActivator}.
*/
public static OtrKeyManagerService scOtrKeyManager
= new OtrKeyManagerServiceImpl();
public static ScOtrKeyManager scOtrKeyManager = new ScOtrKeyManagerImpl();
/**
* The {@link ResourceManagementService} of the {@link OtrActivator}. Can
@ -70,7 +69,7 @@ public void start(BundleContext bc) throws Exception
bundleContext = bc;
// Init static variables, don't proceed without them.
scOtrEngine = new OtrEngineServiceImpl();
scOtrEngine = new ScOtrEngineImpl();
otrTransformLayer = new OtrTransformLayer();
resourceService =
@ -131,16 +130,8 @@ public void start(BundleContext bc) throws Exception
}
}
// Register the Otr engine service.
bundleContext.registerService( OtrEngineService.class.getName(),
scOtrEngine, null);
// Register the Otr key manager service.
bundleContext.registerService( OtrKeyManagerService.class.getName(),
scOtrKeyManager, null);
Hashtable<String, String> containerFilter =
new Hashtable<String, String>();
Hashtable<String, String> containerFilter
= new Hashtable<String, String>();
// Register the right-click menu item.
containerFilter.put(Container.CONTAINER_ID,
@ -167,6 +158,18 @@ public void start(BundleContext bc) throws Exception
bundleContext.registerService(PluginComponent.class.getName(),
new OtrMetaContactButton(Container.CONTAINER_CHAT_TOOL_BAR),
containerFilter);
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.SECURITY_TYPE);
// Register the configuration form.
bundleContext.registerService(ConfigurationForm.class.getName(),
new LazyConfigurationForm(
"net.java.sip.communicator.plugin.otr.OtrConfigurationPanel",
getClass().getClassLoader(),
"plugin.otr.configform.ICON",
"service.gui.CHAT", 30),
properties);
}
private ServiceRegistration regRightClickMenu;
@ -290,6 +293,32 @@ else if (serviceEvent.getType() == ServiceEvent.UNREGISTERING)
}
/**
* Gets all the available accounts in SIP Communicator.
*
* @return a {@link List} of {@link AccountID}.
*/
public static List<AccountID> getAllAccountIDs()
{
Map<Object, ProtocolProviderFactory> providerFactoriesMap =
OtrActivator.getProtocolProviderFactories();
if (providerFactoriesMap == null)
return null;
List<AccountID> accountIDs = new Vector<AccountID>();
for (ProtocolProviderFactory providerFactory : providerFactoriesMap
.values())
{
for (AccountID accountID : providerFactory.getRegisteredAccounts())
{
accountIDs.add(accountID);
}
}
return accountIDs;
}
/**
* Gets an {@link AccountID} by its UID.
*

@ -3,7 +3,7 @@
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.securityconfig.chat;
package net.java.sip.communicator.plugin.otr;
import java.awt.*;
import java.awt.event.*;
@ -13,7 +13,6 @@
import javax.swing.border.*;
import net.java.otr4j.*;
import net.java.sip.communicator.plugin.securityconfig.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
@ -88,8 +87,7 @@ public String toString()
public AccountsComboBox()
{
List<AccountID> accountIDs
= SecurityConfigActivator.getAllAccountIDs();
List<AccountID> accountIDs = OtrActivator.getAllAccountIDs();
if (accountIDs == null)
return;
@ -127,9 +125,9 @@ private void openAccount(AccountID account)
lblFingerprint.setEnabled(false);
btnGenerate.setEnabled(false);
lblFingerprint.setText(SecurityConfigActivator.getResources()
lblFingerprint.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.NO_KEY_PRESENT"));
btnGenerate.setText(SecurityConfigActivator.getResources()
btnGenerate.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.GENERATE"));
}
else
@ -138,20 +136,20 @@ private void openAccount(AccountID account)
btnGenerate.setEnabled(true);
String fingerprint =
SecurityConfigActivator.getOtrKeyManagerService()
OtrActivator.scOtrKeyManager
.getLocalFingerprint(account);
if (fingerprint == null || fingerprint.length() < 1)
{
lblFingerprint.setText(SecurityConfigActivator.getResources()
lblFingerprint.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.NO_KEY_PRESENT"));
btnGenerate.setText(SecurityConfigActivator.getResources()
btnGenerate.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.GENERATE"));
}
else
{
lblFingerprint.setText(fingerprint);
btnGenerate.setText(SecurityConfigActivator.getResources()
btnGenerate.setText(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.REGENERATE"));
}
}
@ -164,17 +162,17 @@ private void initComponents()
{
this.setBorder(BorderFactory.createTitledBorder(BorderFactory
.createEtchedBorder(EtchedBorder.LOWERED),
SecurityConfigActivator.getResources()
OtrActivator.resourceService
.getI18NString("plugin.otr.configform.MY_PRIVATE_KEYS")));
JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1));
labelsPanel.add(new JLabel(SecurityConfigActivator.getResources()
labelsPanel.add(new JLabel(OtrActivator.resourceService
.getI18NString("service.gui.ACCOUNT") + ": "));
labelsPanel.add(new JLabel(
SecurityConfigActivator.getResources()
.getI18NString("plugin.otr.configform.FINGERPRINT") + ": "));
OtrActivator.resourceService
.getI18NString("plugin.otr.configform.FINGERPRINT") + ": "));
JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1));
@ -203,7 +201,7 @@ public void actionPerformed(ActionEvent e)
AccountID account = cbAccounts.getSelectedAccountID();
if (account == null)
return;
SecurityConfigActivator.getOtrKeyManagerService()
OtrActivator.scOtrKeyManager
.generateKeyPair(account);
openAccount(account);
}
@ -238,8 +236,7 @@ public DefaultOtrPolicyPanel()
public void loadPolicy()
{
OtrPolicy otrPolicy
= SecurityConfigActivator.getOtrEngineService()
.getGlobalPolicy();
= OtrActivator.scOtrEngine.getGlobalPolicy();
boolean otrEnabled = otrPolicy.getEnableManual();
cbEnable.setSelected(otrEnabled);
@ -263,21 +260,20 @@ private void initComponents()
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
cbEnable =
new SIPCommCheckBox(SecurityConfigActivator.getResources()
new SIPCommCheckBox(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.CB_ENABLE"));
cbEnable.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
OtrPolicy otrPolicy
= SecurityConfigActivator.getOtrEngineService()
= OtrActivator.scOtrEngine
.getGlobalPolicy();
otrPolicy.setEnableManual(((JCheckBox) e.getSource())
.isSelected());
SecurityConfigActivator.getOtrEngineService()
.setGlobalPolicy(otrPolicy);
OtrActivator.scOtrEngine.setGlobalPolicy(otrPolicy);
DefaultOtrPolicyPanel.this.loadPolicy();
}
@ -285,21 +281,20 @@ public void actionPerformed(ActionEvent e)
this.add(cbEnable);
cbAutoInitiate =
new SIPCommCheckBox(SecurityConfigActivator.getResources()
new SIPCommCheckBox(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.CB_AUTO"));
cbAutoInitiate.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
OtrPolicy otrPolicy =
SecurityConfigActivator.getOtrEngineService()
OtrActivator.scOtrEngine
.getGlobalPolicy();
otrPolicy.setEnableAlways(((JCheckBox) e.getSource())
.isSelected());
SecurityConfigActivator.getOtrEngineService()
.setGlobalPolicy(otrPolicy);
OtrActivator.scOtrEngine.setGlobalPolicy(otrPolicy);
DefaultOtrPolicyPanel.this.loadPolicy();
}
@ -308,21 +303,19 @@ public void actionPerformed(ActionEvent e)
this.add(cbAutoInitiate);
cbRequireOtr =
new SIPCommCheckBox(SecurityConfigActivator.getResources()
new SIPCommCheckBox(OtrActivator.resourceService
.getI18NString("plugin.otr.configform.CB_REQUIRE"));
cbRequireOtr.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
OtrPolicy otrPolicy =
SecurityConfigActivator.getOtrEngineService()
.getGlobalPolicy();
OtrActivator.scOtrEngine.getGlobalPolicy();
otrPolicy.setRequireEncryption(((JCheckBox) e.getSource())
.isSelected());
SecurityConfigActivator.getOtrEngineService()
.setGlobalPolicy(otrPolicy);
OtrActivator.scOtrEngine.setGlobalPolicy(otrPolicy);
DefaultOtrPolicyPanel.this.loadPolicy();

@ -15,7 +15,7 @@
*
* @author George Politis
*/
public interface OtrEngineService
public interface ScOtrEngine
{
// Proxy methods OtrEngine.

@ -19,8 +19,8 @@
/**
* @author George Politis
*/
public class OtrEngineServiceImpl
implements OtrEngineService
public class ScOtrEngineImpl
implements ScOtrEngine
{
private final OtrConfigurator configurator = new OtrConfigurator();
@ -119,8 +119,8 @@ public void showError(SessionID sessionID, String err)
Chat.ERROR_MESSAGE, err,
OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE);
}
public OtrEngineServiceImpl()
public ScOtrEngineImpl()
{
this.otrEngine.addOtrEngineListener(new OtrEngineListener()
{
@ -344,6 +344,5 @@ public void setContactPolicy(Contact contact, OtrPolicy policy)
for (ScOtrEngineListener l : listeners)
l.contactPolicyChanged(contact);
}
}

@ -14,8 +14,9 @@
* @author George Politis
*
*/
public interface OtrKeyManagerService
public interface ScOtrKeyManager
{
public abstract void addListener(ScOtrKeyManagerListener l);
public abstract void removeListener(ScOtrKeyManagerListener l);

@ -15,8 +15,8 @@
/**
* @author George Politis
*/
public class OtrKeyManagerServiceImpl
implements OtrKeyManagerService
public class ScOtrKeyManagerImpl
implements ScOtrKeyManager
{
private final OtrConfigurator configurator = new OtrConfigurator();

@ -3,8 +3,7 @@ Bundle-Name: OTR (Off-the-Record) Messaging
Bundle-Description: Support for secure, Off The Record messaging in SIP Communicator
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Export-Package: net.java.sip.communicator.plugin.otr
System-Bundle: yes
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.browserlauncher,
net.java.sip.communicator.service.configuration,
@ -14,10 +13,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
net.java.otr4j,
net.java.otr4j.crypto,
net.java.otr4j.session,
net.java.sip.communicator.util.swing,
javax.imageio,
javax.swing,
javax.swing.border,

@ -5,6 +5,8 @@
*/
package net.java.sip.communicator.plugin.pluginmanager;
import java.util.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
@ -45,6 +47,9 @@ public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.ADVANCED_TYPE);
bundleContext.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
@ -53,7 +58,7 @@ public void start(BundleContext bc) throws Exception
"plugin.pluginmanager.PLUGIN_ICON",
"plugin.pluginmanager.PLUGINS",
1000, true),
null);
properties);
}
/**

@ -48,16 +48,6 @@ public class SecurityConfigActivator
*/
private static ConfigurationService configurationService;
/**
* The Otr key manager service.
*/
private static OtrKeyManagerService otrKeyManagerService;
/**
* The Otr engine service.
*/
private static OtrEngineService otrEngineService;
/**
* Starts this plugin.
* @param bc the BundleContext
@ -69,12 +59,15 @@ public void start(BundleContext bc) throws Exception
bundleContext = bc;
// Register the configuration form.
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.GENERAL_TYPE);
bundleContext.registerService(ConfigurationForm.class.getName(),
new LazyConfigurationForm(
"net.java.sip.communicator.plugin.securityconfig.SecurityConfigurationPanel",
getClass().getClassLoader(),
"plugin.securityconfig.ICON",
"plugin.securityconfig.TITLE", 20), null);
"plugin.securityconfig.TITLE", 20), properties);
}
/**
@ -96,14 +89,15 @@ public static ResourceManagementService getResources()
{
if (resourceService == null)
{
ServiceReference confReference
ServiceReference resReference
= bundleContext
.getServiceReference(
ResourceManagementService.class.getName());
resourceService
= (ResourceManagementService)
bundleContext.getService(confReference);
if (resReference != null)
resourceService
= (ResourceManagementService)
bundleContext.getService(resReference);
}
return resourceService;
}
@ -123,58 +117,14 @@ public static ConfigurationService getConfigurationService()
= bundleContext
.getServiceReference(ConfigurationService.class.getName());
configurationService
= (ConfigurationService)
bundleContext.getService(confReference);
if (confReference != null)
configurationService
= (ConfigurationService)
bundleContext.getService(confReference);
}
return configurationService;
}
/**
* Returns a reference to the <tt>OtrEngineService</tt> implementation
* currently registered in the bundle context or null if no such
* implementation was found.
*
* @return a currently valid implementation of the <tt>OtrEngineService</tt>
*/
public static OtrEngineService getOtrEngineService()
{
if (otrEngineService == null)
{
ServiceReference confReference
= bundleContext
.getServiceReference(OtrEngineService.class.getName());
otrEngineService
= (OtrEngineService)
bundleContext.getService(confReference);
}
return otrEngineService;
}
/**
* Returns a reference to the <tt>OtrKeyManagerService</tt> implementation
* currently registered in the bundle context or null if no such
* implementation was found.
*
* @return a currently valid implementation of the
* <tt>OtrKeyManagerService</tt>
*/
public static OtrKeyManagerService getOtrKeyManagerService()
{
if (otrKeyManagerService == null)
{
ServiceReference confReference
= bundleContext
.getServiceReference(OtrKeyManagerService.class.getName());
otrKeyManagerService
= (OtrKeyManagerService)
bundleContext.getService(confReference);
}
return otrKeyManagerService;
}
/**
* Gets all the available accounts in SIP Communicator.
*

@ -9,9 +9,9 @@
import javax.swing.*;
import net.java.sip.communicator.plugin.securityconfig.call.*;
import net.java.sip.communicator.plugin.securityconfig.chat.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.service.gui.*;
import org.osgi.framework.*;
/**
* The main security configuration form panel.
@ -19,22 +19,91 @@
* @author Yana Stamcheva
*/
public class SecurityConfigurationPanel
extends TransparentPanel
extends JTabbedPane
implements ServiceListener
{
/**
* Creates the <tt>SecurityConfigurationPanel</tt>.
*/
public SecurityConfigurationPanel()
{
super(new BorderLayout());
init();
SecurityConfigActivator.bundleContext.addServiceListener(this);
}
/**
* Initializes this panel.
*/
private void init()
{
String osgiFilter = "("
+ ConfigurationForm.FORM_TYPE
+ "="+ConfigurationForm.SECURITY_TYPE+")";
ServiceReference[] confFormsRefs = null;
try
{
confFormsRefs = SecurityConfigActivator.bundleContext
.getServiceReferences( ConfigurationForm.class.getName(),
osgiFilter);
}
catch (InvalidSyntaxException ex)
{}
if(confFormsRefs != null)
{
for (int i = 0; i < confFormsRefs.length; i++)
{
ConfigurationForm form
= (ConfigurationForm) SecurityConfigActivator.bundleContext
.getService(confFormsRefs[i]);
Object formComponent = form.getForm();
if (formComponent instanceof Component)
addTab(form.getTitle(), (Component) formComponent);
}
}
}
/**
* Handles registration of a new configuration form.
* @param event the <tt>ServiceEvent</tt> that notified us
*/
public void serviceChanged(ServiceEvent event)
{
ServiceReference serviceRef = event.getServiceReference();
Object property = serviceRef.getProperty(ConfigurationForm.FORM_TYPE);
if (property != ConfigurationForm.SECURITY_TYPE)
return;
Object sService
= SecurityConfigActivator.bundleContext
.getService(serviceRef);
// we don't care if the source service is not a configuration form
if (!(sService instanceof ConfigurationForm))
return;
ConfigurationForm configForm = (ConfigurationForm) sService;
JTabbedPane tabbedPane = new JTabbedPane();
if (!configForm.isAdvanced())
return;
tabbedPane.addTab(SecurityConfigActivator.getResources()
.getI18NString("service.gui.CHAT"), new OtrConfigurationPanel());
tabbedPane.addTab(SecurityConfigActivator.getResources()
.getI18NString("service.gui.CALL"), new ZrtpConfigurePanel());
Object formComponent;
switch (event.getType())
{
case ServiceEvent.REGISTERED:
formComponent = configForm.getForm();
if (formComponent instanceof Component)
addTab(configForm.getTitle(), (Component) formComponent);
break;
add(tabbedPane);
case ServiceEvent.UNREGISTERING:
formComponent = configForm.getForm();
if (formComponent instanceof Component)
remove((Component) formComponent);
break;
}
}
}

@ -12,9 +12,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.util,
net.java.sip.communicator.util.swing,
net.java.sip.communicator.plugin.otr,
net.java.sip.communicator.service.contactlist,
net.java.otr4j,
gnu.java.zrtp,
javax.imageio,
javax.swing,

@ -19,6 +19,26 @@
*/
public interface ConfigurationForm
{
/**
* The name of a property representing the type of the configuration form.
*/
public static final String FORM_TYPE = "FORM_TYPE";
/**
* The security configuration form type.
*/
public static final String SECURITY_TYPE = "SECURITY_TYPE";
/**
* The general configuration form type.
*/
public static final String GENERAL_TYPE = "GENERAL_TYPE";
/**
* The advanced configuration form type.
*/
public static final String ADVANCED_TYPE = "ADVANCED_TYPE";
/**
* Returns the title of this configuration form.
* @return the title of this configuration form

Loading…
Cancel
Save