Back to index

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

#include <nsMsgHdr.h>

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

List of all members.

Public Member Functions

 nsMsgHdr (nsMsgDatabase *db, nsIMdbRow *dbRow)
virtual ~nsMsgHdr ()
virtual nsresult GetRawFlags (PRUint32 *result)
void Init ()
virtual nsresult InitCachedValues ()
virtual nsresult InitFlags ()
NS_DECL_ISUPPORTS nsIMdbRowGetMDBRow ()
PRBool IsParentOf (nsIMsgDBHdr *possibleChild)
PRBool IsAncestorOf (nsIMsgDBHdr *possibleChild)
AString getProperty (in string propertyName)
void setProperty (in string propertyName, in AString propertyStr)
void setStringProperty (in string propertyName, in string propertyValue)
string getStringProperty (in string propertyName)
unsigned long getUint32Property (in string propertyName)
void setUint32Property (in string propertyName, in unsigned long propertyVal)
void markRead (in boolean read)
void markFlagged (in boolean flagged)
void markHasAttachments (in boolean hasAttachments)
void setPriorityString (in string priority)
unsigned long OrFlags (in unsigned long flags)
unsigned long AndFlags (in unsigned long flags)
void setReferences (in string references)
ACString getStringReference (in long refNum)
void setRecipientsArray (in string names, in string addresses, in unsigned long numAddresses)
void setCCListArray (in string names, in string addresses, in unsigned long numAddresses)
void getAuthorCollationKey (out octetPtr key, out unsigned long len)
void getSubjectCollationKey (out octetPtr key, out unsigned long len)
void getRecipientsCollationKey (out octetPtr key, out unsigned long len)

Public Attributes

readonly attribute boolean isRead
readonly attribute boolean isFlagged
attribute nsMsgPriorityValue priority
attribute unsigned long flags
attribute nsMsgKey threadId
attribute nsMsgKey messageKey
attribute nsMsgKey threadParent
attribute unsigned long messageSize
attribute unsigned long lineCount
attribute unsigned long statusOffset
attribute unsigned long messageOffset
attribute unsigned long offlineMessageSize
attribute PRTime date
readonly attribute unsigned long dateInSeconds
attribute string messageId
attribute string ccList
attribute string author
attribute string subject
attribute string recipients
readonly attribute unsigned short numReferences
readonly attribute wstring mime2DecodedAuthor
readonly attribute wstring mime2DecodedSubject
readonly attribute wstring mime2DecodedRecipients
attribute string Charset
attribute nsMsgLabelValue label
attribute string accountKey
readonly attribute nsIMsgFolder folder

Protected Member Functions

nsresult SetStringColumn (const char *str, mdb_token token)
nsresult SetUInt32Column (PRUint32 value, mdb_token token)
nsresult GetUInt32Column (mdb_token token, PRUint32 *pvalue, PRUint32 defaultValue=0)
nsresult BuildRecipientsFromArray (const char *names, const char *addresses, PRUint32 numAddresses, nsCAutoString &allRecipients)
nsresult ParseReferences (const char *references)
const char * GetNextReference (const char *startNextRef, nsCString &reference)
const char * GetPrevReference (const char *prevRef, nsCString &reference)

Protected Attributes

nsMsgKey m_threadId
nsMsgKey m_messageKey
nsMsgKey m_threadParent
PRTime m_date
PRUint32 m_messageSize
PRUint32 m_statusOffset
PRUint32 m_flags
PRUint16 m_numReferences
nsCStringArray m_references
nsMsgPriorityValue m_priority
nsMsgDatabasem_mdb
nsIMdbRowm_mdbRow
PRUint32 m_initedValues

Friends

class nsMsgDatabase

Detailed Description

Definition at line 49 of file nsMsgHdr.h.


Constructor & Destructor Documentation

nsMsgHdr::nsMsgHdr ( nsMsgDatabase db,
nsIMdbRow dbRow 
)

Definition at line 55 of file nsMsgHdr.cpp.

