summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/base/public/nsIFolderListener.idl
blob: 3906ef2f4620280d8d5ce74c238a9be8dd208f81 (plain)
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
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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"

interface nsIMsgFolder;
interface nsIMsgDBHdr;

typedef unsigned long folderListenerNotifyFlagValue;

/**
 * nsIFolderListener defines callbacks to handle various notifications
 * about changes in folders.
 * These listeners can be attached to individual folders, or they
 * can be registered globally, with nsIMsgMailSession.
 * These notifications originate from nsIMsgFolder implementations.
 * (nsIMsgFolder has corresponding methods for generating these
 * notifications).
 */
[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)]
interface nsIFolderListener : nsISupports {
  // "added" flag covers adding both messages and child folders.
  const folderListenerNotifyFlagValue added = 0x1;
  void onFolderAdded(in nsIMsgFolder parent, in nsIMsgFolder child);
  void onMessageAdded(in nsIMsgFolder parent, in nsIMsgDBHdr msg);

  // "removed" flag covers removing both messages and child folders.
  const folderListenerNotifyFlagValue removed = 0x2;
  void onFolderRemoved(in nsIMsgFolder parent, in nsIMsgFolder child);
  void onMessageRemoved(in nsIMsgFolder parent, in nsIMsgDBHdr msg);

  const folderListenerNotifyFlagValue propertyChanged = 0x4;
  void onFolderPropertyChanged(in nsIMsgFolder folder,
                               in ACString property,
                               in AUTF8String oldValue,
                               in AUTF8String newValue);

  const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
  // While this property handles long long (64bit wide) values,
  // the Javascript engine will only pass values up to 2^53 to the consumers.
  void onFolderIntPropertyChanged(in nsIMsgFolder folder,
                                  in ACString property,
                                  in long long oldValue,
                                  in long long newValue);

  const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
  void onFolderBoolPropertyChanged(in nsIMsgFolder folder,
                                   in ACString property,
                                   in boolean oldValue,
                                   in boolean newValue);

  const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
  void onFolderUnicharPropertyChanged(in nsIMsgFolder folder,
                                      in ACString property,
                                      in AString oldValue,
                                      in AString newValue);

  const folderListenerNotifyFlagValue propertyFlagChanged = 0x40;
  void onFolderPropertyFlagChanged(in nsIMsgDBHdr msg,
                                   in ACString property,
                                   in unsigned long oldFlag,
                                   in unsigned long newFlag);

  const folderListenerNotifyFlagValue event = 0x80;
  void onFolderEvent(in nsIMsgFolder folder, in ACString event);

  const folderListenerNotifyFlagValue all = 0xFFFFFFFF;
};