|
|
|
|
@ -103,12 +103,8 @@ private void actionPerformed(ActionListener listener, ActionEvent evt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (non-Javadoc)
|
|
|
|
|
*
|
|
|
|
|
* @see net.java.sip.communicator.service.protocol.event.
|
|
|
|
|
* CallChangeAdapter
|
|
|
|
|
* #callStateChanged(net.java.sip.communicator
|
|
|
|
|
* .service.protocol.event.CallChangeEvent)
|
|
|
|
|
* Implements
|
|
|
|
|
* CallChangeAdapter#callStateChanged(CallChangeEvent).
|
|
|
|
|
*/
|
|
|
|
|
public void callStateChanged(CallChangeEvent evt)
|
|
|
|
|
{
|
|
|
|
|
@ -137,18 +133,12 @@ public void callStateChanged(CallChangeEvent evt)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CallPeer targetPeer =
|
|
|
|
|
findCallPeer(target);
|
|
|
|
|
CallPeer targetPeer = findCallPeer(target);
|
|
|
|
|
|
|
|
|
|
if (targetPeer == null)
|
|
|
|
|
{
|
|
|
|
|
telephony.transfer(callPeer, target);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
telephony.transfer(callPeer,
|
|
|
|
|
targetPeer);
|
|
|
|
|
}
|
|
|
|
|
telephony.transfer(callPeer, targetPeer);
|
|
|
|
|
}
|
|
|
|
|
catch (OperationFailedException ex)
|
|
|
|
|
{
|
|
|
|
|
@ -161,36 +151,31 @@ public void callStateChanged(CallChangeEvent evt)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the first <code>CallPeer</code> known to a specific
|
|
|
|
|
* <code>OperationSetBasicTelephony</code> to have a specific address.
|
|
|
|
|
* Returns the first <tt>CallPeer</tt> known to a specific
|
|
|
|
|
* <tt>OperationSetBasicTelephony</tt> to have a specific address.
|
|
|
|
|
*
|
|
|
|
|
* @param telephony the <code>OperationSetBasicTelephony</code> to have its
|
|
|
|
|
* <code>CallPeer</code>s examined in search for one which
|
|
|
|
|
* has a specific address
|
|
|
|
|
* @param address the address to locate the associated
|
|
|
|
|
* <code>CallPeer</code> of
|
|
|
|
|
* @param telephony the <tt>OperationSetBasicTelephony</tt> to have its
|
|
|
|
|
* <tt>CallPeer</tt>s examined in search for one which has a specific
|
|
|
|
|
* address
|
|
|
|
|
* @param address the address to locate the associated <tt>CallPeer</tt> of
|
|
|
|
|
* @return the first <tt>CallPeer</tt> known to the specified
|
|
|
|
|
* <tt>OperationSetBasicTelephony</tt> to have the specified address
|
|
|
|
|
*/
|
|
|
|
|
@SuppressWarnings("unchecked") //pfff ... well we can't make OpSetTelephony
|
|
|
|
|
//return a non-raw type iterator as it would break descendants that are using
|
|
|
|
|
//it with Call extensions. Someone would have to explain to me one day
|
|
|
|
|
//why java complains in such cases.
|
|
|
|
|
private CallPeer findCallPeer(
|
|
|
|
|
OperationSetBasicTelephony telephony, String address)
|
|
|
|
|
{
|
|
|
|
|
for (Iterator<Call> callIter = telephony.getActiveCalls();
|
|
|
|
|
callIter.hasNext();)
|
|
|
|
|
for (Iterator<? extends Call> callIter = telephony.getActiveCalls();
|
|
|
|
|
callIter.hasNext();)
|
|
|
|
|
{
|
|
|
|
|
Call call = callIter.next();
|
|
|
|
|
|
|
|
|
|
for (Iterator<CallPeer> peerIter =
|
|
|
|
|
call.getCallPeers(); peerIter.hasNext();)
|
|
|
|
|
for (Iterator<CallPeer> peerIter = call.getCallPeers();
|
|
|
|
|
peerIter.hasNext();)
|
|
|
|
|
{
|
|
|
|
|
CallPeer peer = peerIter.next();
|
|
|
|
|
|
|
|
|
|
if (address.equals(peer.getAddress()))
|
|
|
|
|
{
|
|
|
|
|
return peer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
@ -239,9 +224,7 @@ private CallPeer findCallPeer(String address)
|
|
|
|
|
{
|
|
|
|
|
peer = findCallPeer(telephony, address);
|
|
|
|
|
if (peer != null)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return peer;
|
|
|
|
|
@ -254,12 +237,12 @@ private CallPeer findCallPeer(String address)
|
|
|
|
|
* The located <code>Frame</code> (if any) is often used as the owner of
|
|
|
|
|
* <code>Dialog</code>s opened by the specified <code>Component</code> in
|
|
|
|
|
* order to provide natural <code>Frame</code> ownership.
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param component the <tt>Component</tt> which is to have its
|
|
|
|
|
* <tt>Component</tt> hierarchy examined for <tt>Frame</tt>
|
|
|
|
|
* @return the first <code>Frame</code> in the ancestor
|
|
|
|
|
* <code>Component</code> hierarchy of the specified
|
|
|
|
|
* <code>Component</code>; <tt>null</tt>, if no such
|
|
|
|
|
* <code>Frame</code> was located
|
|
|
|
|
* <code>Component</code> hierarchy of the specified <code>Component</code>;
|
|
|
|
|
* <tt>null</tt>, if no such <code>Frame</code> was located
|
|
|
|
|
*/
|
|
|
|
|
public static Frame getFrame(Component component)
|
|
|
|
|
{
|
|
|
|
|
@ -268,9 +251,8 @@ public static Frame getFrame(Component component)
|
|
|
|
|
Container container = component.getParent();
|
|
|
|
|
|
|
|
|
|
if (container instanceof Frame)
|
|
|
|
|
{
|
|
|
|
|
return (Frame) container;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component = container;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
|