Esempio n. 1
0
        // Token: 0x060004C5 RID: 1221 RVA: 0x00027B38 File Offset: 0x00025D38
        private void RenderMrr(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(base.OwaContext.UserContext, false);

            if (recipientCache != null)
            {
                recipientCache.SortByDisplayName();
                writer.Write("<tr><td class=\"lt\">");
                MRRSelect.Render(MRRSelect.Type.CalendarRecipients, recipientCache, writer);
                writer.Write("</td></tr>");
            }
            RecipientCache recipientCache2 = RoomsCache.TryGetCache(base.OwaContext.UserContext, false);

            if (recipientCache2 != null)
            {
                recipientCache2.SortByDisplayName();
                writer.Write("<tr><td class=\"lt\">");
                MRRSelect.Render(MRRSelect.Type.Resources, recipientCache2, writer);
                writer.Write("</td></tr>");
            }
        }
Esempio n. 2
0
        protected bool GetExchangeParticipantsFromRecipientInfo(RecipientInfo recipientInfo, List <Participant> exchangeParticipants)
        {
            bool        flag = false;
            Participant item = null;

            this.AnrOptions.ResolveContactsFirst = base.UserContext.UserOptions.CheckNameInContactsFirst;
            if (recipientInfo.PendingChunk != null)
            {
                RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
                ArrayList      arrayList      = new ArrayList();
                RecipientWell.ResolveAndRenderChunk(this.Writer, recipientInfo.PendingChunk, arrayList, recipientCache, base.UserContext, this.AnrOptions);
                for (int i = 0; i < arrayList.Count; i++)
                {
                    RecipientWellNode recipientWellNode = (RecipientWellNode)arrayList[i];
                    flag |= Utilities.CreateExchangeParticipant(out item, recipientWellNode.DisplayName, recipientWellNode.RoutingAddress, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.StoreObjectId, recipientWellNode.EmailAddressIndex);
                    exchangeParticipants.Add(item);
                }
            }
            else
            {
                flag |= recipientInfo.ToParticipant(out item);
                exchangeParticipants.Add(item);
            }
            return(flag);
        }
        // Token: 0x06002F18 RID: 12056 RVA: 0x0010F830 File Offset: 0x0010DA30
        internal void GetCache(TextWriter writer, OwaContext owaContext, UserContext userContext)
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.GetCache");
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(userContext);

            if (recipientCache != null)
            {
                recipientCache.Sort();
                bool flag = false;
                if (!userContext.IsFeatureEnabled(Feature.Contacts))
                {
                    flag = true;
                }
                bool flag2 = false;
                for (int i = 0; i < recipientCache.CacheLength; i++)
                {
                    if (!flag || recipientCache.CacheEntries[i].AddressOrigin != AddressOrigin.Store)
                    {
                        if (flag2)
                        {
                            writer.Write(",");
                        }
                        flag2 = true;
                        AutoCompleteCacheEntry.RenderEntryJavascript(writer, recipientCache.CacheEntries[i]);
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Loads world data for the specified path &amp; settings file
        /// </summary>
        /// <param name="dataPath">The path to the World directory</param>
        /// <param name="settings">The settings filename</param>
        public bool LoadWorld(string dataPath, string settings)
        {
            HasLoaded = false;
            if (string.IsNullOrEmpty(dataPath) || !Directory.Exists(dataPath))
            {
                return(false);
            }

            Structure = new InternalStructure();
            Structure.SetPath(dataPath);

            Structure.LoadCurrentAndPreviousTwSnapshot(out _villages, out _players, out _tribes);

            if (_villageTypes != null)
            {
                _villageTypes.Close();
            }
            _villageTypes = Structure.CurrentVillageTypes;

            bool settingLoadSuccess = LoadSettingsCore(settings, false);

            if (!settingLoadSuccess)
            {
                return(false);
            }

            Cache = new AutoCompleteCache(_players, _tribes);

            HasLoaded = true;

            EventPublisher.InformLoaded(this, EventArgs.Empty);
            EventPublisher.InformSettingsLoaded(this, EventArgs.Empty);

            return(true);
        }
Esempio n. 5
0
 // Token: 0x06002290 RID: 8848 RVA: 0x000C5CD5 File Offset: 0x000C3ED5
 public FromOfFilterContextMenu(UserContext userContext) : base("divFltrFrmMnu", userContext)
 {
     this.recipientCache = AutoCompleteCache.TryGetCache(userContext);
     if (this.recipientCache != null)
     {
         this.recipientCache.Sort();
     }
 }
 public void UpdateCache()
 {
     ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.UpdateCache");
     RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
     if (array != null && array.Length != 0)
     {
         AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
     }
 }
        public void DeleteFromCache()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.DeleteFromCache");
            string         email          = (string)base.GetParameter("em");
            string         id             = (string)base.GetParameter("id");
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(base.OwaContext.UserContext);

            if (recipientCache != null)
            {
                recipientCache.RemoveEntry(email, id);
            }
        }
Esempio n. 8
0
        private void RenderMostRecentRecipients(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(base.OwaContext.UserContext, false);

            if (recipientCache != null)
            {
                recipientCache.SortByDisplayName();
                MRRSelect.Render(MRRSelect.Type.MessageRecipients, recipientCache, writer);
            }
        }
Esempio n. 9
0
        private World()
        {
            Settings       = new WorldSettings();
            EventPublisher = new Publisher();

            Map      = Map.CreateMap();
            _miniMap = Map.CreateMiniMap(Map);

            _players  = new Dictionary <string, Player>();
            _tribes   = new Dictionary <string, Tribe>();
            _villages = new WorldVillagesCollection();

            Cache = new AutoCompleteCache();
            Views = new ViewsCollection();

            You = new Player();
        }
        // Token: 0x06002F16 RID: 12054 RVA: 0x0010F73C File Offset: 0x0010D93C
        private void ResolveIndividualWell(string name, AnrManager.Options anrOptions)
        {
            string[] array = (string[])base.GetParameter(name);
            if (array == null)
            {
                return;
            }
            anrOptions.ResolveContactsFirst = base.UserContext.UserOptions.CheckNameInContactsFirst;
            if (name == "From")
            {
                anrOptions.ResolveOnlyFromAddressBook = true;
            }
            this.Writer.Write("<div id=\"{0}\">", name);
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);

            for (int i = 0; i < array.Length; i++)
            {
                RecipientWell.ResolveAndRenderChunk(this.Writer, array[i], null, recipientCache, base.UserContext, anrOptions);
            }
            this.Writer.Write("</div>");
        }
Esempio n. 11
0
        public static void AddRecipientsToDraft(string[] ids, Item draft, RecipientItemType type, UserContext userContext)
        {
            if (draft == null)
            {
                throw new ArgumentNullException("draft");
            }
            MessageItem      messageItem      = draft as MessageItem;
            CalendarItemBase calendarItemBase = draft as CalendarItemBase;

            if (messageItem == null && calendarItemBase == null)
            {
                throw new ArgumentException("The draft should be a MessageItem or a CalendarItemBase while it is now a " + draft.GetType().Name);
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("usercontext");
            }
            if (ids == null || ids.Length == 0)
            {
                throw new ArgumentException("ids is null or empty.", "ids");
            }
            IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, userContext);
            SortBy            sortBy           = new SortBy(ADRecipientSchema.DisplayName, SortOrder.Descending);
            RecipientCache    recipientCache   = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);

            for (int i = 0; i < ids.Length; i++)
            {
                Guid          guidFromBase64String = Utilities.GetGuidFromBase64String(ids[i]);
                QueryFilter   filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, guidFromBase64String);
                ADRecipient[] array  = recipientSession.Find(null, QueryScope.SubTree, filter, sortBy, 1);
                if (array != null && array.Length != 0)
                {
                    Participant participant = new Participant(array[0]);
                    if (participant != null)
                    {
                        AddressBookHelper.AddParticipantToItem(draft, type, participant);
                        int recipientFlags = 0;
                        if (draft is CalendarItem && DirectoryAssistance.IsADRecipientRoom(array[0]))
                        {
                            recipientFlags = 2;
                        }
                        if (recipientCache != null && userContext.UserOptions.AddRecipientsToAutoCompleteCache)
                        {
                            string participantProperty = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null);
                            recipientCache.AddEntry(array[0].DisplayName, participantProperty, array[0].LegacyExchangeDN, string.Empty, "EX", AddressOrigin.Directory, recipientFlags, null, EmailAddressIndex.None);
                        }
                    }
                }
            }
            if (recipientCache != null && recipientCache.IsDirty)
            {
                recipientCache.Commit(true);
            }
            if (messageItem != null)
            {
                AddressBookHelper.SaveItem(draft);
                return;
            }
            if (calendarItemBase != null)
            {
                EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
            }
        }
