Exemplo n.º 1
0
        /// <summary>
        /// Create new full message request
        /// </summary>
        /// <param name="client"></param>
        /// <param name="msg"></param>
        public FullMessageRequest(IMAPAsyncClient client, IMessage msg)
        {
            _msg = msg;
            _client = client;


        }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new mailbox for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPMailboxManager(IMAPAsyncClient client)
 {
     _boxType = MailboxType.Virtual;
     //_physMailboxLoaded = false;
     _client = client;
     _client.DataManager.New();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveMessageRequest"/> class.
        /// </summary>
        /// <param name="client">The imap client.</param>
        public MoveMessageRequest(IMAPAsyncClient client)
        {
            if (client == null)
                throw new ArgumentNullException("client");

            this._client = client;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new mailbox for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPMailboxManager(IMAPAsyncClient client)
 {
     _boxType = MailboxType.Virtual;
     //_physMailboxLoaded = false;
     _client = client;
     _client.DataManager.New();
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            IMAPConfig config = new IMAPConfig("imap.gmail.com", "atmospherian", "Xr3pr1s3Y", true, true, "");
            config.SaveConfig(@"c:\settings.cfg");
            //IMAPConfig config = new IMAPConfig(@"c:\test1.cfg");
            IMAPAsyncClient client = new IMAPAsyncClient(config, 5);

            client.MailboxManager.CreateNewMailbox(@"c:\test.mbx");

            client.Start();
            FolderTreeRequest ftr = new FolderTreeRequest("\"\"", null);
            client.RequestManager.SubmitAndWait(ftr,false);

            IBatchRequest batch = new SimpleBatchRequest();
            foreach (IFolder folder in client.MailboxManager.GetAllFolders())
            {
                FolderDataRequest fdr = new FolderDataRequest(folder, null);
                fdr.RequestCompleted += delegate(IRequest req)
                                            {
                                                FolderDataProcessor fdp = req.GetProcessorAsType<FolderDataProcessor>();
                                                IFolder f = fdp.Request.Command.ParameterObjects[0] as IFolder;
                                                Console.WriteLine("Data for {0} loaded. {1} Messages found.", f.Name, f.Exists);
                                            };
                batch.Requests.Add(fdr);
            }

            client.RequestManager.SubmitBatchAndWait(batch, false);
            batch.Requests.Clear();
            foreach (IFolder folder in client.MailboxManager.GetAllFolders())
            {
                MessageListRequest mlr = new MessageListRequest(folder, null);
                mlr.RequestCompleted += delegate(IRequest req)
                                            {
                                                MessageListProcessor fdp = req.GetProcessorAsType<MessageListProcessor>();
                                                IFolder f = fdp.Request.Command.ParameterObjects[0] as IFolder;
                                                Console.WriteLine("Message List for {0} loaded. {1} Messages found.", f.Name, f.Exists);
                                            };

                batch.Requests.Add(mlr);
            }

            client.RequestManager.SubmitBatchAndWait(batch, false);

            client.MailboxManager.DownloadEntireAccount(delegate(int messagesCompleted, int totalMessages, IFolder currentFolder)
                                                            {
                                                                Console.WriteLine();
                                                                Console.WriteLine("Message {0} of {1} downloaded from {2}", messagesCompleted, totalMessages, currentFolder.Name);
                                                            }, delegate(int totalFolders, int totalMessages, long totalTime)
                                                                   {
                                                                       Console.WriteLine("{0} Messages in {1} folders downloaded in {2} minutes.", totalMessages, totalFolders, new TimeSpan(totalTime).Minutes);
                                                                   });

            //config.CacheFi

            Console.WriteLine("Press any key");
            Console.ReadLine();

            client.Stop();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Create a new request manager for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPRequestManager(IMAPAsyncClient client)
 {
     _client = client;
     _pendingRequests = new List<IRequest>();
     _pendingBatchRequests = new List<IBatchRequest>();
     _activeRequests = new List<IRequest>();
     _requestCount = 0;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Create a new request manager for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPRequestManager(IMAPAsyncClient client)
 {
     _client               = client;
     _pendingRequests      = new List <IRequest>();
     _pendingBatchRequests = new List <IBatchRequest>();
     _activeRequests       = new List <IRequest>();
     _requestCount         = 0;
 }
 /// <summary>
 /// Create a new connection pool for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPConnectionPool(IMAPAsyncClient client)
 {
     _numConnections = 5;
     _workers = new List<IMAPConnectionWorker>();
     _config = null;
     _client = client;
     _config = _client.Config;
     _loggers = new List<WorkerLogger>();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Create a new connection pool for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPConnectionPool(IMAPAsyncClient client)
 {
     _numConnections = 5;
     _workers        = new List <IMAPConnectionWorker>();
     _config         = null;
     _client         = client;
     _config         = _client.Config;
     _loggers        = new List <WorkerLogger>();
 }
Exemplo n.º 10
0
 public IMAPShell(IMAPConfig config, bool autoConnect)
 {
     _config = config;
     _client = new IMAPAsyncClient(config, 5);
     _currentFolder = null;
     _autoConnect = autoConnect;
     
     InitCommandMap();
 }
 /// <summary>
 /// 
 /// </summary>        
 public IMAPConnectionWorker(IMAPAsyncClient client, int id)
 {
     _client = client;
     _workerID = id;
     _logger = new WorkerLogger(id);
     _config = _client.Config;
     _conn = new IMAPConnection(_config, _logger);
     _shuttingDown = false;
     _loggedIn = false;
     _processingRequest = false;
 }
Exemplo n.º 12
0
 private void button1_Click(object sender, EventArgs e)
 {
     label1.Text = "Getting folder list...";
     IMAPConfig config = new IMAPConfig(@"c:\test1.cfg");
     client = new IMAPAsyncClient(config, 5);
     //IMAPConnectionPool.GetInstance().StartUp(config, 5);
     client.Start();
     client.RequestManager.SubmitRequest(new FolderTreeRequest("\"\"", FolderTreeCallback), false);
     button1.Enabled = false;
     button2.Enabled = true;
 }
Exemplo n.º 13
0
 /// <summary>
 ///
 /// </summary>
 public IMAPConnectionWorker(IMAPAsyncClient client, int id)
 {
     _client            = client;
     _workerID          = id;
     _logger            = new WorkerLogger(id);
     _config            = _client.Config;
     _conn              = new IMAPConnection(_config, _logger);
     _shuttingDown      = false;
     _loggedIn          = false;
     _processingRequest = false;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Create a new Folder object with the specified ID
 /// </summary>
 /// <param name="id"></param>
 /// <param name="client"></param>
 public Folder(IMAPAsyncClient client, int id)
 {
     _id = id;
     _client = client;
 }
Exemplo n.º 15
0
 public MessageViewer(IMessage msg, IMAPAsyncClient client)
 {
     InitializeComponent();
     _client = client;
     _msg = msg;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Create a Message object with the specified ID
 /// </summary>
 /// <param name="id"></param>
 /// <param name="client"></param>
 public Message(IMAPAsyncClient client, int id)
 {
     _id = id;
     _client = client;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Create a new content object. The ID must already exist in the content table
 /// </summary>
 /// <param name="client"></param>
 /// <param name="contentID"></param>
 public MessageContent(IMAPAsyncClient client, int contentID)
 {
     _client = client;
     _id = contentID;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Create a new NewMessageRequest
 /// </summary>
 /// <param name="client"></param>
 public NewMessagesRequest(IMAPAsyncClient client)
 {
     _client = client;
     _criteria = new SearchCriteria(true);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Create a new Contact object with the specified ID
 /// </summary>
 /// <param name="id"></param>
 /// <param name="client"></param>
 public Contact(IMAPAsyncClient client, int id)
 {
     _id = id;
     _client = client;
 }
Exemplo n.º 20
0
        private List<Note> GetMailList(string server, string username, string password, string notefolder)
        {
            List<Note> noteList = new List<Note>();
            if (cancelled)
            {
                return noteList;
            }

            IMAPConfig config = new IMAPConfig(server, username, password, true, true, "/");
            client = new IMAPAsyncClient(config, 2);
            if (client.Start(false) == false)
            {
                cancelled = true;
                return noteList;
            }

            GetMailsListRecursive(notefolder, ref noteList);

            return noteList;
        }