/** * for non-inotify case, this method is invoked repeatedly */ private void CrawlHook(Scheduler.Task task) { if (local_indexer != null) { local_indexer.Crawl(); } if (dimap_indexer != null) { dimap_indexer.Crawl(); } task.Reschedule = true; task.TriggerTime = DateTime.Now.AddSeconds(polling_interval_in_seconds); }
/** * called by Start(), starts actual work * create indexers * ask indexers to crawl the mails * for non-inotify case, ask to poll */ private void StartWorker() { Log.Debug("Starting KMail backend"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); // check if there is at all anything to crawl if (local_path == null && (!Directory.Exists(dimap_path))) { GLib.Timeout.Add(60000, new GLib.TimeoutHandler(CheckForExistence)); Log.Debug("KMail directories (local mail) " + dimap_path + " not found, will repoll."); return; } Log.Debug("Starting mail crawl"); if (local_path != null) { local_indexer = new KMailIndexer(this, "local", local_path); local_indexer.Crawl(); } // FIXME: parse kmailrc to get dimap account name if (Directory.Exists(dimap_path)) { dimap_indexer = new KMailIndexer(this, "dimap", dimap_path); dimap_indexer.Crawl(); } Log.Debug("Mail crawl done"); if (!Inotify.Enabled) { Scheduler.Task task = Scheduler.TaskFromHook(new Scheduler.TaskHook(CrawlHook)); task.Tag = "Crawling Maildir directories"; task.Source = this; task.TriggerTime = DateTime.Now.AddSeconds(polling_interval_in_seconds); ThisScheduler.Add(task); } stopwatch.Stop(); Log.Debug("KMail driver worker thread done in {0}", stopwatch); }
/** * called by Start(), starts actual work * create indexers * ask indexers to crawl the mails * for non-inotify case, ask to poll */ private void StartWorker () { Log.Debug ("Starting KMail backend"); Stopwatch stopwatch = new Stopwatch (); stopwatch.Start (); // check if there is at all anything to crawl if ( local_path == null && (!Directory.Exists (dimap_path))) { GLib.Timeout.Add (60000, new GLib.TimeoutHandler (CheckForExistence)); Log.Debug ("KMail directories (local mail) " + dimap_path + " not found, will repoll."); return; } Log.Debug ("Starting mail crawl"); if (local_path != null) { local_indexer = new KMailIndexer (this, "local", local_path); local_indexer.Crawl (); } // FIXME: parse kmailrc to get dimap account name if (Directory.Exists (dimap_path)) { dimap_indexer = new KMailIndexer (this, "dimap", dimap_path); dimap_indexer.Crawl (); } Log.Debug ("Mail crawl done"); if (! Inotify.Enabled) { Scheduler.Task task = Scheduler.TaskFromHook (new Scheduler.TaskHook (CrawlHook)); task.Tag = "Crawling Maildir directories"; task.Source = this; task.TriggerTime = DateTime.Now.AddSeconds (polling_interval_in_seconds); ThisScheduler.Add (task); } stopwatch.Stop (); Log.Debug ("KMail driver worker thread done in {0}", stopwatch); }