Exemplo n.º 1
0
 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);
         }
     });
 }
Exemplo n.º 2
0
 protected MessageRec CreateMessageRec(string uniqueId, long messageSize)
 {
     PropValueData[] messageProps = SyncEmailUtils.GetMessageProps(default(SyncEmailContext), this.Mailbox.PopConnection.ConnectionContext.UserName, this.FolderId, new PropValueData[0]);
     PropValueData[] array        = new PropValueData[messageProps.Length + 1];
     messageProps.CopyTo(array, 0);
     array[array.Length - 1] = new PropValueData(PropTag.LastModificationTime, CommonUtils.DefaultLastModificationTime);
     return(new MessageRec(PopEntryId.CreateMessageEntryId(uniqueId), this.FolderId, CommonUtils.DefaultLastModificationTime, (int)messageSize, MsgRecFlags.None, array));
 }
Exemplo n.º 3
0
 PropTag[] IMailbox.GetIDsFromNames(bool createIfNotExists, NamedPropData[] npda)
 {
     MrsTracer.Provider.Function("ImapMailbox.IMailbox.GetIDsFromNames", new object[0]);
     if (createIfNotExists)
     {
         throw new GetIdsFromNamesCalledOnDestinationException();
     }
     return(SyncEmailUtils.GetIDsFromNames(npda, null));
 }
Exemplo n.º 4
0
 PropTag[] IMailbox.GetIDsFromNames(bool createIfNotExists, NamedPropData[] npda)
 {
     MrsTracer.Provider.Function("EasMailbox.IMailbox.GetIDsFromNames", new object[0]);
     if (createIfNotExists)
     {
         throw new GetIdsFromNamesCalledOnDestinationException();
     }
     return(SyncEmailUtils.GetIDsFromNames(npda, (NamedPropData propTag) => StringComparer.OrdinalIgnoreCase.Equals(propTag.Name, "ObjectType")));
 }
Exemplo n.º 5
0
 private PropValueData[] GetAdditionalProps(DeleteCommand delete)
 {
     return(SyncEmailUtils.GetMessageProps(new SyncEmailContext
     {
         SyncMessageId = delete.ServerId
     }, this.UserSmtpAddressString, base.EntryId, new PropValueData[]
     {
         new PropValueData(PropTag.ObjectType, 1)
     }));
 }
Exemplo n.º 6
0
 protected override void CopySingleMessage(MessageRec message, IFolderProxy folderProxy, PropTag[] propTagsToExclude, PropTag[] excludeProps)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("PopSourceMailbox.CopySingleMessage", OperationType.None),
         new EntryIDsDataContext(message.EntryId)
     }).Execute(delegate
     {
         SyncEmailUtils.CopyMimeStream(this, message, folderProxy);
     });
 }
Exemplo n.º 7
0
 private PropValueData[] GetAdditionalProps(Fetch fetch)
 {
     return(SyncEmailUtils.GetMessageProps(new SyncEmailContext
     {
         IsRead = new bool?(fetch.IsRead()),
         IsDraft = new bool?(base.EasFolderType == EasFolderType.Drafts),
         SyncMessageId = fetch.ServerId
     }, this.UserSmtpAddressString, base.EntryId, new PropValueData[]
     {
         new PropValueData(PropTag.LastModificationTime, DateTime.UtcNow)
     }));
 }
Exemplo n.º 8
0
        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()));
        }
Exemplo n.º 9
0
        private List <MessageRec> GetMessageRecs(List <ImapMessageRec> imapMessageRecs)
        {
            if (imapMessageRecs.Count == 0)
            {
                return(new List <MessageRec>(0));
            }
            List <MessageRec> list = new List <MessageRec>(imapMessageRecs.Count);

            foreach (ImapMessageRec imapMessageRec in imapMessageRecs)
            {
                SyncEmailContext syncEmailContext = ImapFolder.GetSyncEmailContext(this.Folder, imapMessageRec);
                int messageSize = 0;
                ImapExtendedMessageRec imapExtendedMessageRec = imapMessageRec as ImapExtendedMessageRec;
                if (imapExtendedMessageRec != null)
                {
                    messageSize = (int)imapExtendedMessageRec.MessageSize;
                }
                PropValueData[] messageProps = SyncEmailUtils.GetMessageProps(syncEmailContext, this.Mailbox.ImapConnection.ConnectionContext.UserName, this.FolderId, new PropValueData[0]);
                MessageRec      item         = new MessageRec(ImapEntryId.CreateMessageEntryId(imapMessageRec.Uid, this.Folder.UidValidity, this.Folder.Name, this.Mailbox.ImapConnection.ConnectionContext.UserName), this.FolderId, CommonUtils.DefaultLastModificationTime, messageSize, MsgRecFlags.None, messageProps);
                list.Add(item);
            }
            return(list);
        }
Exemplo n.º 10
0
        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()));
        }
Exemplo n.º 11
0
        public static PropValueData[] GetMessageProps(SyncEmailContext context, string accountName, byte[] folderId, params PropValueData[] extraProps)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("accountName", accountName);
            ArgumentValidator.ThrowIfNull("folderId", folderId);
            List <PropValueData> list = new List <PropValueData>(SyncEmailUtils.SyncEmailPropTags.Length + 3);

            list.Add(new PropValueData(SyncEmailUtils.SyncMessageIdPTag, context.SyncMessageId));
            list.Add(new PropValueData(SyncEmailUtils.SyncAccountNamePTag, accountName));
            list.Add(new PropValueData(SyncEmailUtils.SyncFolderIdPTag, folderId));
            foreach (PropTag propTag in SyncEmailUtils.SyncEmailPropTags)
            {
                PropTag propTag2 = propTag;
                if (propTag2 != PropTag.MessageFlags)
                {
                    if (propTag2 != (PropTag)276824067U)
                    {
                        if (propTag2 == PropTag.SpamConfidenceLevel)
                        {
                            list.Add(new PropValueData(propTag, -1));
                        }
                    }
                    else if (context.ResponseType != null)
                    {
                        list.Add(new PropValueData(propTag, (int)SyncEmailUtils.GetIconIndex(context.ResponseType)));
                    }
                }
                else
                {
                    list.Add(new PropValueData(propTag, (int)SyncEmailUtils.GetMessageFlags(context.IsRead, context.IsDraft)));
                }
            }
            if (extraProps != null)
            {
                list.AddRange(extraProps);
            }
            return(list.ToArray());
        }