Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
nsNewsDatabase Class Reference

#include <nsNewsDatabase.h>

Inheritance diagram for nsNewsDatabase:
Inheritance graph
[legend]
Collaboration diagram for nsNewsDatabase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsNewsDatabase ()
virtual ~nsNewsDatabase ()
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSINEWSDATABASE
NS_IMETHOD 
Close (PRBool forceCommit)
NS_IMETHOD ForceClosed ()
NS_IMETHOD Commit (nsMsgDBCommit commitType)
virtual PRUint32 GetCurVersion ()
NS_IMETHOD IsRead (nsMsgKey key, PRBool *pRead)
virtual nsresult IsHeaderRead (nsIMsgDBHdr *msgHdr, PRBool *pRead)
NS_IMETHOD GetHighWaterArticleNum (nsMsgKey *key)
NS_IMETHOD GetLowWaterArticleNum (nsMsgKey *key)
NS_IMETHOD MarkAllRead (nsMsgKeyArray *thoseMarked)
virtual nsresult ExpireUpTo (nsMsgKey expireKey)
virtual nsresult ExpireRange (nsMsgKey startRange, nsMsgKey endRange)
virtual PRBool SetHdrReadFlag (nsIMsgDBHdr *msgHdr, PRBool bRead)
virtual nsresult AdjustExpungedBytesOnDelete (nsIMsgDBHdr *msgHdr)
nsresult SyncWithReadSet ()
NS_IMETHOD GetDefaultViewFlags (nsMsgViewFlagsTypeValue *aDefaultViewFlags)
NS_IMETHOD GetDefaultSortType (nsMsgViewSortTypeValue *aDefaultSortType)
NS_IMETHOD GetDefaultSortOrder (nsMsgViewSortOrderValue *aDefaultSortOrder)
virtual nsresult MarkHdrReadInDB (nsIMsgDBHdr *msgHdr, PRBool bRead, nsIDBChangeListener *instigator)
virtual nsresult OpenMDB (const char *dbName, PRBool create)
virtual nsresult CloseMDB (PRBool commit)
virtual nsresult CreateMsgHdr (nsIMdbRow *hdrRow, nsMsgKey key, nsIMsgDBHdr **result)
virtual nsresult GetThreadForMsgKey (nsMsgKey msgKey, nsIMsgThread **result)
virtual nsresult EnumerateMessagesWithFlag (nsISimpleEnumerator **result, PRUint32 *pFlag)
nsresult GetSearchResultsTable (const char *searchFolderUri, PRBool createIfMissing, nsIMdbTable **table)
nsresult ListAllThreads (nsMsgKeyArray *threadIds)
nsIMdbEnvGetEnv ()
nsIMdbStoreGetStore ()
nsIMsgHeaderParserGetHeaderParser ()
nsresult GetCollationKeyGenerator ()
nsIMimeConverterGetMimeConverter ()
nsresult GetTableCreateIfMissing (const char *scope, const char *kind, nsIMdbTable **table, mdb_token &scopeToken, mdb_token &kindToken)
nsresult RowCellColumnTonsString (nsIMdbRow *row, mdb_token columnToken, nsAString &resultStr)
nsresult RowCellColumnToUInt32 (nsIMdbRow *row, mdb_token columnToken, PRUint32 *uint32Result, PRUint32 defaultValue=0)
nsresult RowCellColumnToUInt32 (nsIMdbRow *row, mdb_token columnToken, PRUint32 &uint32Result, PRUint32 defaultValue=0)
nsresult RowCellColumnToMime2DecodedString (nsIMdbRow *row, mdb_token columnToken, PRUnichar **)
nsresult RowCellColumnToCollationKey (nsIMdbRow *row, mdb_token columnToken, PRUint8 **result, PRUint32 *len)
nsresult RowCellColumnToConstCharPtr (nsIMdbRow *row, mdb_token columnToken, const char **ptr)
nsresult RowCellColumnToAddressCollationKey (nsIMdbRow *row, mdb_token colToken, PRUint8 **result, PRUint32 *len)
nsresult GetProperty (nsIMdbRow *row, const char *propertyName, char **result)
nsresult SetProperty (nsIMdbRow *row, const char *propertyName, const char *propertyVal)
nsresult GetPropertyAsNSString (nsIMdbRow *row, const char *propertyName, nsAString &result)
nsresult SetPropertyFromNSString (nsIMdbRow *row, const char *propertyName, const nsAString &propertyVal)
nsresult GetUint32Property (nsIMdbRow *row, const char *propertyName, PRUint32 *result, PRUint32 defaultValue=0)
nsresult SetUint32Property (nsIMdbRow *row, const char *propertyName, PRUint32 propertyVal)
nsresult SetNSStringPropertyWithToken (nsIMdbRow *row, mdb_token aProperty, const nsAString &propertyStr)
nsresult UInt32ToRowCellColumn (nsIMdbRow *row, mdb_token columnToken, PRUint32 value)
nsresult CharPtrToRowCellColumn (nsIMdbRow *row, mdb_token columnToken, const char *charPtr)
nsresult RowCellColumnToCharPtr (nsIMdbRow *row, mdb_token columnToken, char **result)
void Open (in nsIFileSpec aFolderName, in boolean aCreate, in boolean aLeaveInvalidDB)
void forceFolderDBClosed (in nsIMsgFolder aFolder)
void Close (in boolean aForceCommit)
void Commit (in nsMsgDBCommit commitType)
void clearCachedHdrs ()
void resetHdrCacheSize (in unsigned long size)
nsIMsgDBHdr GetMsgHdrForKey (in nsMsgKey key)
nsIMsgDBHdr getMsgHdrForMessageID (in string messageID)
boolean ContainsKey (in nsMsgKey key)
nsIMsgDBHdr CreateNewHdr (in nsMsgKey key)
void AddNewHdrToDB (in nsIMsgDBHdr newHdr, in boolean notify)
nsIMsgDBHdr CopyHdrFromExistingHdr (in nsMsgKey key, in nsIMsgDBHdr existingHdr, in boolean addHdrToDB)
void ListAllKeys (in nsMsgKeyArrayRef outputKeys)
nsISimpleEnumerator EnumerateMessages ()
nsISimpleEnumerator EnumerateThreads ()
void syncCounts ()
nsIMsgThread GetThreadContainingMsgHdr (in nsIMsgDBHdr msgHdr)
void MarkHdrRead (in nsIMsgDBHdr msgHdr, in boolean bRead, in nsIDBChangeListener instigator)
void MarkHdrReplied (in nsIMsgDBHdr msgHdr, in boolean bReplied, in nsIDBChangeListener instigator)
void MarkHdrMarked (in nsIMsgDBHdr msgHdr, in boolean mark, in nsIDBChangeListener instigator)
void MarkMDNNeeded (in nsMsgKey key, in boolean bNeeded, in nsIDBChangeListener instigator)
boolean IsMDNNeeded (in nsMsgKey key)
void MarkMDNSent (in nsMsgKey key, in boolean bNeeded, in nsIDBChangeListener instigator)
boolean IsMDNSent (in nsMsgKey key)
void MarkRead (in nsMsgKey key, in boolean bRead, in nsIDBChangeListener instigator)
void MarkReplied (in nsMsgKey key, in boolean bReplied, in nsIDBChangeListener instigator)
void MarkForwarded (in nsMsgKey key, in boolean bForwarded, in nsIDBChangeListener instigator)
void MarkHasAttachments (in nsMsgKey key, in boolean bHasAttachments, in nsIDBChangeListener instigator)
void MarkThreadRead (in nsIMsgThread thread, in nsIDBChangeListener instigator, in nsMsgKeyArrayPtr thoseMarked)
void MarkThreadIgnored (in nsIMsgThread thread, in nsMsgKey threadKey, in boolean bIgnored, in nsIDBChangeListener instigator)
void MarkThreadWatched (in nsIMsgThread thread, in nsMsgKey threadKey, in boolean bWatched, in nsIDBChangeListener instigator)
boolean IsRead (in nsMsgKey key)
boolean IsIgnored (in nsMsgKey key)
boolean IsMarked (in nsMsgKey key)
boolean HasAttachments (in nsMsgKey key)
void MarkAllRead (in nsMsgKeyArrayPtr thoseMarked)
void MarkReadByDate (in PRTime startDate, in PRTime endDate, in nsMsgKeyArrayPtr markedIds)
void DeleteMessages (in nsMsgKeyArrayPtr nsMsgKeys, in nsIDBChangeListener instigator)
void DeleteMessage (in nsMsgKey key, in nsIDBChangeListener instigator, in boolean commit)
void DeleteHeader (in nsIMsgDBHdr msgHdr, in nsIDBChangeListener instigator, in boolean commit, in boolean notify)
void RemoveHeaderMdbRow (in nsIMsgDBHdr msgHdr)
void UndoDelete (in nsIMsgDBHdr msgHdr)
void MarkMarked (in nsMsgKey key, in boolean mark, in nsIDBChangeListener instigator)
void MarkOffline (in nsMsgKey key, in boolean offline, in nsIDBChangeListener instigator)
void SetLabel (in nsMsgKey key, in nsMsgLabelValue label)
void setStringProperty (in nsMsgKey aKey, in string aProperty, in string aValue)
void MarkImapDeleted (in nsMsgKey key, in boolean deleted, in nsIDBChangeListener instigator)
void applyRetentionSettings (in nsIMsgRetentionSettings aMsgRetentionSettings, in boolean aDeleteViaFolder)
boolean HasNew ()
void ClearNewList (in boolean notify)
void AddToNewList (in nsMsgKey key)
void StartBatch ()
void EndBatch ()
nsIMsgOfflineImapOperation GetOfflineOpForKey (in nsMsgKey messageKey, in boolean create)
void RemoveOfflineOp (in nsIMsgOfflineImapOperation op)
nsISimpleEnumerator EnumerateOfflineOps ()
void ListAllOfflineOpIds (in nsMsgKeyArrayPtr offlineOpIds)
void ListAllOfflineDeletes (in nsMsgKeyArrayPtr offlineDeletes)
void ListAllOfflineMsgs (in nsMsgKeyArrayPtr offlineMsgs)
void setAttributesOnPendingHdr (in nsIMsgDBHdr pendingHdr, in string property, in string propertyVal, in long flags)
void createCollationKey (in AString sourceString, out octetPtr key, out unsigned long len)
long compareCollationKeys (in octetPtr key1, in unsigned long len1, in octetPtr key2, in unsigned long len2)
void getNewList (out unsigned long count,[array, size_is(count)] out nsMsgKey newKeys)
 The list of messages currently in the NEW state.
nsISimpleEnumerator getCachedHits (in string aSearchFolderUri)
void refreshCache (in string aSearchFolderUri, in unsigned long aNumKeys,[array, size_is(aNumKeys)] in nsMsgKey aNewHits, out unsigned long aNumBadHits,[array, size_is(aNumBadHits)] out nsMsgKey aStaleHits)
void updateHdrInCache (in string aSearchFolderUri, in nsIMsgDBHdr aHdr, in boolean aAdd)
boolean hdrIsInCache (in string aSearchFolderUri, in nsIMsgDBHdr aHdr)
void AddListener (in nsIDBChangeListener listener)
void RemoveListener (in nsIDBChangeListener listener)
void NotifyHdrChangeAll (in nsIMsgDBHdr aHdrChanged, in unsigned long aOldFlags, in unsigned long aNewFlags, in nsIDBChangeListener instigator)
void NotifyHdrAddedAll (in nsIMsgDBHdr aHdrAdded, in nsMsgKey parentKey, in long flags, in nsIDBChangeListener instigator)
void NotifyHdrDeletedAll (in nsIMsgDBHdr aHdrDeleted, in nsMsgKey parentKey, in long flags, in nsIDBChangeListener instigator)
void NotifyParentChangedAll (in nsMsgKey keyReparented, in nsMsgKey oldParent, in nsMsgKey newParent, in nsIDBChangeListener instigator)
void NotifyReadChanged (in nsIDBChangeListener instigator)
void NotifyJunkScoreChanged (in nsIDBChangeListener aInstigator)
void NotifyAnnouncerGoingAway ()

Static Public Member Functions

static nsIMdbFactoryGetMDBFactory ()
static nsMsgDatabaseFindInCache (nsFileSpec &dbName)
static nsIMsgDatabaseFindInCache (nsIMsgFolder *folder)
static struct mdbYarnnsStringToYarn (struct mdbYarn *yarn, const nsAString &str)
static struct mdbYarnUInt32ToYarn (struct mdbYarn *yarn, PRUint32 i)
static void YarnTonsString (struct mdbYarn *yarn, nsAString &str)
static void YarnTonsCString (struct mdbYarn *yarn, nsACString &str)
static void YarnToUInt32 (struct mdbYarn *yarn, PRUint32 *i)
static void CleanupCache ()

Public Attributes

readonly attribute nsIDBFolderInfo dBFolderInfo
readonly attribute nsMsgKey FirstNew
attribute nsIMsgRetentionSettings msgRetentionSettings
attribute nsIMsgDownloadSettings msgDownloadSettings
attribute boolean summaryValid
readonly attribute nsMsgKey lowWaterArticleNum
readonly attribute nsMsgKey highWaterArticleNum
attribute nsMsgKey nextPseudoMsgKey
readonly attribute nsMsgKey nextFakeOfflineMsgKey
readonly attribute
nsMsgViewFlagsTypeValue 
defaultViewFlags
readonly attribute
nsMsgViewSortTypeValue 
defaultSortType
readonly attribute
nsMsgViewSortOrderValue 
defaultSortOrder
attribute unsigned long msgHdrCacheSize
attribute nsIOFileStream folderStream
attribute nsMsgKeySetPtr readSet

Protected Member Functions

