Пример #1
0
        public MailException AddAddresses(List <dtoRecipient> recipients, RecipientType recipientType)
        {
            try
            {
                switch (recipientType)
                {
                case RecipientType.To:
                    recipients.Where(r => String.IsNullOrEmpty(r.DisplayName)).ToList().ForEach(r => To.Add(new MailAddress(r.MailAddress)));
                    recipients.Where(r => !String.IsNullOrEmpty(r.DisplayName)).ToList().ForEach(r => To.Add(new MailAddress(r.MailAddress, r.DisplayName)));
                    break;

                case RecipientType.CC:
                    recipients.Where(r => String.IsNullOrEmpty(r.DisplayName)).ToList().ForEach(r => CC.Add(new MailAddress(r.MailAddress)));
                    recipients.Where(r => !String.IsNullOrEmpty(r.DisplayName)).ToList().ForEach(r => CC.Add(new MailAddress(r.MailAddress, r.DisplayName)));
                    break;

                case RecipientType.BCC:
                    recipients.Where(r => String.IsNullOrEmpty(r.DisplayName)).ToList().ForEach(r => BCC.Add(new MailAddress(r.MailAddress)));
                    recipients.Where(r => !String.IsNullOrEmpty(r.DisplayName)).ToList().ForEach(r => BCC.Add(new MailAddress(r.MailAddress, r.DisplayName)));
                    break;
                }
                return(MailException.None);
            }
            catch (Exception ex)
            {
                return(MailException.InvalidAddress);
            }
        }
Пример #2
0
        private DirectoryObjectClass GetMsoObjectClassForRecipient(RecipientType recipientType, RecipientTypeDetails recipientTypeDetails)
        {
            switch (recipientType)
            {
            case RecipientType.User:
            case RecipientType.UserMailbox:
            case RecipientType.MailUser:
                if ((recipientTypeDetails & RecipientTypeDetails.GroupMailbox) != RecipientTypeDetails.None)
                {
                    return(DirectoryObjectClass.Group);
                }
                return(DirectoryObjectClass.User);

            case RecipientType.Contact:
            case RecipientType.MailContact:
                return(DirectoryObjectClass.Contact);

            case RecipientType.Group:
            case RecipientType.MailUniversalDistributionGroup:
            case RecipientType.MailUniversalSecurityGroup:
            case RecipientType.MailNonUniversalGroup:
                return(DirectoryObjectClass.Group);

            default:
                return(DirectoryObjectClass.Company);
            }
        }
Пример #3
0
        // Token: 0x0600112F RID: 4399 RVA: 0x00063E70 File Offset: 0x00062070
        private GrammarGeneratorTaskContext InitializeTask(RecipientType recipientType, DirectoryProcessorBaseTaskContext context)
        {
            base.Logger.TraceDebug(this, "Entering GrammarGenerator.InitializeTask recipientType='{0}'", new object[]
            {
                recipientType
            });
            UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_GrammarGenerationStarted, null, new object[]
            {
                base.TenantId,
                base.RunId,
                recipientType.ToString()
            });
            GrammarFileDistributionShare.CreateDirectoryProcessorFolder();
            IGrammarGeneratorInterface grammarGeneratorInstance = null;

            if (recipientType != RecipientType.User)
            {
                if (recipientType != RecipientType.Group)
                {
                    ExAssert.RetailAssert(false, "Unsupported recipient type");
                }
                else
                {
                    grammarGeneratorInstance = new DLGrammarGenerator(base.Logger);
                }
            }
            else
            {
                grammarGeneratorInstance = new UserGrammarGenerator(base.Logger, base.OrgId);
            }
            CultureInfo[] grammarCultures = UMGrammarTenantCache.Instance.GetGrammarCultures();
            return(new GrammarGeneratorTaskContext(context.MailboxData, context.Job, context.TaskQueue, context.Step, context.TaskStatus, grammarGeneratorInstance, grammarCultures, base.Logger, context.RunData, context.DeferredFinalizeTasks));
        }
Пример #4
0
        internal static QueryFilter OptimizeRecipientTypeFilter(OrFilter orFilter)
        {
            Filters.RecipientTypeBitVector32 recipientTypeBitVector = default(Filters.RecipientTypeBitVector32);
            List <QueryFilter> list = null;

            foreach (QueryFilter queryFilter in orFilter.Filters)
            {
                ComparisonFilter comparisonFilter = queryFilter as ComparisonFilter;
                if (comparisonFilter != null && comparisonFilter.ComparisonOperator == ComparisonOperator.Equal && comparisonFilter.Property == ADRecipientSchema.RecipientType)
                {
                    RecipientType index = (RecipientType)ADObject.PropertyValueFromEqualityFilter(comparisonFilter);
                    recipientTypeBitVector[index] = true;
                }
                else
                {
                    if (list == null)
                    {
                        list = new List <QueryFilter>(orFilter.FilterCount);
                    }
                    list.Add(queryFilter);
                }
            }
            QueryFilter queryFilter2 = null;

            if (!Filters.RecipientTypeFilterOptimizations.TryGetValue(recipientTypeBitVector.Data, out queryFilter2))
            {
                return(orFilter);
            }
            if (list == null)
            {
                return(queryFilter2);
            }
            list.Add(queryFilter2);
            return(new OrFilter(list.ToArray()));
        }
