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 EasSyncResult SyncMessages(EasConnectionWrapper easConnectionWrapper, EasSyncOptions options) { MrsTracer.Provider.Function("EasFolder.SyncMessages: SyncKey={0}", new object[] { options.SyncKey }); bool recentOnly = !EasFolder.IsCalendarFolder(base.EasFolderType) && options.RecentOnly && !EasFolder.IsContactFolder(base.EasFolderType); SyncResponse syncResponse; try { syncResponse = easConnectionWrapper.Sync(base.ServerId, options, recentOnly); } catch (EasRequiresSyncKeyResetException ex) { MrsTracer.Provider.Error("Encountered RequiresSyncKeyReset error: {0}", new object[] { ex }); options.SyncKey = "0"; syncResponse = easConnectionWrapper.Sync(base.ServerId, options, recentOnly); } if (!(options.SyncKey == "0")) { return(this.GetMessageRecsAndNewSyncKey(syncResponse, options)); } return(this.ProcessPrimingSync(easConnectionWrapper, options, syncResponse)); }
private PropValueData[] GetAdditionalProps(AddCommand add) { List <PropValueData> list = new List <PropValueData>(); list.Add(new PropValueData(PropTag.LastModificationTime, CommonUtils.DefaultLastModificationTime)); list.Add(new PropValueData(PropTag.ObjectType, 0)); if (EasFolder.IsContactFolder(base.EasFolderType)) { List <PropValueData> contactProperties = EasFxContactMessage.GetContactProperties(add.ApplicationData); if (contactProperties.Count > 0) { list.AddRange(contactProperties); } } return(SyncEmailUtils.GetMessageProps(new SyncEmailContext { IsRead = new bool?(add.IsRead()), IsDraft = new bool?(base.EasFolderType == EasFolderType.Drafts), SyncMessageId = add.ServerId }, this.UserSmtpAddressString, base.EntryId, list.ToArray())); }
private PropValueData[] GetAdditionalProps(ChangeCommand change) { bool?isRead = change.IsRead(); EasMessageCategory easMessageCategory = (isRead == null) ? EasMessageCategory.AddOrUpdate : (isRead.Value ? EasMessageCategory.ChangeToRead : EasMessageCategory.ChangeToUnread); List <PropValueData> list = new List <PropValueData>(); list.Add(new PropValueData(PropTag.LastModificationTime, DateTime.UtcNow)); list.Add(new PropValueData(PropTag.ObjectType, (int)easMessageCategory)); if (EasFolder.IsContactFolder(base.EasFolderType)) { List <PropValueData> contactProperties = EasFxContactMessage.GetContactProperties(change.ApplicationData); if (contactProperties.Count > 0) { list.AddRange(contactProperties); } } return(SyncEmailUtils.GetMessageProps(new SyncEmailContext { IsRead = isRead, IsDraft = new bool?(base.EasFolderType == EasFolderType.Drafts), SyncMessageId = change.ServerId }, this.UserSmtpAddressString, base.EntryId, list.ToArray())); }
private byte[] MoveItem(byte[] messageEntryId, byte[] sourceFolderEntryId, byte[] destFolderEntryId, out bool isPermanentDeletionMove) { isPermanentDeletionMove = false; base.CheckDisposed(); Add add; if (!base.EasFolderCache.TryGetValue(sourceFolderEntryId, out add)) { MrsTracer.Provider.Warning("Source folder {0} doesn't exist", new object[] { TraceUtils.DumpBytes(sourceFolderEntryId) }); throw new EasObjectNotFoundException(EasMailbox.GetStringId(sourceFolderEntryId)); } Add add2; if (!base.EasFolderCache.TryGetValue(destFolderEntryId, out add2)) { MrsTracer.Provider.Warning("Destination folder {0} doesn't exist", new object[] { TraceUtils.DumpBytes(destFolderEntryId) }); throw new EasObjectNotFoundException(EasMailbox.GetStringId(destFolderEntryId)); } string stringId = EasMailbox.GetStringId(messageEntryId); if (add2.Type == 4 && EasFolder.IsCalendarFolder((EasFolderType)add.Type)) { this.DeleteItem(messageEntryId, sourceFolderEntryId); isPermanentDeletionMove = true; return(null); } string stringId2 = base.EasConnectionWrapper.MoveItem(stringId, add.ServerId, add2.ServerId); return(EasMailbox.GetEntryId(stringId2)); }
private IEnumerable <MessageRec> CreateMessageRecsForAdditions(List <AddCommand> additions) { foreach (AddCommand addition in additions) { yield return(new MessageRec(EasMailbox.GetEntryId(addition.ServerId), base.EntryId, EasFolder.GetCreationTimestamp(addition.ApplicationData.DateReceived), (int)((addition.ApplicationData.Body == null) ? 0U : addition.ApplicationData.Body.EstimatedDataSize), MsgRecFlags.None, this.GetAdditionalProps(addition))); } yield break; }
private List <MessageRec> CreateMessageRecsForFetches(IReadOnlyCollection <Fetch> fetches) { List <MessageRec> list = new List <MessageRec>(fetches.Count); foreach (Fetch fetch in fetches) { if (fetch.Status == 1) { list.Add(new MessageRec(EasMailbox.GetEntryId(fetch.ServerId), base.EntryId, EasFolder.GetCreationTimestamp(fetch.Properties.DateReceived), (int)fetch.Properties.Body.EstimatedDataSize, MsgRecFlags.None, this.GetAdditionalProps(fetch))); } } return(list); }