Exemple #1
0
        internal static void RemoveProxy(ADRecipient recipient, ProxyAddressCollection collection, ProxyAddressPrefix prefix, ArrayList phoneNumbers, UMDialPlan dialPlan)
        {
            Hashtable hashtable = new Hashtable();

            foreach (object obj in phoneNumbers)
            {
                string extension = (string)obj;
                hashtable.Add(UMMailbox.BuildAddressStringFromExtensionAndPhoneContext(extension, dialPlan.PhoneContext), true);
            }
            UMMailbox.RemoveProxy(recipient, collection, prefix, hashtable);
        }
Exemple #2
0
        internal static void ClearProxy(ADRecipient recipient, ProxyAddressCollection targetAddresses, ProxyAddressPrefix targetPrefix, Hashtable safeTable)
        {
            Hashtable hashtable = new Hashtable();

            foreach (ProxyAddress proxyAddress in targetAddresses)
            {
                if (proxyAddress.Prefix == targetPrefix && (safeTable == null || !safeTable.ContainsKey(proxyAddress.AddressString)))
                {
                    hashtable.Add(proxyAddress.AddressString, true);
                }
            }
            UMMailbox.RemoveProxy(recipient, targetAddresses, targetPrefix, hashtable);
        }
Exemple #3
0
 internal static bool PhoneNumberExists(ProxyAddressCollection addresses, ProxyAddressPrefix prefix, string phoneNumber)
 {
     foreach (ProxyAddress proxyAddress in addresses)
     {
         if (proxyAddress.Prefix == prefix)
         {
             string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
             if (extensionFromProxyAddress.Equals(phoneNumber))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #4
0
 internal static string GetPrimaryExtension(ProxyAddressCollection emailAddresses, ProxyAddressPrefix prefix)
 {
     foreach (ProxyAddress proxyAddress in emailAddresses)
     {
         if (proxyAddress.IsPrimaryAddress && proxyAddress.Prefix == prefix)
         {
             string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
             if (extensionFromProxyAddress != null)
             {
                 return(extensionFromProxyAddress);
             }
         }
     }
     return(null);
 }
Exemple #5
0
        internal string GetEUMPhoneNumber(UMDialPlan dialPlan)
        {
            Hashtable airSyncSafeTable = UMMailbox.GetAirSyncSafeTable(this.UMAddresses, ProxyAddressPrefix.ASUM, dialPlan);

            foreach (ProxyAddress proxyAddress in this.EmailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (phoneContextFromProxyAddress == dialPlan.PhoneContext && UMMailbox.IsProxyAddressLocalExtension(proxyAddress) && !airSyncSafeTable.ContainsKey(proxyAddress.AddressString))
                    {
                        return(UMMailbox.GetExtensionFromProxyAddress(proxyAddress));
                    }
                }
            }
            return(null);
        }
Exemple #6
0
        internal static MultiValuedProperty <string> GetExtensionsFromCollection(ProxyAddressCollection addresses, ProxyAddressPrefix prefix, string phoneContext)
        {
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            foreach (ProxyAddress proxyAddress in addresses)
            {
                if (proxyAddress.Prefix == prefix && (phoneContext == null || proxyAddress.AddressString.EndsWith(phoneContext)))
                {
                    string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
                    if (extensionFromProxyAddress != null)
                    {
                        multiValuedProperty.Add(extensionFromProxyAddress);
                    }
                }
            }
            return(multiValuedProperty);
        }
Exemple #7
0
        internal static List <string> GetDialPlanPhoneContexts(ProxyAddressCollection proxyAddresses, bool excludePrimaryContext)
        {
            if (proxyAddresses == null)
            {
                throw new ArgumentNullException("proxyAddresses");
            }
            List <string> list = new List <string>();

            foreach (ProxyAddress proxyAddress in proxyAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM && (!proxyAddress.IsPrimaryAddress || !excludePrimaryContext))
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (phoneContextFromProxyAddress != null)
                    {
                        list.Add(phoneContextFromProxyAddress);
                    }
                }
            }
            return(list);
        }
