void ISourceMailbox.ExportMessages(List <MessageRec> messages, IFxProxyPool proxyPool, ExportMessagesFlags flags, PropTag[] propsToCopyExplicitly, PropTag[] excludeProps)
 {
     MrsTracer.Provider.Function("ImapSourceMailbox.ExportMessages({0} messages)", new object[]
     {
         messages.Count
     });
     base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
     this.CopyMessagesOneByOne(messages, proxyPool, propsToCopyExplicitly, excludeProps, delegate(MessageRec curMsg)
     {
         using (ImapFolder folder = base.GetFolder <ImapSourceFolder>(curMsg.FolderId))
         {
             if (folder == null)
             {
                 throw new FolderIsMissingTransientException();
             }
             folder.Folder.SelectImapFolder(base.ImapConnection);
         }
     });
 }
 private void SetReadFlags(byte[] messageEntryId, byte[] folderEntryId, bool isRead)
 {
     base.CheckDisposed();
     using (ImapFolder folder = base.GetFolder <ImapSourceFolder>(folderEntryId))
     {
         if (folder == null)
         {
             MrsTracer.Provider.Warning("Source folder {0} doesn't exist", new object[]
             {
                 TraceUtils.DumpBytes(folderEntryId)
             });
             throw new ImapObjectNotFoundException(TraceUtils.DumpBytes(folderEntryId));
         }
         uint        item = ImapEntryId.ParseUid(messageEntryId);
         List <uint> list = new List <uint>(1);
         list.Add(item);
         List <ImapMessageRec> list2 = folder.Folder.LookupMessages(base.ImapConnection, list);
         if (list2.Count == 0)
         {
             MrsTracer.Provider.Warning("Source message {0} doesn't exist", new object[]
             {
                 TraceUtils.DumpBytes(messageEntryId)
             });
             throw new ImapObjectNotFoundException(TraceUtils.DumpBytes(messageEntryId));
         }
         ImapMailFlags imapMailFlags  = list2[0].ImapMailFlags;
         ImapMailFlags imapMailFlags2 = isRead ? (imapMailFlags | ImapMailFlags.Seen) : (imapMailFlags & ~ImapMailFlags.Seen);
         if (imapMailFlags != imapMailFlags2)
         {
             string text = item.ToString(CultureInfo.InvariantCulture);
             MrsTracer.Provider.Debug("StoreMessageFlags - uid: {0}, flagsToStore: {1}, previousFlags {2}", new object[]
             {
                 text,
                 imapMailFlags2,
                 imapMailFlags
             });
             base.ImapConnection.StoreMessageFlags(text, imapMailFlags2, imapMailFlags);
         }
     }
 }
Esempio n. 3
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);
        }