From a9c65e9cd3b508baa050db62a86b018fd981ea3e Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Wed, 8 May 2013 10:48:03 +0300 Subject: [PATCH] Adds additional utility methods. --- .../util/call/MetaContactPhoneUtil.java | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) 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); } /**