void DwDispositionType::_PrintDebugInfo(std::ostream &aStrm) const { DwFieldBody::_PrintDebugInfo(aStrm); aStrm << "Disposition Type: " << mDispositionTypeStr << " (" << mDispositionType << ")\n"; aStrm << "Filename: " << mFilenameStr << "\n"; aStrm << "Parameters: "; DwParameter *param = mFirstParameter; if(param) { int count = 0; while(param) { if(count) aStrm << ' '; aStrm << param->ObjectId(); param = param->Next(); ++count; } aStrm << '\n'; } else { aStrm << "(none)\n"; } }
void DwDispositionType::CopyParameterList(DwParameter *aFirst) { DwParameter *param = aFirst; while(param) { DwParameter *newParam = (DwParameter *) param->Clone(); AddParameter(newParam); param = param->Next(); } }
void DwDispositionType::DeleteParameterList() { DwParameter *param = mFirstParameter; while(param) { DwParameter *nextParam = param->Next(); delete param; param = nextParam; } mFirstParameter = 0; SetModified(); }
void DwDispositionType::_AddParameter(DwParameter *aParam) { if(!mFirstParameter) { mFirstParameter = aParam; } else { DwParameter *cur = mFirstParameter; if(cur) { DwParameter *next = cur->Next(); while(next) { cur = next; next = cur->Next(); } cur->SetNext(aParam); } } aParam->SetParent(this); }
void DwDispositionType::CheckInvariants() const { #if defined(DW_DEBUG_VERSION) mDispositionTypeStr.CheckInvariants(); mFilenameStr.CheckInvariants(); DwParameter *param = mFirstParameter; while(param) { param->CheckInvariants(); assert((DwMessageComponent *) this == param->Parent()); param = param->Next(); } #endif // defined(DW_DEBUG_VERSION) }
void DwDispositionType::PrintDebugInfo(std::ostream &aStrm, int aDepth) const { aStrm << "------------ Debug info for DwDispositionType class ------------\n"; _PrintDebugInfo(aStrm); int depth = aDepth - 1; depth = (depth >= 0) ? depth : 0; if(aDepth == 0 || depth > 0) { DwParameter *param = mFirstParameter; while(param) { param->PrintDebugInfo(aStrm, depth); param = param->Next(); } } }
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; }
void DwDispositionType::SetFilename(const DwString &aStr) { mFilenameStr = aStr; // Search for filename parameter in parameter list. If found, set its // value. DwParameter *param = mFirstParameter; while(param) { if(DwStrcasecmp(param->Attribute(), "filename") == 0) { param->SetValue(mFilenameStr); return; } param = param->Next(); } // Boundary parameter not found. Add it. param = DwParameter::NewParameter("", 0); param->SetAttribute("Filename"); param->SetValue(aStr); AddParameter(param); }
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; }
void DwDispositionType::Assemble() { if(!mIsModified) return; mString = ""; if(mDispositionTypeStr.length() == 0) return; mString += mDispositionTypeStr; DwParameter *param = FirstParameter(); while(param) { param->Assemble(); if(IsFolding()) { mString += ";" DW_EOL " "; } else { mString += "; "; } mString += param->AsString(); param = param->Next(); } mIsModified = 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; }