Esempio n. 12
0
        // Token: 0x06002E02 RID: 11778 RVA: 0x00105754 File Offset: 0x00103954
        private void ProcessMessageRequest(MessageAction action)
        {
            MessageItem messageItem = null;
            bool        flag        = base.IsParameterSet("Id");

            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.UserContext);
            }
            try
            {
                if (flag)
                {
                    messageItem = base.GetRequestItem <MessageItem>(new PropertyDefinition[0]);
                }
                else
                {
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "ItemId wasn't set in the request. Creating new message in the drafts folder.");
                    messageItem = MessageItem.Create(base.UserContext.MailboxSession, base.UserContext.DraftsFolderId);
                    messageItem[ItemSchema.ConversationIndexTracking] = true;
                    messageItem.ClassName = "IPM.Note.Mobile.SMS";
                    if (Globals.ArePerfCountersEnabled)
                    {
                        OwaSingleCounters.ItemsCreated.Increment();
                    }
                }
                bool flag2 = base.UpdateMessage(messageItem, StoreObjectType.Message);
                if (base.IsParameterSet("Body"))
                {
                    string text = (string)base.GetParameter("Body");
                    messageItem.Subject = ((text.Length > 160) ? text.Substring(0, 160) : text).Replace("\r\n", " ");
                }
                if (action == MessageAction.Save)
                {
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Saving message");
                    Utilities.SaveItem(messageItem, flag);
                    messageItem.Load();
                    if (!flag)
                    {
                        if (ExTraceGlobals.MailDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                        {
                            ExTraceGlobals.MailDataTracer.TraceDebug <string>((long)this.GetHashCode(), "New message ID is '{0}'", messageItem.Id.ObjectId.ToBase64String());
                        }
                        base.WriteNewItemId(messageItem);
                    }
                    base.WriteChangeKey(messageItem);
                }
                else if (action == MessageAction.Send)
                {
                    if (flag2)
                    {
                        throw new OwaEventHandlerException("Unresolved recipients", LocalizedStrings.GetNonEncoded(2063734279));
                    }
                    if (messageItem.Recipients.Count == 0)
                    {
                        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");
                        messageItem.SetProperties(EditSmsEventHandler.propertiesDeliveryStatusForNewMessage, EditSmsEventHandler.propertyValuesDeliveryStatusForNewMessage);
                        try
                        {
                            messageItem.Send();
                        }
                        catch (Exception exception)
                        {
                            if (Utilities.ShouldSendChangeKeyForException(exception))
                            {
                                messageItem.Load();
                                if (!flag && ExTraceGlobals.MailDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                                {
                                    ExTraceGlobals.MailDataTracer.TraceDebug <string>((long)this.GetHashCode(), "New message ID is '{0}'", messageItem.Id.ObjectId.ToBase64String());
                                }
                                base.SaveIdAndChangeKeyInCustomErrorInfo(messageItem);
                            }
                            throw;
                        }
                        if (Globals.ArePerfCountersEnabled)
                        {
                            OwaSingleCounters.MessagesSent.Increment();
                        }
                    }
                }
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
        }
        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;
                }
            }
        }
