Back to index

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

#include <nsIMAPBodyShell.h>

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

List of all members.

Public Member Functions

virtual PRBool GetIsValid ()
virtual void SetIsValid (PRBool valid)
virtual nsIMAPBodypartType GetType ()=0
virtual PRInt32 Generate (nsIMAPBodyShell *aShell, PRBool, PRBool)
virtual void AdoptPartDataBuffer (char *buf)
virtual void AdoptHeaderDataBuffer (char *buf)
virtual PRBool ShouldFetchInline (nsIMAPBodyShell *aShell)
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 ~nsIMAPBodypart ()
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)
 nsIMAPBodypart (char *partNumber, nsIMAPBodypart *parentPart)

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 61 of file nsIMAPBodyShell.h.


Constructor & Destructor Documentation

nsIMAPBodypart::nsIMAPBodypart ( char *  partNumber,
nsIMAPBodypart parentPart 
) [protected]

Definition at line 341 of file nsIMAPBodyShell.cpp.

{
  SetIsValid(PR_TRUE);
  m_parentPart = parentPart;
  m_partNumberString = partNumber; // storage adopted
  m_partData = NULL;
  m_headerData = NULL;
  m_boundaryData = NULL;    // initialize from parsed BODYSTRUCTURE
  m_contentLength = 0;
  m_partLength = 0;
  
  m_contentType = NULL;
  m_bodyType = NULL;
  m_bodySubType = NULL;
  m_bodyID = NULL;
  m_bodyDescription = NULL;
  m_bodyEncoding = NULL;
}

Here is the call graph for this function:


Member Function Documentation

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

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]

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]

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:

virtual PRInt32 nsIMAPBodypart::Generate ( nsIMAPBodyShell aShell,
PRBool  ,
PRBool   
) [inline, virtual]

Reimplemented in nsIMAPBodypartMessage, nsIMAPBodypartLeaf, nsIMAPBodypartMultipart, and nsIMAPMessageHeaders.

Definition at line 71 of file nsIMAPBodyShell.h.

{ return -1; }

Here is the caller graph for this function:

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

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]

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]

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]

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:

Definition at line 110 of file nsIMAPBodyShell.h.

{ return m_bodySubType; }

Here is the caller graph for this function:

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

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]

Definition at line 65 of file nsIMAPBodyShell.h.

{ return m_isValid; }

Here is the caller graph for this function:

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]

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]

Definition at line 96 of file nsIMAPBodyShell.h.

{ return m_partNumberString; }

Here is the caller graph for this function:

virtual nsIMAPBodypartType nsIMAPBodypart::GetType ( ) [pure virtual]

Implemented in nsIMAPBodypartMessage, nsIMAPBodypartLeaf, nsIMAPBodypartMultipart, and nsIMAPMessageHeaders.

Here is the caller graph for this function:

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

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]

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:

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

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]

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]

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:

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

Reimplemented in nsIMAPBodypartMessage, nsIMAPBodypartLeaf, nsIMAPBodypartMultipart, and nsIMAPMessageHeaders.

Definition at line 74 of file nsIMAPBodyShell.h.

{ return PR_TRUE; }  // returns PR_TRUE if this part should be fetched inline for generation.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 133 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodyEncoding [protected]

Definition at line 134 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodyID [protected]

Definition at line 132 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodySubType [protected]

Definition at line 131 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_bodyType [protected]

Definition at line 130 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_boundaryData [protected]

Definition at line 123 of file nsIMAPBodyShell.h.

Definition at line 125 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_contentType [protected]

Definition at line 129 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_headerData [protected]

Definition at line 122 of file nsIMAPBodyShell.h.

Definition at line 119 of file nsIMAPBodyShell.h.

Definition at line 126 of file nsIMAPBodyShell.h.

char* nsIMAPBodypart::m_partData [protected]

Definition at line 121 of file nsIMAPBodyShell.h.

Definition at line 124 of file nsIMAPBodyShell.h.

Definition at line 120 of file nsIMAPBodyShell.h.


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