summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-04-15 08:07:53 (UTC)
committer groucho <groucho>2003-04-15 08:07:53 (UTC)
commitd0de397e46581f6ed5fcfad320b2b61be3858c5d (patch) (unidiff)
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()
118{ 118{
119 OContactAccess::List::Iterator it; 119 OContactAccess::List::Iterator it;
120 120
121 QString lineEmail, lineName, email, name; 121 QString lineEmail, lineName, email, name;
122 OContactAccess m_contactdb("mailit"); 122 OContactAccess m_contactdb("mailit");
123 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 123 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
124 //OContact* oc; 124 //OContact* oc;
125 125
126 for ( it = m_list.begin(); it != m_list.end(); ++it ) 126 for ( it = m_list.begin(); it != m_list.end(); ++it )
127 { 127 {
128 //oc=(OContact*) it; 128 //oc=(OContact*) it;
129 if ((*it).defaultEmail().length()!=0) 129 if ((*it).defaultEmail().length()!=0)
130 addContact((*it).defaultEmail(),(*it).fullName()); 130 addContact((*it).defaultEmail(),(*it).fileAs());
131 } 131 }
132 132
133 /*if (! f.open(IO_ReadOnly) ) 133 /*if (! f.open(IO_ReadOnly) )
134 return; 134 return;
135 135
136 QTextStream stream(&f); 136 QTextStream stream(&f);
137 137
138 while (! stream.atEnd() ) { 138 while (! stream.atEnd() ) {
139 lineEmail = stream.readLine(); 139 lineEmail = stream.readLine();
140 if (! stream.atEnd() ) 140 if (! stream.atEnd() )
141 lineName = stream.readLine(); 141 lineName = stream.readLine();
142 else return; 142 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()
523 } 523 }
524 524
525} 525}
526 526
527void EmailClient::readMail() 527void EmailClient::readMail()
528{ 528{
529 Email mail; 529 Email mail;
530 int start, stop; 530 int start, stop;
531 QString s, del; 531 QString s, del;
532 532
533 QFile f(getPath(FALSE) + "inbox.txt"); 533 QFile f(getPath(FALSE) + "inbox.txt");
534// QFileInfo fi(f); 534// QFileInfo fi(f);
535 qDebug( f.name()); 535 //qDebug( f.name());
536 536
537 if ( f.open(IO_ReadOnly) ) { // file opened successfully 537 if ( f.open(IO_ReadOnly) ) { // file opened successfully
538 QTextStream t( &f ); // use a text stream 538 QTextStream t( &f ); // use a text stream
539 s = t.read(); 539 s = t.read();
540 f.close(); 540 f.close();
541 541
542 start = 0; 542 start = 0;
543 del = "\n.\n"; 543 del = "\n.\n";
544 while ((uint) start < s.length()) { 544 while ((uint) start < s.length()) {
545 stop = s.find(del, start); 545 stop = s.find(del, start);
546 if (stop == -1) 546 if (stop == -1)
547 stop = s.length() - del.length(); 547 stop = s.length() - del.length();
@@ -577,30 +577,30 @@ void EmailClient::readMail()
577} 577}
578 578
579void EmailClient::saveMail(QString fileName, QListView *view) 579void EmailClient::saveMail(QString fileName, QListView *view)
580{ 580{
581 QFile f(fileName); 581 QFile f(fileName);
582 Email *mail; 582 Email *mail;
583 583
584 if (! f.open(IO_WriteOnly) ) { 584 if (! f.open(IO_WriteOnly) ) {
585 qWarning("could not open file"); 585 qWarning("could not open file");
586 return; 586 return;
587 } 587 }
588 item = (EmailListItem *) view->firstChild(); 588 item = (EmailListItem *) view->firstChild();
589 qDebug (QString("Write : ") ); 589 //qDebug (QString("Write : ") );
590 QTextStream t(&f); 590 QTextStream t(&f);
591 while (item != NULL) { 591 while (item != NULL) {
592 mail = item->getMail(); 592 mail = item->getMail();
593 qDebug(mail->rawMail); 593 //qDebug(mail->rawMail);
594 qDebug(mail->recipients.first()); 594 //qDebug(mail->recipients.first());
595 t << mail->rawMail; 595 t << mail->rawMail;
596 596
597 mailconf->setGroup(mail->id); 597 mailconf->setGroup(mail->id);
598 mailconf->writeEntry("mailread", mail->read); 598 mailconf->writeEntry("mailread", mail->read);
599 599
600 item = (EmailListItem *) item->nextSibling(); 600 item = (EmailListItem *) item->nextSibling();
601 } 601 }
602 f.close(); 602 f.close();
603} 603}
604 604
605//paths for mailit, is settings, inbox, enclosures 605//paths for mailit, is settings, inbox, enclosures
606QString EmailClient::getPath(bool enclosurePath) 606QString 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)
154 QString delimiter, header, body, mimeHeader, mimeBody; 154 QString delimiter, header, body, mimeHeader, mimeBody;
155 QString content, contentType, contentAttribute, id, encoding; 155 QString content, contentType, contentAttribute, id, encoding;
156 QString fileName, storedName; 156 QString fileName, storedName;
157 int enclosureId = 0; 157 int enclosureId = 0;
158 158
159 mail->rawMail = in; 159 mail->rawMail = in;
160 mail->received = TRUE; 160 mail->received = TRUE;
161 mail->files.setAutoDelete(TRUE); 161 mail->files.setAutoDelete(TRUE);
162 162
163 temp = lineShift + "." + lineShift; 163 temp = lineShift + "." + lineShift;
164 164
165 if (in.right(temp.length()) != temp) { 165 if (in.right(temp.length()) != temp) {
166 qWarning(in.right(temp.length()));
167 qWarning(" . added at end of email as separator");
168 mail->rawMail += temp; 166 mail->rawMail += temp;
169 } 167 }
170 168
171 169
172 delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" 170 delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n"
173 pos = in.find(delimiter, 0, FALSE); 171 pos = in.find(delimiter, 0, FALSE);
174 header = in.left(pos); 172 header = in.left(pos);
175 body = in.right(in.length() - pos - delimiter.length()); 173 body = in.right(in.length() - pos - delimiter.length());
176 if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) 174 if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n'))
177 body.truncate(body.length()-2); 175 body.truncate(body.length()-2);
178 176
179 TextParser p(header, lineShift); 177 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 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "mailitwindow.h" 20#include "mailitwindow.h"
21 21
22MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) 22MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
23 : QMainWindow(parent, name, fl) 23 : QMainWindow(parent, name, fl)
24{ 24{
25 currentCaption = "Mailit"; 25 currentCaption = "Mailit";
26 setCaption(tr(currentCaption)); 26 setCaption(tr(currentCaption));
27 views = new QWidgetStack(this); 27 views = new QWidgetStack(this);
28 setCentralWidget(views); 28 setCentralWidget(views);
29 29
30 qWarning("***Starting writeMail");
31 emailClient = new EmailClient(views, "client"); 30 emailClient = new EmailClient(views, "client");
32 writeMail = new WriteMail(views, "writing"); 31 writeMail = new WriteMail(views, "writing");
33 readMail = new ReadMail(views, "reading"); 32 readMail = new ReadMail(views, "reading");
34 qWarning("***Finished readMail");
35 33
36 views->raiseWidget(emailClient); 34 views->raiseWidget(emailClient);
37 35
38 connect(emailClient, SIGNAL(composeRequested()), 36 connect(emailClient, SIGNAL(composeRequested()),
39 this, SLOT(compose()) ); 37 this, SLOT(compose()) );
40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, 38 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
41 SLOT(viewMail(QListView *, Email *)) ); 39 SLOT(viewMail(QListView *, Email *)) );
42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this, 40 connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
43 SLOT(updateMailView(Email *)) ); 41 SLOT(updateMailView(Email *)) );
44 42
45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); 43 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, 44 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
@@ -51,25 +49,24 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); 49 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
52 connect(readMail, SIGNAL(replyRequested(Email &)), this, 50 connect(readMail, SIGNAL(replyRequested(Email &)), this,
53 SLOT(composeReply(Email &)) ); 51 SLOT(composeReply(Email &)) );
54 connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, 52 connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
55 SLOT(deleteMail(EmailListItem *, bool &)) ); 53 SLOT(deleteMail(EmailListItem *, bool &)) );
56 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, 54 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
57 SLOT(moveMailFront(Email *)) ); 55 SLOT(moveMailFront(Email *)) );
58 56
59 connect(emailClient, SIGNAL(newCaption(const QString &)), 57 connect(emailClient, SIGNAL(newCaption(const QString &)),
60 this, SLOT(updateCaption(const QString &)) ); 58 this, SLOT(updateCaption(const QString &)) );
61 viewingMail = FALSE; 59 viewingMail = FALSE;
62 60
63 qWarning("***Finished MailitWindow");
64} 61}
65 62
66MailItWindow::~MailItWindow() 63MailItWindow::~MailItWindow()
67{ 64{
68} 65}
69 66
70void MailItWindow::closeEvent(QCloseEvent *e) 67void MailItWindow::closeEvent(QCloseEvent *e)
71{ 68{
72 if (views->visibleWidget() == emailClient) { 69 if (views->visibleWidget() == emailClient) {
73 e->accept(); 70 e->accept();
74 } else { 71 } else {
75 showEmailClient(); 72 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)
110 110
111void PopClient::incomingData() 111void PopClient::incomingData()
112{ 112{
113 QString response, temp, temp2, timeStamp; 113 QString response, temp, temp2, timeStamp;
114 QString md5Source; 114 QString md5Source;
115 int start, end; 115 int start, end;
116// char *md5Digest; 116// char *md5Digest;
117 char md5Digest[16]; 117 char md5Digest[16];
118// if ( !socket->canReadLine() ) 118// if ( !socket->canReadLine() )
119// return; 119// return;
120 120
121 response = socket->readLine(); 121 response = socket->readLine();
122 qDebug(response +" %d", status); 122 //qDebug(response +" %d", status);
123 123
124 switch(status) { 124 switch(status) {
125 //logging in 125 //logging in
126 case Init: { 126 case Init: {
127#ifdef APOP_TEST 127#ifdef APOP_TEST
128 start = response.find('<',0); 128 start = response.find('<',0);
129 end = response.find('>', start); 129 end = response.find('>', start);
130 if( start >= 0 && end > start ) 130 if( start >= 0 && end > start )
131 { 131 {
132 timeStamp = response.mid( start , end - start + 1); 132 timeStamp = response.mid( start , end - start + 1);
133 md5Source = timeStamp + popPassword; 133 md5Source = timeStamp + popPassword;
134 qDebug( md5Source); 134 //qDebug( md5Source);
135// for( int i = 0; i < md5Source.length(); i++) { 135// for( int i = 0; i < md5Source.length(); i++) {
136// buff[i] = (QChar)md5Source[i]; 136// buff[i] = (QChar)md5Source[i];
137// } 137// }
138 138
139 md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); 139 md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]);
140// md5_buffer(char const *buffer, unsigned int len, char *digest); 140// md5_buffer(char const *buffer, unsigned int len, char *digest);
141 141
142// MD5_Init( &ctx); 142// MD5_Init( &ctx);
143// MD5_Update( &ctx, buff, sizeof( buff) ); 143// MD5_Update( &ctx, buff, sizeof( buff) );
144// MD5_Final( md5Digest, &ctx); 144// MD5_Final( md5Digest, &ctx);
145// MD5( buff, md5Source.length(), md5Digest); 145// MD5( buff, md5Source.length(), md5Digest);
146 146
@@ -183,25 +183,25 @@ void PopClient::incomingData()
183 if (response[0] == '+') { 183 if (response[0] == '+') {
184 temp = response.replace(0, 4, ""); 184 temp = response.replace(0, 4, "");
185 int x = temp.find(" ", 0); 185 int x = temp.find(" ", 0);
186 temp.truncate((uint) x); 186 temp.truncate((uint) x);
187 newMessages = temp.toInt(); 187 newMessages = temp.toInt();
188 messageCount = 1; 188 messageCount = 1;
189 status = List; 189 status = List;
190 190
191 if (synchronize) { 191 if (synchronize) {
192 //messages deleted from server, reload all 192 //messages deleted from server, reload all
193 if (newMessages < lastSync) 193 if (newMessages < lastSync)
194 lastSync = 0; 194 lastSync = 0;
195 messageCount = lastSync + 1; 195 messageCount = 1;
196 } 196 }
197 197
198 if (selected) { 198 if (selected) {
199 int *ptr = mailList->first(); 199 int *ptr = mailList->first();
200 if (ptr != 0) { 200 if (ptr != 0) {
201 newMessages++; //to ensure no early jumpout 201 newMessages++; //to ensure no early jumpout
202 messageCount = *(mailList->first()); 202 messageCount = *(mailList->first());
203 } else newMessages = 0; 203 } else newMessages = 0;
204 } 204 }
205 } else errorHandling(ErrUnknownResponse); 205 } else errorHandling(ErrUnknownResponse);
206 } 206 }
207 //Read message number x, count upwards to messageCount 207 //Read message number x, count upwards to messageCount
@@ -231,25 +231,25 @@ void PopClient::incomingData()
231 //get size of message, eg "500 characters in message.." -> int 500 231 //get size of message, eg "500 characters in message.." -> int 500
232 case Size: { 232 case Size: {
233 if (status != Quit) { //because of idiotic switch 233 if (status != Quit) { //because of idiotic switch
234 if (response[0] == '+') { 234 if (response[0] == '+') {
235 temp = response.replace(0, 4, ""); 235 temp = response.replace(0, 4, "");
236 int x = temp.find(" ", 0); 236 int x = temp.find(" ", 0);
237 temp = temp.right(temp.length() - ((uint) x + 1) ); 237 temp = temp.right(temp.length() - ((uint) x + 1) );
238 mailSize = temp.toInt(); 238 mailSize = temp.toInt();
239 emit currentMailSize(mailSize); 239 emit currentMailSize(mailSize);
240 240
241 status = Retr; 241 status = Retr;
242 } else { 242 } else {
243 qWarning(response); 243 //qWarning(response);
244 errorHandling(ErrUnknownResponse); 244 errorHandling(ErrUnknownResponse);
245 } 245 }
246 } 246 }
247 } 247 }
248 //Read message number x, count upwards to messageCount 248 //Read message number x, count upwards to messageCount
249 case Retr: { 249 case Retr: {
250 if (status != Quit) { 250 if (status != Quit) {
251 if (!preview || mailSize <= headerLimit) { 251 if (!preview || mailSize <= headerLimit) {
252 *stream << "RETR " << messageCount << "\r\n"; 252 *stream << "RETR " << messageCount << "\r\n";
253 } else { //only header 253 } else { //only header
254 *stream << "TOP " << messageCount << " 0\r\n"; 254 *stream << "TOP " << messageCount << " 0\r\n";
255 } 255 }
@@ -277,25 +277,25 @@ void PopClient::incomingData()
277 response = socket->readLine(); 277 response = socket->readLine();
278 message += response; 278 message += response;
279 } 279 }
280 emit downloadedSize(message.length()); 280 emit downloadedSize(message.length());
281 int x = message.find("\r\n.\r\n",-5); 281 int x = message.find("\r\n.\r\n",-5);
282 if (x == -1) { 282 if (x == -1) {
283 break; 283 break;
284 } else { //message reach entire size 284 } else { //message reach entire size
285 //complete mail downloaded 285 //complete mail downloaded
286 if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ 286 if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){
287 emit newMessage(message, messageCount-1, mailSize, TRUE); 287 emit newMessage(message, messageCount-1, mailSize, TRUE);
288 } else { //incomplete mail downloaded 288 } else { //incomplete mail downloaded
289 emit newMessage(message, messageCount-1, mailSize, FALSE); 289 emit newMessage(message, messageCount-1, mailSize, FALSE);
290 } 290 }
291 if (messageCount > newMessages) //that was the last message 291 if (messageCount > newMessages) //that was the last message
292 status = Quit; 292 status = Quit;
293 else { //ask for new message 293 else { //ask for new message
294 if (selected) { //grab next from queue 294 if (selected) { //grab next from queue
295 int *ptr = mailList->next(); 295 int *ptr = mailList->next();
296 if (ptr != 0) { 296 if (ptr != 0) {
297 messageCount = *ptr; 297 messageCount = *ptr;
298 *stream << "LIST " << messageCount << "\r\n"; 298 *stream << "LIST " << messageCount << "\r\n";
299 status = Size; 299 status = Size;
300 //completing a previously closed transfer 300 //completing a previously closed transfer
301 if ( (messageCount - lastSync) <= 0) { 301 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()
80 connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); 80 connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
81 plainTextButton->addTo(bar); 81 plainTextButton->addTo(bar);
82 plainTextButton->addTo(viewMenu); 82 plainTextButton->addTo(viewMenu);
83 83
84 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 84 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
85 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 85 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
86 deleteButton->addTo(bar); 86 deleteButton->addTo(bar);
87 deleteButton->addTo(mailMenu); 87 deleteButton->addTo(mailMenu);
88 88
89 viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); 89 viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));
90 90
91 emailView = new QTextView( this, "emailView" ); 91 emailView = new QTextView( this, "emailView" );
92
92 setCentralWidget(emailView); 93 setCentralWidget(emailView);
93 94
94 mime = new QMimeSourceFactory(); 95 mime = new QMimeSourceFactory();
95 emailView->setMimeSourceFactory(mime); 96 emailView->setMimeSourceFactory(mime);
96} 97}
97 98
98void ReadMail::updateView() 99void ReadMail::updateView()
99{ 100{
100 Enclosure *ePtr; 101 Enclosure *ePtr;
101 QString mailStringSize; 102 QString mailStringSize;
102 QString text, temp; 103 QString text, temp;
103 104
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)
78 mailList.clear(); 78 mailList.clear();
79 sending = FALSE; 79 sending = FALSE;
80} 80}
81 81
82void SmtpClient::incomingData() 82void SmtpClient::incomingData()
83{ 83{
84 QString response; 84 QString response;
85 85
86 if (!socket->canReadLine()) 86 if (!socket->canReadLine())
87 return; 87 return;
88 88
89 response = socket->readLine(); 89 response = socket->readLine();
90 qDebug(response); 90 //qDebug(response);
91 91
92 switch(status) { 92 switch(status) {
93 case Init: { 93 case Init: {
94 if (response[0] == '2') { 94 if (response[0] == '2') {
95 status = From; 95 status = From;
96 mailPtr = mailList.first(); 96 mailPtr = mailList.first();
97 *stream << "HELO there\r\n"; 97 *stream << "HELO there\r\n";
98 qDebug("HELO"); 98 //qDebug("HELO");
99 } else errorHandling(ErrUnknownResponse); 99 } else errorHandling(ErrUnknownResponse);
100 break; 100 break;
101 } 101 }
102 case From: { 102 case From: {
103 if (response[0] == '2') { 103 if (response[0] == '2') {
104 *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; 104 *stream << "MAIL FROM: " << mailPtr->from << "\r\n";
105 status = Recv; 105 status = Recv;
106 qDebug("MAIL FROM: "+mailPtr->from); 106 //qDebug("MAIL FROM: "+mailPtr->from);
107 } else errorHandling(ErrUnknownResponse); 107 } else errorHandling(ErrUnknownResponse);
108 break; 108 break;
109 } 109 }
110 case Recv: { 110 case Recv: {
111 if (response[0] == '2') { 111 if (response[0] == '2') {
112 it = mailPtr->to.begin(); 112 it = mailPtr->to.begin();
113 if (it == NULL) 113 if (it == NULL)
114 errorHandling(ErrUnknownResponse); 114 errorHandling(ErrUnknownResponse);
115 *stream << "RCPT TO: <" << *it << ">\r\n"; 115 *stream << "RCPT TO: " << *it << ">\r\n";
116 qDebug("RCPT TO: "+ *it); 116 //qDebug("RCPT TO: "+ *it);
117 status = MRcv; 117 status = MRcv;
118 } else errorHandling(ErrUnknownResponse); 118 } else errorHandling(ErrUnknownResponse);
119 break; 119 break;
120 } 120 }
121 case MRcv: { 121 case MRcv: {
122 if (response[0] == '2') { 122 if (response[0] == '2') {
123 it++; 123 it++;
124 if ( it != mailPtr->to.end() ) { 124 if ( it != mailPtr->to.end() ) {
125 *stream << "RCPT TO: <" << *it << ">\r\n"; 125 *stream << "RCPT TO: <" << *it << ">\r\n";
126 qDebug("RCPT TO: "+ *it); 126 //qDebug("RCPT TO: "+ *it);
127 break; 127 break;
128 } else { 128 } else {
129 status = Data; 129 status = Data;
130 } 130 }
131 } else errorHandling(ErrUnknownResponse); 131 } else errorHandling(ErrUnknownResponse);
132 } 132 }
133 case Data: { 133 case Data: {
134 if (response[0] == '2') { 134 if (response[0] == '2') {
135 *stream << "DATA\r\n"; 135 *stream << "DATA\r\n";
136 status = Body; 136 status = Body;
137 qDebug("DATA"); 137 //qDebug("DATA");
138 emit updateStatus(tr("Sending: ") + mailPtr->subject); 138 emit updateStatus(tr("Sending: ") + mailPtr->subject);
139 } else errorHandling(ErrUnknownResponse); 139 } else errorHandling(ErrUnknownResponse);
140 break; 140 break;
141 } 141 }
142 case Body: { 142 case Body: {
143 if (response[0] == '3') { 143 if (response[0] == '3') {
144 *stream << mailPtr->body << "\r\n.\r\n"; 144 *stream << mailPtr->body << "\r\n.\r\n";
145 mailPtr = mailList.next(); 145 mailPtr = mailList.next();
146 if (mailPtr != NULL) { 146 if (mailPtr != NULL) {
147 status = From; 147 status = From;
148 } else { 148 } else {
149 status = Quit; 149 status = Quit;
150 } 150 }
151 qDebug("BODY"); 151 //qDebug("BODY");
152 } else errorHandling(ErrUnknownResponse); 152 } else errorHandling(ErrUnknownResponse);
153 break; 153 break;
154 } 154 }
155 case Quit: { 155 case Quit: {
156 if (response[0] == '2') { 156 if (response[0] == '2') {
157 *stream << "QUIT\r\n"; 157 *stream << "QUIT\r\n";
158 status = Done; 158 status = Done;
159 QString temp; 159 QString temp;
160 temp.setNum(mailList.count()); 160 temp.setNum(mailList.count());
161 emit updateStatus(tr("Sent ") + temp + tr(" messages")); 161 emit updateStatus(tr("Sent ") + temp + tr(" messages"));
162 emit mailSent(); 162 emit mailSent();
163 mailList.clear(); 163 mailList.clear();
164 sending = FALSE; 164 sending = FALSE;
165 socket->close(); 165 socket->close();
166 qDebug("QUIT"); 166 //qDebug("QUIT");
167 } else errorHandling(ErrUnknownResponse); 167 } else errorHandling(ErrUnknownResponse);
168 break; 168 break;
169 } 169 }
170 } 170 }
171} 171}
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()
118{ 118{
119 OContactAccess::List::Iterator it; 119 OContactAccess::List::Iterator it;
120 120
121 QString lineEmail, lineName, email, name; 121 QString lineEmail, lineName, email, name;
122 OContactAccess m_contactdb("mailit"); 122 OContactAccess m_contactdb("mailit");
123 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 123 OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
124 //OContact* oc; 124 //OContact* oc;
125 125
126 for ( it = m_list.begin(); it != m_list.end(); ++it ) 126 for ( it = m_list.begin(); it != m_list.end(); ++it )
127 { 127 {
128 //oc=(OContact*) it; 128 //oc=(OContact*) it;
129 if ((*it).defaultEmail().length()!=0) 129 if ((*it).defaultEmail().length()!=0)
130 addContact((*it).defaultEmail(),(*it).fullName()); 130 addContact((*it).defaultEmail(),(*it).fileAs());
131 } 131 }
132 132
133 /*if (! f.open(IO_ReadOnly) ) 133 /*if (! f.open(IO_ReadOnly) )
134 return; 134 return;
135 135
136 QTextStream stream(&f); 136 QTextStream stream(&f);
137 137
138 while (! stream.atEnd() ) { 138 while (! stream.atEnd() ) {
139 lineEmail = stream.readLine(); 139 lineEmail = stream.readLine();
140 if (! stream.atEnd() ) 140 if (! stream.atEnd() )
141 lineName = stream.readLine(); 141 lineName = stream.readLine();
142 else return; 142 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()
523 } 523 }
524 524
525} 525}
526 526
527void EmailClient::readMail() 527void EmailClient::readMail()
528{ 528{
529 Email mail; 529 Email mail;
530 int start, stop; 530 int start, stop;
531 QString s, del; 531 QString s, del;
532 532
533 QFile f(getPath(FALSE) + "inbox.txt"); 533 QFile f(getPath(FALSE) + "inbox.txt");
534// QFileInfo fi(f); 534// QFileInfo fi(f);
535 qDebug( f.name()); 535 //qDebug( f.name());
536 536
537 if ( f.open(IO_ReadOnly) ) { // file opened successfully 537 if ( f.open(IO_ReadOnly) ) { // file opened successfully
538 QTextStream t( &f ); // use a text stream 538 QTextStream t( &f ); // use a text stream
539 s = t.read(); 539 s = t.read();
540 f.close(); 540 f.close();
541 541
542 start = 0; 542 start = 0;
543 del = "\n.\n"; 543 del = "\n.\n";
544 while ((uint) start < s.length()) { 544 while ((uint) start < s.length()) {
545 stop = s.find(del, start); 545 stop = s.find(del, start);
546 if (stop == -1) 546 if (stop == -1)
547 stop = s.length() - del.length(); 547 stop = s.length() - del.length();
@@ -577,30 +577,30 @@ void EmailClient::readMail()
577} 577}
578 578
579void EmailClient::saveMail(QString fileName, QListView *view) 579void EmailClient::saveMail(QString fileName, QListView *view)
580{ 580{
581 QFile f(fileName); 581 QFile f(fileName);
582 Email *mail; 582 Email *mail;
583 583
584 if (! f.open(IO_WriteOnly) ) { 584 if (! f.open(IO_WriteOnly) ) {
585 qWarning("could not open file"); 585 qWarning("could not open file");
586 return; 586 return;
587 } 587 }
588 item = (EmailListItem *) view->firstChild(); 588 item = (EmailListItem *) view->firstChild();
589 qDebug (QString("Write : ") ); 589 //qDebug (QString("Write : ") );
590 QTextStream t(&f); 590 QTextStream t(&f);
591 while (item != NULL) { 591 while (item != NULL) {
592 mail = item->getMail(); 592 mail = item->getMail();
593 qDebug(mail->rawMail); 593 //qDebug(mail->rawMail);
594 qDebug(mail->recipients.first()); 594 //qDebug(mail->recipients.first());
595 t << mail->rawMail; 595 t << mail->rawMail;
596 596
597 mailconf->setGroup(mail->id); 597 mailconf->setGroup(mail->id);
598 mailconf->writeEntry("mailread", mail->read); 598 mailconf->writeEntry("mailread", mail->read);
599 599
600 item = (EmailListItem *) item->nextSibling(); 600 item = (EmailListItem *) item->nextSibling();
601 } 601 }
602 f.close(); 602 f.close();
603} 603}
604 604
605//paths for mailit, is settings, inbox, enclosures 605//paths for mailit, is settings, inbox, enclosures
606QString EmailClient::getPath(bool enclosurePath) 606QString 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)
154 QString delimiter, header, body, mimeHeader, mimeBody; 154 QString delimiter, header, body, mimeHeader, mimeBody;
155 QString content, contentType, contentAttribute, id, encoding; 155 QString content, contentType, contentAttribute, id, encoding;
156 QString fileName, storedName; 156 QString fileName, storedName;
157 int enclosureId = 0; 157 int enclosureId = 0;
158 158
159 mail->rawMail = in; 159 mail->rawMail = in;
160 mail->received = TRUE; 160 mail->received = TRUE;
161 mail->files.setAutoDelete(TRUE); 161 mail->files.setAutoDelete(TRUE);
162 162
163 temp = lineShift + "." + lineShift; 163 temp = lineShift + "." + lineShift;
164 164
165 if (in.right(temp.length()) != temp) { 165 if (in.right(temp.length()) != temp) {
166 qWarning(in.right(temp.length()));
167 qWarning(" . added at end of email as separator");
168 mail->rawMail += temp; 166 mail->rawMail += temp;
169 } 167 }
170 168
171 169
172 delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" 170 delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n"
173 pos = in.find(delimiter, 0, FALSE); 171 pos = in.find(delimiter, 0, FALSE);
174 header = in.left(pos); 172 header = in.left(pos);
175 body = in.right(in.length() - pos - delimiter.length()); 173 body = in.right(in.length() - pos - delimiter.length());
176 if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) 174 if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n'))
177 body.truncate(body.length()-2); 175 body.truncate(body.length()-2);
178 176
179 TextParser p(header, lineShift); 177 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 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "mailitwindow.h" 20#include "mailitwindow.h"
21 21
22MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) 22MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
23 : QMainWindow(parent, name, fl) 23 : QMainWindow(parent, name, fl)
24{ 24{
25 currentCaption = "Mailit"; 25 currentCaption = "Mailit";
26 setCaption(tr(currentCaption)); 26 setCaption(tr(currentCaption));
27 views = new QWidgetStack(this); 27 views = new QWidgetStack(this);
28 setCentralWidget(views); 28 setCentralWidget(views);
29 29
30 qWarning("***Starting writeMail");
31 emailClient = new EmailClient(views, "client"); 30 emailClient = new EmailClient(views, "client");
32 writeMail = new WriteMail(views, "writing"); 31 writeMail = new WriteMail(views, "writing");
33 readMail = new ReadMail(views, "reading"); 32 readMail = new ReadMail(views, "reading");
34 qWarning("***Finished readMail");
35 33
36 views->raiseWidget(emailClient); 34 views->raiseWidget(emailClient);
37 35
38 connect(emailClient, SIGNAL(composeRequested()), 36 connect(emailClient, SIGNAL(composeRequested()),
39 this, SLOT(compose()) ); 37 this, SLOT(compose()) );
40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, 38 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
41 SLOT(viewMail(QListView *, Email *)) ); 39 SLOT(viewMail(QListView *, Email *)) );
42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this, 40 connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
43 SLOT(updateMailView(Email *)) ); 41 SLOT(updateMailView(Email *)) );
44 42
45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); 43 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, 44 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
@@ -51,25 +49,24 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); 49 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
52 connect(readMail, SIGNAL(replyRequested(Email &)), this, 50 connect(readMail, SIGNAL(replyRequested(Email &)), this,
53 SLOT(composeReply(Email &)) ); 51 SLOT(composeReply(Email &)) );
54 connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, 52 connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
55 SLOT(deleteMail(EmailListItem *, bool &)) ); 53 SLOT(deleteMail(EmailListItem *, bool &)) );
56 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, 54 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
57 SLOT(moveMailFront(Email *)) ); 55 SLOT(moveMailFront(Email *)) );
58 56
59 connect(emailClient, SIGNAL(newCaption(const QString &)), 57 connect(emailClient, SIGNAL(newCaption(const QString &)),
60 this, SLOT(updateCaption(const QString &)) ); 58 this, SLOT(updateCaption(const QString &)) );
61 viewingMail = FALSE; 59 viewingMail = FALSE;
62 60
63 qWarning("***Finished MailitWindow");
64} 61}
65 62
66MailItWindow::~MailItWindow() 63MailItWindow::~MailItWindow()
67{ 64{
68} 65}
69 66
70void MailItWindow::closeEvent(QCloseEvent *e) 67void MailItWindow::closeEvent(QCloseEvent *e)
71{ 68{
72 if (views->visibleWidget() == emailClient) { 69 if (views->visibleWidget() == emailClient) {
73 e->accept(); 70 e->accept();
74 } else { 71 } else {
75 showEmailClient(); 72 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)
110 110
111void PopClient::incomingData() 111void PopClient::incomingData()
112{ 112{
113 QString response, temp, temp2, timeStamp; 113 QString response, temp, temp2, timeStamp;
114 QString md5Source; 114 QString md5Source;
115 int start, end; 115 int start, end;
116// char *md5Digest; 116// char *md5Digest;
117 char md5Digest[16]; 117 char md5Digest[16];
118// if ( !socket->canReadLine() ) 118// if ( !socket->canReadLine() )
119// return; 119// return;
120 120
121 response = socket->readLine(); 121 response = socket->readLine();
122 qDebug(response +" %d", status); 122 //qDebug(response +" %d", status);
123 123
124 switch(status) { 124 switch(status) {
125 //logging in 125 //logging in
126 case Init: { 126 case Init: {
127#ifdef APOP_TEST 127#ifdef APOP_TEST
128 start = response.find('<',0); 128 start = response.find('<',0);
129 end = response.find('>', start); 129 end = response.find('>', start);
130 if( start >= 0 && end > start ) 130 if( start >= 0 && end > start )
131 { 131 {
132 timeStamp = response.mid( start , end - start + 1); 132 timeStamp = response.mid( start , end - start + 1);
133 md5Source = timeStamp + popPassword; 133 md5Source = timeStamp + popPassword;
134 qDebug( md5Source); 134 //qDebug( md5Source);
135// for( int i = 0; i < md5Source.length(); i++) { 135// for( int i = 0; i < md5Source.length(); i++) {
136// buff[i] = (QChar)md5Source[i]; 136// buff[i] = (QChar)md5Source[i];
137// } 137// }
138 138
139 md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); 139 md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]);
140// md5_buffer(char const *buffer, unsigned int len, char *digest); 140// md5_buffer(char const *buffer, unsigned int len, char *digest);
141 141
142// MD5_Init( &ctx); 142// MD5_Init( &ctx);
143// MD5_Update( &ctx, buff, sizeof( buff) ); 143// MD5_Update( &ctx, buff, sizeof( buff) );
144// MD5_Final( md5Digest, &ctx); 144// MD5_Final( md5Digest, &ctx);
145// MD5( buff, md5Source.length(), md5Digest); 145// MD5( buff, md5Source.length(), md5Digest);
146 146
@@ -183,25 +183,25 @@ void PopClient::incomingData()
183 if (response[0] == '+') { 183 if (response[0] == '+') {
184 temp = response.replace(0, 4, ""); 184 temp = response.replace(0, 4, "");
185 int x = temp.find(" ", 0); 185 int x = temp.find(" ", 0);
186 temp.truncate((uint) x); 186 temp.truncate((uint) x);
187 newMessages = temp.toInt(); 187 newMessages = temp.toInt();
188 messageCount = 1; 188 messageCount = 1;
189 status = List; 189 status = List;
190 190
191 if (synchronize) { 191 if (synchronize) {
192 //messages deleted from server, reload all 192 //messages deleted from server, reload all
193 if (newMessages < lastSync) 193 if (newMessages < lastSync)
194 lastSync = 0; 194 lastSync = 0;
195 messageCount = lastSync + 1; 195 messageCount = 1;
196 } 196 }
197 197
198 if (selected) { 198 if (selected) {
199 int *ptr = mailList->first(); 199 int *ptr = mailList->first();
200 if (ptr != 0) { 200 if (ptr != 0) {
201 newMessages++; //to ensure no early jumpout 201 newMessages++; //to ensure no early jumpout
202 messageCount = *(mailList->first()); 202 messageCount = *(mailList->first());
203 } else newMessages = 0; 203 } else newMessages = 0;
204 } 204 }
205 } else errorHandling(ErrUnknownResponse); 205 } else errorHandling(ErrUnknownResponse);
206 } 206 }
207 //Read message number x, count upwards to messageCount 207 //Read message number x, count upwards to messageCount
@@ -231,25 +231,25 @@ void PopClient::incomingData()
231 //get size of message, eg "500 characters in message.." -> int 500 231 //get size of message, eg "500 characters in message.." -> int 500
232 case Size: { 232 case Size: {
233 if (status != Quit) { //because of idiotic switch 233 if (status != Quit) { //because of idiotic switch
234 if (response[0] == '+') { 234 if (response[0] == '+') {
235 temp = response.replace(0, 4, ""); 235 temp = response.replace(0, 4, "");
236 int x = temp.find(" ", 0); 236 int x = temp.find(" ", 0);
237 temp = temp.right(temp.length() - ((uint) x + 1) ); 237 temp = temp.right(temp.length() - ((uint) x + 1) );
238 mailSize = temp.toInt(); 238 mailSize = temp.toInt();
239 emit currentMailSize(mailSize); 239 emit currentMailSize(mailSize);
240 240
241 status = Retr; 241 status = Retr;
242 } else { 242 } else {
243 qWarning(response); 243 //qWarning(response);
244 errorHandling(ErrUnknownResponse); 244 errorHandling(ErrUnknownResponse);
245 } 245 }
246 } 246 }
247 } 247 }
248 //Read message number x, count upwards to messageCount 248 //Read message number x, count upwards to messageCount
249 case Retr: { 249 case Retr: {
250 if (status != Quit) { 250 if (status != Quit) {
251 if (!preview || mailSize <= headerLimit) { 251 if (!preview || mailSize <= headerLimit) {
252 *stream << "RETR " << messageCount << "\r\n"; 252 *stream << "RETR " << messageCount << "\r\n";
253 } else { //only header 253 } else { //only header
254 *stream << "TOP " << messageCount << " 0\r\n"; 254 *stream << "TOP " << messageCount << " 0\r\n";
255 } 255 }
@@ -277,25 +277,25 @@ void PopClient::incomingData()
277 response = socket->readLine(); 277 response = socket->readLine();
278 message += response; 278 message += response;
279 } 279 }
280 emit downloadedSize(message.length()); 280 emit downloadedSize(message.length());
281 int x = message.find("\r\n.\r\n",-5); 281 int x = message.find("\r\n.\r\n",-5);
282 if (x == -1) { 282 if (x == -1) {
283 break; 283 break;
284 } else { //message reach entire size 284 } else { //message reach entire size
285 //complete mail downloaded 285 //complete mail downloaded
286 if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ 286 if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){
287 emit newMessage(message, messageCount-1, mailSize, TRUE); 287 emit newMessage(message, messageCount-1, mailSize, TRUE);
288 } else { //incomplete mail downloaded 288 } else { //incomplete mail downloaded
289 emit newMessage(message, messageCount-1, mailSize, FALSE); 289 emit newMessage(message, messageCount-1, mailSize, FALSE);
290 } 290 }
291 if (messageCount > newMessages) //that was the last message 291 if (messageCount > newMessages) //that was the last message
292 status = Quit; 292 status = Quit;
293 else { //ask for new message 293 else { //ask for new message
294 if (selected) { //grab next from queue 294 if (selected) { //grab next from queue
295 int *ptr = mailList->next(); 295 int *ptr = mailList->next();
296 if (ptr != 0) { 296 if (ptr != 0) {
297 messageCount = *ptr; 297 messageCount = *ptr;
298 *stream << "LIST " << messageCount << "\r\n"; 298 *stream << "LIST " << messageCount << "\r\n";
299 status = Size; 299 status = Size;
300 //completing a previously closed transfer 300 //completing a previously closed transfer
301 if ( (messageCount - lastSync) <= 0) { 301 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()
80 connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); 80 connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
81 plainTextButton->addTo(bar); 81 plainTextButton->addTo(bar);
82 plainTextButton->addTo(viewMenu); 82 plainTextButton->addTo(viewMenu);
83 83
84 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); 84 deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
85 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); 85 connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
86 deleteButton->addTo(bar); 86 deleteButton->addTo(bar);
87 deleteButton->addTo(mailMenu); 87 deleteButton->addTo(mailMenu);
88 88
89 viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); 89 viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));
90 90
91 emailView = new QTextView( this, "emailView" ); 91 emailView = new QTextView( this, "emailView" );
92
92 setCentralWidget(emailView); 93 setCentralWidget(emailView);
93 94
94 mime = new QMimeSourceFactory(); 95 mime = new QMimeSourceFactory();
95 emailView->setMimeSourceFactory(mime); 96 emailView->setMimeSourceFactory(mime);
96} 97}
97 98
98void ReadMail::updateView() 99void ReadMail::updateView()
99{ 100{
100 Enclosure *ePtr; 101 Enclosure *ePtr;
101 QString mailStringSize; 102 QString mailStringSize;
102 QString text, temp; 103 QString text, temp;
103 104
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)
78 mailList.clear(); 78 mailList.clear();
79 sending = FALSE; 79 sending = FALSE;
80} 80}
81 81
82void SmtpClient::incomingData() 82void SmtpClient::incomingData()
83{ 83{
84 QString response; 84 QString response;
85 85
86 if (!socket->canReadLine()) 86 if (!socket->canReadLine())
87 return; 87 return;
88 88
89 response = socket->readLine(); 89 response = socket->readLine();
90 qDebug(response); 90 //qDebug(response);
91 91
92 switch(status) { 92 switch(status) {
93 case Init: { 93 case Init: {
94 if (response[0] == '2') { 94 if (response[0] == '2') {
95 status = From; 95 status = From;
96 mailPtr = mailList.first(); 96 mailPtr = mailList.first();
97 *stream << "HELO there\r\n"; 97 *stream << "HELO there\r\n";
98 qDebug("HELO"); 98 //qDebug("HELO");
99 } else errorHandling(ErrUnknownResponse); 99 } else errorHandling(ErrUnknownResponse);
100 break; 100 break;
101 } 101 }
102 case From: { 102 case From: {
103 if (response[0] == '2') { 103 if (response[0] == '2') {
104 *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; 104 *stream << "MAIL FROM: " << mailPtr->from << "\r\n";
105 status = Recv; 105 status = Recv;
106 qDebug("MAIL FROM: "+mailPtr->from); 106 //qDebug("MAIL FROM: "+mailPtr->from);
107 } else errorHandling(ErrUnknownResponse); 107 } else errorHandling(ErrUnknownResponse);
108 break; 108 break;
109 } 109 }
110 case Recv: { 110 case Recv: {
111 if (response[0] == '2') { 111 if (response[0] == '2') {
112 it = mailPtr->to.begin(); 112 it = mailPtr->to.begin();
113 if (it == NULL) 113 if (it == NULL)
114 errorHandling(ErrUnknownResponse); 114 errorHandling(ErrUnknownResponse);
115 *stream << "RCPT TO: <" << *it << ">\r\n"; 115 *stream << "RCPT TO: " << *it << ">\r\n";
116 qDebug("RCPT TO: "+ *it); 116 //qDebug("RCPT TO: "+ *it);
117 status = MRcv; 117 status = MRcv;
118 } else errorHandling(ErrUnknownResponse); 118 } else errorHandling(ErrUnknownResponse);
119 break; 119 break;
120 } 120 }
121 case MRcv: { 121 case MRcv: {
122 if (response[0] == '2') { 122 if (response[0] == '2') {
123 it++; 123 it++;
124 if ( it != mailPtr->to.end() ) { 124 if ( it != mailPtr->to.end() ) {
125 *stream << "RCPT TO: <" << *it << ">\r\n"; 125 *stream << "RCPT TO: <" << *it << ">\r\n";
126 qDebug("RCPT TO: "+ *it); 126 //qDebug("RCPT TO: "+ *it);
127 break; 127 break;
128 } else { 128 } else {
129 status = Data; 129 status = Data;
130 } 130 }
131 } else errorHandling(ErrUnknownResponse); 131 } else errorHandling(ErrUnknownResponse);
132 } 132 }
133 case Data: { 133 case Data: {
134 if (response[0] == '2') { 134 if (response[0] == '2') {
135 *stream << "DATA\r\n"; 135 *stream << "DATA\r\n";
136 status = Body; 136 status = Body;
137 qDebug("DATA"); 137 //qDebug("DATA");
138 emit updateStatus(tr("Sending: ") + mailPtr->subject); 138 emit updateStatus(tr("Sending: ") + mailPtr->subject);
139 } else errorHandling(ErrUnknownResponse); 139 } else errorHandling(ErrUnknownResponse);
140 break; 140 break;
141 } 141 }
142 case Body: { 142 case Body: {
143 if (response[0] == '3') { 143 if (response[0] == '3') {
144 *stream << mailPtr->body << "\r\n.\r\n"; 144 *stream << mailPtr->body << "\r\n.\r\n";
145 mailPtr = mailList.next(); 145 mailPtr = mailList.next();
146 if (mailPtr != NULL) { 146 if (mailPtr != NULL) {
147 status = From; 147 status = From;
148 } else { 148 } else {
149 status = Quit; 149 status = Quit;
150 } 150 }
151 qDebug("BODY"); 151 //qDebug("BODY");
152 } else errorHandling(ErrUnknownResponse); 152 } else errorHandling(ErrUnknownResponse);
153 break; 153 break;
154 } 154 }
155 case Quit: { 155 case Quit: {
156 if (response[0] == '2') { 156 if (response[0] == '2') {
157 *stream << "QUIT\r\n"; 157 *stream << "QUIT\r\n";
158 status = Done; 158 status = Done;
159 QString temp; 159 QString temp;
160 temp.setNum(mailList.count()); 160 temp.setNum(mailList.count());
161 emit updateStatus(tr("Sent ") + temp + tr(" messages")); 161 emit updateStatus(tr("Sent ") + temp + tr(" messages"));
162 emit mailSent(); 162 emit mailSent();
163 mailList.clear(); 163 mailList.clear();
164 sending = FALSE; 164 sending = FALSE;
165 socket->close(); 165 socket->close();
166 qDebug("QUIT"); 166 //qDebug("QUIT");
167 } else errorHandling(ErrUnknownResponse); 167 } else errorHandling(ErrUnknownResponse);
168 break; 168 break;
169 } 169 }
170 } 170 }
171} 171}