Diffstat (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 7c813cc..2df55ff 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,43 +1,45 @@ | |||
1 | #include "smtpwrapper.h" | 1 | #include "smtpwrapper.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | #include "abstractmail.h" | 3 | #include "abstractmail.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | #include "sendmailprogress.h" | 6 | #include "sendmailprogress.h" |
7 | 7 | ||
8 | //#include <opie2/odebug.h> | 8 | //#include <opie2/odebug.h> |
9 | //#include <qt.h> | 9 | //#include <qt.h> |
10 | #include <qapplication.h> | 10 | #include <qapplication.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | //Added by qt3to4: | ||
13 | #include <Q3ValueList> | ||
12 | #include <stdlib.h> | 14 | #include <stdlib.h> |
13 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
14 | //#include <qpe/config.h> | 16 | //#include <qpe/config.h> |
15 | #include <qpe/qcopenvelope_qws.h> | 17 | #include <qpe/qcopenvelope_qws.h> |
16 | #endif | 18 | #endif |
17 | #include <libetpan/libetpan.h> | 19 | #include <libetpan/libetpan.h> |
18 | #include <klocale.h> | 20 | #include <klocale.h> |
19 | #include <kglobal.h> | 21 | #include <kglobal.h> |
20 | #include <kconfig.h> | 22 | #include <kconfig.h> |
21 | 23 | ||
22 | 24 | ||
23 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
24 | progressMailSend*SMTPwrapper::sendProgress = 0; | 26 | progressMailSend*SMTPwrapper::sendProgress = 0; |
25 | 27 | ||
26 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) | 28 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) |
27 | : Generatemail() | 29 | : Generatemail() |
28 | { | 30 | { |
29 | m_SmtpAccount = aSmtp; | 31 | m_SmtpAccount = aSmtp; |
30 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); | 32 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); |
31 | cfg.setGroup( "Status" ); | 33 | cfg.setGroup( "Status" ); |
32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 34 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
33 | emit queuedMails( m_queuedMail ); | 35 | emit queuedMails( m_queuedMail ); |
34 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); | 36 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); |
35 | m_smtp = 0; | 37 | m_smtp = 0; |
36 | } | 38 | } |
37 | 39 | ||
38 | SMTPwrapper::~SMTPwrapper() | 40 | SMTPwrapper::~SMTPwrapper() |
39 | { | 41 | { |
40 | disc_server(); | 42 | disc_server(); |
41 | } | 43 | } |
42 | 44 | ||
43 | void SMTPwrapper::emitQCop( int queued ) { | 45 | void SMTPwrapper::emitQCop( int queued ) { |
@@ -405,66 +407,66 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { | |||
405 | fields = 0; | 407 | fields = 0; |
406 | } | 408 | } |
407 | if (data) { | 409 | if (data) { |
408 | delete data; | 410 | delete data; |
409 | } | 411 | } |
410 | if (from) { | 412 | if (from) { |
411 | free(from); | 413 | free(from); |
412 | } | 414 | } |
413 | if (rcpts) { | 415 | if (rcpts) { |
414 | smtp_address_list_free( rcpts ); | 416 | smtp_address_list_free( rcpts ); |
415 | } | 417 | } |
416 | return res; | 418 | return res; |
417 | } | 419 | } |
418 | 420 | ||
419 | /* this is a special fun */ | 421 | /* this is a special fun */ |
420 | bool SMTPwrapper::flushOutbox() { | 422 | bool SMTPwrapper::flushOutbox() { |
421 | bool returnValue = true; | 423 | bool returnValue = true; |
422 | 424 | ||
423 | ; // odebug << "Sending the queue" << oendl; | 425 | ; // odebug << "Sending the queue" << oendl; |
424 | if (!m_SmtpAccount) { | 426 | if (!m_SmtpAccount) { |
425 | ; // odebug << "No smtp account given" << oendl; | 427 | ; // odebug << "No smtp account given" << oendl; |
426 | return false; | 428 | return false; |
427 | } | 429 | } |
428 | 430 | ||
429 | bool reset_user_value = false; | 431 | bool reset_user_value = false; |
430 | QString localfolders = AbstractMail::defaultLocalfolder(); | 432 | QString localfolders = AbstractMail::defaultLocalfolder(); |
431 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 433 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
432 | if (!wrap) { | 434 | if (!wrap) { |
433 | ; // odebug << "memory error" << oendl; | 435 | ; // odebug << "memory error" << oendl; |
434 | return false; | 436 | return false; |
435 | } | 437 | } |
436 | QString oldPw, oldUser; | 438 | QString oldPw, oldUser; |
437 | QValueList<RecMailP> mailsToSend; | 439 | Q3ValueList<RecMailP> mailsToSend; |
438 | QValueList<RecMailP> mailsToRemove; | 440 | Q3ValueList<RecMailP> mailsToRemove; |
439 | QString mbox("Outgoing"); | 441 | QString mbox("Outgoing"); |
440 | wrap->listMessages(mbox,mailsToSend); | 442 | wrap->listMessages(mbox,mailsToSend); |
441 | if (mailsToSend.count()==0) { | 443 | if (mailsToSend.count()==0) { |
442 | delete wrap; | 444 | delete wrap; |
443 | ; // odebug << "No mails to send" << oendl; | 445 | ; // odebug << "No mails to send" << oendl; |
444 | return false; | 446 | return false; |
445 | } | 447 | } |
446 | 448 | ||
447 | oldPw = m_SmtpAccount->getPassword(); | 449 | oldPw = m_SmtpAccount->getPassword(); |
448 | oldUser = m_SmtpAccount->getUser(); | 450 | oldUser = m_SmtpAccount->getUser(); |
449 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { | 451 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { |
450 | // get'em | 452 | // get'em |
451 | QString user,pass; | 453 | QString user,pass; |
452 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); | 454 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); |
453 | login.show(); | 455 | login.show(); |
454 | if ( QDialog::Accepted == login.exec() ) { | 456 | if ( QDialog::Accepted == login.exec() ) { |
455 | // ok | 457 | // ok |
456 | user = login.getUser().latin1(); | 458 | user = login.getUser().latin1(); |
457 | pass = login.getPassword().latin1(); | 459 | pass = login.getPassword().latin1(); |
458 | reset_user_value = true; | 460 | reset_user_value = true; |
459 | m_SmtpAccount->setUser(user); | 461 | m_SmtpAccount->setUser(user); |
460 | m_SmtpAccount->setPassword(pass); | 462 | m_SmtpAccount->setPassword(pass); |
461 | } else { | 463 | } else { |
462 | return true; | 464 | return true; |
463 | } | 465 | } |
464 | } | 466 | } |
465 | 467 | ||
466 | 468 | ||
467 | sendProgress = new progressMailSend(); | 469 | sendProgress = new progressMailSend(); |
468 | sendProgress->show(); | 470 | sendProgress->show(); |
469 | sendProgress->setMaxMails(mailsToSend.count()); | 471 | sendProgress->setMaxMails(mailsToSend.count()); |
470 | 472 | ||