summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/emailhandler.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/mailit/emailhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 59ccd90..39f693d 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -166,26 +166,28 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai
if (in.right(temp.length()) != temp) {
mail->rawMail += temp;
}
delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n"
pos = in.find(delimiter, 0, FALSE);
header = in.left(pos);
body = in.right(in.length() - pos - delimiter.length());
if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n'))
body.truncate(body.length()-2);
- TextParser p(header, lineShift);
-
+ // TextParser p(header, lineShift);
+ TextParser * lp = new TextParser(header, lineShift);
+#define p (*lp)
+
if ((pos = p.find("FROM",':', 0, TRUE)) != -1) {
pos++;
if (p.separatorAt(pos) == ' ') {
mail->from = p.getString(&pos, '<', false);
mail->from = mail->from.stripWhiteSpace();
if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) {
mail->from = mail->from.left(mail->from.length() - 1);
mail->from = mail->from.right(mail->from.length() - 1);
}
pos++;
mail->fromMail = p.getString(&pos, '>', false);
} else {
@@ -261,24 +263,25 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai
pos++;
boundary = p.getString(&pos, 'z', true);
if (boundary[0] == '"') {
boundary = boundary.left(boundary.length() - 1); //strip "
boundary = boundary.right(boundary.length() - 1); //strip "
}
boundary = "--" + boundary; //create boundary field
}
if (boundary == "") { //fooled by Mime-Version
mail->body = body;
mail->bodyPlain = body;
+ delete lp;
return mail;
}
while (body.length() > 0) {
pos = body.find(boundary, 0, FALSE);
pos = body.find(delimiter, pos, FALSE);
mimeHeader = body.left(pos);
mimeBody = body.right(body.length() - pos - delimiter.length());
TextParser bp(mimeHeader, lineShift);
contentType = "";
contentAttribute = "";
@@ -329,24 +332,25 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai
mail->body = mimeBody;
mail->bodyPlain = mimeBody;
}
if (contentAttribute == "HTML") {
mail->body = mimeBody;
}
}
}
} else {
mail->bodyPlain = body;
mail->body = body;
}
+ delete lp;
return TRUE;
}
bool EmailHandler::getEnclosure(Enclosure *ePtr)
{
QFile f(ePtr->path + ePtr->name);
char src[4];
char *destPtr;
QByteArray buffer;
uint bufCount, pos, decodedCount, size, x;
if (! f.open(IO_WriteOnly) ) {