private bool CheckAndUpdateHashes(JunkEmailRule junkEmailRule, UpdateType currentUpdateType) { AddressHashes addressHashes = this.ComputeHashForMailbox(junkEmailRule, currentUpdateType); if (!this.CompareHashes(addressHashes, this.DataObject, currentUpdateType)) { byte[] array = addressHashes.GetBytes(); if (array.Length == 0) { array = null; } switch (currentUpdateType) { case UpdateType.SafeSenders: this.DataObject.SafeSendersHash = array; break; case UpdateType.SafeRecipients: this.DataObject.SafeRecipientsHash = array; break; case UpdateType.BlockedSenders: this.DataObject.BlockedSendersHash = array; break; } return(true); } return(false); }
private AddressHashes ComputeHashForMailbox(JunkEmailRule junkEmailRule, UpdateType type) { AddressHashes addressHashes = new AddressHashes(); switch (type) { case UpdateType.SafeSenders: { if (this.IncludeDomains) { int num = this.UpdateAddressHashes(addressHashes, 3072, junkEmailRule.TrustedSenderDomainCollection); this.summary.SkippedSafeSenderDomains = junkEmailRule.TrustedSenderDomainCollection.Count - num; } if (junkEmailRule.IsContactsFolderTrusted) { int num2 = this.UpdateAddressHashes(addressHashes, 3072, junkEmailRule.TrustedContactsEmailCollection); this.summary.SkippedContacts = junkEmailRule.TrustedContactsEmailCollection.Count - num2; } int num3 = this.UpdateAddressHashes(addressHashes, 3072, junkEmailRule.TrustedSenderEmailCollection); this.summary.SkippedSafeSenders = junkEmailRule.TrustedSenderEmailCollection.Count - num3; break; } case UpdateType.SafeRecipients: { if (this.IncludeDomains) { int num4 = this.UpdateAddressHashes(addressHashes, 2048, junkEmailRule.TrustedRecipientDomainCollection); this.summary.SkippedSafeRecipientDomains = junkEmailRule.TrustedRecipientDomainCollection.Count - num4; } int num5 = this.UpdateAddressHashes(addressHashes, 2048, junkEmailRule.TrustedRecipientEmailCollection); this.summary.SkippedSafeRecipients = junkEmailRule.TrustedRecipientEmailCollection.Count - num5; break; } case UpdateType.BlockedSenders: { if (this.IncludeDomains) { int num6 = this.UpdateAddressHashes(addressHashes, 2048, junkEmailRule.BlockedSenderDomainCollection); this.summary.SkippedBlockedSenderDomains = junkEmailRule.BlockedSenderDomainCollection.Count - num6; } int num7 = this.UpdateAddressHashes(addressHashes, 2048, junkEmailRule.BlockedSenderEmailCollection); this.summary.SkippedBlockedSenders = junkEmailRule.BlockedSenderEmailCollection.Count - num7; break; } } return(addressHashes); }
private int UpdateAddressHashes(AddressHashes addressHashes, int maxEntries, IEnumerable <string> addressCollection) { int num = 0; foreach (string addressOrDomain in addressCollection) { if (addressHashes.Count >= maxEntries) { break; } num++; addressHashes.Add(addressOrDomain); } return(num); }
// Token: 0x06000B4C RID: 2892 RVA: 0x00048F64 File Offset: 0x00047164 private byte[] GetSafeRecipientsHash(JunkEmailRule junkEmailRule, out bool oversized) { AddressHashes addressHashes = new AddressHashes(); int num = 0; int num2 = 0; oversized = false; if (Configuration.IncludeSafeDomains) { foreach (string text in junkEmailRule.TrustedRecipientDomainCollection) { if (addressHashes.Count >= Configuration.MaxSafeRecipients) { break; } num++; addressHashes.Add(text); JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Adding safe recipient domain {0} to list", text); } if (junkEmailRule.TrustedRecipientDomainCollection.Count != num) { oversized = true; JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <int>((long)this.GetHashCode(), "{0} safe recipient domain entries had to be skipped due to size constraints.", junkEmailRule.TrustedRecipientDomainCollection.Count - num); } } foreach (string text2 in junkEmailRule.TrustedRecipientEmailCollection) { if (addressHashes.Count >= Configuration.MaxSafeRecipients) { break; } num2++; addressHashes.Add(text2); JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Adding safe recipient {0} to list", text2); } if (junkEmailRule.TrustedRecipientEmailCollection.Count != num2) { oversized = true; JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <int>((long)this.GetHashCode(), "{0} safe recipient entries had to be skipped due to size constraints.", junkEmailRule.TrustedRecipientEmailCollection.Count - num2); } byte[] bytes = addressHashes.GetBytes(); if (bytes.Length == 0) { return(null); } return(bytes); }
// Token: 0x06000B4D RID: 2893 RVA: 0x000490DC File Offset: 0x000472DC private byte[] GetBlockedSendersHash(JunkEmailRule junkEmailRule, out bool oversized) { AddressHashes addressHashes = new AddressHashes(); int num = 0; int num2 = 0; oversized = false; foreach (string text in junkEmailRule.BlockedSenderDomainCollection) { if (addressHashes.Count >= Configuration.MaxBlockedSenders) { break; } num++; addressHashes.Add(text); JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Adding blocked sender domain {0} to list", text); } if (junkEmailRule.BlockedSenderDomainCollection.Count != num) { oversized = true; JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <int>((long)this.GetHashCode(), "{0} blocked sender domain entries had to be skipped due to size constraints.", junkEmailRule.BlockedSenderDomainCollection.Count - num); } foreach (string text2 in junkEmailRule.BlockedSenderEmailCollection) { if (addressHashes.Count >= Configuration.MaxBlockedSenders) { break; } num2++; addressHashes.Add(text2); JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Adding blocked sender {0} to list", text2); } if (junkEmailRule.BlockedSenderEmailCollection.Count != num2) { oversized = true; JunkEmailOptionsCommiterAssistant.Tracer.TraceDebug <int>((long)this.GetHashCode(), "{0} blocked sender entries had to be skipped due to size constraints.", junkEmailRule.BlockedSenderEmailCollection.Count - num2); } byte[] bytes = addressHashes.GetBytes(); if (bytes.Length == 0) { return(null); } return(bytes); }
private bool CompareHashes(AddressHashes ssl, ADRecipient recipient, UpdateType type) { byte[] array = null; byte[] array2 = null; switch (type) { case UpdateType.SafeSenders: array2 = recipient.SafeSendersHash; break; case UpdateType.SafeRecipients: array2 = recipient.SafeRecipientsHash; break; case UpdateType.BlockedSenders: array2 = recipient.BlockedSendersHash; break; } if (ssl != null) { array = ssl.GetBytes(); } if (array2 == null) { return(array == null || array.Length == 0); } if (array.Length != array2.Length) { return(false); } for (int i = 0; i < array.Length; i++) { if (array[i] != array2[i]) { return(false); } } return(true); }