diff options
author | Damian Minkov <damencho@jitsi.org> | 2012-10-18 10:38:00 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2012-10-18 10:38:00 +0000 |
commit | 93aeb79acfee9f44297acc7e2e6ca1abb97d19dd (patch) | |
tree | 2d0eda9e0bc195a2b0ffad8558929771f224b83b /src/net/java | |
parent | 9d2858020d94b6f4051c18e4f01a38f6abaa5a4b (diff) | |
download | jitsi-93aeb79acfee9f44297acc7e2e6ca1abb97d19dd.zip jitsi-93aeb79acfee9f44297acc7e2e6ca1abb97d19dd.tar.gz jitsi-93aeb79acfee9f44297acc7e2e6ca1abb97d19dd.tar.bz2 |
A hack fixing problem with playing notifications during the ongoing call.
Diffstat (limited to 'src/net/java')
4 files changed, 53 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index 2436738..9612adc 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -1525,4 +1525,14 @@ public class UIServiceImpl { return new TreeContactList(); } + + /** + * Returns a collection of all currently in progress calls. + * + * @return a collection of all currently in progress calls. + */ + public Collection<Call> getInProgressCalls() + { + return CallManager.getInProgressCalls(); + } } diff --git a/src/net/java/sip/communicator/impl/notification/NotificationActivator.java b/src/net/java/sip/communicator/impl/notification/NotificationActivator.java index a7d94bd..7cd65c3 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationActivator.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationActivator.java @@ -6,6 +6,7 @@ */ package net.java.sip.communicator.impl.notification; +import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.notification.*; import net.java.sip.communicator.service.systray.*; import net.java.sip.communicator.util.*; @@ -31,6 +32,11 @@ public class NotificationActivator private static SystrayService systrayService; private static NotificationService notificationService; + /** + * A reference to the <tt>UIService</tt> currently in use in Jitsi. + */ + private static UIService uiService = null; + private CommandNotificationHandler commandHandler; private LogMessageNotificationHandler logMessageHandler; private PopupMessageNotificationHandler popupMessageHandler; @@ -125,4 +131,18 @@ public class NotificationActivator return systrayService; } + + /** + * Returns a reference to an UIService implementation currently registered + * in the bundle context or null if no such implementation was found. + * + * @return a reference to an UIService implementation currently registered + * in the bundle context or null if no such implementation was found. + */ + public static UIService getUIService() + { + if(uiService == null) + uiService = ServiceUtils.getService(bundleContext, UIService.class); + return uiService; + } } diff --git a/src/net/java/sip/communicator/impl/notification/SoundNotificationHandlerImpl.java b/src/net/java/sip/communicator/impl/notification/SoundNotificationHandlerImpl.java index 507353d..fad7e2b 100644 --- a/src/net/java/sip/communicator/impl/notification/SoundNotificationHandlerImpl.java +++ b/src/net/java/sip/communicator/impl/notification/SoundNotificationHandlerImpl.java @@ -9,6 +9,7 @@ package net.java.sip.communicator.impl.notification; import java.awt.*; import java.util.*; +import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.notification.*; import org.jitsi.service.audionotifier.*; @@ -107,6 +108,20 @@ public class SoundNotificationHandlerImpl || StringUtils.isNullOrEmpty(action.getDescriptor(), true)) return; + // this is hack, seen on some os (particularly seen on macosx with + // external devices). + // when playing notification in the call, can break the call and + // no further communicating can be done after the notification. + // So we skip playing notification if we have a call running + if(playback) + { + UIService uiService = NotificationActivator.getUIService(); + if(uiService.getInProgressCalls().size() > 0) + { + return; + } + } + SCAudioClip audio = audioNotifService .createAudio(action.getDescriptor(), playback); @@ -215,7 +230,7 @@ public class SoundNotificationHandlerImpl public void play() { started = true; - new Thread() + new Thread("Playing beep:" + this.getClass()) { @Override public void run() diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java index add11c0..b732bd7 100644 --- a/src/net/java/sip/communicator/service/gui/UIService.java +++ b/src/net/java/sip/communicator/service/gui/UIService.java @@ -462,4 +462,11 @@ public interface UIService * @return the created <tt>ContactList</tt> */ public ContactList createContactListComponent(); + + /** + * Returns a collection of all currently in progress calls. + * + * @return a collection of all currently in progress calls. + */ + public Collection<Call> getInProgressCalls(); } |