Continued development...

This commit is contained in:
Brad Arant committed 2019-08-02 15:43:31 -07:00
1 parent c957bbbb6f
commit 50f6e972de
24 files changed
+243 -40

No files matched your search

+16 -6
View File
@@ -1,6 +1,7 @@
#include "IMFMessage.h"
#include "IMFHeader.h"
#include "IMFMultipart.h"
#include "IMFPlainText.h"
namespace coreutils {
@@ -16,9 +17,14 @@ namespace coreutils {
std::string type = getHeader("Content-Type");
if(type.size() == 0)
type = "text/plain";
if(type == "multipart/form-data")
body = new IMFMultipart(in, getHeaderKeyPairValue("Content-Type", "boundary"));
else
else if(type == "text/plain")
body = new IMFPlainText(in);
else
body = new IMFBody();
}
@@ -39,8 +45,8 @@ namespace coreutils {
if(header.getKey() == key) {
std::string value = header.getValue();
if(valueOnly) {
std::vector<std::string> split = PString(value).split(";");
value = split[0];
std::vector<PString> split = PString(value).split(";");
value = split[0].str();
}
return value;
}
@@ -50,9 +56,8 @@ namespace coreutils {
std::string IMFMessage::getHeaderKeyPairValue(std::string headerKey, std::string key) {
coreutils::PString psource(getHeader(headerKey, false));
std::vector<std::string> sourcep = psource.split(";");
for(std::string keyx: sourcep) {
PString work(keyx);
std::vector<PString> sourcep = psource.split(";");
for(PString work: sourcep) {
work.skipWhitespace();
std::string token = work.getTokenExclude("=");
if(work.ifNext("=")) {
@@ -72,4 +77,9 @@ namespace coreutils {
return std::string("false");
}
IMFBody * IMFMessage::getBody() {
return body;
}
}