Пример #5
0
        public List <MailAddress> GetRecipients(RecipientType Allowed)
        {
            List <MailAddress> Recipients = new List <MailAddress>();

            for (int i = 0; i < GetCount(); i++)
            {
                uint t = GetMapiIntegerValue(mapi.EntryTypes.RecipientType, i);
                if (t == (uint)Allowed)
                {
                    string DisplayName  = GetMapiStringValue(mapi.EntryTypes.RecipientDisplayName, i);
                    string EmailAddress = GetMapiStringValue(mapi.EntryTypes.EmailAddress, i);
                    try
                    {
                        MailAddress a = new MailAddress(EmailAddress, DisplayName);
                        Recipients.Add(a);
                    }
                    catch (FormatException e)
                    {
                        /*
                         * For now, ignore this
                         */
                    }
                }
            }
            return(Recipients);
        }
Пример #6
0
        internal static RecipientItemType MapiRecipientTypeToRecipientItemType(RecipientType recipientType)
        {
            if (recipientType == RecipientType.Unknown)
            {
                return(RecipientItemType.Unknown);
            }
            RecipientType recipientType2 = recipientType & (RecipientType)2147483647;
            RecipientType recipientType3 = recipientType2;

            switch (recipientType3)
            {
            case RecipientType.To:
            case RecipientType.Cc:
            case RecipientType.Bcc:
                break;

            default:
                if (recipientType3 != RecipientType.P1)
                {
                    return(RecipientItemType.Unknown);
                }
                break;
            }
            return((RecipientItemType)recipientType2);
        }
Пример #7
0
        // Token: 0x06001060 RID: 4192 RVA: 0x0005FB2C File Offset: 0x0005DD2C
        private string GetMetadataFileName(RecipientType recipientType)
        {
            string text = null;

            if (recipientType != RecipientType.User)
            {
                if (recipientType != RecipientType.Group)
                {
                    ExAssert.RetailAssert(false, "Unsupported recipient type");
                }
                else
                {
                    text = "DistributionList.xml";
                }
            }
            else
            {
                text = "User.xml";
            }
            base.Logger.TraceDebug(this, "GetMetadataFileName fileName='{0}'", new object[]
            {
                text
            });
            return(text);
        }
Пример #8
0
        // Token: 0x0600105D RID: 4189 RVA: 0x0005F918 File Offset: 0x0005DB18
        private void LogCompletion(DtmfMapGeneratorTaskContext taskContext, RecipientType recipientType)
        {
            base.Logger.TraceDebug(null, "Entering DtmfMapGenerator.LogCompletion recipientType='{0}'", new object[]
            {
                recipientType
            });
            UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_DtmfMapGenerationSuccessful, null, new object[]
            {
                base.RunData.TenantId,
                base.RunData.RunId,
                recipientType
            });
            DateTime runStartTime              = base.RunStartTime;
            DateTime lastFullUpdateTimeUtc     = taskContext.IsFullUpdate ? base.RunStartTime : taskContext.Metadata.LastFullUpdateTimeUtc;
            DtmfMapGenerationMetadata metadata = new DtmfMapGenerationMetadata(1, base.TenantId, base.RunId, Utils.GetLocalHostFqdn(), "15.00.1497.010", runStartTime, lastFullUpdateTimeUtc);
            string metadataFileName            = this.GetMetadataFileName(recipientType);
            string dtmfMapFolderPath           = GrammarFileDistributionShare.GetDtmfMapFolderPath(base.RunData.OrgId, base.RunData.MailboxGuid);

            base.Logger.TraceDebug(this, "LogCompletion folderPath='{0}', fileName='{1}'", new object[]
            {
                dtmfMapFolderPath,
                metadataFileName
            });
            string text = DtmfMapGenerationMetadata.Serialize(metadata, metadataFileName, dtmfMapFolderPath);

            if (text != null)
            {
                this.UploadMetadata(text, metadataFileName);
            }
        }
Пример #9
0
        public void AddList(RecipientType type, string[] list, Dictionary <string, string> dic)
        {
            // http://www.ietf.org/rfc/rfc0822.txt

            if (list == null || list.Length == 0)
            {
                return;
            }

            var i = 1;

            // By default, the string must be 7-bit ASCII.
            // If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string.
            // MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. For more information, see RFC 2047.


            foreach (var address in To)
            {
                // &Destination.ToAddresses.member.1=allan%40example.com

                dic.Add($"Destination.{type}Addresses.member.{i}", address);

                i++;
            }
        }