Esempio n. 14
0
        public void OpenOtherUserFolder()
        {
            base.ThrowIfCannotActAsOwner();
            if (base.UserContext.IsExplicitLogon)
            {
                throw new OwaInvalidRequestException("Cannot open other's folder in explict logon mode");
            }
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");

            if (navigationNodeGroupSection == NavigationNodeGroupSection.Contacts || navigationNodeGroupSection == NavigationNodeGroupSection.Tasks)
            {
                throw new OwaInvalidRequestException("Cannot open other's contacts/tasks folder");
            }
            DefaultFolderType defaultFolderType;

            switch (navigationNodeGroupSection)
            {
            case NavigationNodeGroupSection.Mail:
                defaultFolderType = DefaultFolderType.Inbox;
                break;

            case NavigationNodeGroupSection.Calendar:
                defaultFolderType = DefaultFolderType.Calendar;
                break;

            case NavigationNodeGroupSection.Contacts:
                defaultFolderType = DefaultFolderType.Contacts;
                break;

            case NavigationNodeGroupSection.Tasks:
                defaultFolderType = DefaultFolderType.Tasks;
                break;

            default:
                throw new OwaInvalidRequestException("Invalid group section: " + navigationNodeGroupSection.ToString());
            }
            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
            }
            if (defaultFolderType != DefaultFolderType.Calendar)
            {
                Folder folder = null;
                if (base.IsParameterSet("RCP"))
                {
                    RecipientInfoAC   recipientInfoAC   = (RecipientInfoAC)base.GetParameter("RCP");
                    ExchangePrincipal exchangePrincipal = null;
                    if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(recipientInfoAC.RoutingAddress, out exchangePrincipal))
                    {
                        if (string.Equals(base.UserContext.MailboxSession.MailboxOwnerLegacyDN, exchangePrincipal.LegacyDn, StringComparison.OrdinalIgnoreCase))
                        {
                            throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                        }
                        folder = this.GetOtherUserFolder(exchangePrincipal, defaultFolderType);
                    }
                }
                else
                {
                    if (!base.IsParameterSet("Id"))
                    {
                        throw new OwaInvalidRequestException("Must specific one of recipient and folder Id.");
                    }
                    OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
                    if (!owaStoreObjectId.IsOtherMailbox)
                    {
                        throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                    }
                    folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, FolderList.FolderTreeQueryProperties);
                }
                try
                {
                    if (folder == null || !Utilities.CanReadItemInFolder(folder))
                    {
                        Strings.IDs localizedId = 1414246128;
                        switch (navigationNodeGroupSection)
                        {
                        case NavigationNodeGroupSection.Mail:
                            localizedId = -236167850;
                            break;

                        case NavigationNodeGroupSection.Contacts:
                            localizedId = -1505241540;
                            break;

                        case NavigationNodeGroupSection.Tasks:
                            localizedId = -65263937;
                            break;
                        }
                        throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(995407892), LocalizedStrings.GetNonEncoded(localizedId), true);
                    }
                    MailboxSession mailboxSession = folder.Session as MailboxSession;
                    if (navigationNodeGroupSection == NavigationNodeGroupSection.Mail)
                    {
                        OtherMailboxConfigEntry otherMailboxConfigEntry = OtherMailboxConfiguration.AddOtherMailboxSession(base.UserContext, mailboxSession);
                        if (otherMailboxConfigEntry != null)
                        {
                            NavigationHost.RenderOtherMailboxFolderTree(this.Writer, base.UserContext, otherMailboxConfigEntry, true);
                        }
                    }
                    else
                    {
                        NavigationNodeCollection.AddNonMailFolderToSharedFoldersGroup(base.UserContext, folder, navigationNodeGroupSection);
                        OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromStoreObject(folder);
                        NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, owaStoreObjectId2, new NavigationNodeGroupSection[]
                        {
                            navigationNodeGroupSection
                        });
                        this.RenderOpenOtherUserFolderReponse(folder.ClassName, owaStoreObjectId2);
                    }
                }
                finally
                {
                    if (folder != null)
                    {
                        folder.Dispose();
                    }
                }
                return;
            }
            if (!base.IsParameterSet("RCP"))
            {
                throw new OwaInvalidRequestException("Recipient is missing for open other user's calendar request");
            }
            this.OpenOtherUserCalendar((RecipientInfoAC)base.GetParameter("RCP"));
        }
