Esempio n. 1
0
        private static void RenderMostRecentRecipientEntry(TextWriter writer, RecipientInfoCacheEntry entry)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            ResolvedRecipientDetail resolvedRecipientDetail = new ResolvedRecipientDetail(entry);

            writer.Write("<option title=\"");
            Utilities.HtmlEncode(resolvedRecipientDetail.SmtpAddress, writer);
            writer.Write("\"");
            writer.Write(" value=\"");
            resolvedRecipientDetail.RenderConcatenatedDetails(false, writer);
            writer.Write("\">");
            string text = string.Empty;

            if (!string.IsNullOrEmpty(resolvedRecipientDetail.DisplayName))
            {
                text = resolvedRecipientDetail.DisplayName;
            }
            else if (!string.IsNullOrEmpty(resolvedRecipientDetail.SmtpAddress))
            {
                text = resolvedRecipientDetail.SmtpAddress;
            }
            else if (!string.IsNullOrEmpty(resolvedRecipientDetail.RoutingAddress))
            {
                text = resolvedRecipientDetail.RoutingAddress;
            }
            Utilities.CropAndRenderText(writer, text, 32);
            writer.Write("</option>");
        }
Esempio n. 2
0
        // Token: 0x06002291 RID: 8849 RVA: 0x000C5D04 File Offset: 0x000C3F04
        protected override void RenderMenuItemExpandoData(TextWriter output)
        {
            if (this.recipientCache == null || this.currentMenuItemIndex >= this.recipientCache.CacheLength || this.currentMenuItemIndex >= 10)
            {
                return;
            }
            RecipientInfoCacheEntry recipientInfoCacheEntry = this.recipientCache.CacheEntries[this.currentMenuItemIndex];

            output.Write(" _dn=\"");
            Utilities.HtmlEncode((recipientInfoCacheEntry.DisplayName == null) ? string.Empty : recipientInfoCacheEntry.DisplayName, output);
            output.Write("\" _em=\"");
            Utilities.HtmlEncode((recipientInfoCacheEntry.RoutingAddress == null) ? string.Empty : recipientInfoCacheEntry.RoutingAddress, output);
            output.Write("\" _rt=\"");
            Utilities.HtmlEncode(recipientInfoCacheEntry.RoutingType, output);
            output.Write("\" _sa=\"");
            Utilities.HtmlEncode((recipientInfoCacheEntry.SmtpAddress == null) ? string.Empty : recipientInfoCacheEntry.SmtpAddress, output);
            output.Write("\" _ao=");
            output.Write((int)recipientInfoCacheEntry.AddressOrigin);
            output.Write(" _rf=");
            output.Write(recipientInfoCacheEntry.RecipientFlags);
            output.Write(" _id=\"");
            Utilities.HtmlEncode((recipientInfoCacheEntry.ItemId == null) ? string.Empty : recipientInfoCacheEntry.ItemId, output);
            output.Write("\" _ei=");
            output.Write((int)recipientInfoCacheEntry.EmailAddressIndex);
            output.Write(" _uri=\"");
            Utilities.HtmlEncode((recipientInfoCacheEntry.SipUri == null) ? string.Empty : recipientInfoCacheEntry.SipUri, output);
            output.Write("\" _mo=\"");
            Utilities.HtmlEncode((recipientInfoCacheEntry.MobilePhoneNumber == null) ? string.Empty : recipientInfoCacheEntry.MobilePhoneNumber, output);
            output.Write("\"");
        }
