Back to index

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

#include <nsIMAPBodyShell.h>

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

List of all members.

Public Member Functions

 nsIMAPMessageHeaders (char *partNum, nsIMAPBodypart *parentPart)
virtual nsIMAPBodypartType GetType ()
virtual PRInt32 Generate (nsIMAPBodyShell *aShell, PRBool stream, PRBool prefetch)
virtual PRBool ShouldFetchInline (nsIMAPBodyShell *aShell)
virtual void QueuePrefetchMessageHeaders (nsIMAPBodyShell *aShell)
virtual PRBool GetIsValid ()
virtual void SetIsValid (PRBool valid)
virtual void AdoptPartDataBuffer (char *buf)
virtual void AdoptHeaderDataBuffer (char *buf)
virtual PRBool PreflightCheckAllInline (nsIMAPBodyShell *aShell)
virtual PRBool ShouldExplicitlyFetchInline ()
virtual PRBool ShouldExplicitlyNotFetchInline ()
virtual PRBool IsLastTextPart (const char *partNumberString)
virtual char * GetPartNumberString ()
virtual nsIMAPBodypartFindPartWithNumber (const char *partNum)
virtual nsIMAPBodypartGetParentPart ()
virtual nsIMAPBodypartMessageGetnsIMAPBodypartMessage ()
const char * GetBodyType ()
const char * GetBodySubType ()
void SetBoundaryData (char *boundaryData)

Protected Member Functions

virtual PRInt32 GeneratePart (nsIMAPBodyShell *aShell, PRBool stream, PRBool prefetch)
virtual PRInt32 GenerateMIMEHeader (nsIMAPBodyShell *aShell, PRBool stream, PRBool prefetch)
virtual PRInt32 GenerateBoundary (nsIMAPBodyShell *aShell, PRBool stream, PRBool prefetch, PRBool lastBoundary)
virtual PRInt32 GenerateEmptyFilling (nsIMAPBodyShell *aShell, PRBool stream, PRBool prefetch)
virtual void QueuePrefetchMIMEHeader (nsIMAPBodyShell *aShell)

Protected Attributes

PRBool m_isValid
char * m_partNumberString
char * m_partData
char * m_headerData
char * m_boundaryData
PRInt32 m_partLength
PRInt32 m_contentLength
nsIMAPBodypartm_parentPart
char * m_contentType
char * m_bodyType
char * m_bodySubType
char * m_bodyID
char * m_bodyDescription
char * m_bodyEncoding

Detailed Description

Definition at line 144 of file nsIMAPBodyShell.h.


Constructor & Destructor Documentation

nsIMAPMessageHeaders::nsIMAPMessageHeaders ( char *  partNum,
nsIMAPBodypart parentPart 
)

Definition at line 1143 of file nsIMAPBodyShell.cpp.

                                                                                    : 
nsIMAPBodypart(partNum, parentPart)
{
  if (!partNum)
  {
    SetIsValid(PR_FALSE);
    return;
  }
  m_partNumberString = nsCRT::strdup(partNum);
  if (!m_partNumberString)
  {
    SetIsValid(PR_FALSE);
    return;
  }
  if (!m_parentPart || !m_parentPart->GetnsIMAPBodypartMessage())
  {
    // Message headers created without a valid Message parent
    NS_ASSERTION(PR_FALSE, "creating message headers with invalid message parent");
    SetIsValid(PR_FALSE);
  }
}

Here is the call graph for this function:


Member Function Documentation

void nsIMAPBodypart::AdoptHeaderDataBuffer ( char *  buf) [virtual, inherited]

Definition at line 394 of file nsIMAPBodyShell.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMAPBodypart::AdoptPartDataBuffer ( char *  buf) [virtual, inherited]

Definition at line 384 of file nsIMAPBodyShell.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsIMAPBodypart * nsIMAPBodypart::FindPartWithNumber ( const char *  partNum) [virtual, inherited]

Reimplemented in nsIMAPBodypartMessage, and nsIMAPBodypartMultipart.

Definition at line 406 of file nsIMAPBodyShell.cpp.