Esempio n. 15
0
        public static void AddContactsToDraft(Item draft, RecipientItemType type, UserContext userContext, params string[] ids)
        {
            if (draft == null)
            {
                throw new ArgumentNullException("draft");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("usercontext");
            }
            if (ids == null || ids.Length == 0)
            {
                throw new ArgumentException("ids is null or empty.", "ids");
            }
            Participant    participant    = null;
            RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
            int            i = 0;

            while (i < ids.Length)
            {
                StoreObjectId storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, ids[i]);
                if (storeObjectId.ObjectType == StoreObjectType.DistributionList)
                {
                    using (DistributionList item = Utilities.GetItem <DistributionList>(userContext, storeObjectId, new PropertyDefinition[]
                    {
                        StoreObjectSchema.DisplayName
                    }))
                    {
                        participant = item.GetAsParticipant();
                        goto IL_113;
                    }
                    goto IL_9B;
                }
                goto IL_9B;
IL_113:
                if (participant != null)
                {
                    if (recipientCache != null && userContext.UserOptions.AddRecipientsToAutoCompleteCache)
                    {
                        string participantProperty = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null);
                        recipientCache.AddEntry(participant.DisplayName, participantProperty, participant.EmailAddress, string.Empty, participant.RoutingType, AddressOrigin.Store, 0, storeObjectId.ToBase64String(), ((StoreParticipantOrigin)participant.Origin).EmailAddressIndex);
                    }
                    AddressBookHelper.AddParticipantToItem(draft, type, participant);
                    participant = null;
                }
                i++;
                continue;