Esempio n. 3
0
 public static void RenderEntryJavascript(TextWriter writer, RecipientInfoCacheEntry entry)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     writer.Write("new Recip('");
     Utilities.JavascriptEncode((entry.DisplayName == null) ? string.Empty : entry.DisplayName, writer);
     writer.Write("','");
     Utilities.JavascriptEncode((entry.RoutingAddress == null) ? string.Empty : entry.RoutingAddress, writer);
     writer.Write("','");
     Utilities.JavascriptEncode((entry.SmtpAddress == null) ? string.Empty : entry.SmtpAddress, writer);
     writer.Write("','");
     Utilities.JavascriptEncode((entry.Alias == null) ? string.Empty : entry.Alias, writer);
     writer.Write("','");
     Utilities.JavascriptEncode(entry.RoutingType, writer);
     writer.Write("',{0},'", (int)entry.AddressOrigin);
     Utilities.JavascriptEncode((entry.ItemId == null) ? string.Empty : entry.ItemId, writer);
     writer.Write("',{0},", entry.RecipientFlags);
     writer.Write("{0},'", (int)entry.EmailAddressIndex);
     Utilities.JavascriptEncode((entry.SipUri == null) ? string.Empty : entry.SipUri, writer);
     writer.Write("','");
     Utilities.JavascriptEncode((entry.MobilePhoneNumber == null) ? string.Empty : entry.MobilePhoneNumber, writer);
     writer.Write("')");
 }
 // Token: 0x0600138B RID: 5003 RVA: 0x000708EF File Offset: 0x0006EAEF
 public override void Bind(RecipientInfoCacheEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException("Entry is null!");
     }
     this.entry = entry;
 }
Esempio n. 5
0
        private void OnPromotedMessageHandler(StoreDriverEventSource source, StoreDriverDeliveryEventArgs args)
        {
            StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = args as StoreDriverDeliveryEventArgsImpl;

            if (storeDriverDeliveryEventArgsImpl.IsPublicFolderRecipient || !ObjectClass.IsSmsMessage(storeDriverDeliveryEventArgsImpl.MessageClass))
            {
                return;
            }
            SmsDeliveryAgent.Tracer.TraceDebug((long)this.GetHashCode(), "Processing incoming message");
            Stopwatch stopwatch = Stopwatch.StartNew();

            try
            {
                MimePart rootPart = storeDriverDeliveryEventArgsImpl.MailItem.Message.RootPart;
                Header   header   = rootPart.Headers.FindFirst("X-MS-Reply-To-Mobile");
                if (header == null || string.IsNullOrEmpty(header.Value))
                {
                    SmsDeliveryAgent.Tracer.TraceDebug <string>((long)this.GetHashCode(), "There's no {0} header or the header value is empty in MimePart of the inbound SMS message", "X-MS-Reply-To-Mobile");
                }
                else
                {
                    string value       = header.Value;
                    string displayName = value;
                    using (SmsRecipientInfoCache smsRecipientInfoCache = new SmsRecipientInfoCache(storeDriverDeliveryEventArgsImpl.MailboxSession, SmsDeliveryAgent.Tracer))
                    {
                        RecipientInfoCacheEntry recipientInfoCacheEntry = smsRecipientInfoCache.LookUp(value);
                        if (recipientInfoCacheEntry != null)
                        {
                            displayName = recipientInfoCacheEntry.DisplayName;
                        }
                    }
                    storeDriverDeliveryEventArgsImpl.ReplayItem.From = new Participant(displayName, value, "MOBILE");
                    SmsDeliveryAgent.Tracer.TraceDebug((long)this.GetHashCode(), "Found entry from SMS recipient which matches");
                    string text = storeDriverDeliveryEventArgsImpl.ReplayItem.Body.GetPartialTextBody(160);
                    if (!string.IsNullOrEmpty(text))
                    {
                        text = text.Replace("\r\n", " ").Trim();
                    }
                    storeDriverDeliveryEventArgsImpl.ReplayItem.Subject = (text ?? string.Empty);
                }
            }
            finally
            {
                stopwatch.Stop();
                MSExchangeInboundSmsDelivery.MessageReceived.Increment();
                if (MSExchangeInboundSmsDelivery.MaximumMessageProcessingTime.RawValue < stopwatch.ElapsedMilliseconds)
                {
                    MSExchangeInboundSmsDelivery.MaximumMessageProcessingTime.RawValue = stopwatch.ElapsedMilliseconds;
                }
                SmsDeliveryAgent.averageMessageProcessingTime.Update(stopwatch.ElapsedMilliseconds);
                SmsDeliveryAgent.Tracer.TraceDebug <long>((long)this.GetHashCode(), "Exiting ConversationsProcessing.ProcessMessage.  Total execution time = {0} ms.", stopwatch.ElapsedMilliseconds);
            }
        }
 public override void AddEntry(RecipientInfoCacheEntry newEntry)
 {
     base.AddEntry(newEntry);
     if (0 < (newEntry.RecipientFlags & 2))
     {
         RecipientCache recipientCache = RoomsCache.TryGetCache(base.UserContext);
         if (recipientCache != null)
         {
             recipientCache.AddEntry(newEntry);
         }
     }
 }
