root/tlate/field_value.cc

Revision e7bbf3c6b857df8ad33c4d39396d693b48a48461, 1.5 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 21 months ago)

Add support for message/rfc822

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
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 "field_value.hh"
21#include "../msg/lexutils.hh"
22#include "../html/util.hh"
23#include "string_value.hh"
24
25namespace tlate
26{
27        value::const_ptr field_value::get(std::string var) const
28        {
29                size_t col = fld.find(':');
30                value::ptr rv;
31                /**/ if (var == "name")
32                        rv.reset(new string_value
33                                 (html::quote(fld.substr(0,col), false)));
34                else if (var == "body")
35                {
36                        std::string s = fld.substr(col+1);
37                        s = msg::decode_unstructured(s);
38                        rv.reset(new string_value(html::quote(s, munge)));
39                }
40                return rv;
41        }
42}
Note: See TracBrowser for help on using the browser.