Пример #10
0
        // Token: 0x06001982 RID: 6530 RVA: 0x0006C154 File Offset: 0x0006A354
        protected override void ValidateWrite(List <ValidationError> errors)
        {
            base.ValidateWrite(errors);
            RecipientType recipientType = base.RecipientType;

            if (RecipientType.MailUniversalDistributionGroup == recipientType || RecipientType.MailNonUniversalGroup == recipientType || RecipientType.MailUniversalSecurityGroup == recipientType)
            {
                if (!base.BypassModerationCheck && this.ReportToManagerEnabled && this.ManagedBy == null)
                {
                    errors.Add(new ObjectValidationError(DirectoryStrings.ErrorReportToManagedEnabledWithoutManager(this.Identity.ToString(), ADGroupSchema.ReportToManagerEnabled.Name), this.Identity, string.Empty));
                }
                if (this.ReportToManagerEnabled && this.ReportToOriginatorEnabled)
                {
                    errors.Add(new ObjectValidationError(DirectoryStrings.ErrorReportToBothManagerAndOriginator(this.Identity.ToString(), ADGroupSchema.ReportToManagerEnabled.Name, ADGroupSchema.ReportToOriginatorEnabled.Name), this.Identity, string.Empty));
                }
            }
            if (this.MemberDepartRestriction == MemberUpdateType.ApprovalRequired)
            {
                errors.Add(new ObjectValidationError(DirectoryStrings.ErrorGroupMemberDepartRestrictionApprovalRequired(this.Identity.ToString()), this.Identity, string.Empty));
            }
            if (this.ManagedBy.Count == 0 && this.MemberJoinRestriction == MemberUpdateType.ApprovalRequired)
            {
                errors.Add(new ObjectValidationError(DirectoryStrings.ErrorJoinApprovalRequiredWithoutManager(this.Identity.ToString()), this.Identity, string.Empty));
            }
        }
Пример #11
0
 public Recipient(TCRowMatrixData row)
 {
     foreach (var exProp in row)
     {
         switch (exProp.ID)
         {
             case 0x0c15:
                 this.Type = (RecipientType)BitConverter.ToUInt32(exProp.Data, 0);
                 break;
             case 0x0e0f:
                 this.Responsibility = exProp.Data[0] == 0x01;
                 break;
             case 0x0ff9:
                 this.Tag = exProp.Data;
                 break;
             case 0x0ffe:
                 this.ObjType = (PSTEnums.ObjectType)BitConverter.ToUInt32(exProp.Data, 0);
                 break;
             case 0x0fff:
                 this.EntryID = new EntryID(exProp.Data);
                 break;
             case 0x3001:
                 this.DisplayName = Encoding.Unicode.GetString(exProp.Data);
                 break;
             case 0x3002:
                 this.EmailAddressType = Encoding.Unicode.GetString(exProp.Data);
                 break;
             case 0x3003:
                 this.EmailAddress = Encoding.Unicode.GetString(exProp.Data);
                 break;
             default:
                 break;
         }
     }
 }
Пример #12
0
 public RewardPointsAjustment(RecipientType type, int amount)
 {
     Id        = -1;
     Settings  = new Dictionary <string, string>();
     Amount    = amount;
     Recipient = type;
 }
Пример #13
0
        // Token: 0x060010D1 RID: 4305 RVA: 0x00062714 File Offset: 0x00060914
        public void SetMetadataValues(object context, RecipientType recipientType, string chunkId)
        {
            this.TraceDebug(context, "Entering SetMetadataValues - TaskName='{0}', RecipientType='{1}', ChunkId='{2}'", new object[]
            {
                this.TaskName,
                recipientType,
                chunkId
            });
            Logger.RegisterMetadata();
            IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();

            if (currentActivityScope != null && currentActivityScope.Status == ActivityContextStatus.ActivityStarted)
            {
                this.TraceDebug(context, "Setting metadata values TaskName='{0}', RecipientType='{1}', ChunkId='{2}', MailboxGuid='{3}', TenantGuid='{4}'", new object[]
                {
                    this.TaskName,
                    recipientType,
                    chunkId,
                    this.RunData.MailboxGuid,
                    this.RunData.TenantGuid
                });
                currentActivityScope.SetProperty(DirectoryProcessorMetadata.TaskName, this.TaskName);
                currentActivityScope.SetProperty(DirectoryProcessorMetadata.RecipientType, recipientType.ToString());
                currentActivityScope.SetProperty(DirectoryProcessorMetadata.ChunkId, chunkId);
                currentActivityScope.SetProperty(DirectoryProcessorMetadata.MailboxGuid, this.RunData.MailboxGuid.ToString());
                currentActivityScope.SetProperty(DirectoryProcessorMetadata.TenantGuid, this.RunData.TenantGuid.ToString());
            }
        }
Пример #14
0
        // Token: 0x06002A6E RID: 10862 RVA: 0x000ED57C File Offset: 0x000EB77C
        private void RenderMemberLink(ADObjectId id, string displayName, RecipientType recipientType)
        {
            string s;

            if (Utilities.IsADDistributionList(recipientType))
            {
                s = "ADDistList";
            }
            else
            {
                s = "AD.RecipientType.User";
            }
            if (string.IsNullOrEmpty(displayName))
            {
                displayName = LocalizedStrings.GetNonEncoded(-808148510);
            }
            string base64StringFromADObjectId = Utilities.GetBase64StringFromADObjectId(id);
            string handlerCode = string.Format("openItmRdFm(\"{0}\",\"{1}\");", Utilities.JavascriptEncode(s), Utilities.JavascriptEncode(base64StringFromADObjectId));

            base.Response.Write("<a class=lnk ");
            base.Response.Write(Utilities.GetScriptHandler("onclick", handlerCode));
            base.Response.Write(">");
            Utilities.HtmlEncode(displayName, base.Response.Output);
            base.Response.Write("</a>");
        }
