|
|
@ -16,6 +16,7 @@ namespace qi = boost::spirit::qi; |
|
|
|
std::string type; |
|
|
|
std::string subtype; |
|
|
|
std::vector<pEpMIME::NameValue> params; |
|
|
|
void tolower(); // only for ASCII chars, but that's sufficient here.
|
|
|
|
}; |
|
|
|
|
|
|
|
BOOST_FUSION_ADAPT_STRUCT( |
|
|
@ -34,6 +35,23 @@ BOOST_FUSION_ADAPT_STRUCT( |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
void ascii_tolower(std::string& s) |
|
|
|
{ |
|
|
|
for(char& c : s) |
|
|
|
{ |
|
|
|
if(c>='A' && c<='Z') |
|
|
|
{ |
|
|
|
c += 32; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void ContentType::tolower() |
|
|
|
{ |
|
|
|
ascii_tolower(type); |
|
|
|
ascii_tolower(subtype); |
|
|
|
} |
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream& o, const ContentType& ct) |
|
|
|
{ |
|
|
|
return o << "CT:{" << ct.type << "/" << ct.subtype << ". params=" << ct.params << " } "; |
|
|
@ -101,6 +119,7 @@ void parse_body(message* msg, const HeaderSection& headers, const std::deque<sv> |
|
|
|
{ |
|
|
|
throw std::runtime_error( "Cannot parse \"" + std::string{cts} + "\" as ContentType"); |
|
|
|
} |
|
|
|
ct.tolower(); |
|
|
|
std::cerr << ct << std::endl; |
|
|
|
|
|
|
|
}else{ // Non-MIME mail
|
|
|
|