{
  m_mdb = db;
  Init();
  m_mdbRow = dbRow;
  if(m_mdb)
  {
    m_mdb->AddRef();
    mdbOid outOid;
    if (dbRow && dbRow->GetOid(m_mdb->GetEnv(), &outOid) == NS_OK)
    {
      m_messageKey = outOid.mOid_Id;
      m_mdb->AddHdrToUseCache((nsIMsgDBHdr *) this, m_messageKey);
    }
  }
}

Here is the call graph for this function:

nsMsgHdr::~nsMsgHdr ( ) [virtual]

Definition at line 138 of file nsMsgHdr.cpp.

{
  if (m_mdbRow)
  {
    if (m_mdb)
    {  
      NS_RELEASE(m_mdbRow);
      m_mdb->RemoveHdrFromUseCache((nsIMsgDBHdr *) this, m_messageKey);
      m_mdb->Release();
    }
  }
}

Here is the call graph for this function:


Member Function Documentation

unsigned long nsIMsgDBHdr::AndFlags ( in unsigned long  flags) [inherited]

Here is the caller graph for this function:

nsresult nsMsgHdr::BuildRecipientsFromArray ( const char *  names,
const char *  addresses,
PRUint32  numAddresses,
nsCAutoString allRecipients 
) [protected]

Definition at line 417 of file nsMsgHdr.cpp.

{
       nsresult ret = NS_OK;
       const char *curName = names;
       const char *curAddress = addresses;
       nsIMsgHeaderParser *headerParser = m_mdb->GetHeaderParser();

       for (PRUint32 i = 0; i < numAddresses; i++, curName += strlen(curName) + 1, curAddress += strlen(curAddress) + 1)
       {
              if (i > 0)
                     allRecipients += ", ";

              if (headerParser)
              {
                 char * fullAddress;
                 ret = headerParser->MakeFullAddress(nsnull, curName, curAddress, &fullAddress);
                 if (NS_SUCCEEDED(ret) && fullAddress)
                 {
                    allRecipients += fullAddress;
                    nsCRT::free(fullAddress);
                    continue;
                 }
              }

        // Just in case the parser failed...
              if (strlen(curName))
              {
                     allRecipients += curName;
                     allRecipients += ' ';
              }

              if (strlen(curAddress))
              {
                     allRecipients += '<';
                     allRecipients += curAddress;
                     allRecipients += '>';
              }
       }
       
       return ret;
}

Here is the call graph for this function:

void nsIMsgDBHdr::getAuthorCollationKey ( out octetPtr  key,
out unsigned long  len 
) [inherited]

Definition at line 66 of file nsMsgHdr.h.

{return m_mdbRow;}

Here is the caller graph for this function:

const char * nsMsgHdr::GetNextReference ( const char *  startNextRef,
nsCString reference 
) [protected]

Definition at line 763 of file nsMsgHdr.cpp.

{
  const char *ptr = startNextRef;
  
  reference.Truncate(0);
  while ((*ptr == '<' || *ptr == ' ' || *ptr == nsCRT::CR || *ptr == nsCRT::LF || *ptr == '\t') && *ptr)
    ptr++;
  
  for (int i = 0; *ptr && *ptr != '>'; i++)
    reference += *ptr++;
  
  if (*ptr == '>')
    ptr++;
  return ptr;
}

Here is the caller graph for this function:

const char * nsMsgHdr::GetPrevReference ( const char *  prevRef,
nsCString reference 
) [protected]

Definition at line 781 of file nsMsgHdr.cpp.

{
  const char *ptr = prevRef;
  
  while ((*ptr == '>' || *ptr == ' ') && *ptr)
    ptr--;
  
  // scan back to '<'
  for (int i = 0; *ptr && *ptr != '<' ; i++)
    ptr--;
  
  GetNextReference(ptr, reference);
  if (*ptr == '<')
    ptr--;
  return ptr;
}

Here is the call graph for this function:

AString nsIMsgDBHdr::getProperty ( in string  propertyName) [inherited]
nsresult nsMsgHdr::GetRawFlags ( PRUint32 result) [virtual]

Definition at line 190 of file nsMsgHdr.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDBHdr::getRecipientsCollationKey ( out octetPtr  key,
out unsigned long  len 
) [inherited]
string nsIMsgDBHdr::getStringProperty ( in string  propertyName) [inherited]
ACString nsIMsgDBHdr::getStringReference ( in long  refNum) [inherited]
void nsIMsgDBHdr::getSubjectCollationKey ( out octetPtr  key,
out unsigned long  len 
) [inherited]
nsresult nsMsgHdr::GetUInt32Column ( mdb_token  token,
PRUint32 pvalue,
PRUint32  defaultValue = 0 
) [protected]