IL_9B:
                using (Contact item2 = Utilities.GetItem <Contact>(userContext, storeObjectId, AddressBookHelper.contactsProperties))
                {
                    foreach (KeyValuePair <EmailAddressIndex, Participant> keyValuePair in item2.EmailAddresses)
                    {
                        if (keyValuePair.Value != null && !string.IsNullOrEmpty(keyValuePair.Value.EmailAddress))
                        {
                            participant = keyValuePair.Value;
                            break;
                        }
                    }
                }
                goto IL_113;
            }
            if (recipientCache != null && recipientCache.IsDirty)
            {
                recipientCache.Commit(true);
            }
            CalendarItemBase calendarItemBase = draft as CalendarItemBase;

            if (calendarItemBase != null)
            {
                EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                return;
            }
            if (draft is MessageItem)
            {
                AddressBookHelper.SaveItem(draft);
            }
        }
Esempio n. 16
0
        private void ProcessMessageRequest(MessageAction action)
        {
            SharingMessageItem sharingMessageItem = null;
            bool flag = false;

            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
            }
            SharingMessageItem requestItem;

            sharingMessageItem = (requestItem = base.GetRequestItem <SharingMessageItem>(new PropertyDefinition[0]));
            try
            {
                if (!sharingMessageItem.IsPublishing && (sharingMessageItem.SharingMessageType.IsInvitationOrAcceptOfRequest || sharingMessageItem.SharingMessageType.IsRequest))
                {
                    SharingLevel level = this.UpdateInviteOrRequestProperties(sharingMessageItem);
                    this.SetSharingLevel(sharingMessageItem, level);
                }
                bool flag2 = base.UpdateMessage(sharingMessageItem, StoreObjectType.Message);
                if (action == MessageAction.Save)
                {
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Saving Sharing message");
                    Utilities.SaveItem(sharingMessageItem, true);
                    this.RenderChangeKey(sharingMessageItem);
                }
                else if (action == MessageAction.Send)
                {
                    if (flag2)
                    {
                        throw new OwaEventHandlerException("Unresolved recipients", LocalizedStrings.GetNonEncoded(2063734279));
                    }
                    if (sharingMessageItem.Recipients.Count == 0 && action == MessageAction.Send)
                    {
                        throw new OwaEventHandlerException("No recipients", LocalizedStrings.GetNonEncoded(1878192149));
                    }
                    if (Utilities.RecipientsOnlyHaveEmptyPDL <Recipient>(base.UserContext, sharingMessageItem.Recipients))
                    {
                        base.RenderPartialFailure(1389137820);
                        return;
                    }
                    ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "Sending sharing message");
                    bool flag3 = false;
                    if (base.IsParameterSet("ForceSend"))
                    {
                        flag3 = (bool)base.GetParameter("ForceSend");
                    }
                    sharingMessageItem.SetSubmitFlags(flag3 ? SharingSubmitFlags.Auto : SharingSubmitFlags.None);
                    try
                    {
                        if (flag)
                        {
                            sharingMessageItem.SendWithoutSavingMessage();
                        }
                        else
                        {
                            sharingMessageItem.Send();
                        }
                    }
                    catch (ObjectNotFoundException e)
                    {
                        this.SendIdAndChangeKeyToClientOnError(sharingMessageItem, e);
                        this.SanitizingWriter.Write("<p id=\"err\" _msg=\"");
                        this.SanitizingWriter.Write(LocalizedStrings.GetNonEncoded(-1608187286), sharingMessageItem.SharedFolderName);
                        this.SanitizingWriter.Write("\"");
                        this.SanitizingWriter.Write(" _shareErr=\"");
                        this.SanitizingWriter.Write(1);
                        this.SanitizingWriter.Write("\"></p>");
                    }
                    catch (InvalidSharingRecipientsException ex)
                    {
                        this.SendIdAndChangeKeyToClientOnError(sharingMessageItem, ex);
                        this.SanitizingWriter.Write("<div id=\"err\" _msg=\"\" _shareErr=\"");
                        SharingPolicy sharingPolicy = DirectoryHelper.ReadSharingPolicy(base.UserContext.MailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, base.UserContext.MailboxSession.MailboxOwner.MailboxInfo.IsArchive, base.UserContext.MailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid));
                        if (sharingPolicy != null && sharingPolicy.IsAllowedForAnonymousCalendarSharing() && ex.InvalidRecipientsResolution != null)
                        {
                            switch (ex.InvalidRecipientsResolution.Resolution)
                            {
                            case InvalidSharingRecipientsResolutionType.PublishAndTryAgain:
                                this.SanitizingWriter.Write(3);
                                this.SanitizingWriter.Write("\" _folderId=\"");
                                this.SanitizingWriter.Write(ex.InvalidRecipientsResolution.FolderId);
                                this.SanitizingWriter.Write("\">");
                                this.RenderPublishAndTryAgainDialog(ex);
                                break;

                            case InvalidSharingRecipientsResolutionType.SendPublishLinks:
                                this.SanitizingWriter.Write(4);
                                this.SanitizingWriter.Write("\">");
                                this.RenderSendPublishLinksDialog(ex);
                                break;

                            default:
                                throw;
                            }
                        }
                        else
                        {
                            this.SanitizingWriter.Write(2);
                            this.SanitizingWriter.Write("\">");
                            this.RenderInvalidRecipientsDialog(ex);
                        }
                        this.SanitizingWriter.Write("</div>");
                    }
                    catch (Exception e2)
                    {
                        this.SendIdAndChangeKeyToClientOnError(sharingMessageItem, e2);
                        throw;
                    }
                    if (Globals.ArePerfCountersEnabled)
                    {
                        OwaSingleCounters.MessagesSent.Increment();
                    }
                }
                RenderingUtilities.RenderNavigationTreeDirtyFlag(this.Writer, base.UserContext, NavigationTreeDirtyFlag.Calendar, new NavigationModule[]
                {
                    NavigationModule.Calendar
                });
            }
            finally
            {
                if (requestItem != null)
                {
                    ((IDisposable)requestItem).Dispose();
                }
            }
        }
		// Token: 0x060002EB RID: 747 RVA: 0x00019444 File Offset: 0x00017644
		private void CommitAndLoad()
		{
			this.Load();
			if (Utilities.IsPostRequest(this.request) && !string.IsNullOrEmpty(base.Command))
			{
				if (base.Command.Equals("ClrMRR", StringComparison.Ordinal))
				{
					AutoCompleteCache autoCompleteCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
					if (autoCompleteCache != null)
					{
						autoCompleteCache.ClearCache();
						autoCompleteCache.Commit(false);
					}
					this.isClearMrrRequest = true;
				}
				string formParameter = Utilities.GetFormParameter(this.request, "selRwCnt");
				if (string.IsNullOrEmpty(formParameter) || !int.TryParse(formParameter, out this.displayItemsPerPage))
				{
					throw new OwaInvalidRequestException("Row count must be a valid number");
				}
				string formParameter2 = Utilities.GetFormParameter(this.request, "selNxt");
				int num;
				if (string.IsNullOrEmpty(formParameter2) || !int.TryParse(formParameter2, out num) || num < 0 || num > 2)
				{
					throw new OwaInvalidRequestException("Next selection must be a valid number");
				}
				this.nextSelection = (NextSelectionDirection)num;
				if (this.userContext.IsFeatureEnabled(Feature.Signature))
				{
					this.autoAddSignature = (Utilities.GetFormParameter(this.request, "chkAddSg", false) != null);
					this.signatureText = Utilities.GetFormParameter(this.request, "txtSg", false);
				}
				this.emptyDeletedItemsOnLogoff = (Utilities.GetFormParameter(this.request, "chkEmDel", false) != null);
				string formParameter3 = Utilities.GetFormParameter(this.request, "rdRcpt", false);
				if (!string.IsNullOrEmpty(formParameter3))
				{
					this.readReceiptResponse = (ReadReceiptResponse)int.Parse(formParameter3);
				}
				this.addRecentRecipientsToMrr = (Utilities.GetFormParameter(this.request, "chkAddMRR", false) != null);
				if (this.userContext.IsFeatureEnabled(Feature.Contacts))
				{
					string formParameter4 = Utilities.GetFormParameter(this.request, "anrFst");
					this.checkNameInContactsFirst = (!string.IsNullOrEmpty(formParameter4) && formParameter4 == "1");
				}
				if (!this.isClearMrrRequest)
				{
					bool flag = false;
					if (this.displayItemsPerPage != this.userContext.UserOptions.BasicViewRowCount)
					{
						this.userContext.UserOptions.BasicViewRowCount = this.displayItemsPerPage;
						flag = true;
					}
					if (this.nextSelection != this.userContext.UserOptions.NextSelection)
					{
						this.userContext.UserOptions.NextSelection = this.nextSelection;
						flag = true;
					}
					if (this.userContext.IsFeatureEnabled(Feature.Signature))
					{
						if (this.autoAddSignature != this.userContext.UserOptions.AutoAddSignature)
						{
							this.userContext.UserOptions.AutoAddSignature = this.autoAddSignature;
							flag = true;
						}
						if (!Utilities.WhiteSpaceOnlyOrNullEmpty(this.signatureText) && (Utilities.WhiteSpaceOnlyOrNullEmpty(this.userContext.UserOptions.SignatureText) || !string.IsNullOrEmpty(Utilities.GetFormParameter(this.request, "chkRplSg", false))))
						{
							this.userContext.UserOptions.SignatureText = this.signatureText;
							this.signatureHtml = BodyConversionUtilities.ConvertTextToHtml(this.signatureText);
							this.userContext.UserOptions.SignatureHtml = this.signatureHtml;
							flag = true;
						}
					}
					if (this.userContext.UserOptions.EmptyDeletedItemsOnLogoff != this.emptyDeletedItemsOnLogoff)
					{
						this.userContext.UserOptions.EmptyDeletedItemsOnLogoff = this.emptyDeletedItemsOnLogoff;
						flag = true;
					}
					if (this.userContext.UserOptions.ReadReceipt != this.readReceiptResponse)
					{
						this.userContext.UserOptions.ReadReceipt = this.readReceiptResponse;
						flag = true;
					}
					if (this.userContext.UserOptions.AddRecipientsToAutoCompleteCache != this.addRecentRecipientsToMrr)
					{
						this.userContext.UserOptions.AddRecipientsToAutoCompleteCache = this.addRecentRecipientsToMrr;
						flag = true;
					}
					if (this.userContext.IsFeatureEnabled(Feature.Contacts) && this.userContext.UserOptions.CheckNameInContactsFirst != this.checkNameInContactsFirst)
					{
						this.userContext.UserOptions.CheckNameInContactsFirst = this.checkNameInContactsFirst;
						flag = true;
					}
					if (flag)
					{
						try
						{
							this.userContext.UserOptions.CommitChanges();
							base.SetSavedSuccessfully(true);
						}
						catch (StoragePermanentException)
						{
							base.SetSavedSuccessfully(false);
						}
						catch (StorageTransientException)
						{
							base.SetSavedSuccessfully(false);
						}
					}
				}
			}
		}
