summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/popclient.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/popclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/popclient.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp
index 6105d09..fedc4e2 100644
--- a/noncore/net/mailit/popclient.cpp
+++ b/noncore/net/mailit/popclient.cpp
@@ -26,12 +26,13 @@ extern "C" {
}
#include <qcstring.h>
PopClient::PopClient()
{
+
socket = new QSocket(this, "popClient");
connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int)));
connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished()));
connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData()));
stream = new QTextStream(socket);
@@ -114,12 +115,13 @@ void PopClient::incomingData()
QString md5Source;
int start, end;
// char *md5Digest;
char md5Digest[16];
// if ( !socket->canReadLine() )
// return;
+
response = socket->readLine();
switch(status) {
//logging in
case Init: {
@@ -148,25 +150,26 @@ void PopClient::incomingData()
{
timeStamp = "";
*stream << "USER " << popUserName << "\r\n";
status = Pass;
}
- break;
+ break;
}
case Pass: {
*stream << "PASS " << popPassword << "\r\n";
- status = Stat;
+ status = Stat;
+
break;
}
//ask for number of messages
case Stat: {
if (response[0] == '+') {
*stream << "STAT" << "\r\n";
- status = Mcnt;
+ status = Mcnt;
} else errorHandling(ErrLoginFailed);
break;
}
//get count of messages, eg "+OK 4 900.." -> int 4
case Mcnt: {
if (response[0] == '+') {
@@ -176,14 +179,14 @@ void PopClient::incomingData()
newMessages = temp.toInt();
messageCount = 1;
status = List;
if (synchronize) {
//messages deleted from server, reload all
- if (newMessages < lastSync)
- lastSync = 0;
+ if (newMessages < lastSync)
+ lastSync = 0;
messageCount = 1;
}
if (selected) {
int *ptr = mailList->first();
if (ptr != 0) {
@@ -270,13 +273,12 @@ void PopClient::incomingData()
}
emit downloadedSize(message.length());
int x = message.find("\r\n.\r\n",-5);
if (x == -1) {
break;
} else { //message reach entire size
-
if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active
{
emit newMessage(message, messageCount-1, mailSize, TRUE);
} else { //incomplete mail downloaded
emit newMessage(message, messageCount-1, mailSize, FALSE);
}