public void IndexAccount (TB.Account account) { TB.Account stored_account = GetParentAccount (account.Path); // We need to act upon changes made to accounts during Thunderbird runtime. // The user might change from plain to SSL, which leads to a new port number // that has to be taken in account for when indexing. if (stored_account == null && Directory.Exists (account.Path) && supported_types [account.Type] != null) { account_list.Add (account); IndexDirectory (account.Path); //Logger.Log.Info ("Indexing {0} account {1}", account.Type.ToString (), account.Server); } else if (stored_account == null && File.Exists (account.Path) && supported_types [account.Type] != null) { account_list.Add (account); IndexFile (account.Path); //Logger.Log.Info ("Indexing {0} account {1}", account.Type.ToString (), account.Server); } else if (stored_account != null && (stored_account.Server != account.Server || stored_account.Port != account.Port || stored_account.Type != account.Type || stored_account.Delimiter != account.Delimiter)) { account_list.Remove (stored_account); account_list.Add (account); // Make sure all running indexables are aware of this since it can affect the way they index NotificationEventArgs args; args = new NotificationEventArgs (NotificationType.UpdateAccountInformation, stored_account); args.Data = (object) account; OnNotification (args); Logger.Log.Info ("Updated {0} with new account details", account.Server); } }
protected virtual void OnNotification(NotificationEventArgs args) { if (NotificationEvent != null) NotificationEvent (this, args); }
protected virtual void OnNotification (object o, NotificationEventArgs args) { if (args.Account != account) return; switch (args.Type) { case NotificationType.StopIndexing: indexer.NotificationEvent -= OnNotification; Logger.Log.Debug ("Stopping running task {0}", account.Server); break; case NotificationType.RestartIndexing: LoadDatabase (); break; case NotificationType.UpdateAccountInformation: account = (TB.Account) args.Data; LoadDatabase (); break; } }