Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsImapMailFolder.cpp File Reference
#include "msgCore.h"
#include "nsMsgImapCID.h"
#include "nsImapMailFolder.h"
#include "nsIEnumerator.h"
#include "nsILocalFile.h"
#include "nsIFolderListener.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIRDFService.h"
#include "nsIRDFDataSource.h"
#include "nsRDFCID.h"
#include "nsFileStream.h"
#include "nsMsgDBCID.h"
#include "nsMsgFolderFlags.h"
#include "nsLocalFolderSummarySpec.h"
#include "nsImapFlagAndUidState.h"
#include "nsIEventQueueService.h"
#include "nsIImapUrl.h"
#include "nsImapUtils.h"
#include "nsMsgUtils.h"
#include "nsIMsgMailSession.h"
#include "nsMsgBaseCID.h"
#include "nsMsgLocalCID.h"
#include "nsImapUndoTxn.h"
#include "nsIIMAPHostSessionList.h"
#include "nsIMsgCopyService.h"
#include "nsICopyMsgStreamListener.h"
#include "nsImapStringBundle.h"
#include "nsIMsgFolderCacheElement.h"
#include "nsTextFormatter.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsMsgI18N.h"
#include "nsICacheSession.h"
#include "nsEscape.h"
#include "nsIDOMWindowInternal.h"
#include "nsIMsgFilter.h"
#include "nsImapMoveCoalescer.h"
#include "nsIPrompt.h"
#include "nsIPromptService.h"
#include "nsIDocShell.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsSpecialSystemDirectory.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsIImapFlagAndUidState.h"
#include "nsIImapHeaderXferInfo.h"
#include "nsIMessenger.h"
#include "nsIMsgSearchAdapter.h"
#include "nsIImapMockChannel.h"
#include "nsIProgressEventSink.h"
#include "nsIMsgWindow.h"
#include "nsIMsgFolder.h"
#include "nsIMsgOfflineImapOperation.h"
#include "nsImapOfflineSync.h"
#include "nsIMsgAccountManager.h"
#include "nsQuickSort.h"
#include "nsIWebNavigation.h"
#include "nsNetUtil.h"
#include "nsIMAPNamespace.h"
#include "nsHashtable.h"
#include "nsIMsgFolderCompactor.h"
#include "nsMsgMessageFlags.h"
#include "nsIMimeHeaders.h"
#include "nsIMsgMdnGenerator.h"
#include "nsISpamSettings.h"
#include "nsInt64.h"
#include <time.h>
#include "nsIMsgMailNewsUrl.h"
#include "nsEmbedCID.h"
#include "nsIMsgComposeService.h"
#include "nsMsgCompCID.h"
#include "nsICacheEntryDescriptor.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIMsgIdentity.h"
#include "nsIMsgFolderNotificationService.h"

Go to the source code of this file.

Classes

class  nsImapFolderCopyState

Defines

#define FOUR_K   4096
#define MAILNEWS_CUSTOM_HEADERS   "mailnews.customHeaders"
#define WHITESPACE   " \015\012"
#define IMAP_ACL_ANYONE_STRING   "anyone"

Functions

static NS_DEFINE_CID (kRDFServiceCID, NS_RDFSERVICE_CID)
static NS_DEFINE_CID (kCMailDB, NS_MAILDB_CID)
static NS_DEFINE_CID (kCImapDB, NS_IMAPDB_CID)
static NS_DEFINE_CID (kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID)
static NS_DEFINE_CID (kParseMailMsgStateCID, NS_PARSEMAILMSGSTATE_CID)
static NS_DEFINE_CID (kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID)
static nsresult RecursiveCopy (nsIFile *srcDir, nsIFile *destDir)
static PRBool nsShouldIgnoreFile (nsString &name)
static int PR_CALLBACK CompareKey (const void *v1, const void *v2, void *)

Define Documentation

#define FOUR_K   4096

Definition at line 131 of file nsImapMailFolder.cpp.

Definition at line 5751 of file nsImapMailFolder.cpp.

