Example #1
0
        /// <summary>
        /// Main constructor.
        /// </summary>
        /// <param name="config">The configuration instance to use for this client</param>
        /// <param name="logger">Custom logger to use with this client. Use null for default logger.</param>
        public IMAPClient(IMAPConfig config, IMAPLogger logger, int maxWorkers)
        {
            _config = config;
            _imap   = new IMAP();

            _logger = logger ?? new IMAPLogger(config);
            //_imap.InfoLogged += Log;
            _imap.Logger = _logger;
            _folders     = new IMAPFolderCollection();

            Log(IMAPBase.LogTypeEnum.IMAP, "------------------------------------------------------");
            Log(IMAPBase.LogTypeEnum.INFO, "InterIMAP Client Initialized");

            if (config.CacheFile != String.Empty)
            {
                this.UsingCache = true;
                Log(IMAPBase.LogTypeEnum.INFO, String.Format("Using Local Cache File: {0}", config.CacheFile));
            }

            if (config.AutoLogon)
            {
                Logon();
            }

            if (UsingCache)
            {
                FileInfo finfo = new FileInfo(config.CacheFile);
                if (finfo.Exists)
                {
                    // this config has a cache file specified. Load the cache into the object model

                    LoadCache();
                    if (!OfflineMode && config.AutoSyncCache)
                    {
                        SyncCache();
                    }
                }
                else
                {
                    _folders.Clear();
                    _folders = _imap.ProcessFolders(_config.DefaultFolderName);
                    //IMAPFolderCollection tempFolders = _imap.ProcessFolders(_config.DefaultFolderName);
                    foreach (IMAPFolder f in _folders)
                    {
                        f.SetClient(this);
                        if (_config.AutoGetMsgID)
                        {
                            f.GetMessageIDs(false);
                        }
                    }



                    BuildNewCache();
                }
            }
        }
Example #2
0
 /// <summary>
 /// Default constructor. Only used for deserialization purposes.
 /// </summary>
 public IMAPClient()
 {
     _config  = null;
     _imap    = new IMAP();
     _folders = new IMAPFolderCollection();
 }
Example #3
0
 public IEnumerable <Email> Buscar(IMAP imap)
 {
     throw new NotImplementedException();
 }