diff --git a/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java b/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java
index 831b3724d..942651d66 100644
--- a/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java
+++ b/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java
@@ -21,6 +21,7 @@
import net.java.sip.communicator.service.protocol.yahooconstants.*;
import net.java.sip.communicator.util.*;
+import org.jitsi.service.configuration.*;
import org.jitsi.util.xml.*;
import org.osgi.framework.*;
import org.w3c.dom.*;
@@ -84,6 +85,28 @@ public class Messenger
*/
static final int MPHONE_TYPE_WORK = 1;
+ /**
+ * The name of the boolean ConfigurationService property which
+ * indicates whether {@link #startConversation(int, String[], String)} is
+ * to invoke {@link UIService#createCall(String[])} with a phone number
+ * associated with a specific IMessengerContact instead of the
+ * Contact address.
+ */
+ private static final String PNAME_CREATE_CALL_BY_PHONE_NUMBER
+ = "net.java.sip.communicator.plugin.msofficecomm."
+ + "CREATE_CALL_BY_PHONE_NUMBER";
+
+ /**
+ * The name of the String ConfigurationService property
+ * which specifies the sort order of the MPHONE_TYPE_* enumerated
+ * type values. The default value orders them as follows:
+ * {@link #MPHONE_TYPE_WORK}, {@link #MPHONE_TYPE_HOME},
+ * {@link #MPHONE_TYPE_MOBILE}, {@link #MPHONE_TYPE_CUSTOM}.
+ */
+ private static final String PNAME_MPHONE_TYPE_SORT_ORDER
+ = "net.java.sip.communicator.plugin.msofficecomm."
+ + "MPHONE_TYPE_SORT_ORDER";
+
/**
* The BundleContext in which the msofficecomm bundle has
* been started.
@@ -97,6 +120,19 @@ public class Messenger
*/
private static MetaContactListService metaContactListService;
+ /**
+ * The MPHONE_TYPE_* enumerated type values indexed by their sort
+ * order position.
+ */
+ private static final int[] MPHONE_TYPE_SORT_ORDER
+ = new int[]
+ {
+ MPHONE_TYPE_WORK,
+ MPHONE_TYPE_HOME,
+ MPHONE_TYPE_MOBILE,
+ MPHONE_TYPE_CUSTOM
+ };
+
/**
* The list of (local) accounts by sign-in name which correspond to
* IMessengerContact implementations having true as the
@@ -338,17 +374,10 @@ else if (phoneNumber instanceof WorkPhoneDetail)
*/
private static int getMPHONE_TYPESortOrder(int mphonetype)
{
- switch (mphonetype)
- {
- case MPHONE_TYPE_HOME:
- return 1;
- case MPHONE_TYPE_MOBILE:
- return 2;
- case MPHONE_TYPE_WORK:
- return 0;
- default:
- return 3;
- }
+ for (int i = 0; i < MPHONE_TYPE_SORT_ORDER.length; i++)
+ if (MPHONE_TYPE_SORT_ORDER[i] == mphonetype)
+ return i;
+ return MPHONE_TYPE_SORT_ORDER.length;
}
/**
@@ -783,6 +812,13 @@ public void startConversation(
}
List contactList = new ArrayList();
+ ConfigurationService cfg
+ = ServiceUtils.getService(
+ bundleContext,
+ ConfigurationService.class);
+ boolean createCallByPhoneNumber
+ = (cfg != null)
+ && cfg.getBoolean(PNAME_CREATE_CALL_BY_PHONE_NUMBER, false);
for (String participant : participants)
{
@@ -796,35 +832,49 @@ public void startConversation(
}
else if (opSetClass.equals(OperationSetBasicTelephony.class))
{
-// Set participantPhoneNumbers
-// = findPhoneNumbersBySigninName(participant, 1);
-//
-// if (participantPhoneNumbers.size() > 0)
-// {
-// contactList.add(
-// participantPhoneNumbers.iterator().next()
-// .getNumber());
-// }
-
/*
- * There is no Contact for the specified participant which
- * supports OperationSetBasicTelephony. Try without the support
- * restriction.
+ * The boolean ConfigurationService property
+ * PNAME_CREATE_CALL_BY_PHONE_NUMBER enables instructing whether
+ * a sign-in name which does not resolve to a Contact with
+ * support for OperationSetBasicTelephony is to be resolved to
+ * a phone number (via an associated vCard).
*/
- participantContacts
- = findContactsBySigninName(participant, null, 1);
- if (participantContacts.size() > 0)
+ if (createCallByPhoneNumber)
{
- contactList.add(
- getSigninName(participantContacts.get(0), null));
+ Set participantPhoneNumbers
+ = findPhoneNumbersBySigninName(participant, 1);
+
+ if (participantPhoneNumbers.size() > 0)
+ {
+ contactList.add(
+ participantPhoneNumbers.iterator().next()
+ .getNumber());
+ }
}
else
{
/*
- * Well, just try to start a conversation with the
- * unresolved contact.
+ * There is no Contact for the specified participant which
+ * supports OperationSetBasicTelephony. Try without the
+ * support restriction.
*/
- contactList.add(participant);
+ participantContacts
+ = findContactsBySigninName(participant, null, 1);
+ if (participantContacts.size() > 0)
+ {
+ contactList.add(
+ getSigninName(
+ participantContacts.get(0),
+ null));
+ }
+ else
+ {
+ /*
+ * Well, just try to start a conversation with the
+ * unresolved contact.
+ */
+ contactList.add(participant);
+ }
}
}
}
diff --git a/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf b/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf
index 2e8b5042d..427d70479 100644
--- a/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf
@@ -12,5 +12,6 @@ Import-Package: javax.swing,
net.java.sip.communicator.service.protocol.msnconstants,
net.java.sip.communicator.service.protocol.yahooconstants,
net.java.sip.communicator.util,
+ org.jitsi.service.configuration,
org.jitsi.util,
org.osgi.framework