@ -132,9 +132,12 @@ public class ZrtpSecurityPanel
private ZidToNameThread zidNameDialogThread ;
private String zidString ;
private String zid Property Name;
private String zid NameKey ;
private ConfigurationService configService ;
private String zidPropertyValue ;
private String zidNameValue ;
private String zidAorKey ;
private String zidAorValue ;
private boolean zidAorMismatch = false ;
/ * *
* Creates an instance of < tt > SecurityPanel < / tt > by specifying the
@ -166,10 +169,23 @@ public ZrtpSecurityPanel( CallPeerRenderer peerRenderer,
videoSecurityLabel = createSecurityLabel ( "" , null ) ;
zidString = zrtpControl . getPeerZidString ( ) ;
zidPropertyName = "net.java.sip.communicator.zrtp.ZIDNAME" + zidString ;
zidNameKey = "net.java.sip.communicator.zrtp.ZIDNAME" + zidString ;
zidAorKey = "net.java.sip.communicator.zrtp.ZIDAOR" + zidString ;
configService = GuiActivator . getConfigurationService ( ) ;
zidPropertyValue = configService . getString ( zidPropertyName ) ;
zidNameValue = configService . getString ( zidNameKey ) ;
zidAorValue = configService . getString ( zidAorKey ) ;
if ( zidAorValue ! = null & &
! zidAorValue . equalsIgnoreCase ( callPeer . getAddress ( ) ) )
{
zidAorMismatch = true ;
if ( zidNameDialogThread = = null )
{
zidNameDialogThread = new ZidToNameThread ( ) ;
zidNameDialogThread . start ( ) ;
}
}
loadSkin ( ) ;
}
@ -349,34 +365,36 @@ private void initSasLabels()
compareLabel . setText ( GuiActivator . getResources ( ) . getI18NString (
"service.gui.security.COMPARE_WITH_PARTNER_SHORT" ) ) ;
confirmButton . setText ( GuiActivator . getResources ( ) . getI18NString (
"serv o ce.gui.CONFIRM") ) ;
"serv i ce.gui.CONFIRM") ) ;
zidPropertyValue = null ;
configService . setProperty ( zidPropertyName , zidPropertyValue ) ;
zidNameValue = null ;
zidAorValue = null ;
configService . setProperty ( zidNameKey , zidNameValue ) ;
configService . setProperty ( zidAorKey , zidAorValue ) ;
}
else
{
compareLabel . setText ( GuiActivator . getResources ( ) . getI18NString (
"service.gui.security.STRING_COMPARED" ) ) ;
confirmButton . setText ( GuiActivator . getResources ( ) . getI18NString (
"serv o ce.gui.CLEAR") ) ;
"serv i ce.gui.CLEAR") ) ;
if ( zid Property Value ! = null )
if ( zid Name Value ! = null )
{
/ *
* Reduce length of ZID name to fit the security status label .
* The security status label ' s tooltip contains the full name
* including an explanatory text .
* /
String label = zid Property Value;
if ( zid Property Value. length ( ) > 6 )
String label = zid Name Value;
if ( zid Name Value. length ( ) > 6 )
{
label = zid Property Value. substring ( 0 , 6 ) + "..." ;
label = zid Name Value. substring ( 0 , 6 ) + "..." ;
}
statusLabel = "zrtp - " + label ;
longNamelabel = GuiActivator . getResources ( ) . getI18NString (
"service.gui.ZID_NAME_SET" ) + " '" + zid Property Value + "'" ;
"service.gui.ZID_NAME_SET" ) + " '" + zid Name Value + "'" ;
}
}
@ -678,6 +696,14 @@ public void setSecurityStatusLabel(SecurityStatusLabel ssl)
securityStatusLabel = ssl ;
}
/ * *
* @return the zidAorMismatch
* /
public boolean isZidAorMismatch ( )
{
return zidAorMismatch ;
}
/ * *
* Handle the ZID name dialog in an own thread
* /
@ -691,37 +717,47 @@ public ZidToNameThread()
@Override
public void run ( )
{
String message = GuiActivator . getResources ( ) . getI18NString ( "service.gui.ZID_NAME_SET" ) ;
if ( zidPropertyValue = = null ) // No name for ZID found, ask for a name
String message = zidAorMismatch ?
GuiActivator . getResources ( ) . getI18NString ( "service.gui.ZID_NAME_UNEXPECTED" ) :
GuiActivator . getResources ( ) . getI18NString ( "service.gui.ZID_NAME_SET" ) ;
if ( zidNameValue = = null ) // No name for ZID found, ask for a name
{
message = GuiActivator . getResources ( ) . getI18NString ( "service.gui.ZID_NAME_NOT_SET" ) ;
zidPropertyValue = callPeer . getDisplayName ( ) ;
message =
GuiActivator . getResources ( ) . getI18NString (
"service.gui.ZID_NAME_NOT_SET" ) ;
zidNameValue = callPeer . getDisplayName ( ) ;
}
PopupDialog dialog = GuiActivator . getUIService ( ) . getPopupDialog ( ) ;
String name = ( String ) dialog . showInputPopupDialog ( message ,
GuiActivator . getResources ( ) . getI18NString ( "service.gui.ZID_NAME_DIALOG" ) ,
PopupDialog . INFORMATION_MESSAGE , null , zidPropertyValue ) ;
String name =
( String ) dialog . showInputPopupDialog ( message , GuiActivator
. getResources ( )
. getI18NString ( "service.gui.ZID_NAME_DIALOG" ) ,
PopupDialog . INFORMATION_MESSAGE , null , zidNameValue ) ;
if ( name ! = null )
{
zidPropertyValue = name ;
configService . setProperty ( zidPropertyName , zidPropertyValue ) ;
zidNameValue = name ;
configService . setProperty ( zidNameKey , zidNameValue ) ;
configService . setProperty ( zidAorKey , callPeer . getAddress ( ) ) ;
/ *
* Reduce length of ZID name to fit the security status label .
* Reduce length of ZID name to fit the security status label .
* The security status label ' s tooltip contains the full name
* including an explanatory text .
* including an explanatory text .
* /
String label = zid Property Value;
if ( zid Property Value. length ( ) > 6 )
String label = zid Name Value;
if ( zid Name Value. length ( ) > 6 )
{
label = zid Property Value. substring ( 0 , 6 ) + "..." ;
label = zid Name Value. substring ( 0 , 6 ) + "..." ;
}
securityStatusLabel . setText ( "zrtp - " + label ) ;
securityStatusLabel . setToolTipText ( GuiActivator . getResources ( ) . getI18NString (
"service.gui.ZID_NAME_SET" ) + " '" + zidPropertyValue + "'" ) ;
securityStatusLabel . setToolTipText ( GuiActivator . getResources ( )
. getI18NString ( "service.gui.ZID_NAME_SET" )
+ " '"
+ zidNameValue + "'" ) ;
}
else
else
securityStatusLabel . setText ( "zrtp" ) ;
zidNameDialogThread = null ;