Esempio n. 7
0
 // Token: 0x06001382 RID: 4994 RVA: 0x00070698 File Offset: 0x0006E898
 public override void Bind(RecipientInfoCacheEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException("Entry is null!");
     }
     foreach (IProperty property in this.propertyFromSchemaLinkId)
     {
         RecipientInfoCacheProperty recipientInfoCacheProperty = (RecipientInfoCacheProperty)property;
         recipientInfoCacheProperty.Bind(entry);
     }
 }
        public override void ConvertServerToClientObject(ISyncItem syncItem, XmlNode airSyncParentNode, SyncOperation changeObject, GlobalInfo globalInfo)
        {
            RecipientInfoCacheEntry entry = (RecipientInfoCacheEntry)syncItem.NativeItem;

            this.recipientInfoCacheDataObject.Bind(entry);
            base.AirSyncDataObject.Bind(airSyncParentNode);
            base.AirSyncDataObject.CopyFrom(this.recipientInfoCacheDataObject);
            base.AirSyncDataObject.Unbind();
            if (changeObject != null && (changeObject.ChangeType == ChangeType.Add || changeObject.ChangeType == ChangeType.Change))
            {
                changeObject.ChangeTrackingInformation = base.ChangeTrackFilter.Filter(airSyncParentNode, changeObject.ChangeTrackingInformation);
            }
            if (changeObject != null && (changeObject.ChangeType == ChangeType.Add || changeObject.ChangeType == ChangeType.Change))
            {
                base.HasAddsOrChangesToReturnToClientImmediately = true;
            }
            base.HasServerChanges = true;
        }
        public void GetSendFromCache()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.GetSendFromCache");
            RecipientInfoCacheEntry entry = AutoCompleteCacheEntry.ParseLogonExchangePrincipal(base.OwaContext.UserContext.ExchangePrincipal, base.OwaContext.UserContext.SipUri, base.OwaContext.UserContext.MobilePhoneNumber);

            AutoCompleteCacheEntry.RenderEntryJavascript(this.Writer, entry);
            this.Writer.Write(";");
            SubscriptionCache cache = SubscriptionCache.GetCache(base.OwaContext.UserContext);

            cache.RenderToJavascript(this.Writer);
            this.Writer.Write(";");
            SendFromCache sendFromCache = SendFromCache.TryGetCache(base.OwaContext.UserContext);

            if (sendFromCache != null)
            {
                sendFromCache.Sort();
                sendFromCache.RenderToJavascript(this.Writer);
            }
        }
