Diffstat (limited to 'noncore/net/mailit/popclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mailit/popclient.cpp | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp index 5da3bcb..1df6b2b 100644 --- a/noncore/net/mailit/popclient.cpp +++ b/noncore/net/mailit/popclient.cpp @@ -30,16 +30,17 @@ extern "C" { 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); - + receiving = FALSE; synchronize = FALSE; lastSync = 0; headerLimit = 0; + mailList = 0; preview = FALSE; } @@ -57,11 +58,11 @@ void PopClient::newConnection(const QString &target, int port) return; } - + status = Init; - + socket->connectToHost(target, port); receiving = TRUE; //selected = FALSE; - + emit updateStatus(tr("DNS lookup")); } @@ -71,5 +72,5 @@ void PopClient::setAccount(const QString &popUser, const QString &popPasswd) popUserName = popUser; popPassword = popPasswd; -} +} void PopClient::setSynchronize(int lastCount) @@ -124,7 +125,7 @@ void PopClient::incomingData() // return; - + response = socket->readLine(); - + switch(status) { //logging in @@ -137,5 +138,5 @@ void PopClient::incomingData() timeStamp = response.mid( start , end - start + 1); md5Source = timeStamp + popPassword; - + md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); @@ -144,5 +145,5 @@ void PopClient::incomingData() printf("%x", md5Digest[j]); } - printf("\n"); + printf("\n"); // qDebug(md5Digest); *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; @@ -157,12 +158,12 @@ void PopClient::incomingData() status = Pass; } - + break; } - + case Pass: { *stream << "PASS " << popPassword << "\r\n"; status = Stat; - + break; } @@ -171,5 +172,5 @@ void PopClient::incomingData() if (response[0] == '+') { *stream << "STAT" << "\r\n"; - status = Mcnt; + status = Mcnt; } else errorHandlingWithMsg(ErrLoginFailed, response); break; @@ -184,5 +185,5 @@ void PopClient::incomingData() messageCount = 1; status = List; - + if (synchronize) { //messages deleted from server, reload all @@ -191,11 +192,11 @@ void PopClient::incomingData() messageCount = 1; } - - if (selected) { + + if (selected && mailList ) { int *ptr = mailList->first(); if (ptr != 0) { newMessages++; //to ensure no early jumpout messageCount = *ptr; - } else newMessages = 0; + } else newMessages = 0; } @@ -225,5 +226,5 @@ void PopClient::incomingData() status = Quit; } - } + } //get size of message, eg "500 characters in message.." -> int 500 case Size: { @@ -235,5 +236,5 @@ void PopClient::incomingData() mailSize = temp.toInt(); emit currentMailSize(mailSize); - + status = Retr; } else { @@ -242,9 +243,9 @@ void PopClient::incomingData() } } - } + } //Read message number x, count upwards to messageCount case Retr: { if (status != Quit) { - if ((selected)||(mailSize <= headerLimit)) + if ((selected)||(mailSize <= headerLimit)) { *stream << "RETR " << messageCount << "\r\n"; @@ -255,5 +256,5 @@ void PopClient::incomingData() status = Ignore; break; - } } + } } case Ignore: { if (status != Quit) { //because of idiotic switch @@ -287,5 +288,5 @@ void PopClient::incomingData() emit newMessage(message, messageCount-1, mailSize, FALSE); } - + if ((messageCount > newMessages)||(selected)) //last message ? { @@ -296,5 +297,5 @@ void PopClient::incomingData() } } - else + else { *stream << "LIST " << messageCount << "\r\n"; @@ -303,5 +304,5 @@ void PopClient::incomingData() temp.setNum(messageCount - lastSync); emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); - + break; } @@ -321,5 +322,5 @@ void PopClient::incomingData() emit updateStatus(tr("No new messages")); } - + socket->close(); receiving = FALSE; |