/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIDBChangeListener.idl
 */

#ifndef __gen_nsIDBChangeListener_h__
#define __gen_nsIDBChangeListener_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

#ifndef __gen_MailNewsTypes2_h__
#include "MailNewsTypes2.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIDBChangeAnnouncer; /* forward declaration */

class nsIMsgDBHdr; /* forward declaration */

class nsIMsgDatabase; /* forward declaration */


/* starting interface:    nsIDBChangeListener */
#define NS_IDBCHANGELISTENER_IID_STR "21c56d34-71b9-42bb-9606-331a6a5f8210"

#define NS_IDBCHANGELISTENER_IID \
  {0x21c56d34, 0x71b9, 0x42bb, \
    { 0x96, 0x06, 0x33, 0x1a, 0x6a, 0x5f, 0x82, 0x10 }}

/**
 * These callbacks are provided to allow listeners to the message database
 * to update their status when changes occur.
 */
class NS_NO_VTABLE NS_SCRIPTABLE nsIDBChangeListener : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDBCHANGELISTENER_IID)

  /**
   * Callback when message flags are changed.
   *
   * @param aHdrChanged The changed header.
   * @param aOldFlags   Message flags prior to change.
   * @param aNewFlags   Message flags after change.
   * @param aInstigator Object that initiated the change.
   */
  /* void onHdrFlagsChanged (in nsIMsgDBHdr aHdrChanged, in unsigned long aOldFlags, in unsigned long aNewFlags, in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, PRUint32 aOldFlags, PRUint32 aNewFlags, nsIDBChangeListener *aInstigator) = 0;

  /**
   * Callback when message is marked as deleted.
   *
   * @param aHdrChanged The message header that is going to be deleted.
   * @param aParentKey  Key of parent.
   * @param aFlags      Flags that message has before delete.
   * @param aInstigator Object that initiated the change. Can be null.
   */
  /* void onHdrDeleted (in nsIMsgDBHdr aHdrChanged, in nsMsgKey aParentKey, in long aFlags, in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnHdrDeleted(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator) = 0;

  /**
   * Callback when message is added.
   *
   * @param aHdrChanged The message header that is added.
   * @param aParentKey  Parent key of message.
   * @param aFlags      Flags that new message will have.
   * @param aInstigator Object that initiated the change. Can be null.
   */
  /* void onHdrAdded (in nsIMsgDBHdr aHdrChanged, in nsMsgKey aParentKey, in long aFlags, in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnHdrAdded(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator) = 0;

  /**
   * Callback when message parrent is changed. Parent is changed when message is deleted or moved.
   *
   * @param aKeyChanged The message key that parent key was changed.
   * @param oldParent   Old parent key.
   * @param newParent   New parent key.
   * @param aInstigator Object that initiated the change. Can be null.
   */
  /* void onParentChanged (in nsMsgKey aKeyChanged, in nsMsgKey oldParent, in nsMsgKey newParent, in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnParentChanged(nsMsgKey aKeyChanged, nsMsgKey oldParent, nsMsgKey newParent, nsIDBChangeListener *aInstigator) = 0;

  /**
   * Callback when announcer is going away. This is good place to release strong pointers to announcer.
   *
   * @param instigator Object that initiated the change. Can be null.
   */
  /* void onAnnouncerGoingAway (in nsIDBChangeAnnouncer instigator); */
  NS_SCRIPTABLE NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator) = 0;

  /**
   * Callback when read flag is changed.
   *
   * @param aInstigator Object that initiated the change. Can be null.
   */
  /* void onReadChanged (in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnReadChanged(nsIDBChangeListener *aInstigator) = 0;

  /**
   * Callback used in case when "junkscore" property is changed.
   *
   * @param aInstigator Object that initiated the change. Can be null.
   */
  /* void onJunkScoreChanged (in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnJunkScoreChanged(nsIDBChangeListener *aInstigator) = 0;

  /**
   * Callback used in the general case where any field may have changed.
   * OnHdrPropertyChanged is called twice per change. On the first call, aPreChange
   * is true, and aStatus is undefined. OnHdrPropertyChanged saves any required status in aStatus
   * (such as a filter match). The calling function stores the value of aStatus, changes the
   * header aHdrToChange, then calls OnHdrPropertyChanged again with aPreChange false. On this
   * second call, the stored value of aStatus is provided, so that any changes may be noted.
   *
   * @param aHdrToChange the message header that is changing.
   * @param aPreChange   true on first call before change, false on second call after change
   * @param aStatus      storage location provided by calling routine for status
   * @param aInstigator  object that initiated the change
   */
  /* void onHdrPropertyChanged (in nsIMsgDBHdr aHdrToChange, in PRBool aPreChange, inout PRUint32 aStatus, in nsIDBChangeListener aInstigator); */
  NS_SCRIPTABLE NS_IMETHOD OnHdrPropertyChanged(nsIMsgDBHdr *aHdrToChange, PRBool aPreChange, PRUint32 *aStatus NS_INOUTPARAM, nsIDBChangeListener *aInstigator) = 0;

  /**
   * Generic notification for extensibility. Common events should be documented
   * here so we have a hope of keeping the documentation up to date.
   * Current events are:
   * "DBOpened" - When a pending listener becomes real. This can happen when
   *              the existing db is force closed and a new one opened. Only
   *              registered pending listeners are notified.
   *
   * @param aDB      the db for this event.
   * @param aEvent   type of event. 
   *
   */
  /* void onEvent (in nsIMsgDatabase aDB, in string aEvent); */
  NS_SCRIPTABLE NS_IMETHOD OnEvent(nsIMsgDatabase *aDB, const char *aEvent) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIDBChangeListener, NS_IDBCHANGELISTENER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDBCHANGELISTENER \
  NS_SCRIPTABLE NS_IMETHOD OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, PRUint32 aOldFlags, PRUint32 aNewFlags, nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnHdrDeleted(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnHdrAdded(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnParentChanged(nsMsgKey aKeyChanged, nsMsgKey oldParent, nsMsgKey newParent, nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator); \
  NS_SCRIPTABLE NS_IMETHOD OnReadChanged(nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnJunkScoreChanged(nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnHdrPropertyChanged(nsIMsgDBHdr *aHdrToChange, PRBool aPreChange, PRUint32 *aStatus NS_INOUTPARAM, nsIDBChangeListener *aInstigator); \
  NS_SCRIPTABLE NS_IMETHOD OnEvent(nsIMsgDatabase *aDB, const char *aEvent); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDBCHANGELISTENER(_to) \
  NS_SCRIPTABLE NS_IMETHOD OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, PRUint32 aOldFlags, PRUint32 aNewFlags, nsIDBChangeListener *aInstigator) { return _to OnHdrFlagsChanged(aHdrChanged, aOldFlags, aNewFlags, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnHdrDeleted(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator) { return _to OnHdrDeleted(aHdrChanged, aParentKey, aFlags, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnHdrAdded(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator) { return _to OnHdrAdded(aHdrChanged, aParentKey, aFlags, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnParentChanged(nsMsgKey aKeyChanged, nsMsgKey oldParent, nsMsgKey newParent, nsIDBChangeListener *aInstigator) { return _to OnParentChanged(aKeyChanged, oldParent, newParent, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator) { return _to OnAnnouncerGoingAway(instigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnReadChanged(nsIDBChangeListener *aInstigator) { return _to OnReadChanged(aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnJunkScoreChanged(nsIDBChangeListener *aInstigator) { return _to OnJunkScoreChanged(aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnHdrPropertyChanged(nsIMsgDBHdr *aHdrToChange, PRBool aPreChange, PRUint32 *aStatus NS_INOUTPARAM, nsIDBChangeListener *aInstigator) { return _to OnHdrPropertyChanged(aHdrToChange, aPreChange, aStatus, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnEvent(nsIMsgDatabase *aDB, const char *aEvent) { return _to OnEvent(aDB, aEvent); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDBCHANGELISTENER(_to) \
  NS_SCRIPTABLE NS_IMETHOD OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, PRUint32 aOldFlags, PRUint32 aNewFlags, nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnHdrFlagsChanged(aHdrChanged, aOldFlags, aNewFlags, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnHdrDeleted(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnHdrDeleted(aHdrChanged, aParentKey, aFlags, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnHdrAdded(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnHdrAdded(aHdrChanged, aParentKey, aFlags, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnParentChanged(nsMsgKey aKeyChanged, nsMsgKey oldParent, nsMsgKey newParent, nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnParentChanged(aKeyChanged, oldParent, newParent, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnAnnouncerGoingAway(instigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnReadChanged(nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnReadChanged(aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnJunkScoreChanged(nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnJunkScoreChanged(aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnHdrPropertyChanged(nsIMsgDBHdr *aHdrToChange, PRBool aPreChange, PRUint32 *aStatus NS_INOUTPARAM, nsIDBChangeListener *aInstigator) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnHdrPropertyChanged(aHdrToChange, aPreChange, aStatus, aInstigator); } \
  NS_SCRIPTABLE NS_IMETHOD OnEvent(nsIMsgDatabase *aDB, const char *aEvent) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnEvent(aDB, aEvent); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsDBChangeListener : public nsIDBChangeListener
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIDBCHANGELISTENER

  nsDBChangeListener();

private:
  ~nsDBChangeListener();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDBChangeListener, nsIDBChangeListener)

nsDBChangeListener::nsDBChangeListener()
{
  /* member initializers and constructor code */
}

nsDBChangeListener::~nsDBChangeListener()
{
  /* destructor code */
}

/* void onHdrFlagsChanged (in nsIMsgDBHdr aHdrChanged, in unsigned long aOldFlags, in unsigned long aNewFlags, in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, PRUint32 aOldFlags, PRUint32 aNewFlags, nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onHdrDeleted (in nsIMsgDBHdr aHdrChanged, in nsMsgKey aParentKey, in long aFlags, in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnHdrDeleted(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onHdrAdded (in nsIMsgDBHdr aHdrChanged, in nsMsgKey aParentKey, in long aFlags, in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnHdrAdded(nsIMsgDBHdr *aHdrChanged, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onParentChanged (in nsMsgKey aKeyChanged, in nsMsgKey oldParent, in nsMsgKey newParent, in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnParentChanged(nsMsgKey aKeyChanged, nsMsgKey oldParent, nsMsgKey newParent, nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onAnnouncerGoingAway (in nsIDBChangeAnnouncer instigator); */
NS_IMETHODIMP nsDBChangeListener::OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onReadChanged (in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnReadChanged(nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onJunkScoreChanged (in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnJunkScoreChanged(nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onHdrPropertyChanged (in nsIMsgDBHdr aHdrToChange, in PRBool aPreChange, inout PRUint32 aStatus, in nsIDBChangeListener aInstigator); */
NS_IMETHODIMP nsDBChangeListener::OnHdrPropertyChanged(nsIMsgDBHdr *aHdrToChange, PRBool aPreChange, PRUint32 *aStatus NS_INOUTPARAM, nsIDBChangeListener *aInstigator)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onEvent (in nsIMsgDatabase aDB, in string aEvent); */
NS_IMETHODIMP nsDBChangeListener::OnEvent(nsIMsgDatabase *aDB, const char *aEvent)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


#endif /* __gen_nsIDBChangeListener_h__ */
