summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/emailhandler.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/emailhandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp42
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
@@ -105,5 +105,5 @@ void EmailHandler::getMail()
105 105
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);
109} 109}
@@ -112,9 +112,5 @@ void EmailHandler::getMailHeaders()
112{ 112{
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
120 headers = TRUE; 116 headers = TRUE;
@@ -136,5 +132,5 @@ void EmailHandler::getMailByList(MailList *mailList)
136} 132}
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{
140 Email mail; 136 Email mail;
@@ -143,5 +139,5 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo
143 mail.serverId = id; 139 mail.serverId = id;
144 mail.size = size; 140 mail.size = size;
145 mail.downloaded = complete; 141 mail.downloaded = incomplete;
146 142
147 emit mailArrived(mail, FALSE); 143 emit mailArrived(mail, FALSE);
@@ -187,4 +183,5 @@ 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);
190 } else { 187 } else {
@@ -200,12 +197,31 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
200 } 197 }
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)
203 {
204 QString rec;
205
206 if (p.separatorAt(pos-1)!='-')
204 { 207 {
205 pos++; 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 }
206 mail->recipients.append (p.getString(&pos, 'z', TRUE) ); 220 mail->recipients.append (p.getString(&pos, 'z', TRUE) );
221 }*/
207 } 222 }
223 //
224 //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") );
208 225
209 //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To:
210 if ((pos = p.find("CC",':', 0, TRUE)) != -1) 226 if ((pos = p.find("CC",':', 0, TRUE)) != -1)
211 { 227 {
@@ -214,12 +230,12 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
214 } 230 }
215 231
216
217 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { 232 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
218 pos++; 233 pos++;
219 mail->subject = p.getString(&pos, 'z', TRUE); 234 mail->subject = p.getString(&pos, 'z', TRUE);
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 }
225 241