Пример #15
0
        private static RecipientDisplayType?ToRecipientDisplayType(RecipientType recipientType)
        {
            switch (recipientType)
            {
            case RecipientType.UserMailbox:
            case RecipientType.MailUser:
                return(new RecipientDisplayType?(RecipientDisplayType.MailboxUser));

            case RecipientType.MailContact:
                return(new RecipientDisplayType?(RecipientDisplayType.RemoteMailUser));

            case RecipientType.MailUniversalDistributionGroup:
            case RecipientType.MailNonUniversalGroup:
                return(new RecipientDisplayType?(RecipientDisplayType.DistributionGroup));

            case RecipientType.MailUniversalSecurityGroup:
                return(new RecipientDisplayType?(RecipientDisplayType.SecurityDistributionGroup));

            case RecipientType.DynamicDistributionGroup:
                return(new RecipientDisplayType?(RecipientDisplayType.DynamicDistributionGroup));

            case RecipientType.PublicFolder:
                return(new RecipientDisplayType?(RecipientDisplayType.PublicFolder));
            }
            return(null);
        }
Пример #16
0
 /// <summary>
 /// Adds the recipients.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="type">The type.</param>
 /// <param name="action">The action.</param>
 private void AddRecipients(Message message, RecipientType type, Action <string> action)
 {
     foreach (var Item in message.Recipients.Where(x => x.Type == type).Select(x => x.Email))
     {
         action(Item);
     }
 }
        private void AddNewMessageReipient(int messageId, int recipientId, RecipientType recipientType)
        {
            using (IDbConnection db = new SqlConnection(_connectionString))
            {
                string sqlQuery = string.Empty;

                switch (recipientType)
                {
                case RecipientType.User:
                    sqlQuery = @"INSERT INTO MessageUserRecipient (MessageId, RecipientId) VALUES(@MessageId, @RecipientId)";
                    break;

                case RecipientType.Group:
                    sqlQuery = @"INSERT INTO MessageGroupRecipient (MessageId, RecipientId) VALUES(@MessageId, @RecipientId)";
                    break;

                default:
                    break;
                }

                var insertValues = new { MessageId = messageId, RecipientId = recipientId };

                db.Query(sqlQuery, insertValues);
            }
        }
Пример #18
0
        // Token: 0x06001FFA RID: 8186 RVA: 0x000B9298 File Offset: 0x000B7498
        protected bool RenderADEmailAddress(IListViewDataSource dataSource, TextWriter writer)
        {
            string text = dataSource.GetItemProperty <SmtpAddress>(ADRecipientSchema.PrimarySmtpAddress, SmtpAddress.Empty).ToString();

            if (text.Length == 0)
            {
                return(false);
            }
            RecipientAddress.RecipientAddressFlags recipientAddressFlags = RecipientAddress.RecipientAddressFlags.None;
            RecipientDisplayType?itemProperty = dataSource.GetItemProperty <RecipientDisplayType?>(ADRecipientSchema.RecipientDisplayType, null);

            if (itemProperty == RecipientDisplayType.ConferenceRoomMailbox || itemProperty == RecipientDisplayType.SyncedConferenceRoomMailbox)
            {
                recipientAddressFlags |= RecipientAddress.RecipientAddressFlags.Room;
            }
            RecipientType itemProperty2 = dataSource.GetItemProperty <RecipientType>(ADRecipientSchema.RecipientType, RecipientType.Invalid);

            if (Utilities.IsADDistributionList(itemProperty2))
            {
                recipientAddressFlags |= RecipientAddress.RecipientAddressFlags.DistributionList;
            }
            string itemProperty3 = dataSource.GetItemProperty <string>(ADRecipientSchema.LegacyExchangeDN, string.Empty);
            ProxyAddressCollection itemProperty4 = dataSource.GetItemProperty <ProxyAddressCollection>(ADRecipientSchema.EmailAddresses, null);
            string sipUri            = InstantMessageUtilities.GetSipUri(itemProperty4);
            string mobilePhoneNumber = Utilities.NormalizePhoneNumber(dataSource.GetItemProperty <string>(ADOrgPersonSchema.MobilePhone, string.Empty));

            this.RenderSingleEmailAddress(writer, dataSource.GetItemProperty <string>(ADRecipientSchema.DisplayName, string.Empty), text, text, itemProperty3, EmailAddressIndex.None, recipientAddressFlags, null, sipUri, mobilePhoneNumber);
            return(true);
        }