{
  // either brute force, or do it the smart way - look at the number.
  // (the parts should be ordered, and hopefully indexed by their number)
  
  if (m_partNumberString && !PL_strcasecmp(partNum, m_partNumberString))
    return this;
  
  //if (!m_partNumberString && !PL_strcasecmp(partNum, "1"))
  //   return this;
  
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsIMAPMessageHeaders::Generate ( nsIMAPBodyShell aShell,
PRBool  stream,
PRBool  prefetch 
) [virtual]

Reimplemented from nsIMAPBodypart.

Definition at line 1179 of file nsIMAPBodyShell.cpp.

{
  // prefetch the header
  if (prefetch && !m_partData && !aShell->DeathSignalReceived())
  {
    QueuePrefetchMessageHeaders(aShell);
  }
  
  if (stream && !prefetch)
    aShell->GetConnection()->Log("SHELL","GENERATE-MessageHeaders",m_partNumberString);
  
  // stream out the part data
  if (ShouldFetchInline(aShell))
  {
    if (!aShell->GetPseudoInterrupted())
      m_contentLength = GeneratePart(aShell, stream, prefetch);
  }
  else
  {
    m_contentLength = 0;    // don't fill in any filling for the headers
  }
  return m_contentLength;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsIMAPBodypart::GenerateBoundary ( nsIMAPBodyShell aShell,
PRBool  stream,
PRBool  prefetch,
PRBool  lastBoundary 
) [protected, virtual, inherited]

Definition at line 511 of file nsIMAPBodyShell.cpp.

{
  if (prefetch)
    return 0; // don't need to prefetch anything
  
  if (m_boundaryData)
  {
    if (!lastBoundary)
    {
      if (stream)
      {
        aShell->GetConnection()->Log("SHELL","GENERATE-Boundary",m_partNumberString);
        aShell->GetConnection()->HandleMessageDownLoadLine(m_boundaryData, PR_FALSE);
      }
      return PL_strlen(m_boundaryData);
    }
    else      // the last boundary
    {
      char *lastBoundaryData = PR_smprintf("%s--", m_boundaryData);
      if (lastBoundaryData)
      {
        if (stream)
        {
          aShell->GetConnection()->Log("SHELL","GENERATE-Boundary-Last",m_partNumberString);
          aShell->GetConnection()->HandleMessageDownLoadLine(lastBoundaryData, PR_FALSE);
        }
        PRInt32 rv = PL_strlen(lastBoundaryData);
        PR_Free(lastBoundaryData);
        return rv;
      }
      else
      {
        //HandleMemoryFailure();
        return 0;
      }
    }
  }
  else
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsIMAPBodypart::GenerateEmptyFilling ( nsIMAPBodyShell aShell,
PRBool  stream,
PRBool  prefetch 
) [protected, virtual, inherited]

Definition at line 552 of file nsIMAPBodyShell.cpp.

{
  if (prefetch)
    return 0; // don't need to prefetch anything
  
  const char emptyString[] = "This body part will be downloaded on demand.";
  // XP_GetString(MK_IMAP_EMPTY_MIME_PART);  ### need to be able to localize
  if (emptyString)
  {
    if (stream)
    {
      aShell->GetConnection()->Log("SHELL","GENERATE-Filling",m_partNumberString);
      aShell->GetConnection()->HandleMessageDownLoadLine(emptyString, PR_FALSE);
    }
    return PL_strlen(emptyString);
  }
  else
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsIMAPBodypart::GenerateMIMEHeader ( nsIMAPBodyShell aShell,
PRBool  stream,
PRBool  prefetch 
) [protected, virtual, inherited]

Definition at line 440 of file nsIMAPBodyShell.cpp.

{
  if (prefetch && !m_headerData)
  {
    QueuePrefetchMIMEHeader(aShell);
    return 0;
  }
  else if (m_headerData)
  {
    PRInt32 mimeHeaderLength = 0;
    
    if (!ShouldFetchInline(aShell))
    {
      // if this part isn't inline, add the X-Mozilla-IMAP-Part header
      char *xPartHeader = PR_smprintf("%s: %s", IMAP_EXTERNAL_CONTENT_HEADER, m_partNumberString);
      if (xPartHeader)
      {
        if (stream)
        {
          aShell->GetConnection()->Log("SHELL","GENERATE-XHeader",m_partNumberString);
          aShell->GetConnection()->HandleMessageDownLoadLine(xPartHeader, PR_FALSE);
        }
        mimeHeaderLength += PL_strlen(xPartHeader);
        PR_Free(xPartHeader);
      }
    }
    
    mimeHeaderLength += PL_strlen(m_headerData);
    if (stream)
    {
      aShell->GetConnection()->Log("SHELL","GENERATE-MIMEHeader",m_partNumberString);
      aShell->GetConnection()->HandleMessageDownLoadLine(m_headerData, PR_FALSE);  // all one line?  Can we do that?
    }
    
    return mimeHeaderLength;
  }
  else 
  {
    SetIsValid(PR_FALSE);   // prefetch didn't adopt a MIME header
    return 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsIMAPBodypart::GeneratePart ( nsIMAPBodyShell aShell,
PRBool  stream,
PRBool  prefetch 
) [protected, virtual, inherited]

Definition at line 483 of file nsIMAPBodyShell.cpp.

{
  if (prefetch)
    return 0; // don't need to prefetch anything
  
  if (m_partData)    // we have prefetched the part data
  {
    if (stream)
    {
      aShell->GetConnection()->Log("SHELL","GENERATE-Part-Prefetched",m_partNumberString);
      aShell->GetConnection()->HandleMessageDownLoadLine(m_partData, PR_FALSE);
    }
    return PL_strlen(m_partData);
  }
  else // we are fetching and streaming this part's body as we go
  {
    if (stream && !aShell->DeathSignalReceived())
    {
      char *generatingPart = aShell->GetGeneratingPart();
      PRBool fetchingSpecificPart = (generatingPart && !PL_strcmp(generatingPart, m_partNumberString));
      
      aShell->GetConnection()->Log("SHELL","GENERATE-Part-Inline",m_partNumberString);
      aShell->GetConnection()->FetchTryChunking(aShell->GetUID().get(), kMIMEPart, PR_TRUE, m_partNumberString, m_partLength, !fetchingSpecificPart);
    }
    return m_partLength;    // the part length has been filled in from the BODYSTRUCTURE response
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* nsIMAPBodypart::GetBodySubType ( ) [inline, inherited]

Definition at line 110 of file nsIMAPBodyShell.h.

{ return m_bodySubType; }

Here is the caller graph for this function:

const char* nsIMAPBodypart::GetBodyType ( ) [inline, inherited]

Definition at line 109 of file nsIMAPBodyShell.h.

{ return m_bodyType; }

Here is the caller graph for this function:

virtual PRBool nsIMAPBodypart::GetIsValid ( ) [inline, virtual, inherited]

Definition at line 65 of file nsIMAPBodyShell.h.

{ return m_isValid; }

Here is the caller graph for this function:

virtual nsIMAPBodypartMessage* nsIMAPBodypart::GetnsIMAPBodypartMessage ( ) [inline, virtual, inherited]

Reimplemented in nsIMAPBodypartMessage.

Definition at line 107 of file nsIMAPBodyShell.h.

{ return NULL; }

Here is the caller graph for this function:

virtual nsIMAPBodypart* nsIMAPBodypart::GetParentPart ( ) [inline, virtual, inherited]

Definition at line 98 of file nsIMAPBodyShell.h.

{ return m_parentPart; }    // Returns the parent of this part.

Here is the caller graph for this function:

virtual char* nsIMAPBodypart::GetPartNumberString ( ) [inline, virtual, inherited]

Definition at line 96 of file nsIMAPBodyShell.h.

{ return m_partNumberString; }

Here is the caller graph for this function:

Implements nsIMAPBodypart.

Definition at line 1165 of file nsIMAPBodyShell.cpp.

virtual PRBool nsIMAPBodypart::IsLastTextPart ( const char *  partNumberString) [inline, virtual, inherited]

Reimplemented in nsIMAPBodypartMultipart.

Definition at line 79 of file nsIMAPBodyShell.h.

{return PR_TRUE;}

Here is the caller graph for this function:

virtual PRBool nsIMAPBodypart::PreflightCheckAllInline ( nsIMAPBodyShell aShell) [inline, virtual, inherited]

Reimplemented in nsIMAPBodypartMessage, nsIMAPBodypartLeaf, and nsIMAPBodypartMultipart.

Definition at line 75 of file nsIMAPBodyShell.h.

{ return PR_TRUE; }

Here is the caller graph for this function:

Definition at line 1170 of file nsIMAPBodyShell.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMAPBodypart::QueuePrefetchMIMEHeader ( nsIMAPBodyShell aShell) [protected, virtual, inherited]

Definition at line 435 of file nsIMAPBodyShell.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIMAPBodypart::SetBoundaryData ( char *  boundaryData) [inline, inherited]

Definition at line 111 of file nsIMAPBodyShell.h.

{ m_boundaryData = boundaryData; }

Here is the caller graph for this function:

void nsIMAPBodypart::SetIsValid ( PRBool  valid) [virtual, inherited]

Definition at line 374 of file nsIMAPBodyShell.cpp.

{
  m_isValid = valid;
  if (!m_isValid)
  {
    //PR_LOG(IMAP, out, ("BODYSHELL: Part is invalid.  Part Number: %s Content-Type: %s", m_partNumberString, m_contentType));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 575 of file nsIMAPBodyShell.cpp.

{
        return PR_FALSE;
}

Here is the caller graph for this function:

Definition at line 583 of file nsIMAPBodyShell.cpp.

{
  return PR_FALSE;
}

Here is the caller graph for this function:

Reimplemented from nsIMAPBodypart.

Definition at line 1203 of file nsIMAPBodyShell.cpp.

{
  return m_parentPart->ShouldFetchInline(aShell);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

char* nsIMAPBodypart::m_bodyDescription [protected, inherited]

Definition at line 133 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodyEncoding [protected, inherited]

Definition at line 134 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodyID [protected, inherited]

Definition at line 132 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodySubType [protected, inherited]

Definition at line 131 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodyType [protected, inherited]

Definition at line 130 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_boundaryData [protected, inherited]

Definition at line 123 of file nsIMAPBodyShell.h.

PRInt32 nsIMAPBodypart::m_contentLength [protected, inherited]

Definition at line 125 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_contentType [protected, inherited]

Definition at line 129 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_headerData [protected, inherited]

Definition at line 122 of file nsIMAPBodyShell.h.

PRBool nsIMAPBodypart::m_isValid [protected, inherited]

Definition at line 119 of file nsIMAPBodyShell.h.

Definition at line 126 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_partData [protected, inherited]

Definition at line 121 of file nsIMAPBodyShell.h.

PRInt32 nsIMAPBodypart::m_partLength [protected, inherited]

Definition at line 124 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_partNumberString [protected, inherited]

Definition at line 120 of file nsIMAPBodyShell.h.


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