Esempio n. 10
0
        private void UpdateEntry(RecipientInfoCacheEntry newEntry, int oldEntryIndex)
        {
            RecipientInfoCacheEntry recipientInfoCacheEntry = this.cacheEntries[oldEntryIndex];

            recipientInfoCacheEntry.IncrementUsage();
            recipientInfoCacheEntry.SetSessionFlag();
            if (!string.Equals(newEntry.DisplayName, newEntry.RoutingAddress))
            {
                recipientInfoCacheEntry.DisplayName = newEntry.DisplayName;
            }
            if (newEntry.Alias.Length > 0)
            {
                recipientInfoCacheEntry.Alias = newEntry.Alias;
            }
            recipientInfoCacheEntry.RoutingType       = newEntry.RoutingType;
            recipientInfoCacheEntry.ItemId            = newEntry.ItemId;
            recipientInfoCacheEntry.EmailAddressIndex = newEntry.EmailAddressIndex;
            recipientInfoCacheEntry.AddressOrigin     = newEntry.AddressOrigin;
            recipientInfoCacheEntry.SipUri            = newEntry.SipUri;
            recipientInfoCacheEntry.MobilePhoneNumber = newEntry.MobilePhoneNumber;
        }
Esempio n. 11
0
        public virtual void AddEntry(RecipientInfoCacheEntry newEntry)
        {
            if (newEntry == null)
            {
                throw new ArgumentNullException("newEntry");
            }
            int num;

            if (Utilities.IsMapiPDL(newEntry.RoutingType))
            {
                num = this.GetEntryIndexByItemId(newEntry.ItemId);
            }
            else
            {
                num = this.GetEntryIndexByEmail(newEntry.RoutingAddress);
            }
            int num2;

            if (num == -1)
            {
                if (this.cacheEntries.Count >= (int)this.cacheSize)
                {
                    num2 = this.GetLeastPriorityEntryIndex();
                    this.cacheEntries[num2] = newEntry;
                }
                else
                {
                    num2 = this.cacheEntries.Count;
                    this.cacheEntries.Add(newEntry);
                }
                newEntry.SetSessionFlag();
            }
            else
            {
                num2 = num;
                this.UpdateEntry(newEntry, num2);
            }
            this.cacheEntries[num2].UpdateTimeStamp();
            this.isDirty = true;
        }
