Back to index

lightning-sunbird  0.9+nobinonly
nsAbOutlookDirectory.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Sun Microsystems, Inc.
00019  * Portions created by the Initial Developer are Copyright (C) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Created by Cyrille Moureaux <Cyrille.Moureaux@sun.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 #ifndef nsAbOutlookDirectory_h___
00039 #define nsAbOutlookDirectory_h___
00040 
00041 #include "nsAbDirectoryRDFResource.h"
00042 #include "nsAbDirProperty.h"
00043 #include "nsIAbDirectoryQuery.h"
00044 #include "nsIAbDirectorySearch.h"
00045 #include "nsAbDirSearchListener.h"
00046 #include "nsHashtable.h"
00047 
00048 #include "nsISupportsArray.h"
00049 
00050 struct nsMapiEntry ;
00051 
00052 class nsAbOutlookDirectory : public nsAbDirectoryRDFResource, // nsIRDFResource
00053                              public nsAbDirProperty, // nsIAbDirectory
00054                              public nsIAbDirectoryQuery,
00055                              public nsIAbDirectorySearch,
00056                              public nsAbDirSearchListenerContext
00057 {
00058 public:
00059        NS_DECL_ISUPPORTS_INHERITED
00060 
00061        nsAbOutlookDirectory(void) ;
00062        virtual ~nsAbOutlookDirectory(void) ;
00063        
00064        // nsAbDirProperty methods
00065        NS_IMETHOD GetChildCards(nsIEnumerator **aCards) ;
00066        NS_IMETHOD GetChildNodes(nsISimpleEnumerator **aNodes) ;
00067     NS_IMETHOD HasCard(nsIAbCard *aCard, PRBool *aHasCard) ;
00068     NS_IMETHOD HasDirectory(nsIAbDirectory *aDirectory, PRBool *aHasDirectory) ;
00069     NS_IMETHOD DeleteCards(nsISupportsArray *aCardList) ;
00070     NS_IMETHOD ModifyDirectory(nsIAbDirectory *directory, nsIAbDirectoryProperties *aProperties);
00071     NS_IMETHOD DeleteDirectory(nsIAbDirectory *aDirectory) ;
00072   NS_IMETHOD AddCard(nsIAbCard *aData, nsIAbCard **addedCard);
00073   NS_IMETHOD DropCard(nsIAbCard *aData, PRBool needToCopyCard);
00074     NS_IMETHOD AddMailList(nsIAbDirectory *aMailList) ;
00075   NS_IMETHOD EditMailListToDatabase(const char *aUri, nsIAbCard *listCard) ;
00076   
00077     // nsAbDirectoryRDFResource method
00078     NS_IMETHOD Init(const char *aUri) ;
00079     // nsIAbDirectoryQuery methods
00080     NS_DECL_NSIABDIRECTORYQUERY
00081     // nsIAbDirectorySearch methods
00082     NS_DECL_NSIABDIRECTORYSEARCH
00083     // nsAbDirSearchListenerContext methods
00084     nsresult OnSearchFinished(PRInt32 aResult) ;
00085     nsresult OnSearchFoundCard(nsIAbCard *aCard) ;
00086     // Perform a MAPI query (function executed in a separate thread)
00087     nsresult ExecuteQuery(nsIAbDirectoryQueryArguments *aArguments,
00088                           nsIAbDirectoryQueryResultListener *aListener,
00089                           PRInt32 aResultLimit, PRInt32 aTimeout,
00090                           PRInt32 aThreadId) ;
00091 
00092 protected:
00093     // Retrieve hierarchy as cards, with an optional restriction
00094     nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
00095     // Retrieve hierarchy as directories
00096     nsresult GetChildNodes(nsISupportsArray **aNodes) ;
00097     // Create a new card
00098     nsresult CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard) ;
00099     // Notification for the UI
00100     nsresult NotifyItemDeletion(nsISupports *aItem) ;
00101     nsresult NotifyItemAddition(nsISupports *aItem) ;
00102     // Force update of MAPI repository for mailing list
00103     nsresult CommitAddressList(void) ;
00104     // Read MAPI repository
00105     nsresult UpdateAddressList(void) ;
00106 
00107     nsMapiEntry *mMapiData ;
00108     // Container for the query threads
00109     nsHashtable mQueryThreads ;
00110     PRInt32 mCurrentQueryId ;
00111     PRLock *mProtector ;
00112     // Data for the search interfaces
00113        nsSupportsHashtable mCardList ;
00114     PRInt32 mSearchContext ;
00115     // Windows AB type
00116     PRUint32 mAbWinType ;
00117 };
00118 
00119 #endif // nsAbOutlookDirectory_h___