Bug 1606066 - Remove nsIAbDirectorySearch; r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 11 Dec 2019 15:22:10 +1300
changeset 37827 a6f54c89daf7a7a3aef24b3569a4970a60bd6fcd
parent 37826 15c5d954b07f6c63adec44d4861ccf9c25c66bed
child 37828 12617633b4ff2aabdace5cea2ba6f7cd1454d05e
push id397
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:16:13 +0000
reviewersmkmelin
bugs1606066
Bug 1606066 - Remove nsIAbDirectorySearch; r=mkmelin
mailnews/addrbook/public/moz.build
mailnews/addrbook/public/nsIAbDirectorySearch.idl
mailnews/addrbook/src/nsAbLDAPDirectory.cpp
mailnews/addrbook/src/nsAbLDAPDirectory.h
mailnews/addrbook/src/nsAbMDBDirectory.cpp
mailnews/addrbook/src/nsAbMDBDirectory.h
mailnews/addrbook/src/nsAbOutlookDirectory.cpp
mailnews/addrbook/src/nsAbOutlookDirectory.h
--- a/mailnews/addrbook/public/moz.build
+++ b/mailnews/addrbook/public/moz.build
@@ -7,17 +7,16 @@ XPIDL_SOURCES += [
     'nsIAbAddressCollector.idl',
     'nsIAbAutoCompleteResult.idl',
     'nsIAbBooleanExpression.idl',
     'nsIAbCard.idl',
     'nsIAbCollection.idl',
     'nsIAbDirectory.idl',
     'nsIAbDirectoryQuery.idl',
     'nsIAbDirectoryQueryProxy.idl',
-    'nsIAbDirectorySearch.idl',
     'nsIAbDirFactory.idl',
     'nsIAbDirFactoryService.idl',
     'nsIAbDirSearchListener.idl',
     'nsIAbItem.idl',
     'nsIAbLDAPAttributeMap.idl',
     'nsIAbLDIFService.idl',
     'nsIAbListener.idl',
     'nsIAbManager.idl',
deleted file mode 100644
--- a/mailnews/addrbook/public/nsIAbDirectorySearch.idl
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-
-#include "nsISupports.idl"
-
-/**
- * Searching of cards on a directory.
- *
- * The search data is defined in the query
- * section of the directory URI, for example
- *
- * moz-abldapdirectory://ldap1.holland/dc=sun,dc=com?<query>
- *
- * If no search data is defined then the methods
- * will return immediately with no error.
- */
-[scriptable, uuid(ABF26047-37E3-44FD-A28A-6D37A1B9CCB3)]
-interface nsIAbDirectorySearch : nsISupports
-{
-    /**
-     * Starts a search on the directory.
-     *
-     * If a search is already being performed
-     * it is stopped.
-     *
-     * The results from a search, cards, will
-     * returned by informing the address book
-     * session that a new card has been added
-     * to the directory.
-     *
-     * The nsIAbDirectoryQuery implementation
-     * of the directory component (or a proxy)
-     * may be used as an implementation for
-     * this specialization of query.
-     *
-     * This method is semantically equivalent
-     * to the nsIAbDirectory.getChildCards
-     * method when there is search criteria
-     * defined in the directory uri.
-     *
-     */
-    void startSearch();
-
-    /**
-     * Stops a search on the directory.
-     *
-     */
-    void stopSearch();
-};
-
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
@@ -241,23 +241,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::SetLDAP
         static_cast<nsIAbDirectory *>(this), "IsSecure",
         (newIsNotSecure ? trueString : falseString),
         (newIsNotSecure ? falseString : trueString));
   }
 
   return NS_OK;
 }
 
