diff options
author | randomdan <randomdan@localhost> | 2012-01-06 02:13:02 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2012-01-06 02:13:02 +0000 |
commit | f91a04ce83f6bfa6232e7a493a327512b5cd250a (patch) | |
tree | f9bc14a67f173fa11a219ba412fdab9aa3e67738 | |
parent | Address memory leaks that have snook in over time (diff) | |
download | project2-f91a04ce83f6bfa6232e7a493a327512b5cd250a.tar.bz2 project2-f91a04ce83f6bfa6232e7a493a327512b5cd250a.tar.xz project2-f91a04ce83f6bfa6232e7a493a327512b5cd250a.zip |
Fix missing email message content
Reimplement ordering of email content parts with support from WritableContent classes
-rw-r--r-- | project2/common/transform.h | 6 | ||||
-rw-r--r-- | project2/json/presenter.cpp | 3 | ||||
-rw-r--r-- | project2/mail/sendmailTask.cpp | 5 | ||||
-rw-r--r-- | project2/xml/transformHtml.cpp | 5 | ||||
-rw-r--r-- | project2/xml/transformHtml.h | 1 | ||||
-rw-r--r-- | project2/xml/transformText.cpp | 4 | ||||
-rw-r--r-- | project2/xml/transformText.h | 1 | ||||
-rw-r--r-- | project2/xml/xmlPresenter.cpp | 5 | ||||
-rw-r--r-- | project2/xml/xmlPresenter.h | 1 |
9 files changed, 29 insertions, 2 deletions
diff --git a/project2/common/transform.h b/project2/common/transform.h index 4e80476..a9dde49 100644 --- a/project2/common/transform.h +++ b/project2/common/transform.h @@ -88,6 +88,12 @@ class TransformImpl : public Transform { class WritableContent { public: + enum Class { + ClassPlain = 1, + ClassPretty = 2, + ClassData = 3 + }; + virtual Class getContentClass() const = 0; virtual Glib::ustring getContentType() const = 0; virtual void writeTo(std::ostream &, const std::string & encoding) const = 0; }; diff --git a/project2/json/presenter.cpp b/project2/json/presenter.cpp index 6500ea1..f50c322 100644 --- a/project2/json/presenter.cpp +++ b/project2/json/presenter.cpp @@ -53,6 +53,9 @@ class JsonPresenter : public MultiRowSetPresenter, public ContentPresenter, publ Glib::ustring getContentType() const { return contentType; } + Class getContentClass() const { + return ClassData; + } void writeTo(std::ostream & o, const std::string & encoding) const { serializeObject(object, o, encoding); } diff --git a/project2/mail/sendmailTask.cpp b/project2/mail/sendmailTask.cpp index d3ee53a..f8bc879 100644 --- a/project2/mail/sendmailTask.cpp +++ b/project2/mail/sendmailTask.cpp @@ -158,10 +158,10 @@ class TransformWritableContentToEmail : public TransformImpl<WritableContent, Se } void transform(const WritableContent * wc, SendMailTask::Parts * parts) const { - parts->parts.insert(new BoundaryBegin(wc->getContentType(), encoding, 1)); + parts->parts.insert(new BoundaryBegin(wc->getContentType(), encoding, wc->getContentClass())); std::stringstream str; wc->writeTo(str, encoding); - parts->parts.insert(new MimeContent(str.str(), 1)); + parts->parts.insert(new MimeContent(str.str(), wc->getContentClass())); SendMailTask::MailPart::mimeIdx += 1; } void configure(ScriptNodePtr s) @@ -176,6 +176,7 @@ DECLARE_TRANSFORM(TransformWritableContentToEmail); class EmailViewHost : public ViewHost { public: EmailViewHost(boost::intrusive_ptr<SendMailTask::Parts> & ps, ScriptNodePtr node) : + CommonObjects(node), CheckHost(node), ViewHost(node), parts(ps), diff --git a/project2/xml/transformHtml.cpp b/project2/xml/transformHtml.cpp index 8cc9202..e280f27 100644 --- a/project2/xml/transformHtml.cpp +++ b/project2/xml/transformHtml.cpp @@ -40,6 +40,11 @@ HtmlDocument::getContentType() const return contentType(); } +WritableContent::Class +HtmlDocument::getContentClass() const { + return ClassPretty; +} + class TransformXmlToHtml : public TransformImpl<xmlpp::Document, HtmlDocument> { public: void transform(const xmlpp::Document * cdata, HtmlDocument * result) const diff --git a/project2/xml/transformHtml.h b/project2/xml/transformHtml.h index 3ea10fd..b8d4207 100644 --- a/project2/xml/transformHtml.h +++ b/project2/xml/transformHtml.h @@ -10,6 +10,7 @@ class HtmlDocument : public SourceOf<HtmlDocument>, public WritableContent, publ htmlDocPtr doc; operator const HtmlDocument * () const; operator const WritableContent * () const; + Class getContentClass() const; Glib::ustring getContentType() const; void writeTo(std::ostream &, const std::string & encoding) const; Variable contentType; diff --git a/project2/xml/transformText.cpp b/project2/xml/transformText.cpp index b9b5e56..2002734 100644 --- a/project2/xml/transformText.cpp +++ b/project2/xml/transformText.cpp @@ -29,6 +29,10 @@ TextDocument::getContentType() const return contentType(); } +WritableContent::Class +TextDocument::getContentClass() const { + return ClassPlain; +} class TransformHtmlToText : public TransformImpl<HtmlDocument, TextDocument> { public: diff --git a/project2/xml/transformText.h b/project2/xml/transformText.h index 7fd1e8f..f1fcaaf 100644 --- a/project2/xml/transformText.h +++ b/project2/xml/transformText.h @@ -10,6 +10,7 @@ class TextDocument : public SourceOf<TextDocument>, public WritableContent, publ Glib::ustring doc; operator const TextDocument * () const; operator const WritableContent * () const; + Class getContentClass() const; Glib::ustring getContentType() const; void writeTo(std::ostream &, const std::string & encoding) const; Variable contentType; diff --git a/project2/xml/xmlPresenter.cpp b/project2/xml/xmlPresenter.cpp index 91d43aa..bde649d 100644 --- a/project2/xml/xmlPresenter.cpp +++ b/project2/xml/xmlPresenter.cpp @@ -151,6 +151,11 @@ XmlPresenter::getContentType() const { return contentType; } +WritableContent::Class +XmlPresenter::getContentClass() const { + return ClassData; +} + void XmlPresenter::writeTo(std::ostream & o, const std::string & enc) const { responseDoc->write_to_stream_formatted(o, enc); diff --git a/project2/xml/xmlPresenter.h b/project2/xml/xmlPresenter.h index eacc793..a7fbb11 100644 --- a/project2/xml/xmlPresenter.h +++ b/project2/xml/xmlPresenter.h @@ -28,6 +28,7 @@ class XmlPresenter : public Presenter, public ContentPresenter, public SourceOf< operator const xmlDoc * () const; operator const boost::shared_ptr<xmlpp::Document> * () const; operator const WritableContent * () const; + Class getContentClass() const; Glib::ustring getContentType() const; void writeTo(std::ostream &, const std::string & enc) const; |