nsresult GetBoolPref (const char *prefName, PRBool *result)
nsresult GetIntPref (const char *prefName, PRInt32 *result)
virtual void GetGlobalPrefs ()
nsIMsgThreadGetThreadForReference (nsCString &msgID, nsIMsgDBHdr **pMsgHdr)
nsIMsgThreadGetThreadForSubject (nsCString &subject)
nsIMsgThreadGetThreadForThreadId (nsMsgKey threadId)
nsMsgHdrGetMsgHdrForReference (nsCString &reference)
nsIMsgDBHdrGetMsgHdrForSubject (nsCString &msgID)
virtual nsresult CreateNewThread (nsMsgKey key, const char *subject, nsMsgThread **newThread)
virtual PRBool ThreadBySubjectWithoutRe ()
virtual PRBool UseStrictThreading ()
virtual nsresult ThreadNewHdr (nsMsgHdr *hdr, PRBool &newThread)
virtual nsresult AddNewThread (nsMsgHdr *msgHdr)
virtual nsresult AddToThread (nsMsgHdr *newHdr, nsIMsgThread *thread, nsIMsgDBHdr *pMsgHdr, PRBool threadInThread)
PRBool MatchDbName (nsFileSpec &dbName)
virtual nsresult SetKeyFlag (nsMsgKey key, PRBool set, PRUint32 flag, nsIDBChangeListener *instigator=NULL)
virtual nsresult SetMsgHdrFlag (nsIMsgDBHdr *msgHdr, PRBool set, PRUint32 flag, nsIDBChangeListener *instigator)
virtual PRBool SetHdrFlag (nsIMsgDBHdr *, PRBool bSet, MsgFlags flag)
virtual PRUint32 GetStatusFlags (nsIMsgDBHdr *msgHdr, PRUint32 origFlags)
virtual nsresult RemoveHeaderFromDB (nsMsgHdr *msgHdr)
virtual nsresult RemoveHeaderFromThread (nsMsgHdr *msgHdr)
nsresult PurgeMessagesOlderThan (PRUint32 daysToKeepHdrs, PRBool keepUnreadMessagesOnly, nsISupportsArray *hdrsToDelete)
nsresult PurgeExcessMessages (PRUint32 numHeadersToKeep, PRBool keepUnreadMessagesOnly, nsISupportsArray *hdrsToDelete)
virtual nsresult InitExistingDB ()
virtual nsresult InitNewDB ()
virtual nsresult InitMDBInfo ()
nsresult GetHdrFromCache (nsMsgKey key, nsIMsgDBHdr **result)
nsresult AddHdrToCache (nsIMsgDBHdr *hdr, nsMsgKey key)
nsresult ClearHdrCache (PRBool reInit)
nsresult RemoveHdrFromCache (nsIMsgDBHdr *hdr, nsMsgKey key)
nsresult GetHdrFromUseCache (nsMsgKey key, nsIMsgDBHdr **result)
nsresult AddHdrToUseCache (nsIMsgDBHdr *hdr, nsMsgKey key)
nsresult ClearUseHdrCache ()
nsresult RemoveHdrFromUseCache (nsIMsgDBHdr *hdr, nsMsgKey key)
mdb_pos FindInsertIndexInSortedTable (nsIMdbTable *table, mdb_id idToInsert)
void ClearCachedObjects (PRBool dbGoingAway)

Static Protected Member Functions

