Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgFolder.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   David Bienvenu <bienvenu@nventure.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038  
00039 #include "nsISupports.idl"
00040 #include "nsICollection.idl"
00041 #include "nsIFolderListener.idl"
00042 #include "nsIMsgThread.idl"
00043 #include "nsIMsgIncomingServer.idl"
00044 #include "nsISupportsArray.idl"
00045 #include "nsIMsgCopyServiceListener.idl"
00046 #include "nsIUrlListener.idl"
00047 #include "nsIEnumerator.idl"
00048 #include "nsISimpleEnumerator.idl"
00049 %{ C++
00050 #include "nsIMsgDatabase.h"
00051 %}
00052 
00053 [ptr] native octet_ptr(PRUint8);
00054 [ptr] native nsAutoString(nsAutoString);
00055 
00056 interface nsIMsgDBHdr;
00057 interface nsIMsgWindow;
00058 interface nsIMsgDatabase;
00059 interface nsIDBFolderInfo;
00060 interface nsIMsgFilterList;
00061 
00062 interface nsIMsgFolderCacheElement;
00063 interface nsITransport;
00064 interface nsIFileSpec;
00065 interface nsIOutputStream;
00066 interface nsIInputStream;
00067 interface nsILocalFile;
00068 interface nsIMsgIdentity;
00069 
00070 typedef long nsMsgBiffState;
00071 // enumerated type for determining if a message has been replied to, forwarded, etc.
00072 typedef long nsMsgDispositionState;
00073 
00074 [scriptable, uuid(83d2454c-632e-4d6e-900a-7236a6d2aa9a)]
00075 interface nsIMsgFolder : nsICollection {
00076 
00077 const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
00078 const nsMsgBiffState nsMsgBiffState_NoMail =  1; // No new mail is waiting.
00079 const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is new mail.
00080 
00081   nsISimpleEnumerator getMessages(in nsIMsgWindow aMsgWindow);
00082   
00083   void startFolderLoading();
00084   void endFolderLoading();
00085   
00086   /* get new headers for db */
00087   void updateFolder(in nsIMsgWindow aWindow);
00088   
00089   readonly attribute wstring prettiestName;
00090 
00094   readonly attribute string folderURL;
00095   
00099   readonly attribute boolean showDeletedMessages;
00100 
00104   readonly attribute nsIMsgIncomingServer server;
00105 
00109   readonly attribute boolean isServer;
00110   readonly attribute boolean canSubscribe;
00111   readonly attribute boolean canFileMessages;
00112   readonly attribute boolean noSelect;  // this is an imap no select folder
00113   readonly attribute boolean imapShared; // this is an imap shared folder
00114   readonly attribute boolean canDeleteMessages; // can't delete from imap read-only
00115 
00121   readonly attribute boolean canCreateSubfolders;
00122 
00128   readonly attribute boolean canRename;
00129 
00130   readonly attribute boolean canCompact;
00131 
00135   readonly attribute nsIMsgFolder rootFolder;
00136 
00141   nsIMsgFilterList getFilterList(in nsIMsgWindow msgWindow);
00142   void setFilterList(in nsIMsgFilterList filterList);
00143   
00144   void ForceDBClosed ();
00145   void Delete ();
00146 
00147   void deleteSubFolders(in nsISupportsArray folders, in nsIMsgWindow msgWindow);
00148   void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage,
00149                        in nsIMsgWindow msgWindow);
00150   void recursiveDelete(in boolean deleteStorage, in nsIMsgWindow msgWindow);
00151 
00152   void createSubfolder(in wstring folderName, in nsIMsgWindow msgWindow);
00153   nsIMsgFolder addSubfolder(in AString folderName);
00154   /* this method ensures the storage for the folder exists.
00155     For local folders, it creates the berkeley mailbox if missing.
00156     For imap folders, it subscribes to the folder if it exists,
00157     or creates it if it doesn't exist
00158   */
00159   void createStorageIfMissing(in nsIUrlListener urlListener);
00160   
00161   void compact(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow);
00162   void compactAll(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow,
00163                   in nsISupportsArray aFolderArray, in boolean aCompactOfflineAlso,
00164                   in nsISupportsArray aOfflineFolderArray);
00165   void compactAllOfflineStores(in nsIMsgWindow aMsgWindow,
00166                                in nsISupportsArray aOfflineFolderArray);
00167   void emptyTrash(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener);
00168 
00174   void rename(in wstring name, in nsIMsgWindow msgWindow);
00175   void renameSubFolders( in nsIMsgWindow msgWindow, in nsIMsgFolder oldFolder);
00181   boolean containsChildNamed(in wstring name);
00182   boolean isAncestorOf(in nsIMsgFolder folder);
00183 
00184   wstring generateUniqueSubfolderName(in wstring prefix,
00185                                       in nsIMsgFolder otherFolder);
00186 
00187   void updateSummaryTotals(in boolean force);
00188   void summaryChanged();
00195   long getNumUnread(in boolean deep);
00196 
00203   long getTotalMessages(in boolean deep);
00204 
00209   //boolean hasNewMessages();
00210   attribute boolean hasNewMessages;
00211 
00216   readonly attribute nsIMsgDBHdr firstNewMessage;
00217 
00222   void clearNewMessages();
00223 
00224   readonly attribute unsigned long expungedBytes;
00225 
00226 
00231   readonly attribute boolean deletable;
00232 
00238   readonly attribute boolean displayRecipients;
00239 
00245   readonly attribute boolean manyHeadersToDownload;
00246 
00247   readonly attribute boolean requiresCleanup;
00248   void clearRequiresCleanup();
00249 
00250 
00254   readonly attribute boolean knowsSearchNntpExtension;
00255   
00259   readonly attribute boolean allowsPosting;
00260 
00261   readonly attribute string relativePathName;
00262 
00267   attribute unsigned long sizeOnDisk;
00268 
00269   readonly attribute string username;
00270   readonly attribute string hostname;
00271 
00272   void setFlag(in unsigned long flag);
00273   void clearFlag(in unsigned long flag);
00274   boolean getFlag(in unsigned long flag);
00275   void setPrefFlag();
00276 
00277   void toggleFlag (in unsigned long flag);
00278   void onFlagChange (in unsigned long flag);
00279   
00280   attribute unsigned long flags;
00281 
00282   nsIMsgFolder getFoldersWithFlag(in unsigned long flags,
00283                                   in unsigned long resultsize,
00284                                   out unsigned long numFolders);
00285 
00286   nsISupportsArray getAllFoldersWithFlag(in unsigned long aFlag);
00287 
00288   void getExpansionArray(in nsISupportsArray expansionArray);
00289 
00290   string getUriForMsg(in nsIMsgDBHdr msgHdr);
00291 
00292   void deleteMessages(in nsISupportsArray messages,
00293                       in nsIMsgWindow msgWindow,
00294                       in boolean deleteStorage, in boolean isMove,
00295                       in nsIMsgCopyServiceListener listener, in boolean allowUndo);
00296 
00297   void copyMessages(in nsIMsgFolder srcFolder, in nsISupportsArray messages,
00298                     in boolean isMove, in nsIMsgWindow msgWindow,
00299                     in nsIMsgCopyServiceListener listener, in boolean isFolder,
00300                     in boolean allowUndo);
00301 
00302   void copyFolder(in nsIMsgFolder srcFolder, in boolean isMoveFolder,
00303                   in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
00304 
00305   void copyFileMessage(in nsIFileSpec fileSpec, in nsIMsgDBHdr msgToReplace,
00306                        in boolean isDraft, in unsigned long newMsgFlags,
00307                        in nsIMsgWindow msgWindow,
00308                        in nsIMsgCopyServiceListener listener);
00309 
00310   void acquireSemaphore (in nsISupports semHolder);
00311   void releaseSemaphore (in nsISupports semHolder);
00312   boolean testSemaphore (in nsISupports semHolder);
00313   readonly attribute boolean locked;
00314 
00315   void getNewMessages(in nsIMsgWindow aWindow, in nsIUrlListener aListener);
00316 
00321   void writeToFolderCache(in nsIMsgFolderCache folderCache, in boolean deep);
00322 
00326   attribute string charset;
00327   attribute boolean charsetOverride;
00328   attribute unsigned long biffState;
00329 
00335    long getNumNewMessages (in boolean deep);
00336 
00337    void setNumNewMessages(in long numNewMessages);
00338 
00342   readonly attribute wstring newMessagesNotificationDescription;
00343 
00344   // are we running a url as a result of the user clicking get msg?
00345   attribute boolean gettingNewMessages;
00349   attribute nsIFileSpec path;
00350 
00351   // this should help in the process of eliminating nsIFileSpec.
00352   attribute nsILocalFile filePath;
00353 
00354   readonly attribute string baseMessageURI;
00355   string generateMessageURI(in nsMsgKey msgKey);
00356 
00357   const nsMsgDispositionState nsMsgDispositionState_None = -1;
00358   const nsMsgDispositionState nsMsgDispositionState_Replied = 0;
00359   const nsMsgDispositionState nsMsgDispositionState_Forwarded = 1;  
00360   void addMessageDispositionState(in nsIMsgDBHdr aMessage,
00361                                   in nsMsgDispositionState aDispositionFlag);
00362 
00363   void markMessagesRead(in nsISupportsArray messages, in boolean markRead);
00364   void markAllMessagesRead();
00365   void markMessagesFlagged(in nsISupportsArray messages, in boolean markFlagged);
00366   void markThreadRead(in nsIMsgThread thread);
00367   void setLabelForMessages(in nsISupportsArray messages, in nsMsgLabelValue label);
00368   nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
00369   void setMsgDatabase (in nsIMsgDatabase msgDatabase);
00370   nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo);
00371   nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey);
00372 
00373   readonly attribute boolean supportsOffline;
00374   boolean shouldStoreMsgOffline(in nsMsgKey msgKey);
00375   boolean hasMsgOffline(in nsMsgKey msgKey);
00376 
00377   nsIInputStream getOfflineFileStream(in nsMsgKey msgKey, out PRUint32 offset,
00378                                       out PRUint32 size);
00379   readonly attribute nsIOutputStream offlineStoreOutputStream;
00380   readonly attribute nsIInputStream offlineStoreInputStream;
00381   void DownloadMessagesForOffline(in nsISupportsArray messages,
00382                                   in nsIMsgWindow window);        
00383   nsIMsgFolder getChildWithURI(in string uri, in boolean deep,
00384                                in boolean caseInsensitive);
00385   void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window);
00391   const unsigned long allMessageCountNotifications    = 0;
00392   void enableNotifications(in long notificationType, in boolean enable,
00393                            in boolean dbBatching);
00394   boolean isCommandEnabled(in string command);
00395   boolean matchOrChangeFilterDestination(in nsIMsgFolder folder,
00396                                          in boolean caseInsensitive);
00397   boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow);
00398   void alertFilterChanged(in nsIMsgWindow msgWindow);
00399   void throwAlertMsg(in string msgName, in nsIMsgWindow msgWindow);
00400   wstring getStringWithFolderNameFromBundle(in string msgName);
00401   void notifyCompactCompleted();
00402   long compareSortKeys(in nsIMsgFolder msgFolder);
00403   [noscript] void getSortKey(out octet_ptr key, out unsigned long length);
00404 
00405   attribute nsIMsgRetentionSettings retentionSettings;
00406   attribute nsIMsgDownloadSettings downloadSettings;
00407   boolean callFilterPlugins(in nsIMsgWindow aMsgWindow);
00411   attribute long sortOrder;
00412 
00416   [noscript]readonly attribute boolean persistElided;
00417 
00418   /* handy accessor when we want a msg folder */
00419   readonly attribute nsIMsgFolder parentMsgFolder;
00420 
00421   attribute nsIDBFolderInfo dBTransferInfo;
00422 
00423   string getStringProperty(in string propertyName);
00424   void setStringProperty(in string propertyName, in string propertyValue);
00425 
00426   /* does not persist across sessions */
00427   attribute nsMsgKey lastMessageLoaded;
00428 
00429   /* old nsIFolder properties and methods */
00430   readonly attribute string URI;
00431   attribute wstring name;
00432   attribute wstring prettyName;
00433   readonly attribute wstring abbreviatedName;
00434 
00435   nsISupports getChildNamed(in wstring name);
00436   attribute nsIMsgFolder parent;
00437 
00438   nsIEnumerator GetSubFolders();
00439   readonly attribute boolean hasSubFolders;
00440 
00441   void AddFolderListener(in nsIFolderListener listener);
00442   void RemoveFolderListener(in nsIFolderListener listener);
00443   nsIMsgFolder FindSubFolder(in ACString escapedSubFolderName);
00444 
00445   void NotifyPropertyChanged(in nsIAtom property,
00446                              in string oldValue,
00447                              in string newValue);
00448   void NotifyIntPropertyChanged(in nsIAtom property,
00449                                 in long oldValue,
00450                                 in long newValue);
00451   void NotifyBoolPropertyChanged(in nsIAtom property,
00452                                  in boolean oldValue,
00453                                  in boolean newValue);
00454   void NotifyPropertyFlagChanged(in nsIMsgDBHdr item,
00455                                  in nsIAtom property,
00456                                  in unsigned long oldValue,
00457                                  in unsigned long newValue);
00458   void NotifyUnicharPropertyChanged(in nsIAtom property,
00459                                     in wstring oldValue,
00460                                     in wstring newValue);
00461   
00462   void NotifyItemAdded(in nsISupports item);
00463   void NotifyItemRemoved(in nsISupports item);
00464 
00465   void NotifyFolderEvent(in nsIAtom event);
00466   
00467   //  void NotifyFolderLoaded();
00468   //  void NotifyDeleteOrMoveMessagesCompleted(in nsIMsgFolder folder);
00469 
00470   // lists all descendents, not just first level children
00471   void ListDescendents(in nsISupportsArray descendents);  
00472   void Shutdown(in boolean shutdownChildren);
00473 
00474   readonly attribute boolean inVFEditSearchScope;
00475   void setInVFEditSearchScope(in boolean aSearchThisFolder, in boolean aSetOnSubFolders);
00476   void copyDataToOutputStreamForAppend(in nsIInputStream aIStream,
00477                      in long aLength, in nsIOutputStream outputStream);
00478   void copyDataDone();
00479   void setJunkScoreForMessages(in nsISupportsArray aMessages, in string aJunkScore);
00480   void applyRetentionSettings();
00481 
00497   void fetchMsgPreviewText([array, size_is (aNumKeys)] in nsMsgKey aKeysToFetch,
00498                       in unsigned long aNumKeys, in boolean aLocalOnly, 
00499                       in nsIUrlListener aUrlListener, out boolean aAsyncResults);
00500 
00501   // used to set/clear tags - we could have a single method to setKeywords which
00502   // would figure out the diffs, but these methods might be more convenient.
00503   // keywords are space delimited, in the case of multiple keywords
00504   void addKeywordsToMessages(in nsISupportsArray aMessages, in string aKeywords);
00505   void removeKeywordsFromMessages(in nsISupportsArray aMessages, in string aKeywords);
00517   ACString getMsgTextFromStream(in nsIMsgDBHdr aMsgHdr, in nsIInputStream aStream, 
00518                                 in long aBytesToRead, in long aMaxOutputLen, in boolean aCompressQuotes);
00519   
00520   // this allows a folder to have a special identity. E.g., you might want to
00521   // associate an identity with a particular newsgroup, or for IMAP shared folders in
00522   // the other users namespace, you might want to create a delegated identity
00523   readonly attribute nsIMsgIdentity customIdentity;
00524 
00525 };