예제 #1
0
        public void Crawl()
        {
            int launched = 0;

            TB.AccountReader reader = null;

            foreach (string path in root_paths)
            {
                try {
                    reader = new TB.AccountReader(path);
                } catch (Exception e) {
                    Logger.Log.Warn(e, "Failed to load accounts: {0}", e.Message);
                    continue;
                }

                foreach (TB.Account account in reader)
                {
                    if (Shutdown.ShutdownRequested)
                    {
                        return;
                    }

                    if (supported_types [account.Type] == null)
                    {
                        continue;
                    }

                    IndexAccount(account);
                    launched++;
                }
            }

            init_phase = false;
            Logger.Log.Info("Indexing {0} ({1}) Thunderbird account(s) spread over {2} profile(s)",
                            launched, account_list.Count, root_paths.Length);

            // Clean out old stuff in case no IndexableGenerator was launched
            if (launched == 0)
            {
                ChildComplete();
            }
        }
예제 #2
0
        public void UpdateAccounts(string root_path)
        {
            TB.AccountReader new_accounts = null;

            try {
                new_accounts = new TB.AccountReader(root_path);
            } catch (Exception e) {
                Logger.Log.Warn("Failed when reading Thunderbird accounts: {0}, account may have been added or removed", e);
                return;
            }

            // Add all accounts again to make sure things are updated the way they should
            foreach (TB.Account account in new_accounts)
            {
                IndexAccount(account);
            }

            // Remove non-existing accounts
            foreach (TB.Account existing in account_list)
            {
                bool found = false;

                foreach (TB.Account new_account in new_accounts)
                {
                    if (existing.Path == new_account.Path)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    RemoveAccount(existing);
                }
            }
        }
예제 #3
0
		public void UpdateAccounts (string root_path)
		{
			TB.AccountReader new_accounts = null;

			try {
				new_accounts = new TB.AccountReader (root_path);
			} catch (Exception e) {
				Logger.Log.Warn ("Failed when reading Thunderbird accounts: {0}, account may have been added or removed", e);
				return;
			}

			// Add all accounts again to make sure things are updated the way they should
			foreach (TB.Account account in new_accounts)
				IndexAccount (account);

			// Remove non-existing accounts
			foreach (TB.Account existing in account_list) {
				bool found = false;
			
				foreach (TB.Account new_account in new_accounts) {
					if (existing.Path == new_account.Path) {
						found = true;
						break;
					}
				}

				if (!found) 
						RemoveAccount (existing);
			}
		}
예제 #4
0
		public void Crawl ()
		{
			int launched = 0;
			TB.AccountReader reader = null;
			
			foreach (string path in root_paths) {
				try {
					reader = new TB.AccountReader (path);
				} catch (Exception e) {
					Logger.Log.Warn (e, "Failed to load accounts: {0}", e.Message);
					continue;
				}
				
				foreach (TB.Account account in reader) {
					if (Shutdown.ShutdownRequested)
						return;
					
					if (supported_types [account.Type] == null)
						continue;
					
					IndexAccount (account);
					launched++;
				}
			}
			
			init_phase = false;
			Logger.Log.Info ("Indexing {0} ({1}) Thunderbird account(s) spread over {2} profile(s)", 
				launched, account_list.Count, root_paths.Length);
			
			// Clean out old stuff in case no IndexableGenerator was launched
			if (launched == 0)
				ChildComplete ();
		}