-/*
- *
- * nsIAbDirectorySearch methods
- *
- */
-
-NS_IMETHODIMP nsAbLDAPDirectory::StartSearch() {
+nsresult nsAbLDAPDirectory::StartSearch() {
   if (!mIsQueryURI || mQueryString.IsEmpty()) return NS_OK;
 
   nsresult rv = Initiate();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = StopSearch();
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -303,17 +297,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::StartSe
   // Enter lock
   MutexAutoLock lock(mLock);
   mPerformingQuery = true;
   mCache.Clear();
 
   return rv;
 }
 
-NS_IMETHODIMP nsAbLDAPDirectory::StopSearch() {
+nsresult nsAbLDAPDirectory::StopSearch() {
   nsresult rv = Initiate();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Enter lock
   {
     MutexAutoLock lockGuard(mLock);
     if (!mPerformingQuery) return NS_OK;
     mPerformingQuery = false;
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.h
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.h
@@ -5,26 +5,24 @@
 
 #ifndef nsAbLDAPDirectory_h__
 #define nsAbLDAPDirectory_h__
 
 #include "mozilla/Attributes.h"
 #include "nsAbDirProperty.h"
 #include "nsAbLDAPDirectoryModify.h"
 #include "nsIAbDirectoryQuery.h"
-#include "nsIAbDirectorySearch.h"
 #include "nsIAbDirSearchListener.h"
 #include "nsIAbLDAPDirectory.h"
 #include "nsIMutableArray.h"
 #include "nsInterfaceHashtable.h"
 #include "mozilla/Mutex.h"
 
 class nsAbLDAPDirectory : public nsAbDirProperty,  // nsIAbDirectory
                           public nsAbLDAPDirectoryModify,
-                          public nsIAbDirectorySearch,
                           public nsIAbLDAPDirectory,
                           public nsIAbDirSearchListener {
  public:
   NS_DECL_ISUPPORTS_INHERITED
 
   nsAbLDAPDirectory();
 
   NS_IMETHOD Init(const char *aUri) override;
@@ -41,25 +39,26 @@ class nsAbLDAPDirectory : public nsAbDir
   NS_IMETHOD GetIsRemote(bool *aIsRemote) override;
   NS_IMETHOD GetIsSecure(bool *aIsRemote) override;
   NS_IMETHOD UseForAutocomplete(const nsACString &aIdentityKey,
                                 bool *aResult) override;
   NS_IMETHOD AddCard(nsIAbCard *aChildCard, nsIAbCard **aAddedCard) override;
   NS_IMETHOD ModifyCard(nsIAbCard *aModifiedCard) override;
   NS_IMETHOD DeleteCards(nsIArray *aCards) override;
 
-  // nsIAbDirectorySearch methods
-  NS_DECL_NSIABDIRECTORYSEARCH
   NS_DECL_NSIABLDAPDIRECTORY
   NS_DECL_NSIABDIRSEARCHLISTENER
 
  protected:
   virtual ~nsAbLDAPDirectory();
   nsresult Initiate();
 
+  nsresult StartSearch();
+  nsresult StopSearch();
+
   bool mPerformingQuery;
   int32_t mContext;
   int32_t mMaxHits;
 
   nsInterfaceHashtable<nsISupportsHashKey, nsIAbCard> mCache;
 
   mozilla::Mutex mLock;
   nsCOMPtr<nsIAbDirectoryQuery> mDirectoryQuery;
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -35,18 +35,17 @@ nsAbMDBDirectory::nsAbMDBDirectory(void)
 
 nsAbMDBDirectory::~nsAbMDBDirectory(void) {
   if (mDatabase) {
     mDatabase->RemoveListener(this);
   }
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(nsAbMDBDirectory, nsAbMDBDirProperty,
-                            nsIAbDirSearchListener, nsIAbDirectorySearch,
-                            nsIAddrDBListener)
+                            nsIAbDirSearchListener, nsIAddrDBListener)
 
 NS_IMETHODIMP nsAbMDBDirectory::Init(const char *aUri) {
   // We need to ensure  that the m_DirPrefId is initialized properly
   nsDependentCString uri(aUri);
 
   // Find the first ? (of the search params) if there is one.
   // We know we can start at the end of the moz-abmdbdirectory:// because
   // that's the URI we should have been passed.
@@ -834,19 +833,17 @@ NS_IMETHODIMP nsAbMDBDirectory::OnListEn
   return rv;
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::OnAnnouncerGoingAway() {
   if (mDatabase) mDatabase->RemoveListener(this);
   return NS_OK;
 }
 
-// nsIAbDirectorySearch methods
-
-NS_IMETHODIMP nsAbMDBDirectory::StartSearch() {
+nsresult nsAbMDBDirectory::StartSearch() {
   if (!mIsQueryURI) return NS_ERROR_FAILURE;
 
   nsresult rv;
 
   mPerformingQuery = true;
   mSearchCache.Clear();
 
   nsCOMPtr<nsIAbDirectoryQueryArguments> arguments =
@@ -899,22 +896,16 @@ NS_IMETHODIMP nsAbMDBDirectory::StartSea
 
   rv = queryProxy->Initiate();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = queryProxy->DoQuery(directory, arguments, this, -1, 0, &mContext);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsAbMDBDirectory::StopSearch() {
-  if (!mIsQueryURI) return NS_ERROR_FAILURE;
-
-  return NS_OK;
-}
-
 // nsAbDirSearchListenerContext methods
 
 NS_IMETHODIMP nsAbMDBDirectory::OnSearchFinished(int32_t aResult,
                                                  const nsAString &aErrorMsg) {
   mPerformingQuery = false;
   return NS_OK;
 }
 
--- a/mailnews/addrbook/src/nsAbMDBDirectory.h
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.h
@@ -13,30 +13,28 @@
 #define nsAbMDBDirectory_h__
 
 #include "mozilla/Attributes.h"
 #include "nsAbMDBDirProperty.h"
 #include "nsIAbCard.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsDirPrefs.h"
-#include "nsIAbDirectorySearch.h"
 #include "nsIAbDirSearchListener.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIAddrDBListener.h"
 
 /*
  * Address Book Directory
  */
 
 class nsAbMDBDirectory
     : public nsAbMDBDirProperty,  // nsIAbDirectory, nsIAbMDBDirectory
       public nsIAbDirSearchListener,
-      public nsIAddrDBListener,
-      public nsIAbDirectorySearch {
+      public nsIAddrDBListener {
  public:
   nsAbMDBDirectory(void);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIADDRDBLISTENER
 
   // Override nsAbMDBDirProperty::Init
   NS_IMETHOD Init(const char *aUri) override;
@@ -74,32 +72,31 @@ class nsAbMDBDirectory
                                  nsIAbCard **aAbCard) override;
   NS_IMETHOD GetCardFromProperty(const char *aProperty,
                                  const nsACString &aValue, bool caseSensitive,
                                  nsIAbCard **result) override;
   NS_IMETHOD GetCardsFromProperty(const char *aProperty,
                                   const nsACString &aValue, bool caseSensitive,
                                   nsISimpleEnumerator **result) override;
 
-  // nsIAbDirectorySearch methods
-  NS_DECL_NSIABDIRECTORYSEARCH
-
   // nsIAbDirSearchListener methods
   NS_DECL_NSIABDIRSEARCHLISTENER
 
  protected:
   virtual ~nsAbMDBDirectory();
   nsresult NotifyPropertyChanged(nsIAbDirectory *list, const char *property,
                                  const nsAString &oldValue,
                                  const nsAString &newValue);
   nsresult NotifyItemAdded(nsISupports *item);
   nsresult NotifyItemDeleted(nsISupports *item);
   nsresult NotifyItemChanged(nsISupports *item);
   nsresult RemoveCardFromAddressList(nsIAbCard *card);
 
+  nsresult StartSearch();
+
   nsresult GetAbDatabase();
   nsCOMPtr<nsIAddrDatabase> mDatabase;
 
   nsCOMArray<nsIAbDirectory> mSubDirectories;
 
   int32_t mContext;
   bool mPerformingQuery;
 
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
@@ -45,18 +45,17 @@ nsAbOutlookDirectory::~nsAbOutlookDirect
     delete mMapiData;
   }
   if (mProtector) {
     PR_DestroyLock(mProtector);
   }
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(nsAbOutlookDirectory, nsAbDirProperty,
-                            nsIAbDirectoryQuery, nsIAbDirectorySearch,
-                            nsIAbDirSearchListener)
+                            nsIAbDirectoryQuery, nsIAbDirSearchListener)
 
 NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri) {
   nsresult rv = nsAbDirProperty::Init(aUri);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString entry;
   nsAutoCString stub;
 
@@ -882,18 +881,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Stop
   PRThread *queryThread;
   if (mQueryThreads.Get(aContext, &queryThread)) {
     PR_Interrupt(queryThread);
     mQueryThreads.Remove(aContext);
   }
   return NS_OK;
 }
 
-// nsIAbDirectorySearch methods
-NS_IMETHODIMP nsAbOutlookDirectory::StartSearch(void) {
+nsresult nsAbOutlookDirectory::StartSearch(void) {
   if (!mIsQueryURI) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
   nsresult retCode = NS_OK;
 
   retCode = StopSearch();
   NS_ENSURE_SUCCESS(retCode, retCode);
   mCardList.Clear();
@@ -911,17 +909,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Star
   NS_ENSURE_SUCCESS(retCode, retCode);
 
   retCode = arguments->SetQuerySubDirectories(true);
   NS_ENSURE_SUCCESS(retCode, retCode);
 
   return DoQuery(this, arguments, this, -1, 0, &mSearchContext);
 }
 
-NS_IMETHODIMP nsAbOutlookDirectory::StopSearch(void) {
+nsresult nsAbOutlookDirectory::StopSearch(void) {
   if (!mIsQueryURI) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
   return StopQuery(mSearchContext);
 }
 
 // nsIAbDirSearchListener
 NS_IMETHODIMP nsAbOutlookDirectory::OnSearchFinished(
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.h
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.h
@@ -3,29 +3,27 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsAbOutlookDirectory_h___
 #define nsAbOutlookDirectory_h___
 
 #include "mozilla/Attributes.h"
 #include "nsAbDirProperty.h"
 #include "nsIAbDirectoryQuery.h"
-#include "nsIAbDirectorySearch.h"
 #include "nsIAbDirSearchListener.h"
 #include "nsDataHashtable.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIMutableArray.h"
 #include "nsAbWinHelper.h"
 #include "prlock.h"
 
 struct nsMapiEntry;
 
 class nsAbOutlookDirectory : public nsAbDirProperty,  // nsIAbDirectory
                              public nsIAbDirectoryQuery,
-                             public nsIAbDirectorySearch,
                              public nsIAbDirSearchListener,
                              public nsIAbDirectoryQueryResultListener {
  public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIABDIRSEARCHLISTENER
   NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER
 
   nsAbOutlookDirectory(void);
@@ -49,24 +47,25 @@ class nsAbOutlookDirectory : public nsAb
   NS_IMETHOD AddMailList(nsIAbDirectory *aMailList,
                          nsIAbDirectory **addedList) override;
   NS_IMETHOD EditMailListToDatabase(nsIAbCard *listCard) override;
 
   // nsAbDirProperty method
   NS_IMETHOD Init(const char *aUri) override;
   // nsIAbDirectoryQuery methods
   NS_DECL_NSIABDIRECTORYQUERY
-  // nsIAbDirectorySearch methods
-  NS_DECL_NSIABDIRECTORYSEARCH
   // Perform a MAPI query (function executed in a separate thread)
   nsresult ExecuteQuery(SRestriction &aRestriction,
                         nsIAbDirSearchListener *aListener, int32_t aResultLimit,
                         int32_t aTimeout, int32_t aThreadId);
 
  protected:
+  nsresult StartSearch();
+  nsresult StopSearch();
+
   // Retrieve hierarchy as cards, with an optional restriction
   nsresult GetChildCards(nsIMutableArray *aCards, void *aRestriction);
   // Retrieve hierarchy as directories
   nsresult GetChildNodes(nsIMutableArray *aNodes);
   // Create a new card
   nsresult CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard);
   // Notification for the UI
   nsresult NotifyItemDeletion(nsISupports *aItem);