summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-04-15 08:07:53 (UTC)
committer groucho <groucho>2003-04-15 08:07:53 (UTC)
commitd0de397e46581f6ed5fcfad320b2b61be3858c5d (patch) (side-by-side diff)
tree1110503d72aa11947642a640ab50656f82c33a71
parente263613e83b64fa93b5f3c1b904715daf076cc78 (diff)
downloadopie-d0de397e46581f6ed5fcfad320b2b61be3858c5d.zip
opie-d0de397e46581f6ed5fcfad320b2b61be3858c5d.tar.gz
opie-d0de397e46581f6ed5fcfad320b2b61be3858c5d.tar.bz2
- SMTP fix preventing authorization with SMTP after POP
- removed debug output - smaller bug fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/addresslist.cpp2
-rw-r--r--noncore/net/mailit/emailclient.cpp8
-rw-r--r--noncore/net/mailit/emailhandler.cpp2
-rw-r--r--noncore/net/mailit/mailitwindow.cpp3
-rw-r--r--noncore/net/mailit/popclient.cpp10
-rw-r--r--noncore/net/mailit/readmail.cpp1
-rw-r--r--noncore/net/mailit/smtpclient.cpp20
-rw-r--r--noncore/unsupported/mailit/addresslist.cpp2
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp8
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp2
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp3
-rw-r--r--noncore/unsupported/mailit/popclient.cpp10
-rw-r--r--noncore/unsupported/mailit/readmail.cpp1
-rw-r--r--noncore/unsupported/mailit/smtpclient.cpp20
14 files changed, 42 insertions, 50 deletions
diff --git a/noncore/net/mailit/addresslist.cpp b/noncore/net/mailit/addresslist.cpp
index 9fe558a..8d9ab91 100644
--- a/noncore/net/mailit/addresslist.cpp
+++ b/noncore/net/mailit/addresslist.cpp
@@ -118,25 +118,25 @@ void AddressList::read()
{
OContactAccess::List::Iterator it;
QString lineEmail, lineName, email, name;
OContactAccess m_contactdb("mailit");
OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
//OContact* oc;
for ( it = m_list.begin(); it != m_list.end(); ++it )
{
//oc=(OContact*) it;
if ((*it).defaultEmail().length()!=0)
- addContact((*it).defaultEmail(),(*it).fullName());
+ addContact((*it).defaultEmail(),(*it).fileAs());
}
/*if (! f.open(IO_ReadOnly) )
return;
QTextStream stream(&f);
while (! stream.atEnd() ) {
lineEmail = stream.readLine();
if (! stream.atEnd() )
lineName = stream.readLine();
else return;
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index 6612541..0d82a9a 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -523,25 +523,25 @@ void EmailClient::outboxItemSelected()
}
}
void EmailClient::readMail()
{
Email mail;
int start, stop;
QString s, del;
QFile f(getPath(FALSE) + "inbox.txt");
// QFileInfo fi(f);
- qDebug( f.name());
+ //qDebug( f.name());
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
s = t.read();
f.close();
start = 0;
del = "\n.\n";
while ((uint) start < s.length()) {
stop = s.find(del, start);
if (stop == -1)
stop = s.length() - del.length();
@@ -577,30 +577,30 @@ void EmailClient::readMail()
}
void EmailClient::saveMail(QString fileName, QListView *view)
{
QFile f(fileName);
Email *mail;
if (! f.open(IO_WriteOnly) ) {
qWarning("could not open file");
return;
}
item = (EmailListItem *) view->firstChild();
- qDebug (QString("Write : ") );
+ //qDebug (QString("Write : ") );
QTextStream t(&f);
while (item != NULL) {
mail = item->getMail();
- qDebug(mail->rawMail);
- qDebug(mail->recipients.first());
+ //qDebug(mail->rawMail);
+ //qDebug(mail->recipients.first());
t << mail->rawMail;
mailconf->setGroup(mail->id);
mailconf->writeEntry("mailread", mail->read);
item = (EmailListItem *) item->nextSibling();
}
f.close();
}
//paths for mailit, is settings, inbox, enclosures
QString EmailClient::getPath(bool enclosurePath)
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp
index 9c1c814..03f8a28 100644
--- a/noncore/net/mailit/emailhandler.cpp
+++ b/noncore/net/mailit/emailhandler.cpp
@@ -154,26 +154,24 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
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);
temp = lineShift + "." + lineShift;
if (in.right(temp.length()) != temp) {
- qWarning(in.right(temp.length()));
- qWarning(" . added at end of email as separator");
mail->rawMail += temp;
}
delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n"
pos = in.find(delimiter, 0, FALSE);
header = in.left(pos);
body = in.right(in.length() - pos - delimiter.length());
if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n'))
body.truncate(body.length()-2);
TextParser p(header, lineShift);
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp
index fd49c1f..2bf1dcb 100644
--- a/noncore/net/mailit/mailitwindow.cpp
+++ b/noncore/net/mailit/mailitwindow.cpp
@@ -18,29 +18,27 @@
**
**********************************************************************/
#include "mailitwindow.h"
MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
: QMainWindow(parent, name, fl)
{
currentCaption = "Mailit";
setCaption(tr(currentCaption));
views = new QWidgetStack(this);
setCentralWidget(views);
- qWarning("***Starting writeMail");
emailClient = new EmailClient(views, "client");
writeMail = new WriteMail(views, "writing");
readMail = new ReadMail(views, "reading");
- qWarning("***Finished readMail");
views->raiseWidget(emailClient);
connect(emailClient, SIGNAL(composeRequested()),
this, SLOT(compose()) );
connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
SLOT(viewMail(QListView *, Email *)) );
connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
SLOT(updateMailView(Email *)) );
connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
@@ -51,25 +49,24 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
connect(readMail, SIGNAL(replyRequested(Email &)), this,
SLOT(composeReply(Email &)) );
connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
SLOT(deleteMail(EmailListItem *, bool &)) );
connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
SLOT(moveMailFront(Email *)) );
connect(emailClient, SIGNAL(newCaption(const QString &)),
this, SLOT(updateCaption(const QString &)) );
viewingMail = FALSE;
- qWarning("***Finished MailitWindow");
}
MailItWindow::~MailItWindow()
{
}
void MailItWindow::closeEvent(QCloseEvent *e)
{
if (views->visibleWidget() == emailClient) {
e->accept();
} else {
showEmailClient();
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp
index 2f14ed2..f9cc337 100644
--- a/noncore/net/mailit/popclient.cpp
+++ b/noncore/net/mailit/popclient.cpp
@@ -110,37 +110,37 @@ void PopClient::errorHandling(int status)
void PopClient::incomingData()
{
QString response, temp, temp2, timeStamp;
QString md5Source;
int start, end;
// char *md5Digest;
char md5Digest[16];
// if ( !socket->canReadLine() )
// return;
response = socket->readLine();
- qDebug(response +" %d", status);
+ //qDebug(response +" %d", status);
switch(status) {
//logging in
case Init: {
#ifdef APOP_TEST
start = response.find('<',0);
end = response.find('>', start);
if( start >= 0 && end > start )
{
timeStamp = response.mid( start , end - start + 1);
md5Source = timeStamp + popPassword;
- qDebug( md5Source);
+ //qDebug( md5Source);
// for( int i = 0; i < md5Source.length(); i++) {
// buff[i] = (QChar)md5Source[i];
// }
md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]);
// md5_buffer(char const *buffer, unsigned int len, char *digest);
// MD5_Init( &ctx);
// MD5_Update( &ctx, buff, sizeof( buff) );
// MD5_Final( md5Digest, &ctx);
// MD5( buff, md5Source.length(), md5Digest);
@@ -183,25 +183,25 @@ void PopClient::incomingData()
if (response[0] == '+') {
temp = response.replace(0, 4, "");
int x = temp.find(" ", 0);
temp.truncate((uint) x);
newMessages = temp.toInt();
messageCount = 1;
status = List;
if (synchronize) {
//messages deleted from server, reload all
if (newMessages < lastSync)
lastSync = 0;
- messageCount = lastSync + 1;
+ messageCount = 1;
}
if (selected) {
int *ptr = mailList->first();
if (ptr != 0) {
newMessages++; //to ensure no early jumpout
messageCount = *(mailList->first());
} else newMessages = 0;
}
} else errorHandling(ErrUnknownResponse);
}
//Read message number x, count upwards to messageCount
@@ -231,25 +231,25 @@ void PopClient::incomingData()
//get size of message, eg "500 characters in message.." -> int 500
case Size: {
if (status != Quit) { //because of idiotic switch
if (response[0] == '+') {
temp = response.replace(0, 4, "");
int x = temp.find(" ", 0);
temp = temp.right(temp.length() - ((uint) x + 1) );
mailSize = temp.toInt();
emit currentMailSize(mailSize);
status = Retr;
} else {
- qWarning(response);
+ //qWarning(response);
errorHandling(ErrUnknownResponse);
}
}
}
//Read message number x, count upwards to messageCount
case Retr: {
if (status != Quit) {
if (!preview || mailSize <= headerLimit) {
*stream << "RETR " << messageCount << "\r\n";
} else { //only header
*stream << "TOP " << messageCount << " 0\r\n";
}
@@ -277,25 +277,25 @@ void PopClient::incomingData()
response = socket->readLine();
message += response;
}
emit downloadedSize(message.length());
int x = message.find("\r\n.\r\n",-5);
if (x == -1) {
break;
} else { //message reach entire size
//complete mail downloaded
if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){
emit newMessage(message, messageCount-1, mailSize, TRUE);
} else { //incomplete mail downloaded
- emit newMessage(message, messageCount-1, mailSize, FALSE);
+ emit newMessage(message, messageCount-1, mailSize, FALSE);
}
if (messageCount > newMessages) //that was the last message
status = Quit;
else { //ask for new message
if (selected) { //grab next from queue
int *ptr = mailList->next();
if (ptr != 0) {
messageCount = *ptr;
*stream << "LIST " << messageCount << "\r\n";
status = Size;
//completing a previously closed transfer
if ( (messageCount - lastSync) <= 0) {
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp
index a5e7147..7cd3e09 100644
--- a/noncore/net/mailit/readmail.cpp
+++ b/noncore/net/mailit/readmail.cpp
@@ -80,24 +80,25 @@ void ReadMail::init()
connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
plainTextButton->addTo(bar);
plainTextButton->addTo(viewMenu);
deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
deleteButton->addTo(bar);
deleteButton->addTo(mailMenu);
viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));
emailView = new QTextView( this, "emailView" );
+
setCentralWidget(emailView);
mime = new QMimeSourceFactory();
emailView->setMimeSourceFactory(mime);
}
void ReadMail::updateView()
{
Enclosure *ePtr;
QString mailStringSize;
QString text, temp;
diff --git a/noncore/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp
index 6699a90..b2e38e5 100644
--- a/noncore/net/mailit/smtpclient.cpp
+++ b/noncore/net/mailit/smtpclient.cpp
@@ -78,94 +78,94 @@ void SmtpClient::errorHandling(int status)
mailList.clear();
sending = FALSE;
}
void SmtpClient::incomingData()
{
QString response;
if (!socket->canReadLine())
return;
response = socket->readLine();
- qDebug(response);
+ //qDebug(response);
switch(status) {
case Init: {
if (response[0] == '2') {
status = From;
mailPtr = mailList.first();
*stream << "HELO there\r\n";
- qDebug("HELO");
+ //qDebug("HELO");
} else errorHandling(ErrUnknownResponse);
break;
}
case From: {
if (response[0] == '2') {
- *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n";
+ *stream << "MAIL FROM: " << mailPtr->from << "\r\n";
status = Recv;
- qDebug("MAIL FROM: "+mailPtr->from);
+ //qDebug("MAIL FROM: "+mailPtr->from);
} else errorHandling(ErrUnknownResponse);
break;
}
case Recv: {
if (response[0] == '2') {
it = mailPtr->to.begin();
if (it == NULL)
errorHandling(ErrUnknownResponse);
- *stream << "RCPT TO: <" << *it << ">\r\n";
- qDebug("RCPT TO: "+ *it);
+ *stream << "RCPT TO: " << *it << ">\r\n";
+ //qDebug("RCPT TO: "+ *it);
status = MRcv;
} else errorHandling(ErrUnknownResponse);
break;
}
case MRcv: {
if (response[0] == '2') {
it++;
if ( it != mailPtr->to.end() ) {
*stream << "RCPT TO: <" << *it << ">\r\n";
- qDebug("RCPT TO: "+ *it);
+ //qDebug("RCPT TO: "+ *it);
break;
} else {
status = Data;
}
} else errorHandling(ErrUnknownResponse);
}
case Data: {
if (response[0] == '2') {
*stream << "DATA\r\n";
status = Body;
- qDebug("DATA");
+ //qDebug("DATA");
emit updateStatus(tr("Sending: ") + mailPtr->subject);
} else errorHandling(ErrUnknownResponse);
break;
}
case Body: {
if (response[0] == '3') {
*stream << mailPtr->body << "\r\n.\r\n";
mailPtr = mailList.next();
if (mailPtr != NULL) {
status = From;
} else {
status = Quit;
}
- qDebug("BODY");
+ //qDebug("BODY");
} else errorHandling(ErrUnknownResponse);
break;
}
case Quit: {
if (response[0] == '2') {
*stream << "QUIT\r\n";
status = Done;
QString temp;
temp.setNum(mailList.count());
emit updateStatus(tr("Sent ") + temp + tr(" messages"));
emit mailSent();
mailList.clear();
sending = FALSE;
socket->close();
- qDebug("QUIT");
+ //qDebug("QUIT");
} else errorHandling(ErrUnknownResponse);
break;
}
}
}
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp
index 9fe558a..8d9ab91 100644
--- a/noncore/unsupported/mailit/addresslist.cpp
+++ b/noncore/unsupported/mailit/addresslist.cpp
@@ -118,25 +118,25 @@ void AddressList::read()
{
OContactAccess::List::Iterator it;
QString lineEmail, lineName, email, name;
OContactAccess m_contactdb("mailit");
OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
//OContact* oc;
for ( it = m_list.begin(); it != m_list.end(); ++it )
{
//oc=(OContact*) it;
if ((*it).defaultEmail().length()!=0)
- addContact((*it).defaultEmail(),(*it).fullName());
+ addContact((*it).defaultEmail(),(*it).fileAs());
}
/*if (! f.open(IO_ReadOnly) )
return;
QTextStream stream(&f);
while (! stream.atEnd() ) {
lineEmail = stream.readLine();
if (! stream.atEnd() )
lineName = stream.readLine();
else return;
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 6612541..0d82a9a 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -523,25 +523,25 @@ void EmailClient::outboxItemSelected()
}
}
void EmailClient::readMail()
{
Email mail;
int start, stop;
QString s, del;
QFile f(getPath(FALSE) + "inbox.txt");
// QFileInfo fi(f);
- qDebug( f.name());
+ //qDebug( f.name());
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
s = t.read();
f.close();
start = 0;
del = "\n.\n";
while ((uint) start < s.length()) {
stop = s.find(del, start);
if (stop == -1)
stop = s.length() - del.length();
@@ -577,30 +577,30 @@ void EmailClient::readMail()
}
void EmailClient::saveMail(QString fileName, QListView *view)
{
QFile f(fileName);
Email *mail;
if (! f.open(IO_WriteOnly) ) {
qWarning("could not open file");
return;
}
item = (EmailListItem *) view->firstChild();
- qDebug (QString("Write : ") );
+ //qDebug (QString("Write : ") );
QTextStream t(&f);
while (item != NULL) {
mail = item->getMail();
- qDebug(mail->rawMail);
- qDebug(mail->recipients.first());
+ //qDebug(mail->rawMail);
+ //qDebug(mail->recipients.first());
t << mail->rawMail;
mailconf->setGroup(mail->id);
mailconf->writeEntry("mailread", mail->read);
item = (EmailListItem *) item->nextSibling();
}
f.close();
}
//paths for mailit, is settings, inbox, enclosures
QString EmailClient::getPath(bool enclosurePath)
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 9c1c814..03f8a28 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -154,26 +154,24 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
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);
temp = lineShift + "." + lineShift;
if (in.right(temp.length()) != temp) {
- qWarning(in.right(temp.length()));
- qWarning(" . added at end of email as separator");
mail->rawMail += temp;
}
delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n"
pos = in.find(delimiter, 0, FALSE);
header = in.left(pos);
body = in.right(in.length() - pos - delimiter.length());
if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n'))
body.truncate(body.length()-2);
TextParser p(header, lineShift);
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp
index fd49c1f..2bf1dcb 100644
--- a/noncore/unsupported/mailit/mailitwindow.cpp
+++ b/noncore/unsupported/mailit/mailitwindow.cpp
@@ -18,29 +18,27 @@
**
**********************************************************************/
#include "mailitwindow.h"
MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
: QMainWindow(parent, name, fl)
{
currentCaption = "Mailit";
setCaption(tr(currentCaption));
views = new QWidgetStack(this);
setCentralWidget(views);
- qWarning("***Starting writeMail");
emailClient = new EmailClient(views, "client");
writeMail = new WriteMail(views, "writing");
readMail = new ReadMail(views, "reading");
- qWarning("***Finished readMail");
views->raiseWidget(emailClient);
connect(emailClient, SIGNAL(composeRequested()),
this, SLOT(compose()) );
connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
SLOT(viewMail(QListView *, Email *)) );
connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
SLOT(updateMailView(Email *)) );
connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
@@ -51,25 +49,24 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
connect(readMail, SIGNAL(replyRequested(Email &)), this,
SLOT(composeReply(Email &)) );
connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
SLOT(deleteMail(EmailListItem *, bool &)) );
connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
SLOT(moveMailFront(Email *)) );
connect(emailClient, SIGNAL(newCaption(const QString &)),
this, SLOT(updateCaption(const QString &)) );
viewingMail = FALSE;
- qWarning("***Finished MailitWindow");
}
MailItWindow::~MailItWindow()
{
}
void MailItWindow::closeEvent(QCloseEvent *e)
{
if (views->visibleWidget() == emailClient) {
e->accept();
} else {
showEmailClient();
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp
index 2f14ed2..f9cc337 100644
--- a/noncore/unsupported/mailit/popclient.cpp
+++ b/noncore/unsupported/mailit/popclient.cpp
@@ -110,37 +110,37 @@ void PopClient::errorHandling(int status)
void PopClient::incomingData()
{
QString response, temp, temp2, timeStamp;
QString md5Source;
int start, end;
// char *md5Digest;
char md5Digest[16];
// if ( !socket->canReadLine() )
// return;
response = socket->readLine();
- qDebug(response +" %d", status);
+ //qDebug(response +" %d", status);
switch(status) {
//logging in
case Init: {
#ifdef APOP_TEST
start = response.find('<',0);
end = response.find('>', start);
if( start >= 0 && end > start )
{
timeStamp = response.mid( start , end - start + 1);
md5Source = timeStamp + popPassword;
- qDebug( md5Source);
+ //qDebug( md5Source);
// for( int i = 0; i < md5Source.length(); i++) {
// buff[i] = (QChar)md5Source[i];
// }
md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]);
// md5_buffer(char const *buffer, unsigned int len, char *digest);
// MD5_Init( &ctx);
// MD5_Update( &ctx, buff, sizeof( buff) );
// MD5_Final( md5Digest, &ctx);
// MD5( buff, md5Source.length(), md5Digest);
@@ -183,25 +183,25 @@ void PopClient::incomingData()
if (response[0] == '+') {
temp = response.replace(0, 4, "");
int x = temp.find(" ", 0);
temp.truncate((uint) x);
newMessages = temp.toInt();
messageCount = 1;
status = List;
if (synchronize) {
//messages deleted from server, reload all
if (newMessages < lastSync)
lastSync = 0;
- messageCount = lastSync + 1;
+ messageCount = 1;
}
if (selected) {
int *ptr = mailList->first();
if (ptr != 0) {
newMessages++; //to ensure no early jumpout
messageCount = *(mailList->first());
} else newMessages = 0;
}
} else errorHandling(ErrUnknownResponse);
}
//Read message number x, count upwards to messageCount
@@ -231,25 +231,25 @@ void PopClient::incomingData()
//get size of message, eg "500 characters in message.." -> int 500
case Size: {
if (status != Quit) { //because of idiotic switch
if (response[0] == '+') {
temp = response.replace(0, 4, "");
int x = temp.find(" ", 0);
temp = temp.right(temp.length() - ((uint) x + 1) );
mailSize = temp.toInt();
emit currentMailSize(mailSize);
status = Retr;
} else {
- qWarning(response);
+ //qWarning(response);
errorHandling(ErrUnknownResponse);
}
}
}
//Read message number x, count upwards to messageCount
case Retr: {
if (status != Quit) {
if (!preview || mailSize <= headerLimit) {
*stream << "RETR " << messageCount << "\r\n";
} else { //only header
*stream << "TOP " << messageCount << " 0\r\n";
}
@@ -277,25 +277,25 @@ void PopClient::incomingData()
response = socket->readLine();
message += response;
}
emit downloadedSize(message.length());
int x = message.find("\r\n.\r\n",-5);
if (x == -1) {
break;
} else { //message reach entire size
//complete mail downloaded
if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){
emit newMessage(message, messageCount-1, mailSize, TRUE);
} else { //incomplete mail downloaded
- emit newMessage(message, messageCount-1, mailSize, FALSE);
+ emit newMessage(message, messageCount-1, mailSize, FALSE);
}
if (messageCount > newMessages) //that was the last message
status = Quit;
else { //ask for new message
if (selected) { //grab next from queue
int *ptr = mailList->next();
if (ptr != 0) {
messageCount = *ptr;
*stream << "LIST " << messageCount << "\r\n";
status = Size;
//completing a previously closed transfer
if ( (messageCount - lastSync) <= 0) {
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp
index a5e7147..7cd3e09 100644
--- a/noncore/unsupported/mailit/readmail.cpp
+++ b/noncore/unsupported/mailit/readmail.cpp
@@ -80,24 +80,25 @@ void ReadMail::init()
connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
plainTextButton->addTo(bar);
plainTextButton->addTo(viewMenu);
deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
deleteButton->addTo(bar);
deleteButton->addTo(mailMenu);
viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));
emailView = new QTextView( this, "emailView" );
+
setCentralWidget(emailView);
mime = new QMimeSourceFactory();
emailView->setMimeSourceFactory(mime);
}
void ReadMail::updateView()
{
Enclosure *ePtr;
QString mailStringSize;
QString text, temp;
diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp
index 6699a90..b2e38e5 100644
--- a/noncore/unsupported/mailit/smtpclient.cpp
+++ b/noncore/unsupported/mailit/smtpclient.cpp
@@ -78,94 +78,94 @@ void SmtpClient::errorHandling(int status)
mailList.clear();
sending = FALSE;
}
void SmtpClient::incomingData()
{
QString response;
if (!socket->canReadLine())
return;
response = socket->readLine();
- qDebug(response);
+ //qDebug(response);
switch(status) {
case Init: {
if (response[0] == '2') {
status = From;
mailPtr = mailList.first();
*stream << "HELO there\r\n";
- qDebug("HELO");
+ //qDebug("HELO");
} else errorHandling(ErrUnknownResponse);
break;
}
case From: {
if (response[0] == '2') {
- *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n";
+ *stream << "MAIL FROM: " << mailPtr->from << "\r\n";
status = Recv;
- qDebug("MAIL FROM: "+mailPtr->from);
+ //qDebug("MAIL FROM: "+mailPtr->from);
} else errorHandling(ErrUnknownResponse);
break;
}
case Recv: {
if (response[0] == '2') {
it = mailPtr->to.begin();
if (it == NULL)
errorHandling(ErrUnknownResponse);
- *stream << "RCPT TO: <" << *it << ">\r\n";
- qDebug("RCPT TO: "+ *it);
+ *stream << "RCPT TO: " << *it << ">\r\n";
+ //qDebug("RCPT TO: "+ *it);
status = MRcv;
} else errorHandling(ErrUnknownResponse);
break;
}
case MRcv: {
if (response[0] == '2') {
it++;
if ( it != mailPtr->to.end() ) {
*stream << "RCPT TO: <" << *it << ">\r\n";
- qDebug("RCPT TO: "+ *it);
+ //qDebug("RCPT TO: "+ *it);
break;
} else {
status = Data;
}
} else errorHandling(ErrUnknownResponse);
}
case Data: {
if (response[0] == '2') {
*stream << "DATA\r\n";
status = Body;
- qDebug("DATA");
+ //qDebug("DATA");
emit updateStatus(tr("Sending: ") + mailPtr->subject);
} else errorHandling(ErrUnknownResponse);
break;
}
case Body: {
if (response[0] == '3') {
*stream << mailPtr->body << "\r\n.\r\n";
mailPtr = mailList.next();
if (mailPtr != NULL) {
status = From;
} else {
status = Quit;
}
- qDebug("BODY");
+ //qDebug("BODY");
} else errorHandling(ErrUnknownResponse);
break;
}
case Quit: {
if (response[0] == '2') {
*stream << "QUIT\r\n";
status = Done;
QString temp;
temp.setNum(mailList.count());
emit updateStatus(tr("Sent ") + temp + tr(" messages"));
emit mailSent();
mailList.clear();
sending = FALSE;
socket->close();
- qDebug("QUIT");
+ //qDebug("QUIT");
} else errorHandling(ErrUnknownResponse);
break;
}
}
}