Пример #19
0
        /// <summary>
        /// Saves statistics in database.
        /// </summary>
        /// <param name="recipientType"></param>
        /// <param name="deliveryDate"></param>
        /// <param name="messageStatus"></param>
        /// <param name="requestId"></param>
        public void SaveStatistics(RecipientType recipientType, DateTime?deliveryDate, string messageStatus, Guid requestId)
        {
            LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.BusinessLayer.Handler.PackageHandler: incoming SavePackage with RequestId: {0}", requestId));

            _sqlManager.InsertIntoPackageStatistic(recipientType, deliveryDate, messageStatus, requestId);

            LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.BusinessLayer.Handler.PackageHandler: leaving SavePackage with RequestId: {0}", requestId));
        }
Пример #20
0
 public Message(string entityId, string moduleId, string command, JToken content)
 {
     EntityId      = string.IsNullOrEmpty(entityId) ? Guid.Empty : new Guid(entityId);
     ModuleId      = string.IsNullOrEmpty(moduleId) ? Guid.Empty : new Guid(moduleId);
     Command       = command;
     Content       = content;
     RecipientType = GetRecipientValue();
 }
Пример #21
0
 private static Recipient ConvertToARecipient(RecipientType type, MailAddress address)
 {
     return(new Recipient
     {
         Type = type,
         Address = ConvertToAddress(address)
     });
 }
Пример #22
0
 public QueueMessage(RecipientType recipient, ulong payload, uint index, uint payloadSize, OperationType messageType)
 {
     Recipient     = recipient;
     Payload       = payload;
     this.index    = index;
     PayloadSize   = payloadSize;
     OperationType = messageType;
 }
Пример #23
0
 public override Address[] getRecipients(RecipientType type)
 {
     if (type.Equals (Message.RecipientType.TO)) {
         return this.to;
     }
     else {
         throw new NotImplementedException ();
     }
 }
Пример #24
0
        protected QueryFilter ConstructQueryFilterWithCustomFilter(QueryFilter customFilter)
        {
            List <QueryFilter> list = new List <QueryFilter>();

            RecipientType[]             recipientTypes = this.RecipientTypes;
            List <RecipientTypeDetails> list2          = new List <RecipientTypeDetails>();

            if (this.InternalRecipientTypeDetails != null && this.InternalRecipientTypeDetails.Length > 0)
            {
                foreach (RecipientTypeDetails recipientTypeDetails in this.InternalRecipientTypeDetails)
                {
                    RecipientType recipientType = RecipientTaskHelper.RecipientTypeDetailsToRecipientType(recipientTypeDetails);
                    if (recipientType != RecipientType.Invalid && Array.IndexOf <RecipientType>(this.RecipientTypes, recipientType) != -1)
                    {
                        list2.Add(recipientTypeDetails);
                    }
                    else if (base.IsVerboseOn)
                    {
                        base.WriteVerbose(Strings.VerboseRecipientTypeDetailsIgnored(recipientTypeDetails.ToString()));
                    }
                }
                if (list2.Count == 0)
                {
                    base.WriteError(new ArgumentException(Strings.ErrorRecipientTypeDetailsConflictWithRecipientType), ErrorCategory.InvalidArgument, null);
                }
            }
            QueryFilter internalFilter = base.InternalFilter;

            if (internalFilter != null)
            {
                list.Add(internalFilter);
            }
            QueryFilter recipientTypeDetailsFilter = RecipientIdParameter.GetRecipientTypeDetailsFilter(list2.ToArray());

            if (recipientTypeDetailsFilter != null)
            {
                list.Add(recipientTypeDetailsFilter);
            }
            else
            {
                list.Add(RecipientIdParameter.GetRecipientTypeFilter(recipientTypes));
            }
            if (this.Organization != null)
            {
                QueryFilter item = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.OrganizationalUnitRoot, base.CurrentOrganizationId.OrganizationalUnit);
                list.Add(item);
            }
            if (customFilter != null)
            {
                list.Add(customFilter);
            }
            if (list.Count != 1)
            {
                return(new AndFilter(list.ToArray()));
            }
            return(list[0]);
        }