Esempio n. 12
0
        public static void UpdateAutoCompleteCacheFromRecipientInfoList(RecipientInfoAC[] entries, UserContext userContext)
        {
            if (entries == null)
            {
                throw new ArgumentNullException("entries");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            AutoCompleteCache autoCompleteCache = AutoCompleteCache.TryGetCache(userContext);

            if (autoCompleteCache != null)
            {
                for (int i = 0; i < entries.Length; i++)
                {
                    RecipientInfoCacheEntry recipientInfoCacheEntry = AutoCompleteCacheEntry.ParseClientEntry(entries[i]);
                    if (recipientInfoCacheEntry != null)
                    {
                        autoCompleteCache.AddEntry(recipientInfoCacheEntry);
                    }
                }
            }
        }
 // Token: 0x0600137C RID: 4988
 public abstract void Bind(RecipientInfoCacheEntry entry);
 public static RecipientInfoCacheSyncItem Bind(RecipientInfoCacheEntry item)
 {
     return(new RecipientInfoCacheSyncItem(item));
 }
 private RecipientInfoCacheSyncItem(RecipientInfoCacheEntry item)
 {
     this.disposeTracker = this.GetDisposeTracker();
     this.item           = item;
 }
 public void Get()
 {
     ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ClientCacheEventHandler.Get");
     base.ResponseContentType = OwaEventContentType.Javascript;
     this.Writer.WriteLine("{");
     this.Writer.Write("sAcc : \"");
     using (RecipientWellEventHandler recipientWellObject = new RecipientWellEventHandler())
     {
         RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
         {
             using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
             {
                 recipientWellObject.GetCache(textWriter, this.OwaContext, this.UserContext);
                 Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
             }
         }, this.GetHashCode());
     }
     this.Writer.WriteLine("\",");
     this.Writer.Write("sPr : \"");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         RecipientInfoCacheEntry entry = AutoCompleteCacheEntry.ParseLogonExchangePrincipal(base.UserContext.ExchangePrincipal, base.UserContext.SipUri, base.UserContext.MobilePhoneNumber);
         using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
         {
             AutoCompleteCacheEntry.RenderEntryJavascript(textWriter, entry);
             Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
         }
     }, this.GetHashCode());
     this.Writer.WriteLine("\",");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         SubscriptionCache cache = SubscriptionCache.GetCache(base.UserContext);
         SendAddressDefaultSetting sendAddressDefaultSetting = new SendAddressDefaultSetting(base.UserContext);
         SubscriptionCacheEntry subscriptionCacheEntry;
         if (cache.TryGetSendAsDefaultEntry(sendAddressDefaultSetting, out subscriptionCacheEntry))
         {
             this.Writer.Write("sDfltFr : \"");
             using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
             {
                 subscriptionCacheEntry.RenderToJavascript(textWriter);
                 Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
             }
             this.Writer.WriteLine("\",");
         }
     }, this.GetHashCode());
     this.Writer.Write("sSc : \"");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         SubscriptionCache cache = SubscriptionCache.GetCache(base.UserContext);
         using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
         {
             cache.RenderToJavascript(textWriter);
             Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
         }
     }, this.GetHashCode());
     this.Writer.WriteLine("\",");
     this.Writer.Write("sMruc : \"");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         SendFromCache sendFromCache = SendFromCache.TryGetCache(base.UserContext);
         if (sendFromCache != null)
         {
             using (TextWriter textWriter = new StringWriter())
             {
                 sendFromCache.RenderToJavascript(textWriter);
                 Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
             }
         }
     }, this.GetHashCode());
     this.Writer.WriteLine("\",");
     this.Writer.Write("sLng : '");
     Utilities.JavascriptEncode(base.UserContext.UserCulture.Name, this.Writer);
     this.Writer.WriteLine("',");
     this.Writer.Write("iThmId : ");
     this.Writer.Write(ThemeManager.GetIdFromStorageId(base.UserContext.UserOptions.ThemeStorageId));
     this.Writer.WriteLine(",");
     this.Writer.Write("sSigHtml : '");
     RenderingUtilities.RenderSignature(this.Writer, base.UserContext, true);
     this.Writer.WriteLine("',");
     this.Writer.Write("sSigTxt : '");
     RenderingUtilities.RenderSignature(this.Writer, base.UserContext, false);
     this.Writer.WriteLine("',");
     this.Writer.Write("fSig : ");
     this.Writer.Write((base.UserContext.IsFeatureEnabled(Feature.Signature) && base.UserContext.UserOptions.AutoAddSignature) ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fSp : '");
     this.Writer.Write(base.UserContext.IsFeatureEnabled(Feature.SpellChecker));
     this.Writer.WriteLine("',");
     this.Writer.Write("iSp : '");
     this.Writer.Write(base.UserContext.UserOptions.SpellingDictionaryLanguage);
     this.Writer.WriteLine("',");
     this.Writer.Write("fSpSn : ");
     this.Writer.Write(base.UserContext.UserOptions.SpellingCheckBeforeSend ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("iFmtBrSt : ");
     this.Writer.Write((int)base.UserContext.UserOptions.FormatBarState);
     this.Writer.WriteLine(",");
     this.Writer.Write("sMruFnts : '");
     Utilities.JavascriptEncode(base.UserContext.UserOptions.MruFonts, this.Writer);
     this.Writer.WriteLine("',");
     this.Writer.Write("sInitFntNm : '");
     Utilities.JavascriptEncode(base.UserContext.UserOptions.ComposeFontName, this.Writer);
     this.Writer.WriteLine("',");
     this.Writer.Write("sInitFntSz : '");
     this.Writer.Write(base.UserContext.UserOptions.ComposeFontSize);
     this.Writer.WriteLine("',");
     this.Writer.Write("sDefFntStyl : '");
     RenderingUtilities.RenderDefaultFontStyle(this.Writer, base.UserContext);
     this.Writer.WriteLine("',");
     this.Writer.Write("fDefFntBold : ");
     this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Bold));
     this.Writer.WriteLine(",");
     this.Writer.Write("fDefFntItalc : ");
     this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Italic));
     this.Writer.WriteLine(",");
     this.Writer.Write("fDefFntUndl : ");
     this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Underline));
     this.Writer.WriteLine(",");
     this.Writer.Write("fTxt : ");
     this.Writer.Write((int)base.UserContext.UserOptions.ComposeMarkup);
     this.Writer.WriteLine(",");
     this.Writer.Write("fShwBcc : ");
     this.Writer.Write(base.UserContext.UserOptions.AlwaysShowBcc ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fShwFrm : ");
     this.Writer.Write(base.UserContext.UserOptions.AlwaysShowFrom ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fAEnc : ");
     this.Writer.Write(OwaRegistryKeys.AlwaysEncrypt ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fASgn : ");
     this.Writer.Write(OwaRegistryKeys.AlwaysSign ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fSgn : ");
     this.Writer.Write(base.UserContext.UserOptions.SmimeSign ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fEnc : ");
     this.Writer.Write(base.UserContext.UserOptions.SmimeEncrypt ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fMstUpd : ");
     this.Writer.WriteLine(OwaRegistryKeys.ForceSMimeClientUpgrade ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("oMailTipsConfig : {");
     this.Writer.Write("'fHideByDefault' : ");
     this.Writer.Write(base.UserContext.UserOptions.HideMailTipsByDefault ? 1 : 0);
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(base.UserContext.ExchangePrincipal.MailboxInfo.OrganizationId, CachedOrganizationConfiguration.ConfigurationTypes.All);
         this.Writer.Write(",");
         this.Writer.Write("'fEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsAllTipsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'fMailboxEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsMailboxSourcedTipsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'fGroupMetricsEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsGroupMetricsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'fExternalEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsExternalRecipientsTipsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'iLargeAudienceThreshold' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsLargeAudienceThreshold);
     }, this.GetHashCode());
     this.Writer.Write("}");
     this.Writer.Write("}");
 }
Esempio n. 17
0
 public ResolvedRecipientDetail(RecipientInfoCacheEntry recipientInfoCacheEntry) : this(recipientInfoCacheEntry.SmtpAddress, recipientInfoCacheEntry.RoutingAddress, recipientInfoCacheEntry.DisplayName, recipientInfoCacheEntry.RoutingType, recipientInfoCacheEntry.AddressOrigin, recipientInfoCacheEntry.RecipientFlags, recipientInfoCacheEntry.ItemId, recipientInfoCacheEntry.EmailAddressIndex)
 {
 }
Esempio n. 18
0
        public void RenderToJavascript(TextWriter writer)
        {
            RecipientInfoCacheEntry entry = new RecipientInfoCacheEntry(this.displayName, this.address, this.address, null, "SMTP", AddressOrigin.OneOff, 0, null, EmailAddressIndex.None, null, null);

            AutoCompleteCacheEntry.RenderEntryJavascript(writer, entry);
        }
        private void ProcessMessageRequest(MessageAction action)
        {
            bool        flag        = false;
            MessageItem messageItem = null;
            bool        flag2       = base.IsParameterSet("Id");
            bool        flag3       = false;

            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
            }
            try
            {
                messageItem = this.GetMessageItem(flag2);
                base.SaveHideMailTipsByDefault();
                switch (action)
                {
                case MessageAction.Send:
                case MessageAction.Save:
                {
                    StoreObjectType storeObjectType = StoreObjectType.Message;
                    if (ObjectClass.IsMeetingRequest(messageItem.ClassName) || ObjectClass.IsMeetingCancellation(messageItem.ClassName) || ObjectClass.IsMeetingResponse(messageItem.ClassName))
                    {
                        storeObjectType = StoreObjectType.MeetingMessage;
                    }
                    flag = base.UpdateMessage(messageItem, storeObjectType);
                    break;
                }

                case MessageAction.SendMime:
                case MessageAction.SaveMime:
                    this.ImportMessageMime(messageItem);
                    flag3 = (base.IsParameterSet("SavToSnt") && !(bool)base.GetParameter("SavToSnt"));
                    if (action == MessageAction.SendMime && base.IsParameterSet("Encrypted") && (bool)base.GetParameter("Encrypted") && base.IsParameterSet("DavSubmitData"))
                    {
                        messageItem[MessageItemSchema.DavSubmitData] = (string)base.GetParameter("DavSubmitData");
                    }
                    else
                    {
                        base.UpdateRecipients(messageItem);
                    }
                    break;
                }
                if (action == MessageAction.Save || action == MessageAction.SaveMime)
                {
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Saving message");
                    Utilities.SaveItem(messageItem, flag2);
                    base.WriteIdAndChangeKey(messageItem, flag2);
                    if (!flag2 && ExTraceGlobals.MailDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        ExTraceGlobals.MailDataTracer.TraceDebug <string>((long)this.GetHashCode(), "EditMessageEventHandler.ProcessMessageRequest - New message ID is '{0}'", messageItem.Id.ObjectId.ToBase64String());
                    }
                }
                else if (action == MessageAction.Send || action == MessageAction.SendMime)
                {
                    if (flag)
                    {
                        throw new OwaEventHandlerException("Unresolved recipients", LocalizedStrings.GetNonEncoded(2063734279));
                    }
                    RightsManagedMessageItem rightsManagedMessageItem = messageItem as RightsManagedMessageItem;
                    bool flag4 = rightsManagedMessageItem != null && rightsManagedMessageItem.Restriction != null;
                    if (messageItem.Recipients.Count == 0 && (action == MessageAction.Send || action != MessageAction.SendMime || !base.IsParameterSet("Encrypted") || !(bool)base.GetParameter("Encrypted")))
                    {
                        throw new OwaEventHandlerException("No recipients", LocalizedStrings.GetNonEncoded(1878192149));
                    }
                    if (Utilities.RecipientsOnlyHaveEmptyPDL <Recipient>(base.UserContext, messageItem.Recipients))
                    {
                        base.RenderPartialFailure(1389137820);
                    }
                    else
                    {
                        ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Sending message");
                        try
                        {
                            if (flag3)
                            {
                                messageItem.SendWithoutSavingMessage();
                            }
                            else
                            {
                                messageItem.Send();
                            }
                            if (null != base.FromParticipant)
                            {
                                Participant v = new Participant(base.UserContext.ExchangePrincipal);
                                if (!base.FromParticipant.AreAddressesEqual(v))
                                {
                                    RecipientInfoCacheEntry fromRecipientEntry = base.GetFromRecipientEntry(base.FromParticipant.EmailAddress);
                                    if (fromRecipientEntry != null)
                                    {
                                        RecipientCache recipientCache = SendFromCache.TryGetCache(base.UserContext);
                                        if (recipientCache != null)
                                        {
                                            recipientCache.AddEntry(fromRecipientEntry);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ExTraceGlobals.MailDataTracer.TraceError <string>((long)this.GetHashCode(), "EditMessageEventHandler.ProcessMessageRequestmessage - Exception: {0}", ex.Message);
                            if (Utilities.ShouldSendChangeKeyForException(ex))
                            {
                                ExTraceGlobals.MailDataTracer.TraceDebug <string>((long)this.GetHashCode(), "EditMessageEventHandler.ProcessMessageRequestmessage attempt to send change key on exception: {0}", ex.Message);
                                base.SaveIdAndChangeKeyInCustomErrorInfo(messageItem);
                            }
                            throw;
                        }
                        if (Globals.ArePerfCountersEnabled)
                        {
                            OwaSingleCounters.MessagesSent.Increment();
                            if (flag4)
                            {
                                OwaSingleCounters.IRMMessagesSent.Increment();
                            }
                        }
                    }
                }
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
        }