Definition at line 757 of file nsMsgHdr.cpp.

{
  return m_mdb->RowCellColumnToUInt32(GetMDBRow(), token, pvalue, defaultValue);
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned long nsIMsgDBHdr::getUint32Property ( in string  propertyName) [inherited]

Definition at line 73 of file nsMsgHdr.cpp.

Here is the caller graph for this function:

Definition at line 87 of file nsMsgHdr.cpp.

Here is the call graph for this function:

Definition at line 117 of file nsMsgHdr.cpp.

{
  
  nsresult err = NS_OK;
  
  if (!m_mdb)
    return NS_ERROR_NULL_POINTER;
  
  if(!(m_initedValues & FLAGS_INITED))
  {
    err = GetUInt32Column(m_mdb->m_flagsColumnToken, &m_flags);
    m_flags &= ~MSG_FLAG_NEW; // don't get new flag from MDB
    
    if(NS_SUCCEEDED(err))
      m_initedValues |= FLAGS_INITED;
  }
  
  return err;
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 825 of file nsMsgHdr.cpp.

{
  const char *references;
  nsMsgHdr* curHdr = NS_STATIC_CAST(nsMsgHdr*, possibleChild);      // closed system, cast ok
  m_mdb->RowCellColumnToConstCharPtr(curHdr->GetMDBRow(), m_mdb->m_referencesColumnToken, &references);
  if (!references)
    return PR_FALSE;
  nsXPIDLCString messageId;
  
  // should put < > around message id to make strstr strictly match
  GetMessageId(getter_Copies(messageId));
  return (strstr(references, messageId.get()) != nsnull);
}

Here is the call graph for this function:

PRBool nsMsgHdr::IsParentOf ( nsIMsgDBHdr possibleChild)

Definition at line 798 of file nsMsgHdr.cpp.

{
  PRUint16 referenceToCheck = 0;
  possibleChild->GetNumReferences(&referenceToCheck);
  nsCAutoString reference;
  nsXPIDLCString messageId;
  
  GetMessageId(getter_Copies(messageId));
  while (referenceToCheck > 0)
  {
    possibleChild->GetStringReference(referenceToCheck - 1, reference);
    
    if (reference.Equals(messageId))
      return PR_TRUE;
    // if reference didn't match, check if this ref is for a non-existent
    // header. If it is, continue looking at ancestors.
    nsCOMPtr <nsIMsgDBHdr> refHdr;
    if (!m_mdb)
      break;
    (void) m_mdb->GetMsgHdrForMessageID(reference.get(), getter_AddRefs(refHdr));
    if (refHdr)
      break;
    referenceToCheck--;
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMsgDBHdr::markFlagged ( in boolean  flagged) [inherited]
void nsIMsgDBHdr::markHasAttachments ( in boolean  hasAttachments) [inherited]
void nsIMsgDBHdr::markRead ( in boolean  read) [inherited]
unsigned long nsIMsgDBHdr::OrFlags ( in unsigned long  flags) [inherited]

Here is the caller graph for this function:

nsresult nsMsgHdr::ParseReferences ( const char *  references) [protected]

Definition at line 325 of file nsMsgHdr.cpp.

{
       const char *startNextRef = references;
       nsCAutoString resultReference;

       while (startNextRef && *startNextRef)
       {
              startNextRef = GetNextReference(startNextRef, resultReference);
              m_references.AppendCString(resultReference);
       }
  m_numReferences = m_references.Count();
       return NS_OK;
}

Here is the call graph for this function:

void nsIMsgDBHdr::setCCListArray ( in string  names,
in string  addresses,
in unsigned long  numAddresses 
) [inherited]
void nsIMsgDBHdr::setPriorityString ( in string  priority) [inherited]
void nsIMsgDBHdr::setProperty ( in string  propertyName,
in AString  propertyStr 
) [inherited]
void nsIMsgDBHdr::setRecipientsArray ( in string  names,
in string  addresses,
in unsigned long  numAddresses 
) [inherited]
void nsIMsgDBHdr::setReferences ( in string  references) [inherited]
nsresult nsMsgHdr::SetStringColumn ( const char *  str,
mdb_token  token 
) [protected]

Definition at line 747 of file nsMsgHdr.cpp.

Here is the call graph for this function:

void nsIMsgDBHdr::setStringProperty ( in string  propertyName,
in string  propertyValue 
) [inherited]
nsresult nsMsgHdr::SetUInt32Column ( PRUint32  value,
mdb_token  token 
) [protected]

Definition at line 752 of file nsMsgHdr.cpp.

Here is the call graph for this function:

void nsIMsgDBHdr::setUint32Property ( in string  propertyName,
in unsigned long  propertyVal 
) [inherited]

Friends And Related Function Documentation

friend class nsMsgDatabase [friend]

Definition at line 52 of file nsMsgHdr.h.


Member Data Documentation

Definition at line 120 of file nsIMsgHdr.idl.

Definition at line 96 of file nsIMsgHdr.idl.

Definition at line 95 of file nsIMsgHdr.idl.

Definition at line 118 of file nsIMsgHdr.idl.

Definition at line 92 of file nsIMsgHdr.idl.

readonly attribute unsigned long nsIMsgDBHdr::dateInSeconds [inherited]

Definition at line 93 of file nsIMsgHdr.idl.

attribute unsigned long nsIMsgDBHdr::flags [inherited]

Definition at line 76 of file nsIMsgHdr.idl.

Definition at line 121 of file nsIMsgHdr.idl.

Definition at line 65 of file nsIMsgHdr.idl.

readonly attribute boolean nsIMsgDBHdr::isRead [inherited]

Definition at line 64 of file nsIMsgHdr.idl.

Definition at line 119 of file nsIMsgHdr.idl.

attribute unsigned long nsIMsgDBHdr::lineCount [inherited]

Definition at line 87 of file nsIMsgHdr.idl.

PRTime nsMsgHdr::m_date [protected]

Definition at line 83 of file nsMsgHdr.h.

Definition at line 86 of file nsMsgHdr.h.

Definition at line 96 of file nsMsgHdr.h.

Definition at line 94 of file nsMsgHdr.h.

Definition at line 95 of file nsMsgHdr.h.

Definition at line 81 of file nsMsgHdr.h.

Definition at line 84 of file nsMsgHdr.h.

Definition at line 87 of file nsMsgHdr.h.

Definition at line 89 of file nsMsgHdr.h.

nsCStringArray nsMsgHdr::m_references [protected]

Definition at line 88 of file nsMsgHdr.h.

Definition at line 85 of file nsMsgHdr.h.

Definition at line 80 of file nsMsgHdr.h.

Definition at line 82 of file nsMsgHdr.h.

Definition at line 94 of file nsIMsgHdr.idl.

Definition at line 82 of file nsIMsgHdr.idl.

Definition at line 89 of file nsIMsgHdr.idl.

attribute unsigned long nsIMsgDBHdr::messageSize [inherited]

Definition at line 86 of file nsIMsgHdr.idl.

readonly attribute wstring nsIMsgDBHdr::mime2DecodedAuthor [inherited]

Definition at line 110 of file nsIMsgHdr.idl.

readonly attribute wstring nsIMsgDBHdr::mime2DecodedRecipients [inherited]

Definition at line 112 of file nsIMsgHdr.idl.

readonly attribute wstring nsIMsgDBHdr::mime2DecodedSubject [inherited]

Definition at line 111 of file nsIMsgHdr.idl.

readonly attribute unsigned short nsIMsgDBHdr::numReferences [inherited]

Definition at line 102 of file nsIMsgHdr.idl.

Definition at line 90 of file nsIMsgHdr.idl.

Definition at line 72 of file nsIMsgHdr.idl.

Definition at line 98 of file nsIMsgHdr.idl.

Definition at line 88 of file nsIMsgHdr.idl.

Definition at line 97 of file nsIMsgHdr.idl.

Definition at line 81 of file nsIMsgHdr.idl.

Definition at line 83 of file nsIMsgHdr.idl.


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