summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/emailhandler.cpp
Unidiff
Diffstat (limited to 'noncore/net/mailit/emailhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailhandler.cpp50
1 files changed, 33 insertions, 17 deletions
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp
index f6c6d60..b180051 100644
--- a/noncore/net/mailit/emailhandler.cpp
+++ b/noncore/net/mailit/emailhandler.cpp
@@ -106,3 +106,3 @@ void EmailHandler::getMail()
106 headers = FALSE; 106 headers = FALSE;
107 popClient->headersOnly(headers, 0); 107 //popClient->headersOnly(headers, 0);
108 popClient->newConnection(mailAccount.popServer, 110); 108 popClient->newConnection(mailAccount.popServer, 110);
@@ -113,7 +113,3 @@ void EmailHandler::getMailHeaders()
113 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); 113 popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
114 if (mailAccount.synchronize) { 114 mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize();
115 popClient->setSynchronize(mailAccount.lastServerMailCount);
116 } else {
117 popClient->removeSynchronize();
118 }
119 115
@@ -137,3 +133,3 @@ void EmailHandler::getMailByList(MailList *mailList)
137 133
138void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) 134void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete)
139{ 135{
@@ -144,3 +140,3 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo
144 mail.size = size; 140 mail.size = size;
145 mail.downloaded = complete; 141 mail.downloaded = incomplete;
146 142
@@ -187,3 +183,4 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
187 } 183 }
188 pos++; 184 pos++;
185
189 mail->fromMail = p.getString(&pos, '>', false); 186 mail->fromMail = p.getString(&pos, '>', false);
@@ -201,10 +198,29 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
201 198
202 //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: 199 pos=0;
203 if ((pos = p.find("TO",':', 0, TRUE)) != -1) 200
201 //Search for To: after the FROM: attribute to prevent hitting the Delivered-To:
202 while((pos = p.find("TO",':', pos+1, TRUE))!=-1)
204 { 203 {
205 pos++; 204 QString rec;
206 mail->recipients.append (p.getString(&pos, 'z', TRUE) ); 205
206 if (p.separatorAt(pos-1)!='-')
207 {
208 pos++;
209 mail->recipients.append(p.getString(&pos, '\r', TRUE));
210 }
211 /*else {
212 if ((p.separatorAt(pos) == '<')|| (p.separatorAt(pos) == ' ')) //No name.. nasty
213 pos++;
214 pos++;
215 mail->fromMail = p.getString(&pos, 'z', TRUE);
216 if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
217 mail->fromMail.truncate(mail->fromMail.length() - 1);
218 mail->from=mail->fromMail;
219 }
220 mail->recipients.append (p.getString(&pos, 'z', TRUE) );
221 }*/
207 } 222 }
208 223 //
209 //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: 224 //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") );
225
210 if ((pos = p.find("CC",':', 0, TRUE)) != -1) 226 if ((pos = p.find("CC",':', 0, TRUE)) != -1)
@@ -215,3 +231,2 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
215 231
216
217 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { 232 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
@@ -220,5 +235,6 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
220 } 235 }
236
221 if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { 237 if ((pos = p.find("DATE",':', 0, TRUE)) != -1) {
222 pos++; 238 pos++;
223 mail->date = p.getString(&pos, 'z', true); 239 mail->date = p.getString(&pos, 'z', TRUE);
224 } 240 }