Move security audio notifications to the NotificationManager and fire security alert audio notification on security off.

cusax-fix
Yana Stamcheva 18 years ago
parent 830c5950bc
commit 980caea144

@ -289,6 +289,9 @@ public void securityOn(CallParticipantSecurityOnEvent securityEvent)
}
participantPanel.createSecurityPanel(securityEvent);
NotificationManager.fireNotification(
NotificationManager.CALL_SECURITY_ON);
}
public void securityOff(CallParticipantSecurityOffEvent securityEvent)
@ -300,7 +303,8 @@ public void securityOff(CallParticipantSecurityOffEvent securityEvent)
participantPanel.setSecured(false);
switch (securityEvent.getSessionType()) {
switch (securityEvent.getSessionType())
{
case CallParticipantSecurityOnEvent.AUDIO_SESSION:
participantPanel.setAudioSecurityOn(false);
break;
@ -308,6 +312,9 @@ public void securityOff(CallParticipantSecurityOffEvent securityEvent)
participantPanel.setVideoSecurityOn(false);
break;
}
NotificationManager.fireNotification(
NotificationManager.CALL_SECURITY_OFF);
}
/**

@ -11,9 +11,7 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.notification.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.swing.*;
@ -28,15 +26,6 @@ public class SecurityPanel
private boolean sasVerified = false;
private final NotificationService notificationService =
GuiActivator.getNotificationService();
private static final String ZRTP_SECURE_NOTIFICATION
= "ZrtpSecureNotification";
private static final String ZRTP_ALERT_NOTIFICATION
= "ZrtpAlertNotification";
private final SIPCommButton sasVerificationButton;
private final JLabel securityStringLabel = new JLabel();
@ -57,21 +46,6 @@ public SecurityPanel(CallParticipant participant)
iconEncr = ImageLoader.getImage(ImageLoader.ENCR);
sasVerificationButton = new SIPCommButton(iconEncr);
if (notificationService != null)
{
notificationService.registerDefaultNotificationForEvent(
ZRTP_SECURE_NOTIFICATION,
NotificationService.ACTION_SOUND,
SoundProperties.ZRTP_SECURE,
null);
notificationService.registerDefaultNotificationForEvent(
ZRTP_ALERT_NOTIFICATION,
NotificationService.ACTION_SOUND,
SoundProperties.ZRTP_ALERT,
null);
}
this.addComponentsToPane();
}
@ -132,8 +106,6 @@ public void refreshStates(CallParticipantSecurityOnEvent event)
sasVerificationButton
.setImage(event.isSecurityVerified() ? iconEncrVerified : iconEncr);
notificationService.fireNotification(ZRTP_SECURE_NOTIFICATION);
revalidate();
repaint();
}

@ -25,6 +25,10 @@ public class NotificationManager
public static final String WARNING_MESSAGE = "WarningMessage";
public static final String CALL_SECURITY_ON = "CallSecurityOn";
public static final String CALL_SECURITY_OFF = "CallSecurityOff";
public static void registerGuiNotifications()
{
NotificationService notificationService
@ -55,7 +59,8 @@ public static void registerGuiNotifications()
SoundNotificationHandler inCallSoundHandler
= (SoundNotificationHandler) notificationService
.createSoundNotificationHandler(SoundProperties.INCOMING_CALL, 2000);
.createSoundNotificationHandler(SoundProperties.INCOMING_CALL,
2000);
notificationService.registerDefaultNotificationForEvent(
INCOMING_CALL,
@ -65,7 +70,8 @@ public static void registerGuiNotifications()
// Register outgoing call notifications.
SoundNotificationHandler outCallSoundHandler
= (SoundNotificationHandler) notificationService
.createSoundNotificationHandler(SoundProperties.OUTGOING_CALL, 3000);
.createSoundNotificationHandler(SoundProperties.OUTGOING_CALL,
3000);
notificationService.registerDefaultNotificationForEvent(
OUTGOING_CALL,
@ -95,6 +101,21 @@ public static void registerGuiNotifications()
NotificationService.ACTION_POPUP_MESSAGE,
null,
null);
// Register sound notification for security state on during a call.
notificationService.registerDefaultNotificationForEvent(
CALL_SECURITY_ON,
NotificationService.ACTION_SOUND,
SoundProperties.ZRTP_SECURE,
null);
// Register sound notification for security state off during a call.
notificationService.registerDefaultNotificationForEvent(
CALL_SECURITY_OFF,
NotificationService.ACTION_SOUND,
SoundProperties.ZRTP_ALERT,
null);
}
/**

Loading…
Cancel
Save