diff --git a/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java b/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java index 11bbd09f4..5cd11ecff 100644 --- a/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java +++ b/src/net/java/sip/communicator/util/call/MetaContactPhoneUtil.java @@ -300,16 +300,37 @@ && hasContactCapabilities(contact, * @return is call enabled for metaContact. */ public boolean isCallEnabled(DetailsResponseListener listener) + { + return isCallEnabled(listener, true); + } + + /** + * Is call enabled for metaContact. If any of the child + * contacts has call enabled. + * @param listener the DetailsResponseListener to listen for result + * details + * @param checkForTelephonyOpSet whether we should check for registered + * telephony operation sets that can be used to dial out, can be used + * in plugins dialing out using methods outside the provider. + * @return is call enabled for metaContact. + */ + public boolean isCallEnabled(DetailsResponseListener listener, + boolean checkForTelephonyOpSet) { // make sure children are checked if(!checkMetaContactPhones(listener)) return false; + boolean hasPhoneCheck = hasPhones; + + if(checkForTelephonyOpSet) + hasPhoneCheck = + hasPhones && AccountUtils.getRegisteredProviders( + OperationSetBasicTelephony.class).size() > 0; + return metaContact.getDefaultContact( OperationSetBasicTelephony.class) != null - || (hasPhones - && AccountUtils.getRegisteredProviders( - OperationSetBasicTelephony.class).size() > 0); + || hasPhoneCheck; } /** @@ -319,7 +340,21 @@ public boolean isCallEnabled(DetailsResponseListener listener) */ public boolean isCallEnabled() { - return isCallEnabled((DetailsResponseListener) null); + return isCallEnabled(null, true); + } + + /** + * Is call enabled for metaContact. If any of the child + * contacts has call enabled. + * @param checkForTelephonyOpSet whether we should check for registered + * telephony operation sets that can be used to dial out, can be used + * in plugins dialing out using methods outside the provider. + * @return is call enabled for metaContact. + */ + public boolean isCallEnabled(boolean checkForTelephonyOpSet) + { + return isCallEnabled(null, + checkForTelephonyOpSet); } /**