Esempio n. 18
0
 // Token: 0x060000B0 RID: 176 RVA: 0x000068A0 File Offset: 0x00004AA0
 public static void ResolveRecipients(string chunk, ArrayList wellNodes, UserContext userContext, bool resolveAgainstContactsFirst)
 {
     if (chunk == null)
     {
         throw new ArgumentNullException("chunk");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     string[] array = Utilities.ParseRecipientChunk(chunk);
     if (array != null)
     {
         RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
         for (int i = 0; i < array.Length; i++)
         {
             string text = array[i].Trim();
             if (text.Length > 0)
             {
                 RecipientAddress  recipientAddress  = AnrManager.ResolveAnrString(text, resolveAgainstContactsFirst, userContext);
                 RecipientWellNode recipientWellNode = new RecipientWellNode(text, null);
                 if (recipientAddress != null)
                 {
                     recipientWellNode.DisplayName       = recipientAddress.DisplayName;
                     recipientWellNode.SmtpAddress       = recipientAddress.SmtpAddress;
                     recipientWellNode.AddressOrigin     = recipientAddress.AddressOrigin;
                     recipientWellNode.RoutingAddress    = recipientAddress.RoutingAddress;
                     recipientWellNode.RoutingType       = recipientAddress.RoutingType;
                     recipientWellNode.RecipientFlags    = recipientAddress.RecipientFlags;
                     recipientWellNode.StoreObjectId     = recipientAddress.StoreObjectId;
                     recipientWellNode.ADObjectId        = recipientAddress.ADObjectId;
                     recipientWellNode.EmailAddressIndex = recipientAddress.EmailAddressIndex;
                 }
                 if ((recipientWellNode.RoutingAddress != null || Utilities.IsMapiPDL(recipientWellNode.RoutingType)) && recipientCache != null)
                 {
                     string itemId = string.Empty;
                     if (recipientWellNode.AddressOrigin == AddressOrigin.Store && recipientWellNode.StoreObjectId != null)
                     {
                         itemId = recipientWellNode.StoreObjectId.ToBase64String();
                     }
                     else if (recipientWellNode.AddressOrigin == AddressOrigin.Directory && recipientWellNode.ADObjectId != null)
                     {
                         itemId = Convert.ToBase64String(recipientWellNode.ADObjectId.ObjectGuid.ToByteArray());
                     }
                     if (string.IsNullOrEmpty(recipientWellNode.DisplayName))
                     {
                         recipientWellNode.DisplayName = recipientWellNode.SmtpAddress;
                     }
                     if (userContext.UserOptions.AddRecipientsToAutoCompleteCache)
                     {
                         recipientCache.AddEntry(recipientWellNode.DisplayName, recipientWellNode.SmtpAddress, recipientWellNode.RoutingAddress, string.Empty, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.RecipientFlags, itemId, recipientWellNode.EmailAddressIndex);
                     }
                 }
                 if (wellNodes != null)
                 {
                     wellNodes.Add(recipientWellNode);
                 }
             }
         }
         if (recipientCache != null && recipientCache.IsDirty)
         {
             recipientCache.Commit(true);
         }
     }
 }