Exemplo n.º 1
0
PMsgPart CInetMessageT::GetTextPart()
{
  MakeParts();

  LPCSTR ContentType = GetKludge( K_RFC_ContentType );
  if ( FarSF::LStrnicmp( ContentType, "multipart", 9 ) == 0 )
  {
    PMsgPart TextPart = NULL;
    PMsgPart NextPart = m_Part;
    while ( NextPart = GetNextPart( NextPart ) )
    {
      ContentType = NextPart->GetKludge( K_RFC_ContentType );
      if ( FarSF::LStrnicmp( ContentType, "text", 4 ) == 0 )
      {
        if ( FarSF::LStrnicmp( ContentType + 5, "plain", 5 ) == 0 )
          return NextPart;
        TextPart = NextPart;
      }
    }
    if ( TextPart )
      return TextPart;
  }

  ContentType = GetKludge( K_RFC_ContentType );
  if ( *ContentType == '\0' || FarSF::LStrnicmp( ContentType, "text", 4 ) == 0 )
    return m_Part;

  return NULL;
}
Exemplo n.º 2
0
int CValueLengthPart::GetNextPart(std::string &nextpart, bool isstring)
{
	char *part;
	size_t length;

	int res = GetNextPart((void **)&part, &length);
	if (res) {
		if (isstring && length > 0 && part[length - 1] == 0) {
			length--;
		}
		nextpart = std::string(part, length);
		free(part);
	}
	return res;
}
Exemplo n.º 3
0
/**
Checks whether this is a STATUS response.
If it is, then it starts buiding an atom tree.  
If the tree is completed then the data is parsed straight away.  Otherwise, more data is requested.
If the atom tree is completed by this line, then tree is parsed to decode the response.
@return ENotRecognised if this is not a STATUS response
		EResponseIncomplete if this is a STATUS resposne, but more data is required.
		ECompleteUntagged if this is a STATUS response that has been fully parsed.
*/
CImapCommand::TParseBlockResult CImapStatus::ParseUntaggedResponseL()
	{
	TParseBlockResult result = ENotRecognised;
	
	TPtrC8 response = GetNextPart();
	if(response.CompareF(KImapTxtStatus) == 0)
		{
		TPtrC8 remainingData = Remainder();
   		TBool wantMoreData = iAtomParser->ProcessLineL(remainingData);
   		if (wantMoreData)
   			{
   			result = EResponseIncomplete;
   			}
   		else
   			{
   			ParseStatusResponseL();
   			result = ECompleteUntagged;
   			}
		}
	
	return result;
	}