private static bool CheckUserEquality(ICorePropertyBag item, StorePropertyDefinition participantPropertyDefinition, IGenericADUser adUser) { Participant participant = item.GetValueOrDefault <Participant>(participantPropertyDefinition, null); if (participant == null) { return(false); } byte[] valueOrDefault = participant.GetValueOrDefault <byte[]>(ParticipantSchema.ParticipantSID); byte[] array = MailboxOwnerAdapter.CalculateEffectiveId(adUser); return((array != null && valueOrDefault != null && ByteArrayComparer.Instance.Equals(valueOrDefault, array)) || StringComparer.OrdinalIgnoreCase.Equals(adUser.LegacyDn, participant.EmailAddress) || StringComparer.OrdinalIgnoreCase.Equals(adUser.PrimarySmtpAddress.ToString(), participant.EmailAddress) || adUser.EmailAddresses.Any((ProxyAddress address) => StringComparer.OrdinalIgnoreCase.Equals(address.AddressString, participant.EmailAddress))); }
public bool SentToMySelf(ICorePropertyBag item) { return(MailboxOwnerAdapter.CheckUserEquality(item, ItemSchema.From, this.User) || MailboxOwnerAdapter.CheckUserEquality(item, ItemSchema.Sender, this.User)); }