Diffstat (limited to 'noncore/unsupported/mailit/popclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/popclient.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index 6105d09..fedc4e2 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp | |||
@@ -26,12 +26,13 @@ extern "C" { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | #include <qcstring.h> | 28 | #include <qcstring.h> |
29 | 29 | ||
30 | PopClient::PopClient() | 30 | PopClient::PopClient() |
31 | { | 31 | { |
32 | |||
32 | socket = new QSocket(this, "popClient"); | 33 | socket = new QSocket(this, "popClient"); |
33 | connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); | 34 | connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); |
34 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); | 35 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); |
35 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); | 36 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); |
36 | 37 | ||
37 | stream = new QTextStream(socket); | 38 | stream = new QTextStream(socket); |
@@ -114,12 +115,13 @@ void PopClient::incomingData() | |||
114 | QString md5Source; | 115 | QString md5Source; |
115 | int start, end; | 116 | int start, end; |
116 | // char *md5Digest; | 117 | // char *md5Digest; |
117 | char md5Digest[16]; | 118 | char md5Digest[16]; |
118 | // if ( !socket->canReadLine() ) | 119 | // if ( !socket->canReadLine() ) |
119 | // return; | 120 | // return; |
121 | |||
120 | 122 | ||
121 | response = socket->readLine(); | 123 | response = socket->readLine(); |
122 | 124 | ||
123 | switch(status) { | 125 | switch(status) { |
124 | //logging in | 126 | //logging in |
125 | case Init: { | 127 | case Init: { |
@@ -148,25 +150,26 @@ void PopClient::incomingData() | |||
148 | { | 150 | { |
149 | timeStamp = ""; | 151 | timeStamp = ""; |
150 | *stream << "USER " << popUserName << "\r\n"; | 152 | *stream << "USER " << popUserName << "\r\n"; |
151 | status = Pass; | 153 | status = Pass; |
152 | } | 154 | } |
153 | 155 | ||
154 | break; | 156 | break; |
155 | } | 157 | } |
156 | 158 | ||
157 | case Pass: { | 159 | case Pass: { |
158 | *stream << "PASS " << popPassword << "\r\n"; | 160 | *stream << "PASS " << popPassword << "\r\n"; |
159 | status = Stat; | 161 | status = Stat; |
162 | |||
160 | break; | 163 | break; |
161 | } | 164 | } |
162 | //ask for number of messages | 165 | //ask for number of messages |
163 | case Stat: { | 166 | case Stat: { |
164 | if (response[0] == '+') { | 167 | if (response[0] == '+') { |
165 | *stream << "STAT" << "\r\n"; | 168 | *stream << "STAT" << "\r\n"; |
166 | status = Mcnt; | 169 | status = Mcnt; |
167 | } else errorHandling(ErrLoginFailed); | 170 | } else errorHandling(ErrLoginFailed); |
168 | break; | 171 | break; |
169 | } | 172 | } |
170 | //get count of messages, eg "+OK 4 900.." -> int 4 | 173 | //get count of messages, eg "+OK 4 900.." -> int 4 |
171 | case Mcnt: { | 174 | case Mcnt: { |
172 | if (response[0] == '+') { | 175 | if (response[0] == '+') { |
@@ -176,14 +179,14 @@ void PopClient::incomingData() | |||
176 | newMessages = temp.toInt(); | 179 | newMessages = temp.toInt(); |
177 | messageCount = 1; | 180 | messageCount = 1; |
178 | status = List; | 181 | status = List; |
179 | 182 | ||
180 | if (synchronize) { | 183 | if (synchronize) { |
181 | //messages deleted from server, reload all | 184 | //messages deleted from server, reload all |
182 | if (newMessages < lastSync) | 185 | if (newMessages < lastSync) |
183 | lastSync = 0; | 186 | lastSync = 0; |
184 | messageCount = 1; | 187 | messageCount = 1; |
185 | } | 188 | } |
186 | 189 | ||
187 | if (selected) { | 190 | if (selected) { |
188 | int *ptr = mailList->first(); | 191 | int *ptr = mailList->first(); |
189 | if (ptr != 0) { | 192 | if (ptr != 0) { |
@@ -270,13 +273,12 @@ void PopClient::incomingData() | |||
270 | } | 273 | } |
271 | emit downloadedSize(message.length()); | 274 | emit downloadedSize(message.length()); |
272 | int x = message.find("\r\n.\r\n",-5); | 275 | int x = message.find("\r\n.\r\n",-5); |
273 | if (x == -1) { | 276 | if (x == -1) { |
274 | break; | 277 | break; |
275 | } else { //message reach entire size | 278 | } else { //message reach entire size |
276 | |||
277 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active | 279 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active |
278 | { | 280 | { |
279 | emit newMessage(message, messageCount-1, mailSize, TRUE); | 281 | emit newMessage(message, messageCount-1, mailSize, TRUE); |
280 | } else { //incomplete mail downloaded | 282 | } else { //incomplete mail downloaded |
281 | emit newMessage(message, messageCount-1, mailSize, FALSE); | 283 | emit newMessage(message, messageCount-1, mailSize, FALSE); |
282 | } | 284 | } |