aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin
diff options
context:
space:
mode:
authorTimur Masar <tmasar@459below.org>2015-10-31 04:06:24 +0100
committerTimur Masar <tmasar@459below.org>2015-11-09 12:56:02 +0100
commit45d8ee64c40fcb4d695c846e3fc4ab61fc9fbdad (patch)
treee7f29f5e500bcd252c42547387dc9d3756bc2fff /src/net/java/sip/communicator/plugin
parent6fcbb76665397dae6d6395f5155c955e4e052863 (diff)
downloadjitsi-45d8ee64c40fcb4d695c846e3fc4ab61fc9fbdad.zip
jitsi-45d8ee64c40fcb4d695c846e3fc4ab61fc9fbdad.tar.gz
jitsi-45d8ee64c40fcb4d695c846e3fc4ab61fc9fbdad.tar.bz2
Option for new behaviour of detecting a contact's capabilities
This reintroduces some old code in order to give the user the option to switch between those two behaviours. It also prevents the removal of all caps nodes (and thusly breaking the new detection) when a rogue offline presence event comes in. This is such an event in which a contact is falsely assumed as offline, if the preferred resource of two or more same prioritised resources goes offline. We are checking this by looking whether it is a "resourceChanged"-event. This should probably be changed again, after those offline presence updates have been fixed.
Diffstat (limited to 'src/net/java/sip/communicator/plugin')
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java24
-rw-r--r--src/net/java/sip/communicator/plugin/generalconfig/XMPPConfigForm.java101
2 files changed, 125 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java
index 2f345d7..7222d97 100644
--- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java
+++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java
@@ -108,6 +108,14 @@ public class GeneralConfigPluginActivator
"net.java.sip.communicator.plugin.generalconfig.sipconfig.DISABLED";
/**
+ * Indicates if the XMPP configuration form should be disabled, i.e.
+ * not visible to the user.
+ */
+ private static final String XMPP_CONFIG_DISABLED_PROP
+ =
+ "net.java.sip.communicator.plugin.generalconfig.xmppconfig.DISABLED";
+
+ /**
* Starts this bundle.
*/
@Override
@@ -155,6 +163,22 @@ public class GeneralConfigPluginActivator
52, true),
properties);
}
+ if (!getConfigurationService()
+ .getBoolean(XMPP_CONFIG_DISABLED_PROP, false))
+ {
+ // Registers the XMPP config panel as advanced configuration form.
+ properties.put( ConfigurationForm.FORM_TYPE,
+ ConfigurationForm.ADVANCED_TYPE);
+ bundleContext.registerService(
+ ConfigurationForm.class.getName(),
+ new LazyConfigurationForm(
+ XMPPConfigForm.class.getName(),
+ getClass().getClassLoader(),
+ null,
+ "plugin.generalconfig.XMPP_CONFIG",
+ 52, true),
+ properties);
+ }
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.ADVANCED_TYPE);
bundleContext.registerService(
diff --git a/src/net/java/sip/communicator/plugin/generalconfig/XMPPConfigForm.java b/src/net/java/sip/communicator/plugin/generalconfig/XMPPConfigForm.java
new file mode 100644
index 0000000..0113232
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/generalconfig/XMPPConfigForm.java
@@ -0,0 +1,101 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Copyright @ 2015 Atlassian Pty Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.java.sip.communicator.plugin.generalconfig;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.*;
+
+import org.jitsi.service.configuration.*;
+
+import net.java.sip.communicator.plugin.desktoputil.*;
+
+/**
+ * Implementation of the configuration form.
+ *
+ * @author Timur Masar
+ */
+public class XMPPConfigForm
+extends TransparentPanel
+{
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * The name of the property used to control whether to use
+ * all resources to show capabilities
+ */
+ public static final String PROP_XMPP_USE_ALL_RESOURCES_FOR_CAPABILITIES =
+ "net.java.sip.communicator.XMPP_USE_ALL_RESOURCES_FOR_CAPABILITIES";
+
+ /**
+ * The default value for the capabilities setting
+ */
+ public static final boolean USE_ALL_RESOURCES_FOR_CAPABILITIES_DEFAULT =
+ true;
+
+ /**
+ * The <tt>ConfigurationService</tt> to be used to access configuration
+ */
+ private final ConfigurationService configurationService
+ = GeneralConfigPluginActivator.getConfigurationService();
+
+ /**
+ * Creates the form.
+ */
+ public XMPPConfigForm()
+ {
+ super(new BorderLayout());
+ Box box = Box.createVerticalBox();
+ add(box, BorderLayout.NORTH);
+
+ TransparentPanel contentPanel = new TransparentPanel();
+ contentPanel.setLayout(new BorderLayout(10, 10));
+
+ box.add(contentPanel);
+
+ TransparentPanel labelPanel
+ = new TransparentPanel(new GridLayout(0, 1, 2, 2));
+ TransparentPanel valuePanel
+ = new TransparentPanel(new GridLayout(0, 1, 2, 2));
+
+ contentPanel.add(labelPanel, BorderLayout.CENTER);
+ contentPanel.add(valuePanel, BorderLayout.WEST);
+
+ final JCheckBox useAllResourcesForCapabilitiesCheckbox =
+ new SIPCommCheckBox(Resources.getString(
+ "plugin.generalconfig.XMPP_USE_ALL_RESOURCES"));
+
+ useAllResourcesForCapabilitiesCheckbox.addActionListener(
+ new ActionListener() {
+ public void actionPerformed(ActionEvent actionEvent) {
+ configurationService.setProperty(
+ PROP_XMPP_USE_ALL_RESOURCES_FOR_CAPABILITIES,
+ useAllResourcesForCapabilitiesCheckbox.isSelected());
+ }
+ });
+ useAllResourcesForCapabilitiesCheckbox.setSelected(
+ configurationService.getBoolean(
+ PROP_XMPP_USE_ALL_RESOURCES_FOR_CAPABILITIES,
+ USE_ALL_RESOURCES_FOR_CAPABILITIES_DEFAULT));
+ valuePanel.add(useAllResourcesForCapabilitiesCheckbox);
+ }
+}