Пример #25
0
        // Token: 0x06001132 RID: 4402 RVA: 0x000642D8 File Offset: 0x000624D8
        private ADEntry LoadADEntry(XmlReader entryReader, NameNormalizer nameNormalizer, GrammarGenerationLog generationLog)
        {
            base.Logger.TraceDebug(this, "Entering GrammarGenerator.LoadADEntry", new object[0]);
            ADEntry       result        = null;
            string        text          = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[2].Name);
            string        attribute     = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[0].Name);
            string        attribute2    = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[1].Name);
            Guid          guid          = new Guid(entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[3].Name));
            RecipientType recipientType = (RecipientType)Enum.Parse(typeof(RecipientType), entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[4].Name));
            string        attribute3    = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[6].Name);
            string        attribute4    = entryReader.GetAttribute(GrammarRecipientHelper.LookupProperties[9].Name);

            base.Logger.TraceDebug(this, "GrammarGenerator.LoadADEntry - displayName='{0}', phoneticDisplayName='{1}', smtpAddress='{2}', objectGuid='{3}', recipientType='{4}', dialPlanGuid='{5}', AddressListMembership='{6}'", new object[]
            {
                attribute,
                attribute2,
                text,
                guid,
                recipientType,
                attribute3,
                attribute4
            });
            if (RecipientType.DynamicDistributionGroup != recipientType)
            {
                List <string> list = new List <string>(2);
                if (!string.IsNullOrEmpty(attribute))
                {
                    list.Add(attribute);
                }
                if (!string.IsNullOrEmpty(attribute2))
                {
                    list.Add(attribute2);
                }
                list = NormalizationHelper.GetNormalizedNames(list, nameNormalizer, recipientType, generationLog);
                if (list != null)
                {
                    base.Logger.TraceDebug(this, "GrammarGenerator.LoadADEntry - Valid names found for entry", new object[0]);
                    text = GrammarRecipientHelper.GetNormalizedEmailAddress(text);
                    Guid        dialPlanGuid = string.IsNullOrEmpty(attribute3) ? Guid.Empty : new Guid(attribute3);
                    List <Guid> list2        = new List <Guid>();
                    if (!string.IsNullOrEmpty(attribute4))
                    {
                        char[] separator = new char[]
                        {
                            ','
                        };
                        string[] array = attribute4.Split(separator);
                        foreach (string g in array)
                        {
                            list2.Add(new Guid(g));
                        }
                    }
                    result = new ADEntry(list, text, guid, recipientType, dialPlanGuid, list2);
                }
            }
            return(result);
        }
Пример #26
0
        public EmailRecipient(IEmailAddress emailAddress, RecipientType recipientType = RecipientType.To)
        {
            if (emailAddress == null)
            {
                throw new ArgumentNullException(nameof(emailAddress));
            }

            this.emailAddress  = emailAddress;
            this.recipientType = recipientType;
        }
Пример #27
0
        public static RecipientAddressFlags ToRecipientAddressFlag(this RecipientType type)
        {
            RecipientAddressFlags result = RecipientAddressFlags.None;

            if (type == RecipientType.MailUniversalDistributionGroup || type == RecipientType.MailUniversalSecurityGroup || type == RecipientType.MailNonUniversalGroup || type == RecipientType.DynamicDistributionGroup)
            {
                result = RecipientAddressFlags.DistributionList;
            }
            return(result);
        }
Пример #28
0
        private void RenderPeers(IADOrgPerson person, TextWriter writer)
        {
            ADObjectId manager = person.Manager;

            if (manager != null)
            {
                ADRecipient adrecipient = base.ADRecipientSession.Read(manager);
                if (adrecipient != null)
                {
                    IADOrgPerson iadorgPerson = (IADOrgPerson)adrecipient;
                    this.peersResults = iadorgPerson.GetDirectReportsView(new PropertyDefinition[]
                    {
                        ADRecipientSchema.DisplayName,
                        ADObjectSchema.Id,
                        ADRecipientSchema.RecipientType
                    });
                }
            }
            if (this.peersResults != null && this.peersResults.Length > 1)
            {
                writer.Write("<tr><td class=\"lbl lp\" nowrap>");
                writer.Write(LocalizedStrings.GetHtmlEncoded(-1417802693));
                writer.Write("</td><td>");
                writer.Write("<table cellpadding=0 cellspacing=0 class=\"drpts\">");
                List <ReadADOrgPerson.ADMember> list = new List <ReadADOrgPerson.ADMember>();
                for (int i = 0; i < this.peersResults.Length; i++)
                {
                    if (!base.ADRecipient.Id.Equals(this.peersResults[i][1]))
                    {
                        list.Add(new ReadADOrgPerson.ADMember(this.peersResults[i][0] as string, this.peersResults[i][1] as ADObjectId, this.peersResults[i][2]));
                    }
                }
                list.Sort(this);
                foreach (ReadADOrgPerson.ADMember admember in list)
                {
                    RecipientType recipientType = (RecipientType)admember.Type;
                    int           readItemType;
                    if (Utilities.IsADDistributionList(recipientType))
                    {
                        readItemType = 2;
                    }
                    else
                    {
                        readItemType = 1;
                    }
                    writer.Write("<tr><td class=\"rptdpd\">");
                    ReadADRecipient.RenderADRecipient(writer, readItemType, admember.Id, admember.DisplayName);
                    writer.Write("</td></tr>");
                }
                writer.Write("</table>");
                writer.Write("</td></tr>");
                writer.Write("<tr><td class=\"spcHd\" colspan=2></td></tr>");
                this.renderOrganizationDetails = true;
            }
        }
Пример #29
0
        public static object CalculateCanNewMoveRequest(object recipientType, object mailboxMoveStatus, object mailboxMoveFlags, object mailboxMoveRemoteHostName, object archiveState)
        {
            bool          flag           = false;
            RecipientType recipientType2 = (RecipientType)recipientType;

            if ((recipientType2 == RecipientType.MailUser || recipientType2 == RecipientType.UserMailbox) && string.IsNullOrEmpty(WinformsHelper.CalculateMoveRequestTypeForMailbox(mailboxMoveStatus, mailboxMoveFlags, mailboxMoveRemoteHostName)))
            {
                flag = (recipientType2 == RecipientType.UserMailbox || ((ArchiveState)archiveState == ArchiveState.Local && WinformsHelper.IsCloudOrganization()));
            }
            return(flag);
        }
