root/msg/message_entity.cc
| Revision 99057e4d73dbb905f06f5ccc4ea49708b8aaa0a8, 2.2 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 20 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* This file is part of Alue, the multiprotocol Internet discussion daemon |
| 2 | |
| 3 | Copyright © 2010 Antti-Juhani Kaijanaho |
| 4 | |
| 5 | Alue is free software: you can redistribute it and/or modify it |
| 6 | under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | Alue is distributed in the hope that it will be useful, but |
| 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with Alue. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | #include "lexutils.hh" |
| 21 | #include "message_entity.hh" |
| 22 | #include "util.hh" |
| 23 | #include "../html/util.hh" |
| 24 | #include "../tlate/data_model.hh" |
| 25 | #include "../tlate/date_value.hh" |
| 26 | #include "../tlate/header_value.hh" |
| 27 | |
| 28 | namespace msg |
| 29 | { |
| 30 | |
| 31 | boost::shared_ptr<tlate::value> |
| 32 | message_entity::get_tlate_value(bool munge) const |
| 33 | { |
| 34 | using html::quote; |
| 35 | tlate::data_model::ptr am(new tlate::data_model); |
| 36 | am->insert("message"); |
| 37 | am->insert("header", new tlate::header_value(m, munge)); |
| 38 | am->insert("from", |
| 39 | quote(decode_unstructured(m->get_field("From", |
| 40 | false)), |
| 41 | munge)); |
| 42 | am->insert("to", |
| 43 | quote(decode_unstructured(m->get_field("To", |
| 44 | false)), |
| 45 | munge)); |
| 46 | am->insert("subject", |
| 47 | quote(decode_unstructured(m->get_field("Subject", |
| 48 | false)), |
| 49 | munge)); |
| 50 | am->insert("date", |
| 51 | new tlate::date_value |
| 52 | (parse_date(m->get_field("Date", false)))); |
| 53 | am->insert("body", m->get_tlate_value(munge)); |
| 54 | return am; |
| 55 | } |
| 56 | |
| 57 | } |
Note: See TracBrowser
for help on using the browser.
