Back to index

lightning-sunbird  0.9+nobinonly
nsMsgDBView.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; 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) 2001-2003
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Seth Spitzer <sspitzer@netscape.com>
00024  *   Dan Mosedale <dmose@netscape.com>
00025  *   David Bienvenu <bienvenu@mozilla.org>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef _nsMsgDBView_H_
00042 #define _nsMsgDBView_H_
00043 
00044 #include "nsIMsgDBView.h"
00045 #include "nsIMsgWindow.h"
00046 #include "nsIMessenger.h"
00047 #include "nsIMsgDatabase.h"
00048 #include "nsIMsgHdr.h"
00049 #include "nsMsgLineBuffer.h" // for nsByteArray
00050 #include "nsMsgKeyArray.h"
00051 #include "nsUint8Array.h"
00052 #include "nsIDBChangeListener.h"
00053 #include "nsITreeView.h"
00054 #include "nsITreeBoxObject.h"
00055 #include "nsITreeSelection.h"
00056 #include "nsVoidArray.h"
00057 #include "nsIMsgFolder.h"
00058 #include "nsIDateTimeFormat.h"
00059 #include "nsIMsgHeaderParser.h"
00060 #include "nsIDOMElement.h"
00061 #include "nsIAtom.h"
00062 #include "nsIImapIncomingServer.h"
00063 #include "nsIWeakReference.h"
00064 #include "nsIMsgFilterPlugin.h"
00065 #include "nsIStringBundle.h"
00066 #include "nsMsgTagService.h"
00067 #include "nsCOMArray.h"
00068 
00069 #define MESSENGER_STRING_URL       "chrome://messenger/locale/messenger.properties"
00070 
00071 enum eFieldType {
00072     kCollationKey,
00073     kU32
00074 };
00075 
00076 // reserve the top 8 bits in the msg flags for the view-only flags.
00077 #define MSG_VIEW_FLAGS 0xEE000000
00078 #define MSG_VIEW_FLAG_HASCHILDREN 0x40000000
00079 #define MSG_VIEW_FLAG_DUMMY 0x20000000
00080 #define MSG_VIEW_FLAG_ISTHREAD 0x8000000
00081 
00082 /* There currently only 5 labels defined */
00083 #define PREF_LABELS_MAX 5
00084 #define PREF_LABELS_DESCRIPTION  "mailnews.labels.description."
00085 #define PREF_LABELS_COLOR  "mailnews.labels.color."
00086 
00087 #define LABEL_COLOR_STRING "lc-"
00088 #define LABEL_COLOR_WHITE_STRING "#FFFFFF"
00089 
00090 // I think this will be an abstract implementation class.
00091 // The classes that implement the tree support will probably
00092 // inherit from this class.
00093 class nsMsgDBView : public nsIMsgDBView, public nsIDBChangeListener,
00094                     public nsITreeView,
00095                     public nsIJunkMailClassificationListener
00096 {
00097 public:
00098   nsMsgDBView();
00099   virtual ~nsMsgDBView();
00100 
00101   NS_DECL_ISUPPORTS
00102   NS_DECL_NSIMSGDBVIEW
00103   NS_DECL_NSIDBCHANGELISTENER
00104   NS_DECL_NSITREEVIEW
00105   NS_DECL_NSIJUNKMAILCLASSIFICATIONLISTENER
00106 
00107   nsMsgViewIndex GetInsertIndexHelper(nsIMsgDBHdr *msgHdr, nsMsgKeyArray *keys,
00108                                         nsMsgViewSortOrderValue sortOrder,
00109                                         nsMsgViewSortTypeValue sortType);
00110 protected:
00111   static nsrefcnt gInstanceCount;
00112   // atoms used for styling the view. we're going to have a lot of
00113   // these so i'm going to make them static.
00114   static nsIAtom* kUnreadMsgAtom;
00115   static nsIAtom* kNewMsgAtom;
00116   static nsIAtom* kReadMsgAtom;
00117   static nsIAtom* kRepliedMsgAtom;
00118   static nsIAtom* kForwardedMsgAtom;
00119   static nsIAtom* kOfflineMsgAtom;
00120   static nsIAtom* kFlaggedMsgAtom;
00121   static nsIAtom* kImapDeletedMsgAtom;
00122   static nsIAtom* kAttachMsgAtom;
00123   static nsIAtom* kHasUnreadAtom;
00124   static nsIAtom* kWatchThreadAtom;
00125   static nsIAtom* kIgnoreThreadAtom;
00126   static nsIAtom* kHasImageAtom;
00127 
00128 #ifdef SUPPORT_PRIORITY_COLORS
00129   static nsIAtom* kHighestPriorityAtom;
00130   static nsIAtom* kHighPriorityAtom;
00131   static nsIAtom* kLowestPriorityAtom;
00132   static nsIAtom* kLowPriorityAtom;
00133 #endif
00134 
00135   static PRUnichar* kHighestPriorityString;
00136   static PRUnichar* kHighPriorityString;
00137   static PRUnichar* kLowestPriorityString;
00138   static PRUnichar* kLowPriorityString;
00139   static PRUnichar* kNormalPriorityString;
00140 
00141   static nsIAtom* kLabelColorWhiteAtom;
00142   static nsIAtom* kLabelColorBlackAtom;
00143 
00144   static nsIAtom* kJunkMsgAtom;
00145   static nsIAtom* kNotJunkMsgAtom;
00146 
00147   static nsIAtom* kDummyMsgAtom;
00148 
00149   static PRUnichar* kReadString;
00150   static PRUnichar* kRepliedString;
00151   static PRUnichar* kForwardedString;
00152   static PRUnichar* kNewString;
00153 
00154   static PRUnichar* kKiloByteString;
00155 
00156   nsCOMPtr<nsITreeBoxObject> mTree;
00157   nsCOMPtr<nsITreeSelection> mTreeSelection;
00158   PRUint32 mNumSelectedRows; // we cache this to determine when to push command status notifications.
00159   PRPackedBool   mSuppressMsgDisplay; // set when the message pane is collapsed
00160   PRPackedBool   mSuppressCommandUpdating;
00161   PRPackedBool   mRemovingRow; // set when we're telling the outline a row is being removed. used to suppress msg loading.
00162                         // during delete/move operations.
00163   PRPackedBool  mCommandsNeedDisablingBecauseOfSelection;
00164   PRPackedBool  mSuppressChangeNotification;
00165   PRPackedBool  mGoForwardEnabled;
00166   PRPackedBool  mGoBackEnabled;
00167   
00168   virtual const char * GetViewName(void) {return "MsgDBView"; }
00169   nsresult FetchAuthor(nsIMsgDBHdr * aHdr, PRUnichar ** aAuthorString);
00170   nsresult FetchRecipients(nsIMsgDBHdr * aHdr, PRUnichar ** aRecipientsString);
00171   nsresult FetchSubject(nsIMsgDBHdr * aMsgHdr, PRUint32 aFlags, PRUnichar ** aValue);
00172   nsresult FetchDate(nsIMsgDBHdr * aHdr, PRUnichar ** aDateString);
00173   nsresult FetchStatus(PRUint32 aFlags, PRUnichar ** aStatusString);
00174   nsresult FetchSize(nsIMsgDBHdr * aHdr, PRUnichar ** aSizeString);
00175   nsresult FetchPriority(nsIMsgDBHdr *aHdr, PRUnichar ** aPriorityString);
00176   nsresult FetchLabel(nsIMsgDBHdr *aHdr, PRUnichar ** aLabelString);
00177   nsresult FetchTags(nsIMsgDBHdr *aHdr, PRUnichar ** aTagString);
00178   nsresult FetchKeywords(nsIMsgDBHdr *aHdr, char ** keywordString);
00179   nsresult FetchAccount(nsIMsgDBHdr * aHdr, PRUnichar ** aAccount);
00180   nsresult CycleThreadedColumn(nsIDOMElement * aElement);
00181 
00182   // Save and Restore Selection are a pair of routines you should
00183   // use when performing an operation which is going to change the view
00184   // and you want to remember the selection. (i.e. for sorting). 
00185   // Call SaveAndClearSelection and we'll give you an array of msg keys for
00186   // the current selection. We also freeze and clear the selection. 
00187   // When you are done changing the view, 
00188   // call RestoreSelection passing in the same array
00189   // and we'll restore the selection AND unfreeze selection in the UI.
00190   nsresult SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsMsgKeyArray *aMsgKeyArray);
00191   nsresult RestoreSelection(nsMsgKey aCurrentmsgKey, nsMsgKeyArray *aMsgKeyArray);
00192 
00193   // this is not safe to use when you have a selection
00194   // RowCountChanged() will call AdjustSelection() 
00195   // it should be called after SaveAndClearSelection() and before
00196   // RestoreSelection()
00197   nsresult AdjustRowCount(PRInt32 rowCountBeforeSort, PRInt32 rowCountAfterSort);
00198 
00199   nsresult GetSelectedIndices(nsUInt32Array *selection);
00200   nsresult GenerateURIForMsgKey(nsMsgKey aMsgKey, nsIMsgFolder *folder, char ** aURI);
00201 // routines used in building up view
00202   virtual PRBool WantsThisThread(nsIMsgThread * thread);
00203   virtual nsresult   AddHdr(nsIMsgDBHdr *msgHdr);
00204   PRBool GetShowingIgnored() {return (m_viewFlags & nsMsgViewFlagsType::kShowIgnored) != 0;}
00205   virtual nsresult OnNewHeader(nsIMsgDBHdr *aNewHdr, nsMsgKey parentKey, PRBool ensureListed);
00206   virtual nsMsgViewIndex GetInsertIndex(nsIMsgDBHdr *msgHdr);
00207   nsMsgViewIndex GetIndexForThread(nsIMsgDBHdr *hdr);
00208   virtual nsresult GetThreadContainingIndex(nsMsgViewIndex index, nsIMsgThread **thread);
00209   virtual nsresult GetMsgHdrForViewIndex(nsMsgViewIndex index, nsIMsgDBHdr **msgHdr);
00210 
00211   nsresult ToggleExpansion(nsMsgViewIndex index, PRUint32 *numChanged);
00212   nsresult ExpandByIndex(nsMsgViewIndex index, PRUint32 *pNumExpanded);
00213   nsresult CollapseByIndex(nsMsgViewIndex index, PRUint32 *pNumCollapsed);
00214   nsresult ExpandAll();
00215   nsresult CollapseAll();
00216   nsresult ExpandAndSelectThread();
00217 
00218   // helper routines for thread expanding and collapsing.
00219   nsresult           GetThreadCount(nsMsgKey messageKey, PRUint32 *pThreadCount);
00220   nsMsgViewIndex GetIndexOfFirstDisplayedKeyInThread(nsIMsgThread *threadHdr);
00221   virtual nsresult GetFirstMessageHdrToDisplayInThread(nsIMsgThread *threadHdr, nsIMsgDBHdr **result);
00222   virtual nsMsgViewIndex ThreadIndexOfMsg(nsMsgKey msgKey, 
00223                               nsMsgViewIndex msgIndex = nsMsgViewIndex_None,
00224                               PRInt32 *pThreadCount = nsnull,
00225                               PRUint32 *pFlags = nsnull);
00226   virtual nsresult GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **pThread);
00227   nsMsgKey GetKeyOfFirstMsgInThread(nsMsgKey key);
00228   PRInt32 CountExpandedThread(nsMsgViewIndex index);
00229   virtual  nsresult ExpansionDelta(nsMsgViewIndex index, PRInt32 *expansionDelta);
00230   nsresult ReverseSort();
00231   nsresult ReverseThreads();
00232   nsresult SaveSortInfo(nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder);
00233   nsresult PersistFolderInfo(nsIDBFolderInfo **dbFolderInfo);
00234   void     SetMRUTimeForFolder(nsIMsgFolder *folder);
00235 
00236   nsMsgKey           GetAt(nsMsgViewIndex index) ;
00237   nsMsgViewIndex     FindViewIndex(nsMsgKey  key) 
00238                                      {return FindKey(key, PR_FALSE);}
00239   nsMsgViewIndex        FindHdr(nsIMsgDBHdr *msgHdr);
00240   virtual nsMsgViewIndex    FindKey(nsMsgKey key, PRBool expand);
00241   virtual nsresult GetDBForViewIndex(nsMsgViewIndex index, nsIMsgDatabase **db);
00242   virtual nsresult GetFolders(nsISupportsArray **folders);
00243   virtual nsresult GetFolderFromMsgURI(const char *aMsgURI, nsIMsgFolder **aFolder);
00244 
00245   virtual nsresult ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex viewIndex, PRUint32 *pNumListed);
00246   nsresult ListUnreadIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex startOfThreadViewIndex, PRUint32 *pNumListed);
00247   nsMsgViewIndex FindParentInThread(nsMsgKey parentKey, nsMsgViewIndex startOfThreadViewIndex);
00248   nsresult ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey parentKey, PRInt32 level, nsMsgViewIndex *viewIndex, PRUint32 *pNumListed);
00249   PRInt32  GetSize(void) {return(m_keys.GetSize());}
00250 
00251   // notification api's
00252   void EnableChangeUpdates();
00253   void DisableChangeUpdates();
00254   void NoteChange(nsMsgViewIndex firstlineChanged, PRInt32 numChanged, 
00255                     nsMsgViewNotificationCodeValue changeType);
00256   void NoteStartChange(nsMsgViewIndex firstlineChanged, PRInt32 numChanged, 
00257                         nsMsgViewNotificationCodeValue changeType);
00258   void NoteEndChange(nsMsgViewIndex firstlineChanged, PRInt32 numChanged, 
00259                         nsMsgViewNotificationCodeValue changeType);
00260 
00261   // for commands
00262   virtual nsresult ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewIndex* indices,
00263                                    PRInt32 numIndices);
00264   virtual nsresult ApplyCommandToIndicesWithFolder(nsMsgViewCommandTypeValue command, nsMsgViewIndex* indices, 
00265                     PRInt32 numIndices, nsIMsgFolder *destFolder);
00266   virtual nsresult CopyMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool isMove, nsIMsgFolder *destFolder);
00267   virtual nsresult DeleteMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices, PRBool deleteStorage);
00268   nsresult SetStringPropertyByIndex(nsMsgViewIndex index, const char *aProperty, const char *aValue);
00269   nsresult SetAsJunkByIndex(nsIJunkMailPlugin *aJunkPlugin, 
00270                                nsMsgViewIndex aIndex,
00271                                nsMsgJunkStatus aNewClassification);
00272   nsresult ToggleReadByIndex(nsMsgViewIndex index);
00273   nsresult SetReadByIndex(nsMsgViewIndex index, PRBool read);
00274   nsresult SetThreadOfMsgReadByIndex(nsMsgViewIndex index, nsMsgKeyArray &keysMarkedRead, PRBool read);
00275   nsresult SetFlaggedByIndex(nsMsgViewIndex index, PRBool mark);
00276   nsresult SetLabelByIndex(nsMsgViewIndex index, nsMsgLabelValue label);
00277   nsresult OrExtraFlag(nsMsgViewIndex index, PRUint32 orflag);
00278   nsresult AndExtraFlag(nsMsgViewIndex index, PRUint32 andflag);
00279   nsresult SetExtraFlag(nsMsgViewIndex index, PRUint32 extraflag);
00280        virtual nsresult RemoveByIndex(nsMsgViewIndex index);
00281   virtual void              OnExtraFlagChanged(nsMsgViewIndex /*index*/, PRUint32 /*extraFlag*/) {}
00282        virtual void         OnHeaderAddedOrDeleted() {} 
00283   nsresult ToggleWatched( nsMsgViewIndex* indices,      PRInt32 numIndices);
00284   nsresult SetThreadWatched(nsIMsgThread *thread, nsMsgViewIndex index, PRBool watched);
00285   nsresult SetThreadIgnored(nsIMsgThread *thread, nsMsgViewIndex threadIndex, PRBool ignored);
00286   nsresult DownloadForOffline(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 numIndices);
00287   nsresult DownloadFlaggedForOffline(nsIMsgWindow *window);
00288   nsMsgViewIndex     GetThreadFromMsgIndex(nsMsgViewIndex index, nsIMsgThread **threadHdr);
00289 
00290   // for sorting
00291   nsresult GetFieldTypeAndLenForSort(nsMsgViewSortTypeValue sortType, PRUint16 *pMaxLen, eFieldType *pFieldType);
00292   nsresult GetCollationKey(nsIMsgDBHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRUint8 **result, 
00293                           PRUint32 *len, nsIMsgCustomColumnHandler* colHandler = nsnull);
00294   nsresult GetLongField(nsIMsgDBHdr *msgHdr, nsMsgViewSortTypeValue sortType, PRUint32 *result, 
00295                           nsIMsgCustomColumnHandler* colHandler = nsnull);
00296   nsresult GetStatusSortValue(nsIMsgDBHdr *msgHdr, PRUint32 *result);
00297   nsresult GetLocationCollationKey(nsIMsgDBHdr *msgHdr, PRUint8 **result, PRUint32 *len);
00298 
00299   // for view navigation
00300   nsresult NavigateFromPos(nsMsgNavigationTypeValue motion, nsMsgViewIndex startIndex, nsMsgKey *pResultKey, 
00301               nsMsgViewIndex *pResultIndex, nsMsgViewIndex *pThreadIndex, PRBool wrap);
00302   nsresult FindNextFlagged(nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex);
00303   nsresult FindFirstNew(nsMsgViewIndex *pResultIndex);
00304   nsresult FindPrevUnread(nsMsgKey startKey, nsMsgKey *pResultKey, nsMsgKey *resultThreadId);
00305   nsresult FindFirstFlagged(nsMsgViewIndex *pResultIndex);
00306   nsresult FindPrevFlagged(nsMsgViewIndex startIndex, nsMsgViewIndex *pResultIndex);
00307   nsresult MarkThreadOfMsgRead(nsMsgKey msgId, nsMsgViewIndex msgIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead);
00308   nsresult MarkThreadRead(nsIMsgThread *threadHdr, nsMsgViewIndex threadIndex, nsMsgKeyArray &idsMarkedRead, PRBool bRead);
00309   PRBool IsValidIndex(nsMsgViewIndex index);
00310   nsresult ToggleIgnored(nsMsgViewIndex * indices, PRInt32 numIndices, nsMsgViewIndex *resultIndex, PRBool *resultToggleState);
00311   PRBool OfflineMsgSelected(nsMsgViewIndex * indices, PRInt32 numIndices);
00312   PRBool NonDummyMsgSelected(nsMsgViewIndex * indices, PRInt32 numIndices);
00313   PRUnichar * GetString(const PRUnichar *aStringName);
00314   nsresult GetPrefLocalizedString(const char *aPrefName, nsString& aResult);
00315   nsresult GetLabelPrefStringAndAtom(const char *aPrefName, nsString& aColor, nsIAtom** aColorAtom);
00316   nsresult AppendKeywordProperties(const char *keywords, nsISupportsArray *properties, PRBool addSelectedTextProperty);
00317   nsresult InitLabelStrings(void);
00318   nsresult CopyDBView(nsMsgDBView *aNewMsgDBView, nsIMessenger *aMessengerInstance, nsIMsgWindow *aMsgWindow, nsIMsgDBViewCommandUpdater *aCmdUpdater);
00319   void InitializeAtomsAndLiterals();
00320   virtual PRInt32 FindLevelInThread(nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThread, nsMsgViewIndex viewIndex);
00321   nsresult GetImapDeleteModel(nsIMsgFolder *folder);
00322   nsresult UpdateDisplayMessage(nsMsgViewIndex viewPosition);
00323 
00324   PRBool AdjustReadFlag(nsIMsgDBHdr *msgHdr, PRUint32 *msgFlags);
00325   void FreeAll(nsVoidArray *ptrs);
00326   void ClearHdrCache();
00327   nsMsgKeyArray m_keys;
00328   nsUInt32Array m_flags;
00329   nsUint8Array   m_levels;
00330   nsMsgImapDeleteModel mDeleteModel;
00331 
00332   // cache the most recently asked for header and corresponding msgKey.
00333   nsCOMPtr <nsIMsgDBHdr>  m_cachedHdr;
00334   nsMsgKey                m_cachedMsgKey;
00335 
00336   // we need to store the message key for the message we are currenty displaying to ensure we
00337   // don't try to redisplay the same message just because the selection changed (i.e. after a sort)
00338   nsMsgKey                m_currentlyDisplayedMsgKey;
00339   nsCString               m_currentlyDisplayedMsgUri;
00340   nsMsgViewIndex          m_currentlyDisplayedViewIndex;
00341   // if we're deleting messages, we want to hold off loading messages on selection changed until the delete is done
00342   // and we want to batch notifications.
00343   PRPackedBool m_deletingRows;
00344   // for certain special folders 
00345   // and decendents of those folders
00346   // (like the "Sent" folder, "Sent/Old Sent")
00347   // the Sender column really shows recipients.
00348   PRPackedBool mIsNews;             // we have special icons for news
00349   PRPackedBool mShowSizeInLines;    // for news we show lines instead of size when true
00350   PRPackedBool m_sortValid;
00351   PRUint8      m_saveRestoreSelectionDepth;
00352 
00353   nsCOMPtr <nsIMsgDatabase> m_db;
00354   nsCOMPtr <nsIMsgFolder> m_folder;
00355   nsCOMPtr <nsIMsgFolder> m_viewFolder; // for virtual folders, the VF db.
00356   nsCOMPtr <nsIAtom> mRedirectorTypeAtom;
00357   nsCOMPtr <nsIAtom> mMessageTypeAtom; // news, rss, mail, etc. 
00358   nsMsgViewSortTypeValue  m_sortType;
00359   nsMsgViewSortOrderValue m_sortOrder;
00360   nsMsgViewFlagsTypeValue m_viewFlags;
00361 
00362   // I18N date formater service which we'll want to cache locally.
00363   nsCOMPtr<nsIDateTimeFormat> mDateFormater;
00364   nsCOMPtr<nsIMsgHeaderParser> mHeaderParser;
00365   nsCOMPtr<nsIMsgTagService> mTagService;
00366   // i'm not sure if we are going to permamently need a nsIMessenger instance or if we'll be able
00367   // to phase it out eventually....for now we need it though.
00368   nsCOMPtr<nsIMessenger> mMessengerInstance;
00369   nsCOMPtr<nsIMsgWindow> mMsgWindow;
00370   nsCOMPtr<nsIMsgDBViewCommandUpdater> mCommandUpdater; // we push command update notifications to the UI from this.
00371   nsCOMPtr<nsIStringBundle> mMessengerStringBundle;  
00372 
00373   // used for the preference labels
00374   nsString mLabelPrefDescriptions[PREF_LABELS_MAX];
00375   nsString mLabelPrefColors[PREF_LABELS_MAX];
00376   // used to cache the atoms created for each color to be displayed
00377   static nsIAtom* mLabelPrefColorAtoms[PREF_LABELS_MAX];
00378 
00379   // used to determine when to start and end
00380   // junk plugin batches
00381   PRUint32 mNumMessagesRemainingInBatch;
00382 
00383   // these are the indices of the messages in the current
00384   // batch/series of batches of messages manually marked
00385   // as junk
00386   nsMsgViewIndex *mJunkIndices;
00387   PRUint32 mNumJunkIndices;
00388   
00389   nsUInt32Array mIndicesToNoteChange;
00390 
00391   //these hold pointers (and IDs) for the nsIMsgCustomColumnHandler object that constitutes the custom column handler
00392   nsCOMArray <nsIMsgCustomColumnHandler> m_customColumnHandlers;
00393   nsStringArray m_customColumnHandlerIDs;
00394   
00395   nsIMsgCustomColumnHandler* GetColumnHandler(const PRUnichar*);
00396   nsIMsgCustomColumnHandler* GetCurColumnHandlerFromDBInfo();
00397 
00398 protected:
00399   static nsresult   InitDisplayFormats();
00400 
00401 private:
00402   static nsDateFormatSelector  m_dateFormatDefault;
00403   static nsDateFormatSelector  m_dateFormatThisWeek;
00404   static nsDateFormatSelector  m_dateFormatToday;
00405   PRBool ServerSupportsFilterAfterTheFact();
00406 
00407   nsresult PerformActionsOnJunkMsgs();
00408   nsresult DetermineActionsForJunkMsgs(PRBool* movingJunkMessages, PRBool* markingJunkMessagesRead, nsIMsgFolder** junkTargetFolder);
00409 
00410 };
00411 
00412 #endif