Пример #30
0
 public override Address[] getRecipients(RecipientType type)
 {
     if (type.Equals(Message.RecipientType.TO))
     {
         return(this.to);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Пример #31
0
 public override void setRecipients(RecipientType type, Address[] addresses)
 {
     if (type.Equals(Message.RecipientType.TO))
     {
         this.to = addresses;
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Пример #32
0
 internal bool this[RecipientType index]
 {
     set
     {
         if (value)
         {
             this.data |= 1 << (int)index;
             return;
         }
         this.data &= ~(1 << (int)index);
     }
 }
Пример #33
0
        public static void Create(Core core, Message message, MessageRecipient recipient, RecipientType type, MailFolder folder)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            Item.Create(core, typeof(MessageRecipient), true,
                new FieldValuePair("message_id", message.Id),
                new FieldValuePair("sender_id", message.SenderId),
                new FieldValuePair("user_id", recipient.UserId),
                new FieldValuePair("message_folder_id", folder.Id),
                new FieldValuePair("recipient_type", (byte)type),
                new FieldValuePair("is_read", type == RecipientType.Sender));
        }
Пример #34
0
 public Recipient()
 {
     this.distTypeField = DistributionType.TO;
     this.recipTypeField = RecipientType.User;
 }
Пример #35
0
 private SubjectWord[] SubjectNamesFor(RecipientType recipient)
 {
     return _subjectNameProviders.Select(x => x(recipient)).ToArray();
 }
Пример #36
0
 private string GetMessageFor(RecipientType recipient)
 {
     return string.Format(_killPhrase, SubjectNamesFor(recipient)).Capitalize();
 }
Пример #37
0
 public override void setRecipients(RecipientType type, Address[] addresses)
 {
     if (type.Equals (Message.RecipientType.TO)) {
         this.to = addresses;
     }
     else {
         throw new NotImplementedException ();
     }
 }
Пример #38
0
 /// <summary>
 /// Adds a recipient to a message
 /// </summary>
 /// <param name="strEmail">email address of recipient</param>
 /// <param name="nType">type of recipient (TO, CC and BCC)</param>
 /// <param name="strAddrType">Address type of address (SMTP, SMS etc)</param>
 /// <returns>true on success</returns>
 public bool AddRecipient(string strEmail, RecipientType nType, string strAddrType)
 {
     return MessageAddRecipient(pObject, strEmail, (int)nType, strAddrType);
 }
Пример #39
0
        /// <summary>
        /// sends an internal notification to a user
        /// </summary>
        /// <param name="recipientId">userid</param>
        /// <param name="notificationType">type of notification</param>
        /// <param name="projectId">the project the notification is for</param>
        /// <returns></returns>
        public bool SendNotification(int recipientId, RecipientType recipientType, BCModel.NotificationType notificationType, int entityId, EntityType entityType)
        {
            try
            {
                switch (recipientType)
                {
                    // if company, then loop through each of the companies users
                    case RecipientType.company:
                        List<Notification> existingNotices = (from r in _repo.Query()
                                                              where r.NotificationType == notificationType      // notification type y
                                                              && r.Recipient.CompanyId == recipientId                     // sent to company z
                                                              && r.EntityId == entityId                       // for project x
                                                              && r.EntityType == entityType
                                                              && !r.Read                                        // not read yet
                                                              && EntityFunctions.DiffDays(r.LastEditTimestamp, DateTime.Now).Value == 0  // from today
                                                              select r).ToList();
                        List<UserProfile> users = _repo.QueryUserProfiles().Where(x => x.CompanyId == recipientId).ToList();

                        if (existingNotices.Count == users.Count) // if there is an unread notice for each user of comany z
                        {
                            appendExistingNotices(existingNotices.ToArray());
                            _repo.Save(); // save changes
                            return true;
                        }
                        else if (existingNotices.Count > 0 && existingNotices.Count < users.Count) // if some users have read the notice already
                        {
                            // update unread
                            appendExistingNotices(existingNotices.ToArray());

                            // create new notices
                            sendNewNotices(users.Where(x => !existingNotices.Select(e => e.RecipientId).Contains(x.UserId)).Select(s => s.UserId).ToArray(), notificationType, entityId, entityType);

                            // save changes
                            _repo.Save();
                            return true;
                        }
                        else // else no notices exist
                        {
                            // create new notices
                            sendNewNotices(users.Select(s => s.UserId).ToArray(), notificationType, entityId, entityType);
                            _repo.Save();
                            return true;
                        }

                    // if user, only do the single notice
                    case RecipientType.user:
                        // find out if there is already a notification type for this project from today
                        Notification existingNotice = (from r in _repo.Query()
                                                       where r.NotificationType == notificationType      // notification type y
                                                       && r.RecipientId == recipientId                     // sent to user z
                                                       && r.EntityId == entityId                       // for project x
                                                       && r.EntityType == entityType
                                                       && !r.Read                                        // not read yet
                                                       && r.LastEditTimestamp.Date == DateTime.Now.Date  // from today
                                                       select r).SingleOrDefault();

                        // if there is not an existing notice
                        if (existingNotice != null)
                        {
                            // pull the notice out of the list
                            existingNotice.Count = existingNotice.Count++;      // increase notice count
                            existingNotice.LastEditTimestamp = DateTime.Now;    // reset timestamp
                            _repo.Update(existingNotice);                       // update notice
                            _repo.Save();                                       // save changes
                            return true;
                        }
                        else // there is no existing notice
                        {
                            Notification theNotice = new Notification
                            {
                                Count = 1,
                                LastEditTimestamp = DateTime.Now,
                                NotificationType = notificationType,
                                EntityId = entityId,
                                EntityType = entityType,
                                Read = false,
                                RecipientId = recipientId
                            };                      // draft the notice
                            _repo.Create(theNotice);    // add to queue
                            _repo.Save();               // send/save
                            return true;
                        }
                    default:
                        throw new ArgumentException("Unknown notification type");
                }

            }
            catch (Exception)
            {
                return false;
            }
        }
Пример #40
0
 /// <summary>
 /// Gets the next recipient
 /// </summary>
 /// <param name="strName">Name of recipient</param>
 /// <param name="strEmail">Email of recipient</param>
 /// <param name="nType">RecipientType (TO, CC, BCC)</param>
 /// <returns>true on success</returns>
 public bool GetNextRecipient(StringBuilder strName, StringBuilder strEmail, out RecipientType nType)
 {
     int nRecipientType;
     nType = RecipientType.UNKNOWN;
     if (MessageGetNextRecipient(pObject, strName, strName.Capacity, strEmail, strEmail.Capacity, out nRecipientType))
     {
         nType = (RecipientType)nRecipientType;
         return true;
     }
     return false;
 }
Пример #41
0
        public void AddRecipient(User user, RecipientType type)
        {
            bool incrementFolderCount = false;
            MailFolder folder = null;
            switch (type)
            {
                case RecipientType.Sender:
                    if (draft)
                    {
                        folder = MailFolder.GetFolder(core, FolderTypes.Draft, user);
                        MessageRecipient.Create(core, this, user, type, folder);
                    }
                    else
                    {
                        folder = MailFolder.GetFolder(core, FolderTypes.Outbox, user);
                        MessageRecipient.Create(core, this, user, type, folder);
                    }
                    incrementFolderCount = true;
                    break;
                default:
                    folder = MailFolder.GetFolder(core, FolderTypes.Inbox, user);
                    MessageRecipient.Create(core, this, user, type, folder);

                    if (!draft)
                    {
                        incrementFolderCount = true;
                    }
                    break;
            }

            if (incrementFolderCount)
            {
                UpdateQuery uquery = new UpdateQuery(typeof(MailFolder));
                uquery.AddCondition("folder_id", folder.Id);
                uquery.AddField("folder_messages", new QueryOperation("folder_messages", QueryOperations.Addition, 1));

                core.Db.Query(uquery);
            }
        }
Пример #42
0
 public void RemoveRecipient(User user, RecipientType type)
 {
     if (core.Session.SignedIn && (SenderId == core.Session.LoggedInMember.Id || user.Id == core.Session.LoggedInMember.Id))
     {
         DeleteQuery dQuery = new DeleteQuery(typeof(MessageRecipient));
         dQuery.AddCondition("message_id", Id);
         dQuery.AddCondition("user_id", user.Id);
         if (type != RecipientType.Any)
         {
             dQuery.AddCondition("recipient_type", (byte)type);
         }
         db.Query(dQuery);
     }
 }
        /// <summary>
        /// Create Recipient Array 
        /// </summary>
        /// <param name="name">Recipient name value</param>
        /// <param name="rowId">RowId value</param>
        /// <param name="recipientType">RecipientType value</param>
        /// <param name="recipientRowSize">RecipientRowSize value</param>
        /// <returns>Return ModifyRecipientRow</returns>
        protected ModifyRecipientRow ChangeRecipientRowSize(string name, uint rowId, RecipientType recipientType, ushort recipientRowSize)
        {
            PropertyRow propertyRow = this.CreateRecipientColumns(name);

            RecipientRow recipientRow = new RecipientRow
            {
                RecipientFlags = 0x065B,
                DisplayName = Common.GetBytesFromUnicodeString(name)
            };
            string domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
            recipientRow.EmailAddress = Common.GetBytesFromUnicodeString(string.Format("{0}{1}{2}", name, TestSuiteBase.At, domainName));
            recipientRow.SimpleDisplayName = Common.GetBytesFromUnicodeString(TestSuiteBase.PrefixOfDisplayName + name);
            recipientRow.RecipientColumnCount = 0x000C; // Matches ColummnCount
            recipientRow.RecipientProperties = propertyRow;

            ModifyRecipientRow modifyRecipientRow = new ModifyRecipientRow
            {
                RowId = rowId,
                RecipientType = (byte)recipientType,
                RecipientRowSize = recipientRowSize,
                RecptRow = recipientRow.Serialize()
            };

            return modifyRecipientRow;
        }