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.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 1be16d4..9c1c814 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -97,49 +97,49 @@ void EmailHandler::setAccount(MailAccount account)
void EmailHandler::getMail()
{
popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
if (mailAccount.synchronize) {
popClient->setSynchronize(mailAccount.lastServerMailCount);
} else {
popClient->removeSynchronize();
}
headers = FALSE;
popClient->headersOnly(headers, 0);
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::getMailHeaders()
{
popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
if (mailAccount.synchronize) {
popClient->setSynchronize(mailAccount.lastServerMailCount);
} else {
popClient->removeSynchronize();
}
headers = TRUE;
- popClient->headersOnly(headers, 2000); //less than 2000, download all
+ popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::getMailByList(MailList *mailList)
{
if (mailList->count() == 0) { //should not occur though
emit mailTransfered(0);
return;
}
headers = FALSE;
popClient->headersOnly(FALSE, 0);
popClient->newConnection(mailAccount.popServer, 110);
popClient->setSelectedMails(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;
@@ -179,60 +179,69 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
TextParser p(header, lineShift);
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 {
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;
}
}
+
+ //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
+ if (pos = p.find("TO",':', pos, TRUE) != -1)
+ {
+ pos++;
+ mail->recipients.append (p.getString(&pos, 'z', TRUE) );
+ }
+
+
+
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 = "";