aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2013-12-07 19:37:40 +0100
committerIngo Bauersachs <ingo@jitsi.org>2013-12-07 19:40:03 +0100
commit01c579208b473e7d9045e02b4de22d42b9ef8628 (patch)
tree8f71613b77922392cb71e0b09bcf617db1c2c4dd /src/net/java
parente81138a2e34811b7d060725004ac5f45f45175a9 (diff)
downloadjitsi-01c579208b473e7d9045e02b4de22d42b9ef8628.zip
jitsi-01c579208b473e7d9045e02b4de22d42b9ef8628.tar.gz
jitsi-01c579208b473e7d9045e02b4de22d42b9ef8628.tar.bz2
Listen only to PPS service events
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/ContactSearchFieldUI.java36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactSearchFieldUI.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactSearchFieldUI.java
index 896be6f..869e156 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactSearchFieldUI.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactSearchFieldUI.java
@@ -39,6 +39,12 @@ public class ContactSearchFieldUI
implements Skinnable
{
/**
+ * Class logger.
+ */
+ private final static Logger logger
+ = Logger.getLogger(ContactSearchFieldUI.class);
+
+ /**
* Indicates whether the call button should be enabled or not.
*/
private boolean isCallButtonEnabled = true;
@@ -98,7 +104,19 @@ public class ContactSearchFieldUI
public void setupListeners()
{
providerRegListener = new ProtocolProviderRegListener();
- GuiActivator.bundleContext.addServiceListener(providerRegListener);
+ try
+ {
+ GuiActivator.bundleContext.addServiceListener(providerRegListener,
+ "(objectclass="
+ + ProtocolProviderService.class.getName() + ")");
+ }
+ catch (InvalidSyntaxException e)
+ {
+ // this should really not happen
+ logger.error(e);
+ return;
+ }
+
for(ProtocolProviderFactory providerFactory :
GuiActivator.getProtocolProviderFactories().values())
{
@@ -180,6 +198,7 @@ public class ContactSearchFieldUI
private class ProtocolProviderRegListener
implements ServiceListener
{
+ @Override
public void serviceChanged(ServiceEvent event)
{
ServiceReference serviceRef = event.getServiceReference();
@@ -191,24 +210,17 @@ public class ContactSearchFieldUI
return;
}
- Object service = GuiActivator.bundleContext.getService(serviceRef);
-
- // we don't care if the source service is not a protocol provider
- if (!(service instanceof ProtocolProviderService))
- {
- return;
- }
-
- ProtocolProviderService pps = (ProtocolProviderService)service;
+ ProtocolProviderService pps = (ProtocolProviderService)
+ GuiActivator.bundleContext.getService(serviceRef);
switch (event.getType())
{
case ServiceEvent.REGISTERED:
- providers.add((ProtocolProviderService) service);
+ providers.add(pps);
pps.addRegistrationStateChangeListener(
providerRegistrationStateListener);
break;
case ServiceEvent.UNREGISTERING:
- providers.remove((ProtocolProviderService) service);
+ providers.remove(pps);
pps.removeRegistrationStateChangeListener(
providerRegistrationStateListener);
break;