summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp9
2 files changed, 14 insertions, 4 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 89ec7ab..ab20249 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -24,26 +24,31 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum )
24 qDebug( "IMAP: %i of %i", current, maximum ); 24 qDebug( "IMAP: %i of %i", current, maximum );
25} 25}
26 26
27void IMAPwrapper::login() 27void IMAPwrapper::login()
28{ 28{
29 const char *server, *user, *pass; 29 const char *server, *user, *pass;
30 uint16_t port; 30 uint16_t port;
31 int err = MAILIMAP_NO_ERROR; 31 int err = MAILIMAP_NO_ERROR;
32 32
33 /* we are connected this moment */ 33 /* we are connected this moment */
34 /* TODO: setup a timer holding the line or if connection closed - delete the value */ 34 /* TODO: setup a timer holding the line or if connection closed - delete the value */
35 if (m_imap) { 35 if (m_imap) {
36 mailstream_flush(m_imap->imap_stream); 36 err = mailimap_noop(m_imap);
37 return; 37 if (err!=MAILIMAP_NO_ERROR) {
38 logout();
39 } else {
40 mailstream_flush(m_imap->imap_stream);
41 return;
42 }
38 } 43 }
39 server = account->getServer().latin1(); 44 server = account->getServer().latin1();
40 port = account->getPort().toUInt(); 45 port = account->getPort().toUInt();
41 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 46 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
42 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 47 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
43 login.show(); 48 login.show();
44 if ( QDialog::Accepted == login.exec() ) { 49 if ( QDialog::Accepted == login.exec() ) {
45 // ok 50 // ok
46 user = strdup( login.getUser().latin1() ); 51 user = strdup( login.getUser().latin1() );
47 pass = strdup( login.getPassword().latin1() ); 52 pass = strdup( login.getPassword().latin1() );
48 } else { 53 } else {
49 // cancel 54 // cancel
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 89ec7ab..ab20249 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -24,26 +24,31 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum )
24 qDebug( "IMAP: %i of %i", current, maximum ); 24 qDebug( "IMAP: %i of %i", current, maximum );
25} 25}
26 26
27void IMAPwrapper::login() 27void IMAPwrapper::login()
28{ 28{
29 const char *server, *user, *pass; 29 const char *server, *user, *pass;
30 uint16_t port; 30 uint16_t port;
31 int err = MAILIMAP_NO_ERROR; 31 int err = MAILIMAP_NO_ERROR;
32 32
33 /* we are connected this moment */ 33 /* we are connected this moment */
34 /* TODO: setup a timer holding the line or if connection closed - delete the value */ 34 /* TODO: setup a timer holding the line or if connection closed - delete the value */
35 if (m_imap) { 35 if (m_imap) {
36 mailstream_flush(m_imap->imap_stream); 36 err = mailimap_noop(m_imap);
37 return; 37 if (err!=MAILIMAP_NO_ERROR) {
38 logout();
39 } else {
40 mailstream_flush(m_imap->imap_stream);
41 return;
42 }
38 } 43 }
39 server = account->getServer().latin1(); 44 server = account->getServer().latin1();
40 port = account->getPort().toUInt(); 45 port = account->getPort().toUInt();
41 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 46 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
42 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 47 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
43 login.show(); 48 login.show();
44 if ( QDialog::Accepted == login.exec() ) { 49 if ( QDialog::Accepted == login.exec() ) {
45 // ok 50 // ok
46 user = strdup( login.getUser().latin1() ); 51 user = strdup( login.getUser().latin1() );
47 pass = strdup( login.getPassword().latin1() ); 52 pass = strdup( login.getPassword().latin1() );
48 } else { 53 } else {
49 // cancel 54 // cancel