static int FindInCache (nsMsgDatabase *pMessageDB)
static void AddToCache (nsMsgDatabase *pMessageDB)
static void RemoveFromCache (nsMsgDatabase *pMessageDB)
static nsVoidArrayGetDBCache ()
static const void *PR_CALLBACK GetKey (PLDHashTable *aTable, PLDHashEntryHdr *aEntry)
static PLDHashNumber PR_CALLBACK HashKey (PLDHashTable *aTable, const void *aKey)
static PRBool PR_CALLBACK MatchEntry (PLDHashTable *aTable, const PLDHashEntryHdr *aEntry, const void *aKey)
static void PR_CALLBACK MoveEntry (PLDHashTable *aTable, const PLDHashEntryHdr *aFrom, PLDHashEntryHdr *aTo)
static void PR_CALLBACK ClearEntry (PLDHashTable *aTable, PLDHashEntryHdr *aEntry)
static PLDHashOperator PR_CALLBACK HeaderEnumerator (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
static PLDHashOperator PR_CALLBACK ClearHeaderEnumerator (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)

Protected Attributes

nsMsgKeySet * m_readSet
nsCOMPtr< nsICollationm_collationKeyGenerator
nsCOMPtr< nsIMimeConverterm_mimeConverter
nsCOMPtr< nsIMsgRetentionSettingsm_retentionSettings
nsCOMPtr< nsIMsgDownloadSettingsm_downloadSettings
nsCOMPtr< nsIMsgFolderm_folder
nsDBFolderInfom_dbFolderInfo
nsMsgKey m_nextPseudoMsgKey
nsIMdbEnvm_mdbEnv
nsIMdbStorem_mdbStore
nsIMdbTablem_mdbAllMsgHeadersTable
nsIMdbTablem_mdbAllThreadsTable
nsFileSpec m_dbName
nsMsgKeyArray m_newSet
PRBool m_mdbTokensInitialized
nsCOMPtr< nsISupportsArraym_ChangeListeners
mdb_token m_hdrRowScopeToken
mdb_token m_threadRowScopeToken
mdb_token m_hdrTableKindToken
mdb_token m_threadTableKindToken
mdb_token m_allThreadsTableKindToken
mdb_token m_subjectColumnToken
mdb_token m_senderColumnToken
mdb_token m_messageIdColumnToken
mdb_token m_referencesColumnToken
mdb_token m_recipientsColumnToken
mdb_token m_dateColumnToken
mdb_token m_messageSizeColumnToken
mdb_token m_flagsColumnToken
mdb_token m_priorityColumnToken
mdb_token m_labelColumnToken
mdb_token m_statusOffsetColumnToken
mdb_token m_numLinesColumnToken
mdb_token m_ccListColumnToken
mdb_token m_threadFlagsColumnToken
mdb_token m_threadIdColumnToken
mdb_token m_threadChildrenColumnToken
mdb_token m_threadUnreadChildrenColumnToken
mdb_token m_messageThreadIdColumnToken
mdb_token m_threadSubjectColumnToken
mdb_token m_numReferencesColumnToken
mdb_token m_messageCharSetColumnToken
mdb_token m_threadParentColumnToken
mdb_token m_threadRootKeyColumnToken
mdb_token m_threadNewestMsgDateColumnToken
mdb_token m_offlineMsgOffsetColumnToken
mdb_token m_offlineMessageSizeColumnToken
nsIMsgHeaderParserm_HeaderParser
PLDHashTablem_headersInUse
PLDHashTablem_cachedHeaders
PRBool m_bCacheHeaders
nsMsgKey m_cachedThreadId
nsCOMPtr< nsIMsgThreadm_cachedThread

Static Protected Attributes

static nsVoidArraym_dbCache = NULL
static PLDHashTableOps gMsgDBHashTableOps

Friends

class nsMsgDBService
class nsMsgHdr
class nsMsgThread
class nsMsgDBEnumerator
class nsMsgDBThreadEnumerator

Detailed Description

Definition at line 49 of file nsNewsDatabase.h.


Constructor & Destructor Documentation

Definition at line 51 of file nsNewsDatabase.cpp.

Definition at line 56 of file nsNewsDatabase.cpp.

{
}

Member Function Documentation

nsresult nsMsgDatabase::AddHdrToCache ( nsIMsgDBHdr hdr,
nsMsgKey  key 
) [protected, inherited]

Definition at line 283 of file nsMsgDatabase.cpp.

{
  if (m_bCacheHeaders)
  {
    if (!m_cachedHeaders)
      m_cachedHeaders = PL_NewDHashTable(&gMsgDBHashTableOps, (void *) nsnull, sizeof(struct MsgHdrHashElement), m_cacheSize );
    if (m_cachedHeaders)
    {
      if (key == nsMsgKey_None)
        hdr->GetMessageKey(&key);
      if (m_cachedHeaders->entryCount > m_cacheSize)
        ClearHdrCache(PR_TRUE);
      PLDHashEntryHdr *entry = PL_DHashTableOperate(m_cachedHeaders, (void *) key, PL_DHASH_ADD);
      if (!entry)
        return NS_ERROR_OUT_OF_MEMORY; // XXX out of memory
      
      MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, entry);
      element->mHdr = hdr;  
      element->mKey = key;
      NS_ADDREF(hdr);     // make the cache hold onto the header
      return NS_OK;
    }
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::AddHdrToUseCache ( nsIMsgDBHdr hdr,
nsMsgKey  key 
) [protected, inherited]

Definition at line 503 of file nsMsgDatabase.cpp.

{
  if (!m_headersInUse)
  {
    mdb_count numHdrs = MSG_HASH_SIZE;
    if (m_mdbAllMsgHeadersTable)
      m_mdbAllMsgHeadersTable->GetCount(GetEnv(), &numHdrs);
    m_headersInUse = PL_NewDHashTable(&gMsgDBHashTableOps, (void *) nsnull, sizeof(struct MsgHdrHashElement), PR_MAX(MSG_HASH_SIZE, numHdrs));
  }
  if (m_headersInUse)
  {
    if (key == nsMsgKey_None)
      hdr->GetMessageKey(&key);
    PLDHashEntryHdr *entry = PL_DHashTableOperate(m_headersInUse, (void *) key, PL_DHASH_ADD);
    if (!entry)
      return NS_ERROR_OUT_OF_MEMORY; // XXX out of memory

    MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, entry);
    element->mHdr = hdr;  
    element->mKey = key;
    // the hash table won't add ref, we'll do it ourselves
    // stand for the addref that CreateMsgHdr normally does.
    NS_ADDREF(hdr);
    return NS_OK;
  }

  return NS_ERROR_OUT_OF_MEMORY;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void nsIMsgDatabase::AddNewHdrToDB ( in nsIMsgDBHdr  newHdr,
in boolean  notify 
) [inherited]
nsresult nsMsgDatabase::AddNewThread ( nsMsgHdr msgHdr) [protected, virtual, inherited]

Definition at line 4020 of file nsMsgDatabase.cpp.

{
  
  if (!msgHdr)
    return NS_ERROR_NULL_POINTER;
  
  nsMsgThread *threadHdr = nsnull;
  
  nsXPIDLCString subject;
  nsMsgKey threadKey = msgHdr->m_messageKey;
  // can't have a thread with key 1 since that's the table id of the all msg hdr table,
  // so give it kTableKeyForThreadOne (0xfffffffe).
  if (threadKey == 1)
    threadKey = kTableKeyForThreadOne;

  nsresult err = msgHdr->GetSubject(getter_Copies(subject));
  
  err = CreateNewThread(threadKey, subject, &threadHdr);
  msgHdr->SetThreadId(threadKey);
  if (threadHdr)
  {
    //        nsCString subject;
    
    threadHdr->AddRef();
    //        err = msgHdr->GetSubject(subject);
    //        threadHdr->SetThreadKey(msgHdr->m_messageKey);
    //        threadHdr->SetSubject(subject.get());
    
    // need to add the thread table to the db.
    AddToThread(msgHdr, threadHdr, nsnull, PR_FALSE);
    
    threadHdr->Release();
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nsMsgDatabase::AddToCache ( nsMsgDatabase pMessageDB) [inline, static, protected, inherited]

Definition at line 189 of file nsMsgDatabase.h.

  {GetDBCache()->AppendElement(pMessageDB);}

Here is the call graph for this function:

nsresult nsMsgDatabase::AddToThread ( nsMsgHdr newHdr,
nsIMsgThread thread,
nsIMsgDBHdr pMsgHdr,
PRBool  threadInThread 
) [protected, virtual, inherited]

Definition at line 3866 of file nsMsgDatabase.cpp.

{
  // don't worry about real threading yet.
  nsCOMPtr <nsIDBChangeAnnouncer> announcer = do_QueryInterface(this);
  
  return thread->AddChild(newHdr, inReplyTo, threadInThread, announcer);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsMsgDatabase.

Definition at line 344 of file nsNewsDatabase.cpp.

{
  PRUint32 msgFlags;
  msgHdr->GetFlags(&msgFlags);
  if (msgFlags & MSG_FLAG_OFFLINE && m_dbFolderInfo)
  {
    PRUint32 size = 0;
    (void)msgHdr->GetOfflineMessageSize(&size);
    return m_dbFolderInfo->ChangeExpungedBytes (size);
  }
  return NS_OK;
}

Here is the call graph for this function:

void nsIMsgDatabase::applyRetentionSettings ( in nsIMsgRetentionSettings  aMsgRetentionSettings,
in boolean  aDeleteViaFolder 
) [inherited]
nsresult nsMsgDatabase::CharPtrToRowCellColumn ( nsIMdbRow row,
mdb_token  columnToken,
const char *  charPtr 
) [inherited]

Definition at line 3393 of file nsMsgDatabase.cpp.

{
  if (!row)
    return NS_ERROR_NULL_POINTER;

  struct mdbYarn yarn;
  yarn.mYarn_Buf = (void *) charPtr;
  yarn.mYarn_Size = PL_strlen((const char *) yarn.mYarn_Buf) + 1;
  yarn.mYarn_Fill = yarn.mYarn_Size - 1;
  yarn.mYarn_Form = 0;      // what to do with this? we're storing csid in the msg hdr...
  
  return row->AddColumn(GetEnv(),  columnToken, &yarn);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDatabase::CleanupCache ( ) [static, inherited]

Definition at line 765 of file nsMsgDatabase.cpp.

{
  if (m_dbCache) // clean up memory leak (needed because some destructors
                 // have user-visible effects, which they shouldn't)
  {
    for (PRInt32 i = 0; i < GetDBCache()->Count(); i++)
    {
      nsMsgDatabase* pMessageDB = NS_STATIC_CAST(nsMsgDatabase*, GetDBCache()->ElementAt(i));
      if (pMessageDB)
      {
        // hold onto the db until we're finished closing it.
        pMessageDB->AddRef();
        // break cycle with folder -> parse msg state -> db
        pMessageDB->m_folder = nsnull;
        pMessageDB->ForceClosed();
        nsrefcnt refcount = pMessageDB->Release();

        // ForceClosed may have caused the last reference (other than
        // this function's) to go away by breaking a cycle
        if (refcount != 0)
        {
          // The destructor may cause the remaining references to be
          // released, so stabilize the refcount and then manually
          // delete.
          ++pMessageDB->mRefCnt;
          delete pMessageDB;
        }
        i--;  // back up array index, since closing removes db from cache.
      }
    }
    NS_ASSERTION(GetNumInCache() == 0, "some msg dbs left open");     // better not be any open db's.
    delete m_dbCache;
  }
  m_dbCache = nsnull; // Need to reset to NULL since it's a
  // static global ptr and maybe referenced 
  // again in other places.
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDatabase::ClearCachedObjects ( PRBool  dbGoingAway) [protected, inherited]

Definition at line 361 of file nsMsgDatabase.cpp.

{
  ClearHdrCache(PR_FALSE);
#ifdef DEBUG_bienvenu1
  if (m_headersInUse && m_headersInUse->entryCount > 0)
  {
        NS_ASSERTION(PR_FALSE, "leaking headers");
    printf("leaking %d headers in %s\n", m_headersInUse->entryCount, (const char *) m_dbName);
  }
#endif
  // We should only clear the use hdr cache when the db is going away, or we could
  // end up with multiple copies of the same logical msg hdr, which will lead to 
  // ref-counting problems.
  if (dbGoingAway)
    ClearUseHdrCache();
  m_cachedThread = nsnull;
  m_cachedThreadId = nsMsgKey_None;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PR_CALLBACK nsMsgDatabase::ClearEntry ( PLDHashTable aTable,
PLDHashEntryHdr aEntry 
) [static, protected, inherited]

Definition at line 495 of file nsMsgDatabase.cpp.

{
  MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, aEntry);
  element->mHdr = nsnull; // eh? Need to release this or not?
  element->mKey = nsMsgKey_None; // eh?
}
nsresult nsMsgDatabase::ClearHdrCache ( PRBool  reInit) [protected, inherited]

Definition at line 380 of file nsMsgDatabase.cpp.

{
  if (m_cachedHeaders)
  {
    // save this away in case we renter this code.
    PLDHashTable  *saveCachedHeaders = m_cachedHeaders;
    m_cachedHeaders = nsnull;
    PL_DHashTableEnumerate(saveCachedHeaders, HeaderEnumerator, nsnull);
    
    if (reInit)
    {
      PL_DHashTableFinish(saveCachedHeaders);
      PL_DHashTableInit(saveCachedHeaders, &gMsgDBHashTableOps, nsnull, sizeof(struct MsgHdrHashElement), m_cacheSize);
      m_cachedHeaders = saveCachedHeaders;
      
    }
    else
    {
      PL_DHashTableDestroy(saveCachedHeaders);
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PLDHashOperator PR_CALLBACK nsMsgDatabase::ClearHeaderEnumerator ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
) [static, protected, inherited]

Definition at line 319 of file nsMsgDatabase.cpp.

{

  MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, hdr);
  if (element && element->mHdr)
  {
    nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, element->mHdr);  // closed system, so this is ok
    // clear out m_mdbRow member variable - the db is going away, which means that this member
    // variable might very well point to a mork db that is gone.
    msgHdr->m_mdbRow = nsnull;
  }
  return PL_DHASH_NEXT;
}

Here is the caller graph for this function:

void nsIMsgDatabase::ClearNewList ( in boolean  notify) [inherited]
nsresult nsMsgDatabase::ClearUseHdrCache ( ) [protected, inherited]

Definition at line 532 of file nsMsgDatabase.cpp.

{
  if (m_headersInUse)
  {
    // clear mdb row pointers of any headers still in use, because the
    // underlying db is going away.
    PL_DHashTableEnumerate(m_headersInUse, ClearHeaderEnumerator, nsnull);
    PL_DHashTableDestroy(m_headersInUse);
    m_headersInUse = nsnull;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 82 of file nsNewsDatabase.cpp.

{
  return nsMsgDatabase::Close(forceCommit);
}
void nsIMsgDatabase::Close ( in boolean  aForceCommit) [inherited]

Here is the caller graph for this function:

nsresult nsMsgDatabase::CloseMDB ( PRBool  commit) [virtual, inherited]

Definition at line 1301 of file nsMsgDatabase.cpp.

{
  if (commit)
    Commit(nsMsgDBCommitType::kSessionCommit);
  return(NS_OK);
}

Here is the call graph for this function:

Definition at line 92 of file nsNewsDatabase.cpp.

{
  if (m_dbFolderInfo && m_readSet)
  {
    // let's write out our idea of the read set so we can compare it with that of
    // the .rc file next time we start up.
    nsXPIDLCString readSet;
    m_readSet->Output(getter_Copies(readSet));
    m_dbFolderInfo->SetCharPtrProperty("readSet", readSet.get());
  }
  return nsMsgDatabase::Commit(commitType);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDatabase::Commit ( in nsMsgDBCommit  commitType) [inherited]

Here is the caller graph for this function:

long nsIMsgDatabase::compareCollationKeys ( in octetPtr  key1,
in unsigned long  len1,
in octetPtr  key2,
in unsigned long  len2 
) [inherited]

Here is the caller graph for this function:

nsIMsgDBHdr nsIMsgDatabase::CopyHdrFromExistingHdr ( in nsMsgKey  key,
in nsIMsgDBHdr  existingHdr,
in boolean  addHdrToDB 
) [inherited]
void nsIMsgDatabase::createCollationKey ( in AString  sourceString,
out octetPtr  key,
out unsigned long  len 
) [inherited]
nsresult nsMsgDatabase::CreateMsgHdr ( nsIMdbRow hdrRow,
nsMsgKey  key,
nsIMsgDBHdr **  result 
) [virtual, inherited]

Definition at line 559 of file nsMsgDatabase.cpp.

{
  nsresult rv = GetHdrFromUseCache(key, result);
  if (NS_SUCCEEDED(rv) && *result)
  {
    hdrRow->Release();
    return rv;
  }
  
  nsMsgHdr *msgHdr = new nsMsgHdr(this, hdrRow);
  if(!msgHdr)
    return NS_ERROR_OUT_OF_MEMORY;
  msgHdr->SetMessageKey(key);
  // don't need to addref here; GetHdrFromUseCache addrefs.
  *result = msgHdr;
  
  AddHdrToCache(msgHdr, key);  
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::CreateNewThread ( nsMsgKey  key,
const char *  subject,
nsMsgThread **  newThread 
) [protected, virtual, inherited]

Definition at line 3636 of file nsMsgDatabase.cpp.

{
  nsresult    err = NS_OK;
  nsIMdbTable        *threadTable;
  struct mdbOid threadTableOID;
  struct mdbOid allThreadsTableOID;
  
  if (!pnewThread || !m_mdbStore)
    return NS_ERROR_NULL_POINTER;
  
  threadTableOID.mOid_Scope = m_hdrRowScopeToken;
  threadTableOID.mOid_Id = threadId;
  
  err  = GetStore()->NewTableWithOid(GetEnv(), &threadTableOID, m_threadTableKindToken, 
    PR_FALSE, nsnull, &threadTable);
  if (NS_FAILED(err)) 
    return err;
  
  allThreadsTableOID.mOid_Scope = m_threadRowScopeToken;
  allThreadsTableOID.mOid_Id = threadId;  
  
  // add a row for this thread in the table of all threads that we'll use
  // to do our mapping between subject strings and threads.
  nsIMdbRow *threadRow = nsnull;
  
  err = m_mdbStore->GetRow(GetEnv(), &allThreadsTableOID, &threadRow);
  if (!threadRow)    
  {
    err  = m_mdbStore->NewRowWithOid(GetEnv(), &allThreadsTableOID, &threadRow);
    if (NS_SUCCEEDED(err) && threadRow)
    {
      if (m_mdbAllThreadsTable)
        m_mdbAllThreadsTable->AddRow(GetEnv(), threadRow);
      err = CharPtrToRowCellColumn(threadRow, m_threadSubjectColumnToken, subject);
      threadRow->Release();
    }
  }
  
  *pnewThread = new nsMsgThread(this, threadTable);
  if (*pnewThread)
    (*pnewThread)->SetThreadKey(threadId);
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDatabase::DeleteHeader ( in nsIMsgDBHdr  msgHdr,
in nsIDBChangeListener  instigator,
in boolean  commit,
in boolean  notify 
) [inherited]
void nsIMsgDatabase::DeleteMessage ( in nsMsgKey  key,
in nsIDBChangeListener  instigator,
in boolean  commit 
) [inherited]
void nsIMsgDatabase::DeleteMessages ( in nsMsgKeyArrayPtr  nsMsgKeys,
in nsIDBChangeListener  instigator 
) [inherited]

Here is the caller graph for this function:

void nsIMsgDatabase::EndBatch ( ) [inherited]

Implemented in nsMailDatabase, and nsImapMailDatabase.

Here is the caller graph for this function:

nsresult nsMsgDatabase::EnumerateMessagesWithFlag ( nsISimpleEnumerator **  result,
PRUint32 pFlag 
) [virtual, inherited]

Definition at line 3027 of file nsMsgDatabase.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsNewsDatabase::ExpireRange ( nsMsgKey  startRange,
nsMsgKey  endRange 
) [virtual]

Definition at line 175 of file nsNewsDatabase.cpp.

nsresult nsNewsDatabase::ExpireUpTo ( nsMsgKey  expireKey) [virtual]

Definition at line 171 of file nsNewsDatabase.cpp.

nsMsgDatabase * nsMsgDatabase::FindInCache ( nsFileSpec dbName) [static, inherited]

Definition at line 806 of file nsMsgDatabase.cpp.

{
  for (PRInt32 i = 0; i < GetDBCache()->Count(); i++)
  {
    nsMsgDatabase* pMessageDB = NS_STATIC_CAST(nsMsgDatabase*, GetDBCache()->ElementAt(i));
    if (pMessageDB->MatchDbName(dbName))
    {
      if (pMessageDB->m_mdbStore)  // don't return db without store
      {
        NS_ADDREF(pMessageDB);
        return pMessageDB;
      }
    }
  }
  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMsgDatabase * nsMsgDatabase::FindInCache ( nsIMsgFolder folder) [static, inherited]

Definition at line 826 of file nsMsgDatabase.cpp.

{
  nsCOMPtr <nsIFileSpec> folderPath;
  nsFileSpec  folderName;
  nsresult rv = folder->GetPath(getter_AddRefs(folderPath));
  NS_ENSURE_SUCCESS(rv, nsnull);
  folderPath->GetFileSpec(&folderName);
  nsLocalFolderSummarySpec summarySpec(folderName);

  nsFileSpec dbPath(summarySpec);
  return (nsIMsgDatabase *) FindInCache(dbPath);
}

Here is the call graph for this function:

int nsMsgDatabase::FindInCache ( nsMsgDatabase pMessageDB) [static, protected, inherited]

Definition at line 842 of file nsMsgDatabase.cpp.

{
  for (PRInt32 i = 0; i < GetDBCache()->Count(); i++)
  {
    if (GetDBCache()->ElementAt(i) == pMessageDB)
      return(i);
  }
  return(-1);
}

Here is the call graph for this function:

mdb_pos nsMsgDatabase::FindInsertIndexInSortedTable ( nsIMdbTable table,
mdb_id  idToInsert 
) [protected, inherited]

Definition at line 5024 of file nsMsgDatabase.cpp.

{
  mdb_pos searchPos = 0;
  PRUint32 rowCount;
  table->GetCount(GetEnv(), &rowCount);
  mdb_pos hi = rowCount;
  mdb_pos lo = 0;
  
  while (hi > lo)
  {
    mdbOid outOid;
    searchPos = (lo + hi - 1) / 2;
    table->PosToOid(GetEnv(), searchPos, &outOid);
    if (outOid.mOid_Id == idToInsert)
    {
      NS_ASSERTION(PR_FALSE, "id shouldn't be in table");
      return hi;
    }
    if (outOid.mOid_Id > idToInsert)
      hi = searchPos;
    else // if (outOid.mOid_Id <  idToInsert)
      lo = searchPos + 1;
  }
  return hi;
}

Here is the call graph for this function:

Implements nsIMsgDatabase.

Definition at line 87 of file nsNewsDatabase.cpp.

nsresult nsMsgDatabase::GetBoolPref ( const char *  prefName,
PRBool result 
) [protected, inherited]

Definition at line 4056 of file nsMsgDatabase.cpp.

{
  PRBool prefValue = PR_FALSE;
  nsresult rv;
  nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  if (pPrefBranch)
  {
    rv = pPrefBranch->GetBoolPref(prefName, &prefValue);
    *result = prefValue;
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsISimpleEnumerator nsIMsgDatabase::getCachedHits ( in string  aSearchFolderUri) [inherited]

Definition at line 3257 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  if (!m_collationKeyGenerator)
  {
    nsCOMPtr <nsILocale> locale; 
    nsAutoString localeName; 
    
    // get a locale service 
    nsCOMPtr <nsILocaleService> localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID, &err);
    if (NS_SUCCEEDED(err))
    {
      // do this for a new db if no UI to be provided for locale selection 
      err = localeService->GetApplicationLocale(getter_AddRefs(locale)); 
      
      if (locale)
      {
        // or generate a locale from a stored locale name ("en_US", "fr_FR") 
        //err = localeFactory->NewLocale(&localeName, &locale); 
        
        nsCOMPtr <nsICollationFactory> f = do_CreateInstance(kCollationFactoryCID, &err);
        if (NS_SUCCEEDED(err) && f)
        {
          // get a collation interface instance 
          err = f->CreateCollation(locale, getter_AddRefs(m_collationKeyGenerator));
        }
      }
    }
  }
  return err;
}

Here is the call graph for this function:

Reimplemented from nsMsgDatabase.

Definition at line 106 of file nsNewsDatabase.cpp.

{
  return kMsgDBVersion;
}
nsVoidArray * nsMsgDatabase::GetDBCache ( ) [static, protected, inherited]

Definition at line 755 of file nsMsgDatabase.cpp.

{
  if (!m_dbCache)
    m_dbCache = new nsVoidArray();
  
  return m_dbCache;
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 384 of file nsNewsDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(aDefaultSortOrder);
  GetIntPref("mailnews.default_news_sort_order", aDefaultSortOrder);
  if (*aDefaultSortOrder != nsMsgViewSortOrder::descending)
    *aDefaultSortOrder = nsMsgViewSortOrder::ascending;
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 373 of file nsNewsDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(aDefaultSortType);
  GetIntPref("mailnews.default_news_sort_type", aDefaultSortType);
  if (*aDefaultSortType < nsMsgViewSortType::byDate ||
      *aDefaultSortType > nsMsgViewSortType::byAccount)
    *aDefaultSortType = nsMsgViewSortType::byThread;
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 358 of file nsNewsDatabase.cpp.

{
  NS_ENSURE_ARG_POINTER(aDefaultViewFlags);
  GetIntPref("mailnews.default_news_view_flags", aDefaultViewFlags);
  if (*aDefaultViewFlags < nsMsgViewFlagsType::kNone ||
      *aDefaultViewFlags > (nsMsgViewFlagsType::kThreadedDisplay |
                            nsMsgViewFlagsType::kShowIgnored |
                            nsMsgViewFlagsType::kUnreadOnly |
                            nsMsgViewFlagsType::kExpandAll |
                            nsMsgViewFlagsType::kGroupBySort))
    *aDefaultViewFlags = nsMsgViewFlagsType::kThreadedDisplay;
  return NS_OK;
}

Here is the call graph for this function:

nsIMdbEnv* nsMsgDatabase::GetEnv ( ) [inline, inherited]

Definition at line 109 of file nsMsgDatabase.h.

{return m_mdbEnv;}
void nsMsgDatabase::GetGlobalPrefs ( ) [protected, virtual, inherited]

Reimplemented in nsMailDatabase.

Definition at line 243 of file nsMsgDatabase.cpp.

{
  if (!gGotGlobalPrefs)
  {
    GetBoolPref("mail.thread_without_re", &gThreadWithoutRe);
    GetBoolPref("mail.strict_threading", &gStrictThreading);
    gGotGlobalPrefs = PR_TRUE;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::GetHdrFromCache ( nsMsgKey  key,
nsIMsgDBHdr **  result 
) [protected, inherited]

Definition at line 255 of file nsMsgDatabase.cpp.

{
  if (!result)
    return NS_ERROR_NULL_POINTER;
  
  nsresult rv = NS_ERROR_FAILURE;
  
  *result = nsnull;
  if (m_bCacheHeaders && m_cachedHeaders)
  {
    PLDHashEntryHdr *entry;
    entry = PL_DHashTableOperate(m_cachedHeaders, (const void *) key, PL_DHASH_LOOKUP);
    if (PL_DHASH_ENTRY_IS_BUSY(entry))
    {
      MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, entry);
      *result = element->mHdr;
      // need to do our own add ref because the PL_DHashTable doesn't addref.
      if (*result)
      {
        NS_ADDREF(*result);
        rv = NS_OK;
      }
    }    
    
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::GetHdrFromUseCache ( nsMsgKey  key,
nsIMsgDBHdr **  result 
) [protected, inherited]

Definition at line 423 of file nsMsgDatabase.cpp.

{
  if (!result)
    return NS_ERROR_NULL_POINTER;
  
  nsresult rv = NS_ERROR_FAILURE;
  
  *result = nsnull;
  
  if (m_headersInUse)
  {
    PLDHashEntryHdr *entry;
    entry = PL_DHashTableOperate(m_headersInUse, (const void *) key, PL_DHASH_LOOKUP);
    if (PL_DHASH_ENTRY_IS_BUSY(entry))
    {
      MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, entry);
      *result = element->mHdr;
    }    
    if (*result)
    {
      NS_ADDREF(*result);
      rv = NS_OK;
    }
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3345 of file nsMsgDatabase.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 137 of file nsNewsDatabase.cpp.

{
  NS_ASSERTION(m_dbFolderInfo, "null db folder info");
  if (!m_dbFolderInfo) 
    return NS_ERROR_FAILURE;
  return m_dbFolderInfo->GetHighWater(key);    
}

Here is the caller graph for this function:

nsresult nsMsgDatabase::GetIntPref ( const char *  prefName,
PRInt32 result 
) [protected, inherited]

Definition at line 4069 of file nsMsgDatabase.cpp.

{
  PRInt32 prefValue = 0;
  nsresult rv;
  nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  if (pPrefBranch)
  {
    rv = pPrefBranch->GetIntPref(prefName, &prefValue);
    *result = prefValue;
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const void *PR_CALLBACK nsMsgDatabase::GetKey ( PLDHashTable aTable,
PLDHashEntryHdr aEntry 
) [static, protected, inherited]

Definition at line 464 of file nsMsgDatabase.cpp.

{
  MsgHdrHashElement* hdr = NS_REINTERPRET_CAST(MsgHdrHashElement*, aEntry);
  return (const void *) hdr->mKey;
}

Definition at line 153 of file nsNewsDatabase.cpp.

{
  nsresult  rv;
  nsMsgHdr  *pHeader;

  nsCOMPtr<nsISimpleEnumerator> hdrs;
  rv = EnumerateMessages(getter_AddRefs(hdrs));
  if (NS_FAILED(rv))
    return rv;

  rv = hdrs->GetNext((nsISupports**)&pHeader);
  NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
  if (NS_FAILED(rv)) 
    return rv;
  
  return pHeader->GetMessageKey(key);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMdbFactory * nsMsgDatabase::GetMDBFactory ( ) [static, inherited]

Definition at line 994 of file nsMsgDatabase.cpp.

{
  static nsIMdbFactory *gMDBFactory = nsnull;
  if (!gMDBFactory)
  {
    nsCOMPtr <nsIMdbFactoryFactory> factoryfactory = do_CreateInstance(kCMorkFactory);
    if (factoryfactory)
      factoryfactory->GetMdbFactory(&gMDBFactory);
  }
  return gMDBFactory;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3167 of file nsMsgDatabase.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

nsMsgHdr * nsMsgDatabase::GetMsgHdrForReference ( nsCString reference) [protected, inherited]

Definition at line 3874 of file nsMsgDatabase.cpp.

{
  NS_ASSERTION(PR_FALSE, "not implemented yet.");
  return nsnull;
}
nsIMsgDBHdr * nsMsgDatabase::GetMsgHdrForSubject ( nsCString msgID) [protected, inherited]

Definition at line 3914 of file nsMsgDatabase.cpp.

{
  nsIMsgDBHdr *msgHdr = nsnull;
  nsresult rv = NS_OK;
  mdbYarn     subjectYarn;
  
  subjectYarn.mYarn_Buf = (void*)subject.get();
  subjectYarn.mYarn_Fill = PL_strlen(subject.get());
  subjectYarn.mYarn_Form = 0;
  subjectYarn.mYarn_Size = subjectYarn.mYarn_Fill;
  
  nsIMdbRow   *hdrRow;
  mdbOid             outRowId;
  mdb_err result = GetStore()->FindRow(GetEnv(), m_hdrRowScopeToken,
    m_subjectColumnToken, &subjectYarn,  &outRowId, 
    &hdrRow);
  if (NS_SUCCEEDED(result) && hdrRow)
  {
    //Get key from row
    mdbOid outOid;
    nsMsgKey key=0;
    if (hdrRow->GetOid(GetEnv(), &outOid) == NS_OK)
      key = outOid.mOid_Id;
    rv = GetHdrFromUseCache(key, &msgHdr);
    if (NS_SUCCEEDED(rv) && msgHdr)
      hdrRow->Release();
    else
      rv = CreateMsgHdr(hdrRow, key, &msgHdr);
  }
  return msgHdr;
}

Here is the call graph for this function:

void nsIMsgDatabase::getNewList ( out unsigned long  count,
[array, size_is(count)] out nsMsgKey  newKeys 
) [inherited]

The list of messages currently in the NEW state.

If there are no such messages, a null pointer may be returned. the caller should free when done using nsMemory::Free.

nsresult nsMsgDatabase::GetProperty ( nsIMdbRow row,
const char *  propertyName,
char **  result 
) [inherited]

Definition at line 3498 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  mdb_token   property_token;
  
  if (m_mdbStore)
    err = m_mdbStore->StringToToken(GetEnv(),  propertyName, &property_token);
  else
    err = NS_ERROR_NULL_POINTER;
  if (err == NS_OK)
    err = RowCellColumnToCharPtr(row, property_token, result);
  
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::GetPropertyAsNSString ( nsIMdbRow row,
const char *  propertyName,
nsAString &  result 
) [inherited]

Definition at line 3524 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  mdb_token   property_token;
  
  err = m_mdbStore->StringToToken(GetEnv(),  propertyName, &property_token);
  if (err == NS_OK)
    err = RowCellColumnTonsString(row, property_token, result);
  
  return err;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::GetSearchResultsTable ( const char *  searchFolderUri,
PRBool  createIfMissing,
nsIMdbTable **  table 
) [inherited]

Definition at line 4892 of file nsMsgDatabase.cpp.

{
  mdb_kind kindToken;
  mdb_count numTables;
  mdb_bool mustBeUnique;
  mdb_err err = m_mdbStore->StringToToken(GetEnv(), searchFolderUri, &kindToken); 
  err = m_mdbStore->GetTableKind(GetEnv(), m_hdrRowScopeToken,  kindToken, 
                                  &numTables, &mustBeUnique, table);
  if ((!*table || NS_FAILED(err)) && createIfMissing)
    err = m_mdbStore->NewTable(GetEnv(), m_hdrRowScopeToken, kindToken, PR_TRUE, nsnull, table);

  return *table ? err : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

PRUint32 nsMsgDatabase::GetStatusFlags ( nsIMsgDBHdr msgHdr,
PRUint32  origFlags 
) [protected, virtual, inherited]

Definition at line 1973 of file nsMsgDatabase.cpp.

{
  PRUint32    statusFlags = origFlags;
  PRBool      isRead = PR_TRUE;
  
  nsMsgKey key;
  (void)msgHdr->GetMessageKey(&key);
  if (m_newSet.GetSize() > 0 && m_newSet.GetAt(m_newSet.GetSize() - 1) == key || m_newSet.IndexOfSorted(key) != kNotFound)
    statusFlags |= MSG_FLAG_NEW;
  else
    statusFlags &= ~MSG_FLAG_NEW;
  if (IsHeaderRead(msgHdr, &isRead) == NS_OK && isRead)
    statusFlags |= MSG_FLAG_READ;
  return statusFlags;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMdbStore* nsMsgDatabase::GetStore ( ) [inline, inherited]

Definition at line 110 of file nsMsgDatabase.h.

{return m_mdbStore;}

Here is the caller graph for this function:

nsresult nsMsgDatabase::GetTableCreateIfMissing ( const char *  scope,
const char *  kind,
nsIMdbTable **  table,
mdb_token scopeToken,
mdb_token kindToken 
) [inherited]

Definition at line 1564 of file nsMsgDatabase.cpp.

{
  struct mdbOid tableOID;

  mdb_err err = GetStore()->StringToToken(GetEnv(), scope, &scopeToken); 
  err = GetStore()->StringToToken(GetEnv(), kind, &kindToken); 
  tableOID.mOid_Scope = scopeToken;
  tableOID.mOid_Id = 1;
  
  nsresult rv = GetStore()->GetTable(GetEnv(), &tableOID, table);
  if (rv != NS_OK)
    rv = NS_ERROR_FAILURE;
  
  // create new all all offline ops table, if it doesn't exist.
  if (NS_SUCCEEDED(rv) && !*table)
  {
    nsIMdbStore *store = GetStore();
    err = (nsresult) store->NewTable(GetEnv(), scopeToken,kindToken, 
                                    PR_FALSE, nsnull, table);
    if (err != NS_OK || !*table)
      rv = NS_ERROR_FAILURE;
  }
  NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't create offline ops table");
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::GetThreadForMsgKey ( nsMsgKey  msgKey,
nsIMsgThread **  result 
) [virtual, inherited]

Definition at line 3972 of file nsMsgDatabase.cpp.

Here is the call graph for this function:

nsIMsgThread * nsMsgDatabase::GetThreadForReference ( nsCString msgID,
nsIMsgDBHdr **  pMsgHdr 
) [protected, inherited]

Definition at line 3681 of file nsMsgDatabase.cpp.

{
  nsIMsgDBHdr *msgHdr = nsnull;
  GetMsgHdrForMessageID(msgID.get(), &msgHdr);  
  nsIMsgThread *thread = NULL;
  
  if (msgHdr != NULL)
  {
    nsMsgKey threadId;
    if (NS_SUCCEEDED(msgHdr->GetThreadId(&threadId)))
    {
      // find thread header for header whose message id we matched.
      thread = GetThreadForThreadId(threadId);
    }
    if (pMsgHdr)
      *pMsgHdr = msgHdr;
    else
      msgHdr->Release();
  }
  return thread;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMsgThread * nsMsgDatabase::GetThreadForSubject ( nsCString subject) [protected, inherited]

Definition at line 3703 of file nsMsgDatabase.cpp.

{
  nsIMsgThread *thread = nsnull;
  
  mdbYarn     subjectYarn;
  
  subjectYarn.mYarn_Buf = (void*)subject.get();
  subjectYarn.mYarn_Fill = PL_strlen(subject.get());
  subjectYarn.mYarn_Form = 0;
  subjectYarn.mYarn_Size = subjectYarn.mYarn_Fill;
  
  nsCOMPtr <nsIMdbRow>      threadRow;
  mdbOid             outRowId;
  if (m_mdbStore)
  {
    mdb_err result = m_mdbStore->FindRow(GetEnv(), m_threadRowScopeToken,
      m_threadSubjectColumnToken, &subjectYarn,  &outRowId, getter_AddRefs(threadRow));
    if (NS_SUCCEEDED(result) && threadRow)
    {
      //Get key from row
      mdbOid outOid;
      nsMsgKey key = 0;
      if (threadRow->GetOid(GetEnv(), &outOid) == NS_OK)
        key = outOid.mOid_Id;
      // find thread header for header whose message id we matched.
      thread = GetThreadForThreadId(key);
    }
#ifdef DEBUG_bienvenu1
    else
    {
      nsresult       rv;
      nsMsgThread *pThread;
      
      nsCOMPtr <nsIMdbPortTableCursor> tableCursor;
      m_mdbStore->GetPortTableCursor(GetEnv(),   m_hdrRowScopeToken, m_threadTableKindToken,
        getter_AddRefs(tableCursor));
      
      
        nsIMdbTable *table;
        
        while (PR_TRUE) 
        {
          rv = tableCursor->NextTable(GetEnv(), &table);
          if (!table) 
            break;
          if (NS_FAILED(rv)) 
            break;
          
          pThread = new nsMsgThread(this, table);
          if(pThread)
          {
            // thread object assumes ref for table.
            NS_ADDREF(pThread);
            nsXPIDLCString curSubject;
            (void)pThread->GetSubject(getter_Copies(curSubject));
            if (subject.Equals(curSubject))
            {
              NS_ASSERTION(PR_FALSE, "thread with subject exists, but FindRow didn't find it\n");
              break;
            }
            NS_IF_RELEASE (pThread);
          }
          else
            break;
        }
      }
#endif
  }
  return thread;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMsgThread * nsMsgDatabase::GetThreadForThreadId ( nsMsgKey  threadId) [protected, inherited]

Definition at line 3986 of file nsMsgDatabase.cpp.

{
  
  if (threadId == m_cachedThreadId && m_cachedThread)
  {
    nsIMsgThread *retThread = m_cachedThread;
    NS_ADDREF(retThread);
    return retThread;
  }
  nsMsgThread *pThread = nsnull;
  if (m_mdbStore)
  {
    mdbOid tableId;
    tableId.mOid_Id = threadId;
    tableId.mOid_Scope = m_hdrRowScopeToken;
    
    nsIMdbTable *threadTable;
    mdb_err res = m_mdbStore->GetTable(GetEnv(), &tableId, &threadTable);
    
    if (NS_SUCCEEDED(res) && threadTable)
    {
      pThread = new nsMsgThread(this, threadTable);
      if(pThread)
      {
        NS_ADDREF(pThread);
        m_cachedThread = pThread;
        m_cachedThreadId = threadId;
      }
    }
  }
  return pThread;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::GetUint32Property ( nsIMdbRow row,
const char *  propertyName,
PRUint32 result,
PRUint32  defaultValue = 0 
) [inherited]

Definition at line 3549 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  mdb_token   property_token;
  
  err = m_mdbStore->StringToToken(GetEnv(),  propertyName, &property_token);
  if (err == NS_OK)
    err = RowCellColumnToUInt32(row, property_token, result, defaultValue);
  
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PLDHashNumber PR_CALLBACK nsMsgDatabase::HashKey ( PLDHashTable aTable,
const void aKey 
) [static, protected, inherited]

Definition at line 473 of file nsMsgDatabase.cpp.

{
  return PLDHashNumber(NS_PTR_TO_INT32(aKey));
}
boolean nsIMsgDatabase::hdrIsInCache ( in string  aSearchFolderUri,
in nsIMsgDBHdr  aHdr 
) [inherited]
PLDHashOperator PR_CALLBACK nsMsgDatabase::HeaderEnumerator ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
) [static, protected, inherited]

Definition at line 310 of file nsMsgDatabase.cpp.

{

  MsgHdrHashElement* element = NS_REINTERPRET_CAST(MsgHdrHashElement*, hdr);
  NS_IF_RELEASE(element->mHdr); 
  return PL_DHASH_NEXT;
}

Here is the caller graph for this function:

nsresult nsMsgDatabase::InitExistingDB ( ) [protected, virtual, inherited]

Definition at line 1591 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  
  err = InitMDBInfo();
  if (err == NS_OK)
  {
    err = GetStore()->GetTable(GetEnv(), &gAllMsgHdrsTableOID, &m_mdbAllMsgHeadersTable);
    if (err == NS_OK)
    {
      m_dbFolderInfo = new nsDBFolderInfo(this);
      if (m_dbFolderInfo)
      {
        NS_ADDREF(m_dbFolderInfo); 
        err = m_dbFolderInfo->InitFromExistingDB();
      }
    }
    else
      err = NS_ERROR_FAILURE;
    
    NS_ASSERTION(NS_SUCCEEDED(err), "failed initing existing db");
    NS_ENSURE_SUCCESS(err, err);
    // create new all msg hdrs table, if it doesn't exist.
    if (NS_SUCCEEDED(err) && !m_mdbAllMsgHeadersTable)
    {
      struct mdbOid allMsgHdrsTableOID;
      allMsgHdrsTableOID.mOid_Scope = m_hdrRowScopeToken;
      allMsgHdrsTableOID.mOid_Id = kAllMsgHdrsTableKey;
      
      mdb_err mdberr  = GetStore()->NewTableWithOid(GetEnv(), &allMsgHdrsTableOID, m_hdrTableKindToken, 
        PR_FALSE, nsnull, &m_mdbAllMsgHeadersTable);
      if (mdberr != NS_OK || !m_mdbAllMsgHeadersTable)
        err = NS_ERROR_FAILURE;
    }
    struct mdbOid allThreadsTableOID;
    allThreadsTableOID.mOid_Scope = m_threadRowScopeToken;
    allThreadsTableOID.mOid_Id = kAllThreadsTableKey;
    err = GetStore()->GetTable(GetEnv(), &gAllThreadsTableOID, &m_mdbAllThreadsTable);
    if (!m_mdbAllThreadsTable)
    {
      
      mdb_err mdberr  = GetStore()->NewTableWithOid(GetEnv(), &allThreadsTableOID, m_allThreadsTableKindToken, 
        PR_FALSE, nsnull, &m_mdbAllThreadsTable);
      if (mdberr != NS_OK || !m_mdbAllThreadsTable)
        err = NS_ERROR_FAILURE;
    }
  }
  if (NS_SUCCEEDED(err) && m_dbFolderInfo)
  {
    PRBool fixedBadRefThreading;
    m_dbFolderInfo->GetBooleanProperty(kFixedBadRefThreadingProp, PR_FALSE, &fixedBadRefThreading);
    if (!fixedBadRefThreading)
    {
      nsCOMPtr <nsISimpleEnumerator> enumerator;
      err = EnumerateMessages(getter_AddRefs(enumerator));
      if (NS_SUCCEEDED(err) && enumerator)
      {
        PRBool hasMore;
        
        while (NS_SUCCEEDED(err = enumerator->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) 
        {
          nsCOMPtr <nsIMsgDBHdr> msgHdr;
          err = enumerator->GetNext(getter_AddRefs(msgHdr));
          NS_ASSERTION(NS_SUCCEEDED(err), "nsMsgDBEnumerator broken");
          if (msgHdr && NS_SUCCEEDED(err))
          {
            nsXPIDLCString messageId;
            nsCAutoString firstReference;
            msgHdr->GetMessageId(getter_Copies(messageId));
            msgHdr->GetStringReference(0, firstReference);
            if (messageId.Equals(firstReference))
            {
              err = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
              break;
            }
          }
        }
      }
            
      m_dbFolderInfo->SetBooleanProperty(kFixedBadRefThreadingProp, PR_TRUE);
    }
    
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::InitMDBInfo ( ) [protected, virtual, inherited]

Definition at line 1678 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  
  if (!m_mdbTokensInitialized && GetStore())
  {
    m_mdbTokensInitialized = PR_TRUE;
    err       = GetStore()->StringToToken(GetEnv(), kMsgHdrsScope, &m_hdrRowScopeToken); 
    if (err == NS_OK)
    {
      GetStore()->StringToToken(GetEnv(),  kSubjectColumnName, &m_subjectColumnToken);
      GetStore()->StringToToken(GetEnv(),  kSenderColumnName, &m_senderColumnToken);
      GetStore()->StringToToken(GetEnv(),  kMessageIdColumnName, &m_messageIdColumnToken);
      // if we just store references as a string, we won't get any savings from the
      // fact there's a lot of duplication. So we may want to break them up into
      // multiple columns, r1, r2, etc.
      GetStore()->StringToToken(GetEnv(),  kReferencesColumnName, &m_referencesColumnToken);
      // similarly, recipients could be tokenized properties
      GetStore()->StringToToken(GetEnv(),  kRecipientsColumnName, &m_recipientsColumnToken);
      GetStore()->StringToToken(GetEnv(),  kDateColumnName, &m_dateColumnToken);
      GetStore()->StringToToken(GetEnv(),  kMessageSizeColumnName, &m_messageSizeColumnToken);
      GetStore()->StringToToken(GetEnv(),  kFlagsColumnName, &m_flagsColumnToken);
      GetStore()->StringToToken(GetEnv(),  kPriorityColumnName, &m_priorityColumnToken);
      GetStore()->StringToToken(GetEnv(),  kLabelColumnName, &m_labelColumnToken);
      GetStore()->StringToToken(GetEnv(),  kStatusOffsetColumnName, &m_statusOffsetColumnToken);
      GetStore()->StringToToken(GetEnv(),  kNumLinesColumnName, &m_numLinesColumnToken);
      GetStore()->StringToToken(GetEnv(),  kCCListColumnName, &m_ccListColumnToken);
      GetStore()->StringToToken(GetEnv(),  kMessageThreadIdColumnName, &m_messageThreadIdColumnToken);
      GetStore()->StringToToken(GetEnv(),  kThreadIdColumnName, &m_threadIdColumnToken);
      GetStore()->StringToToken(GetEnv(),  kThreadFlagsColumnName, &m_threadFlagsColumnToken);
      GetStore()->StringToToken(GetEnv(),  kThreadNewestMsgDateColumnName, &m_threadNewestMsgDateColumnToken);
      GetStore()->StringToToken(GetEnv(),  kThreadChildrenColumnName, &m_threadChildrenColumnToken);
      GetStore()->StringToToken(GetEnv(),  kThreadUnreadChildrenColumnName, &m_threadUnreadChildrenColumnToken);
      GetStore()->StringToToken(GetEnv(),  kThreadSubjectColumnName, &m_threadSubjectColumnToken);
      GetStore()->StringToToken(GetEnv(),  kNumReferencesColumnName, &m_numReferencesColumnToken);
      GetStore()->StringToToken(GetEnv(),  kMessageCharSetColumnName, &m_messageCharSetColumnToken);
      err = GetStore()->StringToToken(GetEnv(), kMsgHdrsTableKind, &m_hdrTableKindToken); 
      if (err == NS_OK)
        err = GetStore()->StringToToken(GetEnv(), kThreadTableKind, &m_threadTableKindToken);
      err = GetStore()->StringToToken(GetEnv(), kAllThreadsTableKind, &m_allThreadsTableKindToken); 
      err     = GetStore()->StringToToken(GetEnv(), kThreadHdrsScope, &m_threadRowScopeToken); 
      err     = GetStore()->StringToToken(GetEnv(), kThreadParentColumnName, &m_threadParentColumnToken);
      err     = GetStore()->StringToToken(GetEnv(), kThreadRootColumnName, &m_threadRootKeyColumnToken);
      err = GetStore()->StringToToken(GetEnv(), kOfflineMsgOffsetColumnName, &m_offlineMsgOffsetColumnToken);
      err = GetStore()->StringToToken(GetEnv(), kOfflineMsgSizeColumnName, &m_offlineMessageSizeColumnToken);
      
      if (err == NS_OK)
      {
        // The table of all message hdrs will have table id 1.
        gAllMsgHdrsTableOID.mOid_Scope = m_hdrRowScopeToken;
        gAllMsgHdrsTableOID.mOid_Id = kAllMsgHdrsTableKey;
        gAllThreadsTableOID.mOid_Scope = m_threadRowScopeToken;
        gAllThreadsTableOID.mOid_Id = kAllThreadsTableKey;
        
      }
    }
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::InitNewDB ( ) [protected, virtual, inherited]

Definition at line 1521 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  
  err = InitMDBInfo();
  if (err == NS_OK)
  {
    nsDBFolderInfo *dbFolderInfo = new nsDBFolderInfo(this); 
    if (dbFolderInfo)
    {
      NS_ADDREF(dbFolderInfo); 
      err = dbFolderInfo->AddToNewMDB();
      dbFolderInfo->SetVersion(GetCurVersion());
      dbFolderInfo->SetBooleanProperty(kFixedBadRefThreadingProp, PR_TRUE);
      nsIMdbStore *store = GetStore();
      // create the unique table for the dbFolderInfo.
      mdb_err mdberr;
      struct mdbOid allMsgHdrsTableOID;
      struct mdbOid allThreadsTableOID;
      if (!store)
        return NS_ERROR_NULL_POINTER;
      
      allMsgHdrsTableOID.mOid_Scope = m_hdrRowScopeToken;
      allMsgHdrsTableOID.mOid_Id = kAllMsgHdrsTableKey;
      allThreadsTableOID.mOid_Scope = m_threadRowScopeToken;
      allThreadsTableOID.mOid_Id = kAllThreadsTableKey;
      
      mdberr  = store->NewTableWithOid(GetEnv(), &allMsgHdrsTableOID, m_hdrTableKindToken, 
        PR_FALSE, nsnull, &m_mdbAllMsgHeadersTable);
      
      // error here is not fatal.
      store->NewTableWithOid(GetEnv(), &allThreadsTableOID, m_allThreadsTableKindToken, 
        PR_FALSE, nsnull, &m_mdbAllThreadsTable);

      m_dbFolderInfo = dbFolderInfo;
      
    }
    else
      err = NS_ERROR_OUT_OF_MEMORY;
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsNewsDatabase::IsHeaderRead ( nsIMsgDBHdr msgHdr,
PRBool pRead 
) [virtual]

Reimplemented from nsMsgDatabase.

Definition at line 122 of file nsNewsDatabase.cpp.

{
    nsresult rv;
    nsMsgKey messageKey;

    if (!msgHdr || !pRead) return NS_ERROR_NULL_POINTER;

    rv = msgHdr->GetMessageKey(&messageKey);
    if (NS_FAILED(rv)) return rv;

    rv = IsRead(messageKey,pRead);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 111 of file nsNewsDatabase.cpp.

{
  NS_ASSERTION(pRead, "null out param in IsRead");
  if (!pRead) return NS_ERROR_NULL_POINTER;

  if (!m_readSet) return NS_ERROR_FAILURE;
  
  *pRead = m_readSet->IsMember(key);
  return NS_OK;
}

Here is the caller graph for this function:

boolean nsIMsgDatabase::IsRead ( in nsMsgKey  key) [inherited]
void nsIMsgDatabase::ListAllKeys ( in nsMsgKeyArrayRef  outputKeys) [inherited]

Here is the caller graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::ListAllThreads ( nsMsgKeyArray *  threadIds) [inherited]

Definition at line 4083 of file nsMsgDatabase.cpp.

{
  nsresult           rv;
  nsMsgThread        *pThread;
  
  nsCOMPtr <nsISimpleEnumerator> threads;
  rv = EnumerateThreads(getter_AddRefs(threads));
  if (NS_FAILED(rv)) return rv;
  PRBool hasMore = PR_FALSE;
  
  while (NS_SUCCEEDED(rv = threads->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) 
  {
    rv = threads->GetNext((nsISupports**)&pThread);
    NS_ENSURE_SUCCESS(rv,rv);
    
    if (threadIds) {
      nsMsgKey key;
      (void)pThread->GetThreadKey(&key);
      threadIds->Add(key);
    }
    //        NS_RELEASE(pThread);
    pThread = nsnull;
  }
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsNewsDatabase::MarkAllRead ( nsMsgKeyArray *  thoseMarked)

Definition at line 257 of file nsNewsDatabase.cpp.

{
  nsMsgKey lowWater = nsMsgKey_None, highWater;
  nsXPIDLCString knownArts;
  if (m_dbFolderInfo)
  {
    m_dbFolderInfo->GetKnownArtsSet(getter_Copies(knownArts));
    nsMsgKeySet *knownKeys = nsMsgKeySet::Create(knownArts);
    if (knownKeys)
      lowWater = knownKeys->GetFirstMember();

    delete knownKeys;
  }
  if (lowWater == nsMsgKey_None)
    GetLowWaterArticleNum(&lowWater);
  GetHighWaterArticleNum(&highWater);
  if (lowWater > 2)
    m_readSet->AddRange(1, lowWater - 1);
  nsresult err = nsMsgDatabase::MarkAllRead(thoseMarked);
  if (NS_SUCCEEDED(err) && 1 <= highWater)
    m_readSet->AddRange(1, highWater);    // mark everything read in newsrc.
  
  return err;
}

Here is the call graph for this function:

void nsIMsgDatabase::MarkAllRead ( in nsMsgKeyArrayPtr  thoseMarked) [inherited]
void nsIMsgDatabase::MarkForwarded ( in nsMsgKey  key,
in boolean  bForwarded,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkHasAttachments ( in nsMsgKey  key,
in boolean  bHasAttachments,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkHdrMarked ( in nsIMsgDBHdr  msgHdr,
in boolean  mark,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkHdrRead ( in nsIMsgDBHdr  msgHdr,
in boolean  bRead,
in nsIDBChangeListener  instigator 
) [inherited]

Here is the caller graph for this function:

nsresult nsMsgDatabase::MarkHdrReadInDB ( nsIMsgDBHdr msgHdr,
PRBool  bRead,
nsIDBChangeListener instigator 
) [virtual, inherited]

Definition at line 2056 of file nsMsgDatabase.cpp.

{
  nsresult rv;
  nsMsgKey key;
  PRUint32 oldFlags;
  PRBool   hdrInDB;
  (void)msgHdr->GetMessageKey(&key);
  msgHdr->GetFlags(&oldFlags);
  
  m_newSet.RemoveElement(key);
  (void) ContainsKey(key, &hdrInDB);
  if (hdrInDB && m_dbFolderInfo)
  {
    if (bRead)
      m_dbFolderInfo->ChangeNumUnreadMessages(-1);
    else
      m_dbFolderInfo->ChangeNumUnreadMessages(1);
  }
  
  SetHdrReadFlag(msgHdr, bRead); // this will cause a commit, at least for local mail, so do it after we change
  // the folder counts above, so they will get committed too.
  PRUint32 flags;
  rv = msgHdr->GetFlags(&flags);
  flags &= ~MSG_FLAG_NEW;
  msgHdr->SetFlags(flags);
  if (NS_FAILED(rv)) return rv;
  
  if (oldFlags == flags)
    return NS_OK;
  
  return NotifyHdrChangeAll(msgHdr, oldFlags, flags, instigator);
}

Here is the call graph for this function:

void nsIMsgDatabase::MarkHdrReplied ( in nsIMsgDBHdr  msgHdr,
in boolean  bReplied,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkImapDeleted ( in nsMsgKey  key,
in boolean  deleted,
in nsIDBChangeListener  instigator 
) [inherited]

Here is the caller graph for this function:

void nsIMsgDatabase::MarkMarked ( in nsMsgKey  key,
in boolean  mark,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkMDNNeeded ( in nsMsgKey  key,
in boolean  bNeeded,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkMDNSent ( in nsMsgKey  key,
in boolean  bNeeded,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkOffline ( in nsMsgKey  key,
in boolean  offline,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkRead ( in nsMsgKey  key,
in boolean  bRead,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkReadByDate ( in PRTime  startDate,
in PRTime  endDate,
in nsMsgKeyArrayPtr  markedIds 
) [inherited]
void nsIMsgDatabase::MarkReplied ( in nsMsgKey  key,
in boolean  bReplied,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkThreadIgnored ( in nsIMsgThread  thread,
in nsMsgKey  threadKey,
in boolean  bIgnored,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIMsgDatabase::MarkThreadRead ( in nsIMsgThread  thread,
in nsIDBChangeListener  instigator,
in nsMsgKeyArrayPtr  thoseMarked 
) [inherited]
void nsIMsgDatabase::MarkThreadWatched ( in nsIMsgThread  thread,
in nsMsgKey  threadKey,
in boolean  bWatched,
in nsIDBChangeListener  instigator 
) [inherited]
PRBool nsMsgDatabase::MatchDbName ( nsFileSpec dbName) [protected, inherited]

Definition at line 852 of file nsMsgDatabase.cpp.

{
  return (m_dbName == dbName); 
}

Here is the caller graph for this function:

PRBool PR_CALLBACK nsMsgDatabase::MatchEntry ( PLDHashTable aTable,
const PLDHashEntryHdr aEntry,
const void aKey 
) [static, protected, inherited]

Definition at line 479 of file nsMsgDatabase.cpp.

{
  const MsgHdrHashElement* hdr = NS_REINTERPRET_CAST(const MsgHdrHashElement*, aEntry);
  return aKey == (const void *) hdr->mKey; // ### or get the key from the hdr...
}
void PR_CALLBACK nsMsgDatabase::MoveEntry ( PLDHashTable aTable,
const PLDHashEntryHdr aFrom,
PLDHashEntryHdr aTo 
) [static, protected, inherited]

Definition at line 486 of file nsMsgDatabase.cpp.

{
  const MsgHdrHashElement* from = NS_REINTERPRET_CAST(const MsgHdrHashElement*, aFrom);
  MsgHdrHashElement* to = NS_REINTERPRET_CAST(MsgHdrHashElement*, aTo);
  // ### eh? Why is this needed? I don't think we have a copy operator?
  *to = *from;
}

Here is the caller graph for this function:

void nsIDBChangeAnnouncer::NotifyHdrAddedAll ( in nsIMsgDBHdr  aHdrAdded,
in nsMsgKey  parentKey,
in long  flags,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIDBChangeAnnouncer::NotifyHdrChangeAll ( in nsIMsgDBHdr  aHdrChanged,
in unsigned long  aOldFlags,
in unsigned long  aNewFlags,
in nsIDBChangeListener  instigator 
) [inherited]

Here is the caller graph for this function:

void nsIDBChangeAnnouncer::NotifyHdrDeletedAll ( in nsIMsgDBHdr  aHdrDeleted,
in nsMsgKey  parentKey,
in long  flags,
in nsIDBChangeListener  instigator 
) [inherited]
void nsIDBChangeAnnouncer::NotifyParentChangedAll ( in nsMsgKey  keyReparented,
in nsMsgKey  oldParent,
in nsMsgKey  newParent,
in nsIDBChangeListener  instigator 
) [inherited]

Here is the caller graph for this function:

Here is the caller graph for this function:

struct mdbYarn * nsMsgDatabase::nsStringToYarn ( struct mdbYarn yarn,
const nsAString &  str 
) [static, read, inherited]

Definition at line 3436 of file nsMsgDatabase.cpp.

{
  yarn->mYarn_Buf = ToNewCString(str);
  yarn->mYarn_Size = str.Length() + 1;
  yarn->mYarn_Fill = yarn->mYarn_Size - 1;
  yarn->mYarn_Form = 0;     // what to do with this? we're storing csid in the msg hdr...
  return yarn;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDatabase::Open ( in nsIFileSpec  aFolderName,
in boolean  aCreate,
in boolean  aLeaveInvalidDB 
) [inherited]
nsresult nsMsgDatabase::OpenMDB ( const char *  dbName,
PRBool  create 
) [virtual, inherited]

Definition at line 1183 of file nsMsgDatabase.cpp.

{
  nsresult ret = NS_OK;
  nsIMdbFactory *myMDBFactory = GetMDBFactory();
  if (myMDBFactory)
  {
    ret = myMDBFactory->MakeEnv(NULL, &m_mdbEnv);
    if (NS_SUCCEEDED(ret))
    {
      nsIMdbThumb *thumb = nsnull;
      struct stat st;
      char    *nativeFileName = nsCRT::strdup(dbName);
      nsIMdbHeap* dbHeap = 0;
      mdb_bool dbFrozen = mdbBool_kFalse; // not readonly, we want modifiable
      
      if (!nativeFileName)
        return NS_ERROR_OUT_OF_MEMORY;
      
      if (m_mdbEnv)
        m_mdbEnv->SetAutoClear(PR_TRUE);
      m_dbName = dbName;
#if defined(XP_WIN) || defined(XP_OS2) || defined(XP_MAC)
      UnixToNative(nativeFileName);
#endif
      if (stat(nativeFileName, &st)) 
        ret = NS_MSG_ERROR_FOLDER_SUMMARY_MISSING;
      else
      {
        mdbOpenPolicy inOpenPolicy;
        mdb_bool     canOpen;
        mdbYarn             outFormatVersion;
        
        nsIMdbFile* oldFile = 0;
        ret = myMDBFactory->OpenOldFile(m_mdbEnv, dbHeap, nativeFileName,
          dbFrozen, &oldFile);
        if ( oldFile )
        {
          if ( ret == NS_OK )
          {
            ret = myMDBFactory->CanOpenFilePort(m_mdbEnv, oldFile, // the file to investigate
              &canOpen, &outFormatVersion);
            if (ret == 0 && canOpen)
            {
              inOpenPolicy.mOpenPolicy_ScopePlan.mScopeStringSet_Count = 0;
              inOpenPolicy.mOpenPolicy_MinMemory = 0;
              inOpenPolicy.mOpenPolicy_MaxLazy = 0;
              
              ret = myMDBFactory->OpenFileStore(m_mdbEnv, dbHeap,
                oldFile, &inOpenPolicy, &thumb); 
            }
            else
              ret = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
          }
          NS_RELEASE(oldFile); // always release our file ref, store has own
        }
      }
      if (NS_SUCCEEDED(ret) && thumb)
      {
        mdb_count outTotal;    // total somethings to do in operation
        mdb_count outCurrent;  // subportion of total completed so far
        mdb_bool outDone = PR_FALSE;      // is operation finished?
        mdb_bool outBroken;     // is operation irreparably dead and broken?
        do
        {
          ret = thumb->DoMore(m_mdbEnv, &outTotal, &outCurrent, &outDone, &outBroken);
          if (ret != 0)
          {// mork isn't really doing NS erorrs yet.
            outDone = PR_TRUE;
            break;
          }
        }
        while (NS_SUCCEEDED(ret) && !outBroken && !outDone);
        //                         m_mdbEnv->ClearErrors(); // ### temporary...
        // only 0 is a non-error return.
        if (ret == 0 && outDone)
        {
          ret = myMDBFactory->ThumbToOpenStore(m_mdbEnv, thumb, &m_mdbStore);
          if (ret == NS_OK)
            ret = (m_mdbStore) ? InitExistingDB() : NS_ERROR_FAILURE;
        }
#ifdef DEBUG_bienvenu1
        DumpContents();
#endif
      }
      else if (create)      // ### need error code saying why open file store failed
      {
        nsIMdbFile* newFile = 0;
        ret = myMDBFactory->CreateNewFile(m_mdbEnv, dbHeap, dbName, &newFile);
        if (NS_FAILED(ret))
          ret = NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
        if ( newFile )
        {
          if (ret == NS_OK)
          {
            mdbOpenPolicy inOpenPolicy;
            
            inOpenPolicy.mOpenPolicy_ScopePlan.mScopeStringSet_Count = 0;
            inOpenPolicy.mOpenPolicy_MinMemory = 0;
            inOpenPolicy.mOpenPolicy_MaxLazy = 0;
            
            ret = myMDBFactory->CreateNewFileStore(m_mdbEnv, dbHeap,
              newFile, &inOpenPolicy, &m_mdbStore);
            if (ret == NS_OK)
              ret = (m_mdbStore) ? InitNewDB() : NS_ERROR_FAILURE;
          }
          NS_RELEASE(newFile); // always release our file ref, store has own
        }
      }
      NS_IF_RELEASE(thumb);
      nsCRT::free(nativeFileName);
    }
  }
#ifdef DEBUG_David_Bienvenu
//  NS_ASSERTION(NS_SUCCEEDED(ret), "failed opening mdb");
#endif
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::PurgeExcessMessages ( PRUint32  numHeadersToKeep,
PRBool  keepUnreadMessagesOnly,
nsISupportsArray hdrsToDelete 
) [protected, inherited]

Definition at line 4576 of file nsMsgDatabase.cpp.

{
  nsresult rv = NS_OK;
  nsMsgHdr           *pHeader;
  nsCOMPtr <nsISimpleEnumerator> hdrs;
  rv = EnumerateMessages(getter_AddRefs(hdrs));
  if (NS_FAILED(rv))
    return rv;
  PRBool hasMore = PR_FALSE;
  nsMsgKeyArray keysToDelete;
  
  mdb_count numHdrs = 0;
  if (m_mdbAllMsgHeadersTable)
    m_mdbAllMsgHeadersTable->GetCount(GetEnv(), &numHdrs);
  else
    return NS_ERROR_NULL_POINTER;
  
  while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) 
  {
    PRBool purgeHdr = PR_FALSE;
    rv = hdrs->GetNext((nsISupports**)&pHeader);
    NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
    if (NS_FAILED(rv)) 
      break;
    
    if (keepUnreadMessagesOnly)
    {
      PRBool isRead;
      IsHeaderRead(pHeader, &isRead);
      if (isRead)
        purgeHdr = PR_TRUE;
      
    }
    // this isn't quite right - we want to prefer unread messages (keep all of those we can)
    if (numHdrs > numHeadersToKeep)
      purgeHdr = PR_TRUE;
    
    if (purgeHdr)
    {
      nsMsgKey msgKey;
      pHeader->GetMessageKey(&msgKey);
      keysToDelete.Add(msgKey);
      numHdrs--;
      if (hdrsToDelete)
        hdrsToDelete->AppendElement(pHeader);
    }
    NS_RELEASE(pHeader);
  }
  
  if (!hdrsToDelete)
  {
    PRInt32 numKeysToDelete = keysToDelete.GetSize();
    if (numKeysToDelete > 0)
    {
      DeleteMessages(&keysToDelete, nsnull);
      if (numKeysToDelete > 10)    // compress commit if we deleted more than 10
        Commit(nsMsgDBCommitType::kCompressCommit);
      else
        Commit(nsMsgDBCommitType::kLargeCommit);
    }
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::PurgeMessagesOlderThan ( PRUint32  daysToKeepHdrs,
PRBool  keepUnreadMessagesOnly,
nsISupportsArray hdrsToDelete 
) [protected, inherited]

Definition at line 4504 of file nsMsgDatabase.cpp.

{
  nsresult rv = NS_OK;
  nsMsgHdr           *pHeader;
  nsCOMPtr <nsISimpleEnumerator> hdrs;
  rv = EnumerateMessages(getter_AddRefs(hdrs));
  nsMsgKeyArray keysToDelete;
  
  if (NS_FAILED(rv))
    return rv;
  PRBool hasMore = PR_FALSE;
  
  PRTime now = PR_Now();
  PRTime cutOffDay;
  
  PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDay;
  
  LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
  LL_UI2L(secondsInDays, 60 * 60 * 24 * daysToKeepHdrs);
  LL_MUL(microSecondsInDay, secondsInDays, microSecondsPerSecond);
  
  LL_SUB(cutOffDay, now, microSecondsInDay); // = now - term->m_value.u.age * 60 * 60 * 24; 
  // so now cutOffDay is the PRTime cut-off point. Any msg with a date less than that will get purged.
  while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE)) 
  {
    PRBool purgeHdr = PR_FALSE;
    
    rv = hdrs->GetNext((nsISupports**)&pHeader);
    NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
    if (NS_FAILED(rv)) 
      break;
    
    if (keepUnreadMessagesOnly)
    {
      PRBool isRead;
      IsHeaderRead(pHeader, &isRead);
      if (isRead)
        purgeHdr = PR_TRUE;
      
    }
    if (!purgeHdr)
    {
      PRTime date;
      pHeader->GetDate(&date);
      if (LL_CMP(date, <, cutOffDay))
        purgeHdr = PR_TRUE;
    }
    if (purgeHdr)
    {
      nsMsgKey msgKey;
      pHeader->GetMessageKey(&msgKey);
      keysToDelete.Add(msgKey);
      if (hdrsToDelete)
        hdrsToDelete->AppendElement(pHeader);
    }
    NS_RELEASE(pHeader);
  }
  
  if (!hdrsToDelete)
  {
    DeleteMessages(&keysToDelete, nsnull);
  
    if (keysToDelete.GetSize() > 10)      // compress commit if we deleted more than 10
      Commit(nsMsgDBCommitType::kCompressCommit);
    else if (keysToDelete.GetSize() > 0)
      Commit(nsMsgDBCommitType::kLargeCommit);
  }
  return rv;
}

Here is the call graph for this function:

void nsIMsgDatabase::refreshCache ( in string  aSearchFolderUri,
in unsigned long  aNumKeys,
[array, size_is(aNumKeys)] in nsMsgKey  aNewHits,
out unsigned long  aNumBadHits,
[array, size_is(aNumBadHits)] out nsMsgKey  aStaleHits 
) [inherited]
void nsMsgDatabase::RemoveFromCache ( nsMsgDatabase pMessageDB) [static, protected, inherited]

Definition at line 860 of file nsMsgDatabase.cpp.

{
  int i = FindInCache(pMessageDB);
  if (i != -1)
    GetDBCache()->RemoveElementAt(i);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RemoveHdrFromCache ( nsIMsgDBHdr hdr,
nsMsgKey  key 
) [protected, inherited]

Definition at line 404 of file nsMsgDatabase.cpp.

{
  if (m_cachedHeaders)
  {
    if (key == nsMsgKey_None)
      hdr->GetMessageKey(&key);
    
    PLDHashEntryHdr *entry = PL_DHashTableOperate(m_cachedHeaders, (const void *) key, PL_DHASH_LOOKUP);
    if (PL_DHASH_ENTRY_IS_BUSY(entry))
    {
      PL_DHashTableOperate(m_cachedHeaders, (void *) key, PL_DHASH_REMOVE);
      NS_RELEASE(hdr); // get rid of extra ref the cache was holding.
    }
    
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RemoveHdrFromUseCache ( nsIMsgDBHdr hdr,
nsMsgKey  key 
) [protected, inherited]

Definition at line 545 of file nsMsgDatabase.cpp.

{
  if (m_headersInUse)
  {
    if (key == nsMsgKey_None)
      hdr->GetMessageKey(&key);
    
    PL_DHashTableOperate(m_headersInUse, (void *) key, PL_DHASH_REMOVE);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RemoveHeaderFromDB ( nsMsgHdr msgHdr) [protected, virtual, inherited]

Definition at line 1948 of file nsMsgDatabase.cpp.

{
  if (!msgHdr)
    return NS_ERROR_NULL_POINTER;
  nsresult ret = NS_OK;
  
  RemoveHdrFromCache(msgHdr, nsMsgKey_None);
  nsIMdbRow* row = msgHdr->GetMDBRow();
  ret = m_mdbAllMsgHeadersTable->CutRow(GetEnv(), row);
  row->CutAllColumns(GetEnv());
  msgHdr->m_initedValues = 0; // invalidate cached values.
  return ret;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::RemoveHeaderFromThread ( nsMsgHdr msgHdr) [protected, virtual, inherited]

Definition at line 1922 of file nsMsgDatabase.cpp.

{
  if (!msgHdr)
    return NS_ERROR_NULL_POINTER;
  nsresult ret = NS_OK;
  nsCOMPtr <nsIMsgThread> thread ;
  ret = GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(thread));
  if (NS_SUCCEEDED(ret) && thread)
  {
    nsCOMPtr <nsIDBChangeAnnouncer> announcer = do_QueryInterface(this);
    ret = thread->RemoveChildHdr(msgHdr, announcer);
  }
  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDatabase::resetHdrCacheSize ( in unsigned long  size) [inherited]
nsresult nsMsgDatabase::RowCellColumnToAddressCollationKey ( nsIMdbRow row,
mdb_token  colToken,
PRUint8 **  result,
PRUint32 len 
) [inherited]

Definition at line 3206 of file nsMsgDatabase.cpp.

{
  const char *cSender;
  nsXPIDLCString name;
  
  nsresult ret = RowCellColumnToConstCharPtr(row, colToken, &cSender);
  if (NS_SUCCEEDED(ret))
  {
    nsIMsgHeaderParser *headerParser = GetHeaderParser();
    if (headerParser)
    {
      // apply mime decode
      nsIMimeConverter *converter = GetMimeConverter();
      
      if (NS_SUCCEEDED(ret) && nsnull != converter) 
      {
        char *resultStr = nsnull;
        char *charset;
        PRBool characterSetOverride;
        m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride);
        ret = RowCellColumnToCharPtr(row, m_messageCharSetColumnToken, &charset);
        if (NS_FAILED(ret) || !*charset || !PL_strcasecmp(charset, "us-ascii") ||
            characterSetOverride)
        {
          PR_Free(charset);
          m_dbFolderInfo->GetCharPtrCharacterSet(&charset);
        }

        ret = converter->DecodeMimeHeader(cSender, &resultStr,
          charset, characterSetOverride);
        if (NS_SUCCEEDED(ret) && resultStr)
        {
          ret = headerParser->ExtractHeaderAddressName ("UTF-8", resultStr, getter_Copies(name));
        }
        else {
          ret = headerParser->ExtractHeaderAddressName ("UTF-8", cSender, getter_Copies(name));
        }
        PR_FREEIF(resultStr);
        PR_FREEIF(charset);
      }
      
    }
  }
  if (NS_SUCCEEDED(ret))
  {
    ret = CreateCollationKey(NS_ConvertUTF8toUCS2(name), result, len);
  }
  
  return ret;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::RowCellColumnToCharPtr ( nsIMdbRow row,
mdb_token  columnToken,
char **  result 
) [inherited]

Definition at line 3408 of file nsMsgDatabase.cpp.

{
  nsresult    err = NS_ERROR_NULL_POINTER;
  
  if (row && result)
  {
    struct mdbYarn yarn;
    err = row->AliasCellYarn(GetEnv(), columnToken, &yarn);
    if (err == NS_OK)
    {
      *result = (char *) PR_CALLOC(yarn.mYarn_Fill + 1);
      if (*result)
      {
        if (yarn.mYarn_Fill > 0)
          memcpy(*result, yarn.mYarn_Buf, yarn.mYarn_Fill);
        else
          **result = 0;
      }
      else
        err = NS_ERROR_OUT_OF_MEMORY;
      
    }
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RowCellColumnToCollationKey ( nsIMdbRow row,
mdb_token  columnToken,
PRUint8 **  result,
PRUint32 len 
) [inherited]

Definition at line 3289 of file nsMsgDatabase.cpp.

{
  const char *nakedString = nsnull;
  nsresult err;
  
  err = RowCellColumnToConstCharPtr(row, columnToken, &nakedString);
  if (NS_SUCCEEDED(err))
  {
    GetMimeConverter();
    if (m_mimeConverter) 
    {
      nsXPIDLCString decodedStr;
      char *charSet;
      PRBool characterSetOverride;
      m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride);
      err = RowCellColumnToCharPtr(row, m_messageCharSetColumnToken, &charSet);
      if (NS_FAILED(err) || !*charSet || !PL_strcasecmp(charSet, "us-ascii") ||
          characterSetOverride)
      {
        PR_Free(charSet);
        m_dbFolderInfo->GetCharPtrCharacterSet(&charSet);
      }
      
      err = m_mimeConverter->DecodeMimeHeader(nakedString, getter_Copies(decodedStr), charSet, characterSetOverride);
      if (NS_SUCCEEDED(err))
        err = CreateCollationKey(NS_ConvertUTF8toUCS2(decodedStr), result, len);
      PR_Free(charSet);
    }
  }
  return err;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::RowCellColumnToConstCharPtr ( nsIMdbRow row,
mdb_token  columnToken,
const char **  ptr 
) [inherited]

Definition at line 3153 of file nsMsgDatabase.cpp.

{
  nsresult    err = NS_OK;
  
  if (hdrRow) // ### probably should be an error if hdrRow is NULL...
  {
    struct mdbYarn yarn;
    err = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
    if (err == NS_OK)
      *ptr = (const char*)yarn.mYarn_Buf;
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RowCellColumnToMime2DecodedString ( nsIMdbRow row,
mdb_token  columnToken,
PRUnichar **  resultStr 
) [inherited]

Definition at line 3177 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  const char *nakedString = nsnull;
  err = RowCellColumnToConstCharPtr(row, columnToken, &nakedString);
  if (NS_SUCCEEDED(err) && nakedString && strlen(nakedString))
  {
    GetMimeConverter();
    if (m_mimeConverter) 
    {
      nsAutoString decodedStr;
      char *charSet;
      PRBool characterSetOverride;
      m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride);
      err = RowCellColumnToCharPtr(row, m_messageCharSetColumnToken, &charSet);
      if (NS_FAILED(err) || !*charSet || !PL_strcasecmp(charSet, "us-ascii") ||
          characterSetOverride)
      {
        PR_Free(charSet);
        m_dbFolderInfo->GetCharPtrCharacterSet(&charSet);
      }

      err = m_mimeConverter->DecodeMimeHeader(nakedString, resultStr, charSet, characterSetOverride);
      PR_Free(charSet);
    }
  }
  return err;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::RowCellColumnTonsString ( nsIMdbRow row,
mdb_token  columnToken,
nsAString &  resultStr 
) [inherited]

Definition at line 3137 of file nsMsgDatabase.cpp.

{
  nsresult    err = NS_OK;
  
  if (hdrRow) // ### probably should be an error if hdrRow is NULL...
  {
    struct mdbYarn yarn;
    err = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
    if (err == NS_OK)
      YarnTonsString(&yarn, resultStr);
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RowCellColumnToUInt32 ( nsIMdbRow row,
mdb_token  columnToken,
PRUint32 uint32Result,
PRUint32  defaultValue = 0 
) [inherited]

Definition at line 3361 of file nsMsgDatabase.cpp.

{
  nsresult    err = NS_OK;
  
  if (uint32Result)
    *uint32Result = defaultValue;
  if (hdrRow) // ### probably should be an error if hdrRow is NULL...
  {
    struct mdbYarn yarn;
    err = hdrRow->AliasCellYarn(GetEnv(), columnToken, &yarn);
    if (err == NS_OK)
      YarnToUInt32(&yarn, uint32Result);
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::RowCellColumnToUInt32 ( nsIMdbRow row,
mdb_token  columnToken,
PRUint32 uint32Result,
PRUint32  defaultValue = 0 
) [inherited]

Definition at line 3356 of file nsMsgDatabase.cpp.

{
  return RowCellColumnToUInt32(hdrRow, columnToken, &uint32Result, defaultValue);
}

Here is the call graph for this function:

void nsIMsgDatabase::setAttributesOnPendingHdr ( in nsIMsgDBHdr  pendingHdr,
in string  property,
in string  propertyVal,
in long  flags 
) [inherited]
PRBool nsMsgDatabase::SetHdrFlag ( nsIMsgDBHdr msgHdr,
PRBool  bSet,
MsgFlags  flag 
) [protected, virtual, inherited]

Reimplemented in nsMailDatabase, and nsImapMailDatabase.

Definition at line 2359 of file nsMsgDatabase.cpp.

{
  PRUint32 statusFlags;
  (void)msgHdr->GetFlags(&statusFlags);
  PRUint32 currentStatusFlags = GetStatusFlags(msgHdr, statusFlags);
  PRBool flagAlreadySet = (currentStatusFlags & flag) != 0;
  
  if ((flagAlreadySet && !bSet) || (!flagAlreadySet && bSet))
  {
    PRUint32 resultFlags;
    if (bSet)
    {
      msgHdr->OrFlags(flag, &resultFlags);
    }
    else
    {
      msgHdr->AndFlags(~flag, &resultFlags);
    }
    return PR_TRUE;
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNewsDatabase::SetHdrReadFlag ( nsIMsgDBHdr msgHdr,
PRBool  bRead 
) [virtual]

Reimplemented from nsMsgDatabase.

Definition at line 208 of file nsNewsDatabase.cpp.

{
    nsresult rv;
    PRBool isRead;
    rv = IsHeaderRead(msgHdr, &isRead);
    
    if (isRead == bRead) 
    {
      // give the base class a chance to update m_flags.
      nsMsgDatabase::SetHdrReadFlag(msgHdr, bRead);
      return PR_FALSE;
    }
    else {
      nsMsgKey messageKey;

      // give the base class a chance to update m_flags.
      nsMsgDatabase::SetHdrReadFlag(msgHdr, bRead);
      rv = msgHdr->GetMessageKey(&messageKey);
      if (NS_FAILED(rv)) return PR_FALSE;

      NS_ASSERTION(m_readSet, "m_readSet is null");
      if (!m_readSet) return PR_FALSE;

      if (!bRead) {
#ifdef DEBUG_NEWS_DATABASE
        printf("remove %d from the set\n",messageKey);
#endif

        rv = m_readSet->Remove(messageKey);
        if (NS_FAILED(rv)) return PR_FALSE;

        rv = NotifyReadChanged(nsnull);
        if (NS_FAILED(rv)) return PR_FALSE;
      }
      else {
#ifdef DEBUG_NEWS_DATABASE
        printf("add %d to the set\n",messageKey);
#endif

        rv = m_readSet->Add(messageKey);
        if (NS_FAILED(rv)) return PR_FALSE;

        rv = NotifyReadChanged(nsnull);
        if (NS_FAILED(rv)) return PR_FALSE;
      }
    }
    return PR_TRUE;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::SetKeyFlag ( nsMsgKey  key,
PRBool  set,
PRUint32  flag,
nsIDBChangeListener instigator = NULL 
) [protected, virtual, inherited]

Definition at line 2317 of file nsMsgDatabase.cpp.

{
  nsresult rv;
  nsCOMPtr <nsIMsgDBHdr> msgHdr;
              
  rv = GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
  if (NS_FAILED(rv) || !msgHdr) 
    return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
  
  PRUint32 oldFlags;
  msgHdr->GetFlags(&oldFlags);
  
  SetHdrFlag(msgHdr, set, flag);
  
  PRUint32 flags;
  (void)msgHdr->GetFlags(&flags);
  
  if (oldFlags == flags)
    return NS_OK;

  return NotifyHdrChangeAll(msgHdr, oldFlags, flags, instigator);
}

Here is the call graph for this function:

void nsIMsgDatabase::SetLabel ( in nsMsgKey  key,
in nsMsgLabelValue  label 
) [inherited]
nsresult nsMsgDatabase::SetMsgHdrFlag ( nsIMsgDBHdr msgHdr,
PRBool  set,
PRUint32  flag,
nsIDBChangeListener instigator 
) [protected, virtual, inherited]

Definition at line 2341 of file nsMsgDatabase.cpp.

{
  PRUint32 oldFlags;
  msgHdr->GetFlags(&oldFlags);

  SetHdrFlag(msgHdr, set, flag);

  PRUint32 flags;
  (void)msgHdr->GetFlags(&flags);

  if (oldFlags == flags)
    return NS_OK;

  return NotifyHdrChangeAll(msgHdr, oldFlags, flags, instigator);
}

Here is the call graph for this function:

nsresult nsMsgDatabase::SetNSStringPropertyWithToken ( nsIMdbRow row,
mdb_token  aProperty,
const nsAString &  propertyStr 
) [inherited]

Definition at line 3583 of file nsMsgDatabase.cpp.

{
  NS_ENSURE_ARG(row);
  struct mdbYarn yarn;
  
  yarn.mYarn_Grow = NULL;
  nsresult err = row->AddColumn(GetEnv(), aProperty, nsStringToYarn(&yarn, propertyStr));
  nsMemory::Free((char *)yarn.mYarn_Buf); // won't need this when we have nsCString
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::SetProperty ( nsIMdbRow row,
const char *  propertyName,
const char *  propertyVal 
) [inherited]

Definition at line 3513 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  mdb_token   property_token;
  
  err = m_mdbStore->StringToToken(GetEnv(),  propertyName, &property_token);
  if (err == NS_OK)
    CharPtrToRowCellColumn(row, property_token, propertyVal);
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::SetPropertyFromNSString ( nsIMdbRow row,
const char *  propertyName,
const nsAString &  propertyVal 
) [inherited]

Definition at line 3536 of file nsMsgDatabase.cpp.

{
  nsresult err = NS_OK;
  mdb_token   property_token;
  
  err = m_mdbStore->StringToToken(GetEnv(),  propertyName, &property_token);
  if (err == NS_OK)
    return SetNSStringPropertyWithToken(row, property_token, propertyVal);
  
  return err;
}

Here is the call graph for this function:

void nsIMsgDatabase::setStringProperty ( in nsMsgKey  aKey,
in string  aProperty,
in string  aValue 
) [inherited]
nsresult nsMsgDatabase::SetUint32Property ( nsIMdbRow row,
const char *  propertyName,
PRUint32  propertyVal 
) [inherited]

Definition at line 3561 of file nsMsgDatabase.cpp.

{
  struct mdbYarn yarn;
  char int32StrBuf[20];
  yarn.mYarn_Buf = int32StrBuf;
  yarn.mYarn_Size = sizeof(int32StrBuf);
  yarn.mYarn_Fill = sizeof(int32StrBuf);

  if (!row)
    return NS_ERROR_NULL_POINTER;

  mdb_token   property_token;
  
  nsresult err = m_mdbStore->StringToToken(GetEnv(),  propertyName, &property_token);
  if (err == NS_OK)
  {
    UInt32ToYarn(&yarn, propertyVal);
    err = row->AddColumn(GetEnv(), property_token, &yarn);
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implemented in nsMailDatabase, and nsImapMailDatabase.

Definition at line 282 of file nsNewsDatabase.cpp.

{

  // The code below attempts to update the underlying nsMsgDatabase's idea
  // of read/unread flags to match the read set in the .newsrc file. It should
  // only be called when they don't match, e.g., we crashed after committing the
  // db but before writing out the .newsrc
  nsCOMPtr <nsISimpleEnumerator> hdrs;
  nsresult rv = EnumerateMessages(getter_AddRefs(hdrs));
  NS_ENSURE_SUCCESS(rv, rv);

  PRBool hasMore = PR_FALSE, readInNewsrc, isReadInDB, changed = PR_FALSE;
  nsCOMPtr <nsIMsgDBHdr> header;
  PRInt32 numMessages = 0, numUnreadMessages = 0;
  nsMsgKey messageKey;
  nsCOMPtr <nsIMsgThread> threadHdr;

  // Scan all messages in DB
  while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && (hasMore == PR_TRUE))
  {
      rv = hdrs->GetNext(getter_AddRefs(header));
      NS_ENSURE_SUCCESS(rv, rv);

      rv = nsMsgDatabase::IsHeaderRead(header, &isReadInDB);
      NS_ENSURE_SUCCESS(rv, rv);
  
      header->GetMessageKey(&messageKey);
      IsRead(messageKey,&readInNewsrc);

      numMessages++;
      if (!readInNewsrc) 
        numUnreadMessages++;

      // If DB and readSet disagree on Read/Unread, fix DB
      if (readInNewsrc!=isReadInDB) 
      {
        MarkHdrRead(header, readInNewsrc, nsnull);
        changed = PR_TRUE;
      }
  }
  
  // Update FolderInfo Counters
  PRInt32 oldMessages, oldUnreadMessages;
  rv = m_dbFolderInfo->GetNumMessages(&oldMessages);
  if (NS_SUCCEEDED(rv) && oldMessages!=numMessages) 
  {
      changed = PR_TRUE;
      m_dbFolderInfo->ChangeNumMessages(numMessages-oldMessages);
  }
  rv = m_dbFolderInfo->GetNumUnreadMessages(&oldUnreadMessages);
  if (NS_SUCCEEDED(rv) && oldUnreadMessages!=numUnreadMessages) 
  {
      changed = PR_TRUE;
      m_dbFolderInfo->ChangeNumUnreadMessages(numUnreadMessages-oldUnreadMessages);
  }

  if (changed)
      Commit(nsMsgDBCommitType::kLargeCommit);

  return rv;
}

Here is the call graph for this function:

PRBool nsMsgDatabase::ThreadBySubjectWithoutRe ( ) [protected, virtual, inherited]

Definition at line 3623 of file nsMsgDatabase.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDatabase::ThreadNewHdr ( nsMsgHdr hdr,
PRBool newThread 
) [protected, virtual, inherited]

Definition at line 3774 of file nsMsgDatabase.cpp.

{
  nsresult result=NS_ERROR_UNEXPECTED;
  nsCOMPtr <nsIMsgThread> thread;
  nsCOMPtr <nsIMsgDBHdr> replyToHdr;
  nsMsgKey threadId = nsMsgKey_None, newHdrKey;
  
  if (!newHdr)
    return NS_ERROR_NULL_POINTER;
  
  newHdr->SetThreadParent(nsMsgKey_None); // if we're undoing, could have a thread parent
  PRUint16 numReferences = 0;
  PRUint32 newHdrFlags = 0;
  
  // use raw flags instead of GetFlags, because GetFlags will
  // pay attention to what's in m_newSet, and this new hdr isn't
  // in m_newSet yet.
  newHdr->GetRawFlags(&newHdrFlags);
  newHdr->GetNumReferences(&numReferences);
  newHdr->GetMessageKey(&newHdrKey);
  
  // try reference threading first
  for (PRInt32 i = numReferences - 1; i >= 0;  i--)
  {
    nsCAutoString reference;
    
    newHdr->GetStringReference(i, reference);
    // first reference we have hdr for is best top-level hdr.
    // but we have to handle case of promoting new header to top-level
    // in case the top-level header comes after a reply.
    
    if (reference.IsEmpty())
      break;
    
    thread = getter_AddRefs(GetThreadForReference(reference, getter_AddRefs(replyToHdr))) ;
    if (thread)
    {
      if (replyToHdr)
      {
        nsMsgKey replyToKey;
        replyToHdr->GetMessageKey(&replyToKey);
        // message claims to be a reply to itself - ignore that since it leads to corrupt threading.
        if (replyToKey == newHdrKey)
        {
          // bad references - throw them all away.
          newHdr->SetMessageId("");
          thread = nsnull;
          break;
        }
      }
      thread->GetThreadKey(&threadId);
      newHdr->SetThreadId(threadId);
      result = AddToThread(newHdr, thread, replyToHdr, PR_TRUE);
      break;
    }
  }
  // if user hasn't said "only thread by ref headers", thread by subject
  if (!UseStrictThreading())
  {
    // try subject threading if we couldn't find a reference and the subject starts with Re:
    nsXPIDLCString subject;
  
    newHdr->GetSubject(getter_Copies(subject));
    if ((ThreadBySubjectWithoutRe() || (newHdrFlags & MSG_FLAG_HAS_RE)) && (!thread))
    {
      nsCAutoString cSubject(subject);
      thread = getter_AddRefs(GetThreadForSubject(cSubject));
      if(thread)
      {
        thread->GetThreadKey(&threadId);
        newHdr->SetThreadId(threadId);
        //TRACE("threading based on subject %s\n", (const char *) msgHdr->m_subject);
        // if we move this and do subject threading after, ref threading, 
        // don't thread within children, since we know it won't work. But for now, pass TRUE.
        result = AddToThread(newHdr, thread, nsnull, PR_TRUE);     
      }
    }
  }
  
  if (!thread)
  {
    // couldn't find any parent articles - msgHdr is top-level thread, for now
    result = AddNewThread(newHdr);
    newThread = PR_TRUE;
  }
  else
  {
    newThread = PR_FALSE;
  }
  return result;
}

Here is the call graph for this function:

nsresult nsMsgDatabase::UInt32ToRowCellColumn ( nsIMdbRow row,
mdb_token  columnToken,
PRUint32  value 
) [inherited]

Definition at line 3377 of file nsMsgDatabase.cpp.

{
  struct mdbYarn yarn;
  char yarnBuf[100];
  
  if (!row)
    return NS_ERROR_NULL_POINTER;

  yarn.mYarn_Buf = (void *) yarnBuf;
  yarn.mYarn_Size = sizeof(yarnBuf);
  yarn.mYarn_Fill = yarn.mYarn_Size;
  yarn.mYarn_Form = 0;
  yarn.mYarn_Grow = NULL;
  return row->AddColumn(GetEnv(),  columnToken, UInt32ToYarn(&yarn, value));
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct mdbYarn * nsMsgDatabase::UInt32ToYarn ( struct mdbYarn yarn,
PRUint32  i 
) [static, read, inherited]

Definition at line 3445 of file nsMsgDatabase.cpp.

{
  PR_snprintf((char *) yarn->mYarn_Buf, yarn->mYarn_Size, "%lx", i);
  yarn->mYarn_Fill = PL_strlen((const char *) yarn->mYarn_Buf);
  yarn->mYarn_Form = 0;     // what to do with this? Should be parsed out of the mime2 header?
  return yarn;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDatabase::UndoDelete ( in nsIMsgDBHdr  msgHdr) [inherited]
void nsIMsgDatabase::updateHdrInCache ( in string  aSearchFolderUri,
in nsIMsgDBHdr  aHdr,
in boolean  aAdd 
) [inherited]
PRBool nsMsgDatabase::UseStrictThreading ( ) [protected, virtual, inherited]

Definition at line 3629 of file nsMsgDatabase.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDatabase::YarnTonsCString ( struct mdbYarn yarn,
nsACString &  str 
) [static, inherited]

Definition at line 3462 of file nsMsgDatabase.cpp.

{
    const char* buf = (const char*)yarn->mYarn_Buf;
    if (buf)
        str.Assign(buf, yarn->mYarn_Fill);
    else
        str.Truncate();
}

Here is the call graph for this function:

void nsMsgDatabase::YarnTonsString ( struct mdbYarn yarn,
nsAString &  str 
) [static, inherited]

Definition at line 3453 of file nsMsgDatabase.cpp.

{
  const char* buf = (const char*)yarn->mYarn_Buf;
  if (buf)
    CopyASCIItoUTF16(Substring(buf, buf + yarn->mYarn_Fill), str);
  else
    str.Truncate();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsMsgDatabase::YarnToUInt32 ( struct mdbYarn yarn,
PRUint32 i 
) [static, inherited]

Definition at line 3473 of file nsMsgDatabase.cpp.

{
  PRUint32 result;
  char *p = (char *) yarn->mYarn_Buf;
  PRInt32 numChars = PR_MIN(8, yarn->mYarn_Fill);
  PRInt32 i;
  
  if (numChars > 0)
  {
    for (i=0, result = 0; i<numChars; i++, p++)
    {
      char C = *p;
      
      PRInt8 unhex = ((C >= '0' && C <= '9') ? C - '0' :
      ((C >= 'A' && C <= 'F') ? C - 'A' + 10 :
                        ((C >= 'a' && C <= 'f') ? C - 'a' + 10 : -1)));
       if (unhex < 0)
         break;
       result = (result << 4) | unhex;
    }
    
    *pResult = result;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsMsgDBEnumerator [friend, inherited]

Definition at line 166 of file nsMsgDatabase.h.

friend class nsMsgDBService [friend, inherited]

Definition at line 84 of file nsMsgDatabase.h.

friend class nsMsgDBThreadEnumerator [friend, inherited]

Definition at line 167 of file nsMsgDatabase.h.

friend class nsMsgHdr [friend, inherited]

Definition at line 164 of file nsMsgDatabase.h.

friend class nsMsgThread [friend, inherited]

Definition at line 165 of file nsMsgDatabase.h.


Member Data Documentation

Definition at line 135 of file nsIMsgDatabase.idl.

Definition at line 290 of file nsIMsgDatabase.idl.

Definition at line 289 of file nsIMsgDatabase.idl.

Definition at line 288 of file nsIMsgDatabase.idl.

Definition at line 239 of file nsIMsgDatabase.idl.

Definition at line 297 of file nsIMsgDatabase.idl.

PLDHashTableOps nsMsgDatabase::gMsgDBHashTableOps [static, protected, inherited]

Definition at line 278 of file nsIMsgDatabase.idl.

Definition at line 277 of file nsIMsgDatabase.idl.

Definition at line 248 of file nsMsgDatabase.h.

PRBool nsMsgDatabase::m_bCacheHeaders [protected, inherited]

Definition at line 310 of file nsMsgDatabase.h.

Definition at line 309 of file nsMsgDatabase.h.

Definition at line 312 of file nsMsgDatabase.h.

nsMsgKey nsMsgDatabase::m_cachedThreadId [protected, inherited]

Definition at line 311 of file nsMsgDatabase.h.

Definition at line 261 of file nsMsgDatabase.h.

Definition at line 243 of file nsMsgDatabase.h.

Definition at line 218 of file nsMsgDatabase.h.

Definition at line 254 of file nsMsgDatabase.h.

nsVoidArray * nsMsgDatabase::m_dbCache = NULL [static, protected, inherited]

Definition at line 216 of file nsMsgDatabase.h.

Definition at line 234 of file nsMsgDatabase.h.

nsFileSpec nsMsgDatabase::m_dbName [protected, inherited]

Definition at line 240 of file nsMsgDatabase.h.

Definition at line 221 of file nsMsgDatabase.h.

Definition at line 256 of file nsMsgDatabase.h.

Definition at line 233 of file nsMsgDatabase.h.

Definition at line 244 of file nsMsgDatabase.h.

Definition at line 246 of file nsMsgDatabase.h.

Definition at line 275 of file nsMsgDatabase.h.

Definition at line 293 of file nsMsgDatabase.h.

Definition at line 258 of file nsMsgDatabase.h.

Definition at line 238 of file nsMsgDatabase.h.

Definition at line 239 of file nsMsgDatabase.h.

nsIMdbEnv* nsMsgDatabase::m_mdbEnv [protected, inherited]

Definition at line 236 of file nsMsgDatabase.h.

nsIMdbStore* nsMsgDatabase::m_mdbStore [protected, inherited]

Definition at line 237 of file nsMsgDatabase.h.

Definition at line 242 of file nsMsgDatabase.h.

Definition at line 269 of file nsMsgDatabase.h.

Definition at line 251 of file nsMsgDatabase.h.

Definition at line 255 of file nsMsgDatabase.h.

Definition at line 266 of file nsMsgDatabase.h.

Definition at line 219 of file nsMsgDatabase.h.

nsMsgKeyArray nsMsgDatabase::m_newSet [protected, inherited]

Definition at line 241 of file nsMsgDatabase.h.

Definition at line 235 of file nsMsgDatabase.h.

Definition at line 260 of file nsMsgDatabase.h.

Definition at line 268 of file nsMsgDatabase.h.

Definition at line 274 of file nsMsgDatabase.h.

Definition at line 273 of file nsMsgDatabase.h.

Definition at line 257 of file nsMsgDatabase.h.

nsMsgKeySet* nsNewsDatabase::m_readSet [protected]

Definition at line 85 of file nsNewsDatabase.h.

Definition at line 253 of file nsMsgDatabase.h.

Definition at line 252 of file nsMsgDatabase.h.

Definition at line 220 of file nsMsgDatabase.h.

Definition at line 250 of file nsMsgDatabase.h.

Definition at line 259 of file nsMsgDatabase.h.

Definition at line 249 of file nsMsgDatabase.h.

Definition at line 264 of file nsMsgDatabase.h.

Definition at line 262 of file nsMsgDatabase.h.

Definition at line 263 of file nsMsgDatabase.h.

Definition at line 272 of file nsMsgDatabase.h.

Definition at line 270 of file nsMsgDatabase.h.

Definition at line 271 of file nsMsgDatabase.h.

Definition at line 245 of file nsMsgDatabase.h.

Definition at line 267 of file nsMsgDatabase.h.

Definition at line 247 of file nsMsgDatabase.h.

Definition at line 265 of file nsMsgDatabase.h.

Definition at line 248 of file nsIMsgDatabase.idl.

Definition at line 293 of file nsIMsgDatabase.idl.

Definition at line 241 of file nsIMsgDatabase.idl.

Definition at line 280 of file nsIMsgDatabase.idl.

Definition at line 279 of file nsIMsgDatabase.idl.

Definition at line 50 of file nsINewsDatabase.idl.

Definition at line 259 of file nsIMsgDatabase.idl.


The documentation for this class was generated from the following files: