summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/emailhandler.cpp
authorllornkcor <llornkcor>2003-05-24 02:07:21 (UTC)
committer llornkcor <llornkcor>2003-05-24 02:07:21 (UTC)
commit694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9 (patch) (side-by-side diff)
tree6c3f2a5837e32adf2755de4f90d3590d585f1a96 /noncore/unsupported/mailit/emailhandler.cpp
parent62d2ddfb5cd77e2637cdf7fe16d76aac04975984 (diff)
downloadopie-694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9.zip
opie-694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9.tar.gz
opie-694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9.tar.bz2
fix for a few crashes. one being stack overwrite. please test before I commit to 0_99
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
@@ -172,14 +172,16 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai
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] == '"') ) {
@@ -267,12 +269,13 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai
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);
@@ -335,12 +338,13 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai
}
}
} else {
mail->bodyPlain = body;
mail->body = body;
}
+ delete lp;
return TRUE;
}
bool EmailHandler::getEnclosure(Enclosure *ePtr)
{
QFile f(ePtr->path + ePtr->name);