Пример #1
0
QString partNode::contentTypeParameter( const char * name ) const {
  if ( !mDwPart || !mDwPart->hasHeaders() )
    return QString::null;
  DwHeaders & headers = mDwPart->Headers();
  if ( !headers.HasContentType() )
    return QString::null;
  DwString attr = name;
  attr.ConvertToLowerCase();
  for ( DwParameter * param = headers.ContentType().FirstParameter() ; param ; param = param->Next() ) {
    DwString this_attr = param->Attribute();
    this_attr.ConvertToLowerCase(); // what a braindead design!
    if ( this_attr == attr )
      return QString::fromLatin1( param->Value().data(), param->Value().size() );
    // warning: misses rfc2231 handling!
  }
  return QString::null;
}
Пример #2
0
const DwString &DwDispositionType::Filename() const
{
    DwParameter *param = mFirstParameter;
    while(param)
    {
        if(DwStrcasecmp(param->Attribute(), "filename") == 0)
        {
            // Filename parameter found. Return its value.
            // Implementation note: this member function is const, which
            // forbids us from assigning to mFilenameStr.  The following
            // trick gets around this.  (ANSI implementations could use the
            // "mutable" declaration).
            DwDispositionType *_this = (DwDispositionType *) this;
            _this->mFilenameStr = param->Value();
            break;
        }
        param = param->Next();
    }
    return mFilenameStr;
}
Пример #3
0
static bool messageIsDispositionNotificationReport(KMMessage *msg)
{
    if(msg->type() == DwMime::kTypeMessage &&
            msg->subtype() == DwMime::kSubtypeDispositionNotification)
        return true;

    if(msg->type() != DwMime::kTypeMultipart ||
            msg->subtype() != DwMime::kSubtypeReport)
        return false;

    DwMediaType &ct = msg->dwContentType();
    DwParameter *param = ct.FirstParameter();
    while(param)
    {
        if(!qstricmp(param->Attribute().c_str(), "report-type")
                && !qstricmp(param->Value().c_str(), "disposition-notification"))
            return true;
        else
            param = param->Next();
    }
    return false;
}