diff options
13 files changed, 180 insertions, 130 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java index ece114b..6d254b4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java @@ -137,7 +137,7 @@ public class CallPanel } /** - * Cteates and adds a panel for a call participant. + * Creates and adds a panel for a call participant. * * @param participantName the call participant name * @param callType the type of call: INCOMING or OUTGOING @@ -164,7 +164,7 @@ public class CallPanel } /** - * Cteates and adds a panel for a call participant. + * Creates and adds a panel for a call participant. * * @param participant the call participant * @param callType the type of call - INCOMING of OUTGOING diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java index 4a9d4a2..3c925c6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java @@ -15,6 +15,7 @@ import javax.swing.Timer; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.impl.gui.i18n.*; /** * The <tt>CallParticipantPanel</tt> is the panel containing data for a call @@ -39,7 +40,9 @@ public class CallParticipantPanel private JLabel photoLabel = new JLabel(new ImageIcon( ImageLoader.getImage(ImageLoader.DEFAULT_USER_PHOTO))); - + + private JLabel secureLabel = new JLabel("Not in call", JLabel.CENTER); + private JPanel northPanel = new JPanel(); private Date callStartTime; @@ -55,7 +58,7 @@ public class CallParticipantPanel private String participantName; private CallParticipant callParticipant; - + /** * Creates a <tt>CallParticipantPanel</tt> for the given call participant. * @@ -67,22 +70,66 @@ public class CallParticipantPanel this(callParticipant.getAddress()); this.callParticipant = callParticipant; - + this.stateLabel.setText(callParticipant.getState().getStateString()); Component holdButton = new HoldButton(this.callParticipant); - holdButton.setBounds(9, 74, 36, 36); - contactPanel.add(holdButton, new Integer(1)); - Component muteButton = new MuteButton(this.callParticipant); - muteButton.setBounds(45, 74, 36, 36); - contactPanel.add(muteButton, new Integer(1)); - Component transferCallButton = createTransferCallButton(); - if (transferCallButton != null) + Component secureButton = createSecureCallButton(); + + if (secureButton != null) { - transferCallButton.setBounds(81, 74, 36, 36); - contactPanel.add(transferCallButton, new Integer(1)); + holdButton.setBounds(3, 74, 36, 36); + muteButton.setBounds(39, 74, 36, 36); + + contactPanel.add(holdButton, new Integer(1)); + contactPanel.add(muteButton, new Integer(1)); + + if (transferCallButton != null) + { + transferCallButton.setBounds(75, 74, 36, 36); + contactPanel.add(transferCallButton, new Integer(1)); + } + + secureButton.setName("secureButton"); + secureButton.setBounds(111, 74, 36, 36); + ((JButton)secureButton).setActionCommand("startSecureMode"); + ((JButton)secureButton).setToolTipText(Messages. + getI18NString("toggleOnSecurity").getText()); + contactPanel.add(secureButton, new Integer(1)); + + this.secureLabel.setName("secureLabel"); + + callParticipant.getCall().addSecureGUIComponent(secureButton.getName(), + secureButton); + callParticipant.getCall().addSecureGUIComponent(secureLabel.getName(), + secureLabel); + + secureLabel.setPreferredSize(new Dimension(110, 50)); + secureLabel.setBorder(BorderFactory.createLineBorder(Color.BLUE)); + secureLabel.setToolTipText(Messages. + getI18NString("defaultSASMessage").getText()); + namePanel.add(secureLabel); + + // Resizing some items + contactPanel.setPreferredSize(new Dimension(150, 170)); + photoLabel.setBounds(30, 0, 90, 100); + namePanel.setBounds(0, 110, 150, 50); + } + else + { + holdButton.setBounds(9, 74, 36, 36); + muteButton.setBounds(45, 74, 36, 36); + + contactPanel.add(holdButton, new Integer(1)); + contactPanel.add(muteButton, new Integer(1)); + + if (transferCallButton != null) + { + transferCallButton.setBounds(81, 74, 36, 36); + contactPanel.add(transferCallButton, new Integer(1)); + } } } @@ -160,7 +207,34 @@ public class CallParticipantPanel } return null; } - + + /** + * Creates a new <code>Component</code> representing a UI means to secure + * the <code>Call</code> of the associated <code>callParticipant</code> or + * <tt>null</tt> if secured call is unsupported. + * + * @return a new <code>Component</code> representing the UI means to + * secure the <code>Call</code> of <code>callParticipant</code> or + * <tt>null</tt> if secured call is unsupported + */ + private Component createSecureCallButton() + { + Call call = callParticipant.getCall(); + + if (call != null) + { + OperationSetSecuredTelephony secured = + (OperationSetSecuredTelephony) call.getProtocolProvider() + .getOperationSet(OperationSetSecuredTelephony.class); + + if (secured != null) + { + return new SecureButton(callParticipant); + } + } + return null; + } + /** * Sets the state of the contained call participant. * @param state the state of the contained call participant diff --git a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java index ca0943f..efb7f7d 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java @@ -43,25 +43,25 @@ public class SecureButton String command = evt.getActionCommand(); if (command.equals("startSecureMode")) { - OperationSetBasicTelephony telephony = - (OperationSetBasicTelephony) call.getProtocolProvider() - .getOperationSet(OperationSetBasicTelephony.class); + OperationSetSecuredTelephony telephony = + (OperationSetSecuredTelephony) call.getProtocolProvider() + .getOperationSet(OperationSetSecuredTelephony.class); - if (telephony.isSecured(callParticipant)) + if (telephony != null && telephony.isSecured(callParticipant)) { updateSecureButton(false); telephony.setSecured(callParticipant, false, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource .SECURE_STATUS_CHANGE_BY_LOCAL); } - else + else if (telephony != null) { updateSecureButton(true); telephony.setSecured(callParticipant, true, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource .SECURE_STATUS_CHANGE_BY_LOCAL); } diff --git a/src/net/java/sip/communicator/impl/media/CallSessionImpl.java b/src/net/java/sip/communicator/impl/media/CallSessionImpl.java index eece1f4..5359ce0 100644 --- a/src/net/java/sip/communicator/impl/media/CallSessionImpl.java +++ b/src/net/java/sip/communicator/impl/media/CallSessionImpl.java @@ -475,7 +475,7 @@ public class CallSessionImpl if (selectedKeyProviderAlgorithm != null /* TODO: Video securing related code * remove the next condition as part of enabling video securing - * (see comments insecureStatusChanged method for more info) + * (see comments in secureStatusChanged method for more info) */ && rtpManager.equals(audioRtpManager)) { @@ -1223,12 +1223,10 @@ public class CallSessionImpl if (selectedKeyProviderAlgorithm != null /* TODO: Video securing related code * remove the next condition as part of enabling video - * securing (see comments insecureStatusChanged method + * securing (see comments in secureStatusChanged method * for more info) */ - && rtpManager.equals(audioRtpManager) - && usingSRTP - ) + && rtpManager.equals(audioRtpManager)) { TransformConnector transConnector = (TransformConnector) this.transConnectors @@ -1975,10 +1973,9 @@ public class CallSessionImpl if (selectedKeyProviderAlgorithm != null && selectedKeyProviderAlgorithm.getProviderType() == KeyProviderAlgorithm.ProviderType.ZRTP_PROVIDER - && usingSRTP /* TODO: Video securing related code * remove the next condition as part of enabling video securing - * (see comments insecureStatusChanged method for more info) + * (see comments in secureStatusChanged method for more info) */ && rtpManager.equals(audioRtpManager)) { @@ -2030,10 +2027,9 @@ public class CallSessionImpl KeyProviderAlgorithm.ProviderType.DUMMY_PROVIDER /* TODO: Video securing related code * remove the next condition as part of enabling video securing - * (see comments insecureStatusChanged method for more info) + * (see comments in secureStatusChanged method for more info) */ - && rtpManager.equals(audioRtpManager) - && usingSRTP) + && rtpManager.equals(audioRtpManager)) { SRTPPolicy srtpPolicy = new SRTPPolicy(SRTPPolicy.AESF8_ENCRYPTION, 16, @@ -2635,7 +2631,7 @@ public class CallSessionImpl * @param source the source of changing the secure status (local or remote) */ public void setSecureCommunicationStatus(boolean activator, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource source) { @@ -2647,7 +2643,7 @@ public class CallSessionImpl // Fire the change event to notify any present CallSession of security change status // if not the case of a reverted secure state // (usually case of previous change rejected due to an error) - if (source != OperationSetBasicTelephony. + if (source != OperationSetSecuredTelephony. SecureStatusChangeSource.SECURE_STATUS_REVERTED) fireSecureStatusChanged(activator, source); @@ -2660,7 +2656,7 @@ public class CallSessionImpl * @param source the source of changing the secure status (local or remote) */ private synchronized void fireSecureStatusChanged(boolean activator, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource source) { if (activator) @@ -2691,7 +2687,7 @@ public class CallSessionImpl public void ZRTPChangeStatus(RTPManager manager, SecureEvent event) { int newStatus = event.getEventID(); - OperationSetBasicTelephony.SecureStatusChangeSource source = event.getSource(); + OperationSetSecuredTelephony.SecureStatusChangeSource source = event.getSource(); TransformConnector transConnector = (TransformConnector) this.transConnectors.get(manager); @@ -2701,7 +2697,7 @@ public class CallSessionImpl // Perform ZRTP engine actions only if triggered by local peer - user commands; // If the remote peer caused the event only general call session security status // is changed (done before event processing) - if (source == OperationSetBasicTelephony. + if (source == OperationSetSecuredTelephony. SecureStatusChangeSource.SECURE_STATUS_CHANGE_BY_LOCAL) { if (newStatus == SecureEvent.SECURE_COMMUNICATION) diff --git a/src/net/java/sip/communicator/impl/media/transform/zrtp/SCCallback.java b/src/net/java/sip/communicator/impl/media/transform/zrtp/SCCallback.java index 267d4cb..3c6c612 100644 --- a/src/net/java/sip/communicator/impl/media/transform/zrtp/SCCallback.java +++ b/src/net/java/sip/communicator/impl/media/transform/zrtp/SCCallback.java @@ -395,7 +395,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(false, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_CHANGE_BY_LOCAL); } @@ -405,7 +405,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(true, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_CHANGE_BY_LOCAL); } @@ -425,7 +425,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(true, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_REVERTED); @@ -438,7 +438,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(false, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_REVERTED); @@ -451,7 +451,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(true, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_REVERTED); @@ -463,7 +463,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(false, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_REVERTED); @@ -475,7 +475,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(false, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_CHANGE_BY_REMOTE); @@ -487,7 +487,7 @@ public class SCCallback callSession. setSecureCommunicationStatus(true, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource. SECURE_STATUS_CHANGE_BY_REMOTE); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java index 497dcd6..45713bf 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicTelephonyJabberImpl.java @@ -685,32 +685,5 @@ public class OperationSetBasicTelephonyJabberImpl { logger.info("session media received "); } - - /** - * Sets the secured state of the call session in which a specific participant - * is involved - * - * @param participant the participant who toggled (or for whom is remotely toggled) - * the secure status change for the call - * @param secured the new secure status - * @param source the source who generated the call change - */ - public void setSecured(CallParticipant participant, boolean secured, - SecureStatusChangeSource source) - { - //TODO - implement security for jabber - } - - /** - * Gets the secured state of the call session in which a specific participant - * is involved - * - * @param participant the participant for who the call state is required - * @return the call state - */ - public boolean isSecured(CallParticipant participant) - { - return false; - } } diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java b/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java index 61e76ae..96b37d3 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java @@ -231,22 +231,4 @@ public class MockOperationSetBasicTelephony fireCallEvent(CallEvent.CALL_ENDED, sourceCall); } } - - /* - * (non-Javadoc) - * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#setSecured(net.java.sip.communicator.service.protocol.CallParticipant, boolean, net.java.sip.communicator.service.media.CallSession.SecureStatusChangeSource) - */ - public void setSecured(CallParticipant participant, boolean secured, - OperationSetBasicTelephony.SecureStatusChangeSource source) - { - } - - /* - * (non-Javadoc) - * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#getSecured(net.java.sip.communicator.service.protocol.CallParticipant) - */ - public boolean isSecured(CallParticipant participant) - { - return false; - } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index 743f85f..81d9a86 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -31,7 +31,8 @@ import net.java.sip.communicator.util.*; public class OperationSetBasicTelephonySipImpl extends AbstractOperationSetBasicTelephony implements MethodProcessor, - OperationSetAdvancedTelephony + OperationSetAdvancedTelephony, + OperationSetSecuredTelephony { private static final Logger logger = Logger.getLogger(OperationSetBasicTelephonySipImpl.class); @@ -2947,7 +2948,7 @@ public class OperationSetBasicTelephonySipImpl /* * (non-Javadoc) - * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#setSecured(net.java.sip.communicator.service.protocol.CallParticipant, boolean, net.java.sip.communicator.service.media.CallSession.SecureStatusChangeSource) + * @see net.java.sip.communicator.service.protocol.OperationSetSecuredTelephony#setSecured(net.java.sip.communicator.service.protocol.CallParticipant, boolean, net.java.sip.communicator.service.protocol.OperationSetSecuredTelephony.SecureStatusChangeSource) */ public void setSecured(CallParticipant participant, boolean secured, SecureStatusChangeSource source) @@ -2958,7 +2959,7 @@ public class OperationSetBasicTelephonySipImpl /* * (non-Javadoc) - * @see net.java.sip.communicator.service.protocol.OperationSetBasicTelephony#getSecured(net.java.sip.communicator.service.protocol.CallParticipant) + * @see net.java.sip.communicator.service.protocol.OperationSetSecuredTelephony#getSecured(net.java.sip.communicator.service.protocol.CallParticipant) */ public boolean isSecured(CallParticipant participant) { diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index eb0820b..148da40 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -683,6 +683,12 @@ public class ProtocolProviderServiceSipImpl OperationSetAdvancedTelephony.class.getName() , opSetAdvancedTelephony); + // init ZRTP (OperationSetBasicTelephonySipImpl implements + // OperationSetSecureTelephony) + this.supportedOperationSets.put( + OperationSetSecuredTelephony.class.getName() + , opSetAdvancedTelephony); + //init presence op set. OperationSetPersistentPresence opSetPersPresence = new OperationSetPresenceSipImpl(this, enablePresence, @@ -713,7 +719,7 @@ public class ProtocolProviderServiceSipImpl OperationSetDTMF opSetDTMF = new OperationSetDTMFSipImpl(this); this.supportedOperationSets.put( OperationSetDTMF.class.getName(), opSetDTMF); - + //initialize our OPTIONS handler ClientCapabilities capabilities = new ClientCapabilities(this); diff --git a/src/net/java/sip/communicator/service/media/CallSession.java b/src/net/java/sip/communicator/service/media/CallSession.java index 163d55b..6346f5b 100644 --- a/src/net/java/sip/communicator/service/media/CallSession.java +++ b/src/net/java/sip/communicator/service/media/CallSession.java @@ -200,7 +200,7 @@ public interface CallSession * @param source the initiator of the secure status change (can be local or remote) */ public void setSecureCommunicationStatus(boolean activator, - OperationSetBasicTelephony. + OperationSetSecuredTelephony. SecureStatusChangeSource source); /** diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java b/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java index 6d0a7d8..c8bba6b 100644 --- a/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java +++ b/src/net/java/sip/communicator/service/protocol/OperationSetBasicTelephony.java @@ -18,7 +18,6 @@ import java.text.*; * * @author Emil Ivov * @author Lubomir Marinov - * @author Emanuel Onica */ public interface OperationSetBasicTelephony extends OperationSet @@ -136,35 +135,4 @@ public interface OperationSetBasicTelephony * <tt>participant</tt>; otherwise, <tt>false</tt> */ public void setMute(CallParticipant participant, boolean mute); - - /** - * Use this to indicate the source of setting the secure status - * of the communication as being the local or remote peer or reverted by local - */ - public static enum SecureStatusChangeSource { - SECURE_STATUS_CHANGE_BY_LOCAL, - SECURE_STATUS_CHANGE_BY_REMOTE, - SECURE_STATUS_REVERTED; - } - - /** - * Sets the secured state of the call session in which a specific participant - * is involved - * - * @param participant the participant who toggled (or for whom is remotely toggled) - * the secure status change for the call - * @param secured the new secure status - * @param source the source who generated the call change - */ - public void setSecured(CallParticipant participant, boolean secured, - SecureStatusChangeSource source); - - /** - * Gets the secured state of the call session in which a specific participant - * is involved - * - * @param participant the participant for who the call state is required - * @return the call state - */ - public boolean isSecured(CallParticipant participant); } diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetSecuredTelephony.java b/src/net/java/sip/communicator/service/protocol/OperationSetSecuredTelephony.java new file mode 100644 index 0000000..faf6033 --- /dev/null +++ b/src/net/java/sip/communicator/service/protocol/OperationSetSecuredTelephony.java @@ -0,0 +1,50 @@ +/* + * 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.service.protocol; + +import net.java.sip.communicator.service.protocol.event.*; + +/** + * An Operation Set defining the encryption operations for telephony. + * + * @author Emanuel Onica + * @author Romain Kuntz + */ +public interface OperationSetSecuredTelephony + extends OperationSet +{ + /** + * Sets the secured state of the call session in which a specific participant + * is involved + * + * @param participant the participant who toggled (or for whom is remotely + * toggled) the secure status change for the call + * @param secured the new secure status + * @param source the source who generated the call change + */ + public void setSecured(CallParticipant participant, boolean secured, + SecureStatusChangeSource source); + + /** + * Gets the secured state of the call session in which a specific participant + * is involved + * + * @param participant the participant for who the call state is required + * @return the call state + */ + public boolean isSecured(CallParticipant participant); + + /** + * Use this to indicate the source of setting the secure status + * of the communication as being the local or remote peer or reverted by local + */ + public static enum SecureStatusChangeSource { + SECURE_STATUS_CHANGE_BY_LOCAL, + SECURE_STATUS_CHANGE_BY_REMOTE, + SECURE_STATUS_REVERTED; + } +} diff --git a/src/net/java/sip/communicator/service/protocol/SecureEvent.java b/src/net/java/sip/communicator/service/protocol/SecureEvent.java index 5ff419d..82b5299 100644 --- a/src/net/java/sip/communicator/service/protocol/SecureEvent.java +++ b/src/net/java/sip/communicator/service/protocol/SecureEvent.java @@ -41,7 +41,7 @@ public class SecureEvent /** * The source that triggered the event - local or remote peer */ - private OperationSetBasicTelephony.SecureStatusChangeSource source; + private OperationSetSecuredTelephony.SecureStatusChangeSource source; /** * The event constructor @@ -51,7 +51,7 @@ public class SecureEvent */ public SecureEvent(CallSessionImpl callSession, int eventID, - OperationSetBasicTelephony.SecureStatusChangeSource source) + OperationSetSecuredTelephony.SecureStatusChangeSource source) { super(callSession); this.eventID = eventID; @@ -72,7 +72,7 @@ public class SecureEvent * Retrieves the source that triggered the event * (change by local peer or remote peer or reverting a previous change) */ - public OperationSetBasicTelephony.SecureStatusChangeSource getSource() + public OperationSetSecuredTelephony.SecureStatusChangeSource getSource() { return source; } |