summaryrefslogtreecommitdiffstats
path: root/mailnews/local/public/nsIMsgLocalMailFolder.idl
blob: 6bf1c5c5bedf806af1fe4e22c1ec6b767862fdfc (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
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
116
117
118
119
120
121
122
/* -*- 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 nsIArray;
interface nsIMsgWindow;
interface nsIUrlListener;
interface nsIMsgDatabase;
interface nsIMsgDBHdr;
interface nsIMsgFolder;
interface nsIMsgCopyServiceListener;

[ptr] native nsLocalFolderScanState(nsLocalFolderScanState);

%{C++
/* flags for markMsgsOnPop3Server */
#define POP3_NONE 0
#define POP3_DELETE 1
#define POP3_FETCH_BODY 2
#define POP3_FORCE_DEL 3

struct nsLocalFolderScanState;
%}

[scriptable, uuid(ebf7576c-e15f-4aba-b021-cc6e9266e90c)]
interface nsIMsgLocalMailFolder : nsISupports {
  /**
   * Set the default flags on the subfolders of this folder, such as
   * Drafts, Templates, etc.
   * @param flags bitwise OR matching the type of mailboxes you want to flag.
   *              This function will be smart and find the right names.
   *              E.g. nsMsgFolderFlags::Inbox | nsMsgFolderFlags::Drafts
   */
  void setFlagsOnDefaultMailboxes(in unsigned long flags);

  /* 
   * This will return null if the db is out of date
   */
  nsIMsgDatabase getDatabaseWOReparse();

  /*
   * This will kick off a url to reparse the db if it's out of date.
   * If aReparseUrlListener is null, folder will use itself as the listener
   */
  nsIMsgDatabase getDatabaseWithReparse(in nsIUrlListener aReparseUrlListener, in nsIMsgWindow aMsgWindow);
  void parseFolder(in nsIMsgWindow aMsgWindow, in nsIUrlListener listener);
  void copyFolderLocal(in nsIMsgFolder srcFolder, in boolean isMove, in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
  void copyAllSubFolders(in nsIMsgFolder srcFolder, in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
  void onCopyCompleted(in nsISupports aSrcSupport, in boolean aMoveCopySucceeded);
  attribute boolean checkForNewMessagesAfterParsing;
  void markMsgsOnPop3Server(in nsIArray aMessages, in int32_t aMark);

  /**
   * File size on disk has possibly changed - update and notify.
   */
  void refreshSizeOnDisk();

  /**
   * Creates a subfolder to the current folder with the passed in folder name.
   * @param aFolderName name of the folder to create.
   * @return newly created folder.
   */
  nsIMsgFolder createLocalSubfolder(in AString aFolderName);

  /**
   * Adds a message to the end of the folder, parsing it as it goes, and
   * applying filters, if applicable.
   * @param aMessage string containing the entire body of the message to add
   * @return the nsIMsgDBHdr of the added message
   */
  nsIMsgDBHdr addMessage(in string aMessage);

  /**
   * Add one or more messages to the end of the folder in a single batch. Each
   * batch requires an fsync() on the mailbox file so it is a good idea to
   * try and minimize the number of calls you make to this method or addMessage.
   *
   * Filters are applied, if applicable.
   *
   * @param aMessageCount The number of messages.
   * @param aMessages An array of pointers to strings containing entire message
   *                  bodies.
   * @return an array of nsIMsgDBHdr of the added messages
   */
  nsIArray addMessageBatch(in uint32_t aMessageCount,
                           [array, size_is(aMessageCount)] in string aMessages);

  /**
   * Functions for updating the UI while running DownloadMessagesForOffline:
   * delete the old message before adding its newly downloaded body, and
   * select the new message after it has replaced the old one
   */
  void deleteDownloadMsg(in nsIMsgDBHdr aMsgHdr, out boolean aDoSelect);
  void selectDownloadMsg();
  void notifyDelete();

  /**
   * Functions for grubbing through a folder to find the Uidl for a
   * given msgDBHdr.
   */
  [noscript] void getFolderScanState(in nsLocalFolderScanState aState);
  [noscript] void getUidlFromFolder(in nsLocalFolderScanState aState, in nsIMsgDBHdr aMsgHdr);


  /**
   * Shows warning if there is not enough space in the message store
   * for a message of the given size.
   */
  boolean warnIfLocalFileTooBig(in nsIMsgWindow aWindow,
                                [optional] in long long aSpaceRequested);

  /**
   * Update properties on a new header from an old header, for cases where
   * a partial message will be replaced with a full message.
   *
   * @param   aOldHdr  message header used as properties source
   * @param   aNewHdr  message header used as properties destination
   */
  void updateNewMsgHdr(in nsIMsgDBHdr aOldHdr, in nsIMsgDBHdr aNewHdr);
};