summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit
authorllornkcor <llornkcor>2003-04-06 19:03:38 (UTC)
committer llornkcor <llornkcor>2003-04-06 19:03:38 (UTC)
commite6023e382d816195ff209b421f58ed5abfffe0e9 (patch) (side-by-side diff)
tree786e10ac117b17f2eee1bfbaec9a1027a33e969a /noncore/unsupported/mailit
parentb284e2c4dcddc4314f94933616d664b08587e29e (diff)
downloadopie-e6023e382d816195ff209b421f58ed5abfffe0e9.zip
opie-e6023e382d816195ff209b421f58ed5abfffe0e9.tar.gz
opie-e6023e382d816195ff209b421f58ed5abfffe0e9.tar.bz2
grumble
Diffstat (limited to 'noncore/unsupported/mailit') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index a086dfc..2144899 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -136,104 +136,104 @@ void EmailHandler::getMailByList(MailList *mailList)
}
void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
{
Email mail;
mail.rawMail = message;
mail.serverId = id;
mail.size = size;
mail.downloaded = complete;
emit mailArrived(mail, FALSE);
}
bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
{
QString temp, boundary;
int pos;
QString delimiter, header, body, mimeHeader, mimeBody;
QString content, contentType, contentAttribute, id, encoding;
QString fileName, storedName;
int enclosureId = 0;
mail->rawMail = in;
mail->received = TRUE;
mail->files.setAutoDelete(TRUE);
temp = lineShift + "." + lineShift;
if (in.right(temp.length()) != temp) {
qWarning(in.right(temp.length()));
qWarning(" . added at end of email as separator");
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);
if ((pos = p.find("FROM",':', 0, TRUE)) != -1) {
pos++;
if (p.separatorAt(pos) == ' ') {
- mail->from = p.getString(&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, '>');
+ mail->fromMail = p.getString(&pos, '>', false);
} else {
if ((p.separatorAt(pos) == '<')
|| (p.separatorAt(pos) == ' ')) //No name.. nasty
pos++;
pos++;
mail->fromMail = p.getString(&pos, 'z', TRUE);
if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
mail->fromMail.truncate(mail->fromMail.length() - 1);
mail->from=mail->fromMail;
}
}
if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
pos++;
mail->subject = p.getString(&pos, 'z', TRUE);
}
if ((pos = p.find("DATE",':', 0, TRUE)) != -1) {
pos++;
mail->date = p.getString(&pos, 'z', true);
}
if ((pos = p.find("TO",':', 0, TRUE)) != -1) {
pos++;
mail->recipients.append (p.getString(&pos, 'z', TRUE) );
}
if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) {
pos++;
if ( (p.wordAt(pos).upper() == "ID") &&
(p.separatorAt(pos) == ':') ) {
id = p.getString(&pos, 'z', TRUE);
mail->id = id;
}
}
pos = 0;
while ( ((pos = p.find("MIME",'-', pos, TRUE)) != -1) ) {
pos++;
if ( (p.wordAt(pos).upper() == "VERSION") &&
(p.separatorAt(pos) == ':') ) {
pos++;
if (p.getString(&pos, 'z', true) == "1.0") {
mail->mimeType = 1;
}
}
}
if (mail->mimeType == 1) {
boundary = "";
if ((pos = p.find("BOUNDARY", '=', 0, TRUE)) != -1) {