Diffstat (limited to 'noncore/unsupported/mailit/emailhandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index f6c6d60..b180051 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp @@ -106,3 +106,3 @@ void EmailHandler::getMail() headers = FALSE; - popClient->headersOnly(headers, 0); + //popClient->headersOnly(headers, 0); popClient->newConnection(mailAccount.popServer, 110); @@ -113,7 +113,3 @@ void EmailHandler::getMailHeaders() popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); - if (mailAccount.synchronize) { - popClient->setSynchronize(mailAccount.lastServerMailCount); - } else { - popClient->removeSynchronize(); - } + mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); @@ -137,3 +133,3 @@ void EmailHandler::getMailByList(MailList *mailList) -void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) +void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) { @@ -144,3 +140,3 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo mail.size = size; - mail.downloaded = complete; + mail.downloaded = incomplete; @@ -188,2 +184,3 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) pos++; + mail->fromMail = p.getString(&pos, '>', false); @@ -201,10 +198,29 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) - //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: - if ((pos = p.find("TO",':', 0, TRUE)) != -1) + pos=0; + + //Search for To: after the FROM: attribute to prevent hitting the Delivered-To: + while((pos = p.find("TO",':', pos+1, TRUE))!=-1) + { + QString rec; + + if (p.separatorAt(pos-1)!='-') { pos++; + mail->recipients.append(p.getString(&pos, '\r', TRUE)); + } + /*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; + } mail->recipients.append (p.getString(&pos, 'z', TRUE) ); + }*/ } + // + //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") ); - //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: if ((pos = p.find("CC",':', 0, TRUE)) != -1) @@ -215,3 +231,2 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) - if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { @@ -220,5 +235,6 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) } + if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { pos++; - mail->date = p.getString(&pos, 'z', true); + mail->date = p.getString(&pos, 'z', TRUE); } |