Merge pull request #68 from jitsi/clean-gtalk-stuff

Clean gtalk stuff
deb-src-release-2.8.5426 5414
bgrozev 11 years ago
commit ca15560d44

@ -12,6 +12,7 @@
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.jabber.*;
import net.java.sip.communicator.service.protocol.media.*;
import net.java.sip.communicator.util.*;
@ -344,7 +345,7 @@ else if(calleeAddress.endsWith(GOOGLE_VOICE_DOMAIN))
}
String bypassDomain = accountID.getAccountPropertyString(
"TELEPHONY_BYPASS_GTALK_CAPS");
JabberAccountID.TELEPHONY_BYPASS_GTALK_CAPS);
boolean alwaysCallGtalk
= ((bypassDomain != null)
@ -373,7 +374,7 @@ else if(calleeAddress.endsWith(GOOGLE_VOICE_DOMAIN))
// connected one with highest priority.
if (fullCalleeURI == null)
fullCalleeURI =
discoverFullJid(calleeAddress, alwaysCallGtalk);
discoverFullJid(calleeAddress);
if (fullCalleeURI == null)
throw new OperationFailedException(
@ -465,18 +466,14 @@ else if(calleeAddress.endsWith(GOOGLE_VOICE_DOMAIN))
* priority which supports either Jingle or Gtalk. Returns the full JID.
*
* @param calleeAddress the address of the callee
* @param isAlwaysCallGtalk indicates if gtalk should be called
*
* @return the full callee URI
*/
private String discoverFullJid( String calleeAddress,
boolean isAlwaysCallGtalk)
private String discoverFullJid(String calleeAddress)
{
String fullCalleeURI = null;
DiscoverInfo discoverInfo = null;
int bestPriority = -1;
boolean isGingle = false;
String gingleURI = null;
PresenceStatus jabberStatus = null;
String calleeURI = null;
@ -505,11 +502,6 @@ private String discoverFullJid( String calleeAddress,
logger.warn("could not retrieve info for " + fullCalleeURI, ex);
}
boolean hasGtalkCaps =
getProtocolProvider().isExtFeatureListSupported(
calleeURI, ProtocolProviderServiceJabberImpl.
CAPS_GTALK_WEB_VOICE);
if (discoverInfo != null && discoverInfo.containsFeature(
ProtocolProviderServiceJabberImpl.URN_XMPP_JINGLE))
{
@ -517,7 +509,6 @@ private String discoverFullJid( String calleeAddress,
{
bestPriority = priority;
fullCalleeURI = calleeURI;
isGingle = false;
jabberStatus = OperationSetPersistentPresenceJabberImpl
.jabberStatusToPresenceStatus(
presence, protocolProvider);
@ -531,45 +522,12 @@ else if(priority == bestPriority && jabberStatus != null)
if(tempStatus.compareTo(jabberStatus) > 0)
{
fullCalleeURI = calleeURI;
isGingle = false;
jabberStatus = tempStatus;
}
}
}
else if (protocolProvider.isGTalkTesting() // GTalk enabled locally
// see if peer supports Google Talk voice
&& (hasGtalkCaps || isAlwaysCallGtalk))
{
if(priority > bestPriority)
{
bestPriority = priority;
isGingle = true;
gingleURI = calleeURI;
jabberStatus =OperationSetPersistentPresenceJabberImpl
.jabberStatusToPresenceStatus( presence,
protocolProvider);
}
else if(priority == bestPriority && jabberStatus != null)
{
PresenceStatus tempStatus =
OperationSetPersistentPresenceJabberImpl
.jabberStatusToPresenceStatus(
presence, protocolProvider);
if(tempStatus.compareTo(jabberStatus) > 0)
{
isGingle = true;
gingleURI = calleeURI;
jabberStatus =OperationSetPersistentPresenceJabberImpl
.jabberStatusToPresenceStatus(
presence, protocolProvider);
}
}
}
}
if(isGingle)
fullCalleeURI = gingleURI;
if(logger.isInfoEnabled())
logger.info("Full JID for outgoing call: " + fullCalleeURI
+ ", priority " + bestPriority);

@ -58,16 +58,6 @@ public class OperationSetContactCapabilitiesJabberImpl
OPERATION_SETS_TO_FEATURES
= new HashMap<Class<? extends OperationSet>, String[]>();
/**
* The <tt>Map</tt> which associates specific additional
* <tt>OperationSet</tt> class with the capabilities to be supported by a
* <tt>Contact</tt> in order to consider the <tt>Contact</tt> to possess the
* respective <tt>OperationSet</tt> capability.
*/
private static final Map<Class<? extends OperationSet>, String[]>
CAPS_OPERATION_SETS_TO_FEATURES
= new HashMap<Class<? extends OperationSet>, String[]>();
static
{
OFFLINE_OPERATION_SETS.add(OperationSetBasicInstantMessaging.class);
@ -107,21 +97,6 @@ public class OperationSetContactCapabilitiesJabberImpl
{
MessageCorrectionExtension.NAMESPACE
});
CAPS_OPERATION_SETS_TO_FEATURES.put(
OperationSetBasicTelephony.class,
new String[]
{
ProtocolProviderServiceJabberImpl.CAPS_GTALK_WEB_VOICE,
});
CAPS_OPERATION_SETS_TO_FEATURES.put(
OperationSetVideoTelephony.class,
new String[]
{
ProtocolProviderServiceJabberImpl.CAPS_GTALK_WEB_VOICE,
ProtocolProviderServiceJabberImpl.CAPS_GTALK_WEB_VIDEO
});
}
/**
@ -353,30 +328,7 @@ private <U extends OperationSet> U getOperationSet(String jid,
jid,
features)))
{
if(CAPS_OPERATION_SETS_TO_FEATURES.containsKey(opsetClass))
{
String[] extFeatures
= CAPS_OPERATION_SETS_TO_FEATURES.get(opsetClass);
// test GTalk
if (!parentProvider.isGTalkTesting())
{
opset = null;
}
else if((extFeatures == null)
|| ((extFeatures.length != 0)
&& !parentProvider
.isExtFeatureListSupported(
jid,
extFeatures)))
{
opset = null;
}
}
else
{
opset = null;
}
opset = null;
}
}

@ -17,7 +17,6 @@
import net.java.sip.communicator.impl.protocol.jabber.debugger.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.caps.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.carbon.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.coin.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.colibri.*;
@ -148,41 +147,6 @@ public class ProtocolProviderServiceJabberImpl
public static final String URN_XMPP_JINGLE_RTP_HDREXT =
"urn:xmpp:jingle:apps:rtp:rtp-hdrext:0";
/**
* Capabilities name for audio call in Google Talk web version.
*/
public static final String CAPS_GTALK_WEB_VOICE = "voice-v1";
/**
* Capabilities name for video call (receive side) in Google Talk web
* version.
*/
public static final String CAPS_GTALK_WEB_VIDEO = "video-v1";
/**
* Capabilities name for video call (sender side) in Google Talk web
* version.
*/
public static final String CAPS_GTALK_WEB_CAMERA = "camera-v1";
/**
* URN for Google voice.
*/
public static final String URN_GOOGLE_VOICE =
"http://www.google.com/xmpp/protocol/voice/v1";
/**
* URN for Google camera.
*/
public static final String URN_GOOGLE_CAMERA =
"http://www.google.com/xmpp/protocol/camera/v1";
/**
* URN for Google video.
*/
public static final String URN_GOOGLE_VIDEO =
"http://www.google.com/xmpp/protocol/video/v1";
/**
* URN for XEP-0077 inband registration
*/
@ -1418,29 +1382,6 @@ private void registerServiceDiscoveryManager()
supportedFeatures.toArray(
new String[supportedFeatures.size()]));
boolean isCallingDisabled
= JabberActivator.getConfigurationService()
.getBoolean(IS_CALLING_DISABLED, false);
boolean isCallingDisabledForAccount = false;
if (accountID != null && accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_CALLING_DISABLED_FOR_ACCOUNT,
false))
isCallingDisabled = true;
if(isGTalkTesting()
&& !isCallingDisabled
&& !isCallingDisabledForAccount)
{
// Add Google Talk "ext" capabilities
discoveryManager.addExtFeature(CAPS_GTALK_WEB_VOICE);
discoveryManager.addExtFeature(CAPS_GTALK_WEB_VIDEO);
discoveryManager.addExtFeature(CAPS_GTALK_WEB_CAMERA);
discoveryManager.addFeature(URN_GOOGLE_VOICE);
discoveryManager.addFeature(URN_GOOGLE_VIDEO);
discoveryManager.addFeature(URN_GOOGLE_CAMERA);
}
/*
* Expose the discoveryManager as service-public through the
* OperationSetContactCapabilities of this ProtocolProviderService.
@ -2373,61 +2314,6 @@ JabberStatusEnum getJabberStatusEnum()
return jabberStatusEnum;
}
/**
* Determines if the given list of <tt>ext features</tt> is supported by the
* specified jabber id.
*
* @param jid the jabber id for which to check
* @param extFeatures the list of ext features to check for
*
* @return <tt>true</tt> if the list of ext features is supported;
* otherwise, <tt>false</tt>
*/
public boolean isExtFeatureListSupported(String jid, String... extFeatures)
{
EntityCapsManager capsManager = discoveryManager.getCapsManager();
EntityCapsManager.Caps caps = capsManager.getCapsByUser(jid);
String bypassDomain = accountID.getAccountPropertyString(
"TELEPHONY_BYPASS_GTALK_CAPS");
String domain = StringUtils.parseServer(jid);
boolean domainEquals = domain.equals(bypassDomain);
if(caps != null && caps.ext != null)
{
String exts[] = caps.ext.split(" ");
boolean found = false;
for(String extFeature : extFeatures)
{
// in case we have a domain that have to bypass GTalk caps
if(extFeature.equals(CAPS_GTALK_WEB_VOICE) && domainEquals)
{
return true;
}
found = false;
for(String ext : exts)
{
if(ext.equals(extFeature))
{
found = true;
break;
}
}
if(!found)
{
break;
}
}
return found;
}
return false;
}
/**
* Determines if the given list of <tt>features</tt> is supported by the
* specified jabber id.
@ -2799,24 +2685,6 @@ public SecurityAuthority getAuthority()
return authority;
}
/**
* Returns true if gtalktesting is enabled, false otherwise.
*
* @return true if gtalktesting is enabled, false otherwise.
*/
public boolean isGTalkTesting()
{
return
Boolean.getBoolean("gtalktesting")
|| JabberActivator.getConfigurationService().getBoolean(
"net.java.sip.communicator.impl.protocol.jabber"
+ ".gtalktesting",
false)
|| accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_USE_GOOGLE_ICE,
true);
}
UserCredentials getUserCredentials()
{
return userCredentials;

@ -39,12 +39,6 @@ public class IceConfigPanel
private final JCheckBox iceBox = new SIPCommCheckBox(
Resources.getString("plugin.jabberaccregwizz.USE_ICE"));
/**
* The check box allowing the user to choose to use ICE.
*/
private final JCheckBox googleIceBox = new SIPCommCheckBox(
Resources.getString("plugin.jabberaccregwizz.USE_GOOGLE_ICE"));
/**
* The check box allowing the user to choose to automatically discover
* STUN servers.
@ -110,7 +104,6 @@ public IceConfigPanel()
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
iceBox.setAlignmentX(Component.LEFT_ALIGNMENT);
googleIceBox.setAlignmentX(Component.LEFT_ALIGNMENT);
autoDiscoverBox.setAlignmentX(Component.LEFT_ALIGNMENT);
defaultStunBox.setAlignmentX(Component.LEFT_ALIGNMENT);
@ -122,7 +115,6 @@ public IceConfigPanel()
autoDiscoverBox.setSelected(true);
defaultStunBox.setSelected(true);
googleIceBox.setSelected(true);
jnBox.setSelected(true);
jnAutoDiscoverBox.setSelected(true);
@ -131,7 +123,6 @@ public IceConfigPanel()
JPanel checkBoxPanel = new TransparentPanel(new GridLayout(0, 1));
checkBoxPanel.add(iceBox);
checkBoxPanel.add(googleIceBox);
checkBoxPanel.add(upnpBox);
checkBoxPanel.add(autoDiscoverBox);
checkBoxPanel.add(defaultStunBox);
@ -763,26 +754,6 @@ protected void setUseIce(boolean isUseIce)
iceBox.setSelected(isUseIce);
}
/**
* Indicates if ice should be used for this account.
* @return <tt>true</tt> if Google ICE should be used for this account,
* otherwise returns <tt>false</tt>
*/
protected boolean isUseGoogleIce()
{
return googleIceBox.isSelected();
}
/**
* Sets the <tt>useGoogleIce</tt> property.
* @param isUseIce <tt>true</tt> to indicate that Google ICE should be used
* for this account, <tt>false</tt> - otherwise.
*/
protected void setUseGoogleIce(boolean isUseIce)
{
googleIceBox.setSelected(isUseIce);
}
/**
* Indicates if the stun server should be automatically discovered.
* @return <tt>true</tt> if the stun server should be automatically

@ -322,7 +322,6 @@ public boolean commitPage(JabberAccountRegistration registration)
securityPanel.commitPanel(registration.getSecurityRegistration());
registration.setUseIce(iceConfigPanel.isUseIce());
registration.setUseGoogleIce(iceConfigPanel.isUseGoogleIce());
registration.setAutoDiscoverStun(iceConfigPanel.isAutoDiscoverStun());
registration.setUseDefaultStunServer(
iceConfigPanel.isUseDefaultStunServer());
@ -417,8 +416,6 @@ public void loadAccount(JabberAccountRegistration accountReg)
iceConfigPanel.setUseIce(accountReg.isUseIce());
iceConfigPanel.setUseGoogleIce(accountReg.isUseGoogleIce());
iceConfigPanel.setAutoDiscoverStun(accountReg.isAutoDiscoverStun());
iceConfigPanel.setUseDefaultStunServer(

@ -338,11 +338,6 @@ public abstract class ProtocolProviderFactory
*/
public static final String IS_USE_ICE = "ICE_ENABLED";
/**
* Indicates if Google ICE should be used.
*/
public static final String IS_USE_GOOGLE_ICE = "GTALK_ICE_ENABLED";
/**
* Indicates if STUN server should be automatically discovered.
*/

@ -350,28 +350,6 @@ public void setUseIce(boolean isUseIce)
putAccountProperty(ProtocolProviderFactory.IS_USE_ICE, isUseIce);
}
/**
* Indicates if ice should be used for this account.
* @return <tt>true</tt> if ICE should be used for this account, otherwise
* returns <tt>false</tt>
*/
public boolean isUseGoogleIce()
{
return getAccountPropertyBoolean(
ProtocolProviderFactory.IS_USE_GOOGLE_ICE, true);
}
/**
* Sets the <tt>useGoogleIce</tt> property.
* @param isUseIce <tt>true</tt> to indicate that ICE should be used for
* this account, <tt>false</tt> - otherwise.
*/
public void setUseGoogleIce(boolean isUseIce)
{
putAccountProperty(
ProtocolProviderFactory.IS_USE_GOOGLE_ICE, isUseIce);
}
/**
* Indicates if the stun server should be automatically discovered.
* @return <tt>true</tt> if the stun server should be automatically

Loading…
Cancel
Save