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.

Mercurial (2a29ee0adb31)

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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
/* -*- 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"
#include "MailNewsTypes2.idl"

interface nsIDBChangeAnnouncer;
interface nsIMsgDBHdr;
interface nsIMsgDatabase;

/**
 * These callbacks are provided to allow listeners to the message database
 * to update their status when changes occur.
 */
[scriptable, uuid(21c56d34-71b9-42bb-9606-331a6a5f8210)]

interface  nsIDBChangeListener : nsISupports {
  /**
   * 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);

  /**
   * 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);

  /**
   * 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);

  /**
   * 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);

  /**
   * 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);

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

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

  /**
   * 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 boolean aPreChange, inout uint32_t aStatus,
                       in nsIDBChangeListener aInstigator);

  /**
   * 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);
};