summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/emailhandler.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/emailhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 62fa64f..59ccd90 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -36,13 +36,13 @@ Enclosure* EnclosureList::dupl(Enclosure *in)
36 ac = new Enclosure(*in); 36 ac = new Enclosure(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailHandler::EmailHandler() 40EmailHandler::EmailHandler()
41{ 41{
42 qDebug("EMailHandler::EmailHandler"); 42 qDebug("EMailHandler::EmailHandler");
43 43
44 smtpClient = new SmtpClient(); 44 smtpClient = new SmtpClient();
45 popClient = new PopClient(); 45 popClient = new PopClient();
46 46
47 connect(smtpClient, SIGNAL(errorOccurred(int)), this, 47 connect(smtpClient, SIGNAL(errorOccurred(int)), this,
48 SIGNAL(smtpError(int)) ); 48 SIGNAL(smtpError(int)) );
@@ -145,13 +145,13 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo
145 mail.size = size; 145 mail.size = size;
146 mail.downloaded = complete; 146 mail.downloaded = complete;
147 147
148 emit mailArrived(mail, FALSE); 148 emit mailArrived(mail, FALSE);
149} 149}
150 150
151bool EmailHandler::parse(QString in, QString lineShift, Email *mail) 151bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail)
152{ 152{
153 QString temp, boundary; 153 QString temp, boundary;
154 int pos; 154 int pos;
155 QString delimiter, header, body, mimeHeader, mimeBody; 155 QString delimiter, header, body, mimeHeader, mimeBody;
156 QString content, contentType, contentAttribute, id, encoding; 156 QString content, contentType, contentAttribute, id, encoding;
157 QString fileName, storedName; 157 QString fileName, storedName;
@@ -201,27 +201,27 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
201 201
202 pos=0; 202 pos=0;
203 203
204 //Search for To: after the FROM: attribute to prevent hitting the Delivered-To: 204 //Search for To: after the FROM: attribute to prevent hitting the Delivered-To:
205 while((pos = p.find("TO",':', pos+1, TRUE))!=-1) 205 while((pos = p.find("TO",':', pos+1, TRUE))!=-1)
206 { 206 {
207 QString rec; 207 QString rec;
208 208
209 if (p.separatorAt(pos-1)!='-')//The - separator means that this is a Delivered-To: or Reply-To: 209 if (p.separatorAt(pos-1)!='-') //The - separator means that this is a Delivered-To: or Reply-To:
210 { 210 {
211 pos++; 211 pos++;
212 mail->recipients.append(p.getString(&pos, '\r', TRUE)); 212 mail->recipients.append(p.getString(&pos, '\r', TRUE));
213 } 213 }
214 } 214 }
215 // 215 //
216 //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") ); 216 //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") );
217 217
218 if ((pos = p.find("CC",':', 0, TRUE)) != -1) 218 if ((pos = p.find("CC",':', 0, TRUE)) != -1)
219 { 219 {
220 pos++; 220 pos++;
221 mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) ); 221 mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) );
222 } 222 }
223 223
224 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { 224 if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) {
225 pos++; 225 pos++;
226 mail->subject = p.getString(&pos, 'z', TRUE); 226 mail->subject = p.getString(&pos, 'z', TRUE);
227 } 227 }
@@ -437,14 +437,14 @@ int EmailHandler::encodeMime(Email *mail)
437{ 437{
438 438
439 QString fileName, fileType, contentType, newBody, boundary; 439 QString fileName, fileType, contentType, newBody, boundary;
440 Enclosure *ePtr; 440 Enclosure *ePtr;
441 441
442 QString userName = mailAccount.name; 442 QString userName = mailAccount.name;
443 if (userName.length()>0)//only embrace it if there is a user name 443 if (userName.length()>0) //only embrace it if there is a user name
444 userName += " <" + mailAccount.emailAddress + ">"; 444 userName += " <" + mailAccount.emailAddress + ">";
445 445
446 //add standard headers 446 //add standard headers
447 newBody = "From: " + userName + "\r\nTo: "; 447 newBody = "From: " + userName + "\r\nTo: ";
448 for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { 448 for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) {
449 newBody += *it + " "; 449 newBody += *it + " ";
450 } 450 }
@@ -507,13 +507,13 @@ int EmailHandler::encodeMime(Email *mail)
507 newBody += "\r\n\r\n--" + boundary + "--"; 507 newBody += "\r\n\r\n--" + boundary + "--";
508 mail->rawMail = newBody; 508 mail->rawMail = newBody;
509 509
510 return 0; 510 return 0;
511} 511}
512 512
513int EmailHandler::encodeFile(QString fileName, QString *toBody) 513int EmailHandler::encodeFile(const QString &fileName, QString *toBody)
514{ 514{
515 char *fileData; 515 char *fileData;
516 char *dataPtr; 516 char *dataPtr;
517 QString temp; 517 QString temp;
518 uint dataSize, count; 518 uint dataSize, count;
519 QFile f(fileName); 519 QFile f(fileName);