From 681297e10b666e13cc463f6fbb16236f36c3266c Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Jul 2005 22:28:02 +0000 Subject: Reference counting and smart pointers. --- src/fileAttachment.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/fileAttachment.cpp') diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp index 423020b2..de1a3ba3 100644 --- a/src/fileAttachment.cpp +++ b/src/fileAttachment.cpp @@ -37,7 +37,7 @@ fileAttachment::fileAttachment(const string& filename, const mediaType& type, co setData(filename); - m_encoding = encoding::decide(*m_data); + m_encoding = encoding::decide(m_data); } @@ -64,7 +64,9 @@ void fileAttachment::setData(const string& filename) throw exceptions::open_file_error(); } - m_data = new streamContentHandler(new utility::inputStreamPointerAdapter(file, true), 0, true); + ref is = vmime::create (file, true); + + m_data = vmime::create (is, 0); } @@ -72,13 +74,13 @@ void fileAttachment::generatePart(bodyPart& part) const { defaultAttachment::generatePart(part); - contentDispositionField& cdf = part.getHeader()->ContentDisposition(); + ref cdf = part.getHeader()->ContentDisposition(); - if (m_fileInfo.hasSize()) cdf.setSize(utility::stringUtils::toString(m_fileInfo.getSize())); - if (m_fileInfo.hasFilename()) cdf.setFilename(m_fileInfo.getFilename()); - if (m_fileInfo.hasCreationDate()) cdf.setCreationDate(m_fileInfo.getCreationDate()); - if (m_fileInfo.hasModificationDate()) cdf.setModificationDate(m_fileInfo.getModificationDate()); - if (m_fileInfo.hasReadDate()) cdf.setReadDate(m_fileInfo.getReadDate()); + if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize())); + if (m_fileInfo.hasFilename()) cdf->setFilename(m_fileInfo.getFilename()); + if (m_fileInfo.hasCreationDate()) cdf->setCreationDate(m_fileInfo.getCreationDate()); + if (m_fileInfo.hasModificationDate()) cdf->setModificationDate(m_fileInfo.getModificationDate()); + if (m_fileInfo.hasReadDate()) cdf->setReadDate(m_fileInfo.getReadDate()); } -- cgit v1.2.3