Exemple #8
0
        internal static bool ContainsMoreThanOneDialplan(ProxyAddressCollection emailAddresses)
        {
            string text = null;

            foreach (ProxyAddress proxyAddress in emailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    string phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                    if (text == null)
                    {
                        text = phoneContextFromProxyAddress;
                    }
                    else if (string.Compare(phoneContextFromProxyAddress, text, StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #9
0
 internal static bool ExtractExtensionInformation(ProxyAddress address, out string extension, out string phoneContext, out string dialplanDisplayName)
 {
     if (address == null)
     {
         throw new ArgumentException("address");
     }
     extension           = null;
     phoneContext        = null;
     dialplanDisplayName = null;
     if (address.Prefix == ProxyAddressPrefix.UM)
     {
         extension           = UMMailbox.GetExtensionFromProxyAddress(address);
         phoneContext        = UMMailbox.GetPhoneContextFromProxyAddress(address);
         dialplanDisplayName = null;
         if (phoneContext != null)
         {
             dialplanDisplayName = phoneContext.Split(new char[]
             {
                 '.'
             })[0];
         }
     }
     return(extension != null && phoneContext != null && dialplanDisplayName != null);
 }
Exemple #10
0
        internal static MultiValuedProperty <string> GetExtensionsFromEmailAddresses(ProxyAddressCollection emailAddresses)
        {
            List <string> list = new List <string>();
            bool          flag = UMMailbox.ContainsMoreThanOneDialplan(emailAddresses);

            foreach (ProxyAddress proxyAddress in emailAddresses)
            {
                if (proxyAddress.Prefix == ProxyAddressPrefix.UM)
                {
                    int num = proxyAddress.AddressString.IndexOf(";");
                    if (num != -1)
                    {
                        if (flag)
                        {
                            string        phoneContextFromProxyAddress = UMMailbox.GetPhoneContextFromProxyAddress(proxyAddress);
                            string        extensionFromProxyAddress    = UMMailbox.GetExtensionFromProxyAddress(proxyAddress);
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.AppendFormat("{0} ({1})", extensionFromProxyAddress, phoneContextFromProxyAddress);
                            list.Add(stringBuilder.ToString());
                        }
                        else
                        {
                            list.Add(UMMailbox.GetExtensionFromProxyAddress(proxyAddress));
                        }
                    }
                }
            }
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            multiValuedProperty.CopyChangesOnly = true;
            foreach (string item in list)
            {
                multiValuedProperty.Add(item);
            }
            return(multiValuedProperty);
        }
Exemple #11
0
        private static bool IsProxyAddressLocalExtension(ProxyAddress emailAddress)
        {
            string extensionFromProxyAddress = UMMailbox.GetExtensionFromProxyAddress(emailAddress);

            return(extensionFromProxyAddress != null && !Regex.IsMatch(extensionFromProxyAddress, "[^0-9]"));
        }
Exemple #12
0
 internal static ProxyAddress BuildProxyAddressFromExtensionAndPhoneContext(string extension, string prefixString, string phoneContext)
 {
     return(ProxyAddress.Parse(prefixString, UMMailbox.BuildAddressStringFromExtensionAndPhoneContext(extension, phoneContext)));
 }
Exemple #13
0
        internal static void AddProxy(ADRecipient recipient, ProxyAddressCollection addresses, string extension, UMDialPlan dialPlan, ProxyAddressPrefix prefix)
        {
            string prefixString = (null == UMMailbox.GetPrimaryExtension(addresses, prefix)) ? prefix.PrimaryPrefix : prefix.SecondaryPrefix;

            addresses.Add(UMMailbox.BuildProxyAddressFromExtensionAndPhoneContext(extension, prefixString, dialPlan.PhoneContext));
        }
Exemple #14
0
        internal static MultiValuedProperty <string> ExtensionsGetter(IPropertyBag propertyBag)
        {
            ProxyAddressCollection emailAddresses = (ProxyAddressCollection)propertyBag[ADRecipientSchema.EmailAddresses];

            return(UMMailbox.GetExtensionsFromEmailAddresses(emailAddresses));
        }