DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (c4a371f2ce99)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
/* 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/. */


#ifndef nsAbLDAPReplicationData_h__
#define nsAbLDAPReplicationData_h__

#include "mozilla/Attributes.h"
#include "nsIAbLDAPReplicationData.h"
#include "nsIWebProgressListener.h"
#include "nsIAbLDAPReplicationQuery.h"
#include "nsAbLDAPListenerBase.h"
#include "nsIAddrDatabase.h"
#include "nsIFile.h"
#include "nsDirPrefs.h"
#include "nsIAbLDAPAttributeMap.h"
#include "nsIAbLDAPDirectory.h"
#include "nsStringGlue.h"

class nsAbLDAPProcessReplicationData : public nsIAbLDAPProcessReplicationData,
                                       public nsAbLDAPListenerBase
{
public:
  NS_DECL_THREADSAFE_ISUPPORTS
  NS_DECL_NSIABLDAPPROCESSREPLICATIONDATA

  nsAbLDAPProcessReplicationData();

  // nsILDAPMessageListener
  NS_IMETHOD OnLDAPMessage(nsILDAPMessage *aMessage) override;

protected:
  virtual ~nsAbLDAPProcessReplicationData();
  virtual nsresult DoTask() override;
  virtual void InitFailed(bool aCancelled = false) override;

  // pointer to the interfaces used by this object
  nsCOMPtr<nsIWebProgressListener> mListener;
  // pointer to the query to call back to once we've finished
  nsCOMPtr<nsIAbLDAPReplicationQuery> mQuery;

  nsCOMPtr<nsIAddrDatabase> mReplicationDB;
  nsCOMPtr <nsIFile> mReplicationFile;
  nsCOMPtr <nsIFile> mBackupReplicationFile;

  // state of processing, protocol used and count of results
  int32_t         mState;
  int32_t         mProtocol;
  int32_t         mCount;
  bool            mDBOpen;
  bool            mInitialized;
  
  nsCOMPtr<nsIAbLDAPDirectory> mDirectory;
  nsCOMPtr<nsIAbLDAPAttributeMap> mAttrMap; // maps ab properties to ldap attrs
  
  virtual nsresult OnLDAPSearchEntry(nsILDAPMessage *aMessage);
  virtual nsresult OnLDAPSearchResult(nsILDAPMessage *aMessage);
  
  nsresult OpenABForReplicatedDir(bool bCreate);
  nsresult DeleteCard(nsString & aDn);
  void Done(bool aSuccess);
};


#endif // nsAbLDAPReplicationData_h__