#define MAILNEWS_CUSTOM_HEADERS   "mailnews.customHeaders"

Definition at line 132 of file nsImapMailFolder.cpp.

#define WHITESPACE   " \015\012"

Definition at line 5238 of file nsImapMailFolder.cpp.


Function Documentation

static int PR_CALLBACK CompareKey ( const void v1,
const void v2,
void  
) [static]

Definition at line 2109 of file nsImapMailFolder.cpp.

{
       // QuickSort callback to compare array values
       nsMsgKey i1 = *(nsMsgKey *)v1;
       nsMsgKey i2 = *(nsMsgKey *)v2;
       return i1 - i2;
}

Here is the caller graph for this function:

static NS_DEFINE_CID ( kRDFServiceCID  ,
NS_RDFSERVICE_CID   
) [static]
static NS_DEFINE_CID ( kCMailDB  ,
NS_MAILDB_CID   
) [static]
static NS_DEFINE_CID ( kCImapDB  ,
NS_IMAPDB_CID   
) [static]
static NS_DEFINE_CID ( kParseMailMsgStateCID  ,
NS_PARSEMAILMSGSTATE_CID   
) [static]
static NS_DEFINE_CID ( kCImapHostSessionList  ,
NS_IIMAPHOSTSESSIONLIST_CID   
) [static]
static PRBool nsShouldIgnoreFile ( nsString name) [static]

Definition at line 320 of file nsImapMailFolder.cpp.

{
    PRInt32 len = name.Length();
    if (len > 4 && name.RFind(".msf", PR_TRUE) == len -4)
    {
        name.SetLength(len-4); // truncate the string
        return PR_FALSE;
    }
    return PR_TRUE;
}

Here is the caller graph for this function:

static nsresult RecursiveCopy ( nsIFile srcDir,
nsIFile destDir 
) [static]

Definition at line 140 of file nsImapMailFolder.cpp.

{
  nsresult rv;
  PRBool isDir;
  
  rv = srcDir->IsDirectory(&isDir);
  if (NS_FAILED(rv)) return rv;
  if (!isDir) return NS_ERROR_INVALID_ARG;
  
  PRBool exists;
  rv = destDir->Exists(&exists);
  if (NS_SUCCEEDED(rv) && !exists)
    rv = destDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
  if (NS_FAILED(rv)) return rv;
  
  PRBool hasMore = PR_FALSE;
  nsCOMPtr<nsISimpleEnumerator> dirIterator;
  rv = srcDir->GetDirectoryEntries(getter_AddRefs(dirIterator));
  if (NS_FAILED(rv)) return rv;
  
  rv = dirIterator->HasMoreElements(&hasMore);
  if (NS_FAILED(rv)) return rv;
  
  nsCOMPtr<nsIFile> dirEntry;
  
  while (hasMore)
  {
    rv = dirIterator->GetNext((nsISupports**)getter_AddRefs(dirEntry));
    if (NS_SUCCEEDED(rv))
    {
      rv = dirEntry->IsDirectory(&isDir);
      if (NS_SUCCEEDED(rv))
      {
        if (isDir)
        {
          nsCOMPtr<nsIFile> destClone;
          rv = destDir->Clone(getter_AddRefs(destClone));
          if (NS_SUCCEEDED(rv))
          {
            nsCOMPtr<nsILocalFile> newChild(do_QueryInterface(destClone));
            nsAutoString leafName;
            dirEntry->GetLeafName(leafName);
            newChild->AppendRelativePath(leafName);
            rv = newChild->Exists(&exists);
            if (NS_SUCCEEDED(rv) && !exists)
              rv = newChild->Create(nsIFile::DIRECTORY_TYPE, 0775);
            rv = RecursiveCopy(dirEntry, newChild);
          }
        }
        else
          rv = dirEntry->CopyTo(destDir, EmptyString());
      }
      
    }
    rv = dirIterator->HasMoreElements(&hasMore);
    if (NS_FAILED(rv)) return rv;
  }
  
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function: