summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/emailhandler.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/emailhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailhandler.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp
index 62fa64f..59ccd90 100644
--- a/noncore/net/mailit/emailhandler.cpp
+++ b/noncore/net/mailit/emailhandler.cpp
@@ -30,25 +30,25 @@ QCollection::Item EnclosureList::newItem(QCollection::Item d)
{
return dupl( (Enclosure *) d);
}
Enclosure* EnclosureList::dupl(Enclosure *in)
{
ac = new Enclosure(*in);
return ac;
}
EmailHandler::EmailHandler()
{
- qDebug("EMailHandler::EmailHandler");
+ qDebug("EMailHandler::EmailHandler");
smtpClient = new SmtpClient();
popClient = new PopClient();
connect(smtpClient, SIGNAL(errorOccurred(int)), this,
SIGNAL(smtpError(int)) );
connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) );
connect(smtpClient, SIGNAL(updateStatus(const QString &)), this,
SIGNAL(updateSmtpStatus(const QString &)) );
connect(popClient, SIGNAL(errorOccurred(int)), this,
SIGNAL(popError(int)) );
@@ -139,25 +139,25 @@ void EmailHandler::getMailByList(MailList *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;
emit mailArrived(mail, FALSE);
}
-bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
+bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail)
{
QString temp, boundary;
int pos;
QString delimiter, header, body, mimeHeader, mimeBody;
QString content, contentType, contentAttribute, id, encoding;
QString fileName, storedName;
int enclosureId = 0;
mail->rawMail = in;
mail->received = TRUE;
mail->files.setAutoDelete(TRUE);
@@ -195,39 +195,39 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
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;
}
}
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)!='-') //The - separator means that this is a Delivered-To: or Reply-To:
- {
- pos++;
- mail->recipients.append(p.getString(&pos, '\r', TRUE));
- }
+ QString rec;
+
+ if (p.separatorAt(pos-1)!='-') //The - separator means that this is a Delivered-To: or Reply-To:
+ {
+ pos++;
+ mail->recipients.append(p.getString(&pos, '\r', TRUE));
+ }
}
//
//if (pos==-1) mail->recipients.append (tr("undisclosed recipients") );
if ((pos = p.find("CC",':', 0, TRUE)) != -1)
{
- pos++;
- mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) );
+ pos++;
+ mail->carbonCopies.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);
}
@@ -431,26 +431,26 @@ int EmailHandler::parse64base(char *src, char *bufOut) {
}
}
return processed;
}
int EmailHandler::encodeMime(Email *mail)
{
QString fileName, fileType, contentType, newBody, boundary;
Enclosure *ePtr;
QString userName = mailAccount.name;
- if (userName.length()>0) //only embrace it if there is a user name
- userName += " <" + mailAccount.emailAddress + ">";
+ if (userName.length()>0) //only embrace it if there is a user name
+ userName += " <" + mailAccount.emailAddress + ">";
//add standard headers
newBody = "From: " + userName + "\r\nTo: ";
for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) {
newBody += *it + " ";
}
newBody += "\r\nCC: ";
for (QStringList::Iterator it = mail->carbonCopies.begin(); it != mail->carbonCopies.end(); ++it ) {
newBody += *it + " ";
}
@@ -501,25 +501,25 @@ int EmailHandler::encodeMime(Email *mail)
fi.fileName() + "\"\r\n\r\n";
if (encodeFile(fileName, &newBody) == -1) //file not found?
return -1;
}
newBody += "\r\n\r\n--" + boundary + "--";
mail->rawMail = newBody;
return 0;
}
-int EmailHandler::encodeFile(QString fileName, QString *toBody)
+int EmailHandler::encodeFile(const QString &fileName, QString *toBody)
{
char *fileData;
char *dataPtr;
QString temp;
uint dataSize, count;
QFile f(fileName);
if (! f.open(IO_ReadOnly) ) {
qWarning("could not open file: " + fileName);
return -1;
}
QTextStream s(&f);