protected override void CopySingleMessage(MessageRec messageRec, IFolderProxy folderProxy, PropTag[] propTagsToExclude, PropTag[] excludeProps) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("EasSourceMailbox.CopySingleMessage", OperationType.None), new EntryIDsDataContext(messageRec.EntryId) }).Execute(delegate { Add add; if (this.EasFolderCache.TryGetValue(messageRec.FolderId, out add)) { EasFolderType easFolderType = add.GetEasFolderType(); if (EasFolder.IsCalendarFolder(easFolderType)) { Properties calendarItemProperties = this.ReadCalendarItem(messageRec); EasSourceMailbox.CopyCalendarItem(messageRec, calendarItemProperties, folderProxy); return; } if (EasFolder.IsContactFolder(easFolderType)) { EasSourceMailbox.CopyContactItem(messageRec, folderProxy); return; } SyncEmailUtils.CopyMimeStream(this, messageRec, folderProxy); } }); }
protected void RefreshFolderCache(EasHierarchySyncState state) { IReadOnlyCollection <Add> folders = state.Folders; EntryIdMap <Add> entryIdMap = new EntryIdMap <Add>(folders.Count); this.defaultCalendarId = null; foreach (Add add in folders) { EasFolderType easFolderType = add.GetEasFolderType(); if (easFolderType == EasFolderType.Calendar) { this.defaultCalendarId = EasMailbox.GetEntryId(add.ServerId); } EasFolderType easFolderType2 = easFolderType; if (easFolderType2 == EasFolderType.UserGeneric) { goto IL_8B; } bool flag; switch (easFolderType2) { case EasFolderType.Contacts: case EasFolderType.UserContacts: flag = !ConfigBase <MRSConfigSchema> .GetConfig <bool>("DisableContactSync"); goto IL_9D; case EasFolderType.UserMail: case EasFolderType.UserCalendar: goto IL_8B; } flag = EasMailbox.folderTypeMap.ContainsKey(easFolderType); IL_9D: if (flag) { entryIdMap.Add(EasMailbox.GetEntryId(add.ServerId), add); continue; } MrsTracer.Provider.Debug("EasMailbox.RefreshFolderCache: ignore {0} folder '{1}' since it is not supported yet", new object[] { easFolderType, add.DisplayName }); continue; IL_8B: flag = true; goto IL_9D; } this.EasFolderCache = entryIdMap; }
internal static bool IsContactFolder(EasFolderType easFolderType) { return(easFolderType == EasFolderType.Contacts || easFolderType == EasFolderType.UserContacts); }
internal static bool IsCalendarFolder(EasFolderType easFolderType) { return(easFolderType == EasFolderType.Calendar || easFolderType == EasFolderType.UserCalendar); }
protected EasFolderBase(string serverId, string parentId, string displayName, EasFolderType folderType) { this.serverId = serverId; this.parentId = parentId; this.displayName = displayName; this.folderType = folderType; this.EntryId = EasMailbox.GetEntryId(serverId); }
internal FolderCreateResponse CreateFolder(string syncKey, string displayName, string parentId, EasFolderType folderType) { FolderCreateRequest folderCreateRequest = new FolderCreateRequest { SyncKey = syncKey, DisplayName = displayName, ParentId = parentId, Type = (int)folderType }; return(this.FolderCreate(folderCreateRequest)); }
private EasSyntheticFolder(string serverId, string parentId, EasFolderType folderType, Func <EasFolderBase, FolderRec> createFolderRec) : base(serverId, parentId, folderType.ToString(), folderType) { this.FolderRec = createFolderRec(this); }