summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/imapwrapper.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 09e52b8..4f0c849 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -38,25 +38,24 @@ int IMAPwrapper::selectMbox(const QString&mbox)
38 } 38 }
39 int err = mailimap_select( m_imap, (char*)mbox.latin1()); 39 int err = mailimap_select( m_imap, (char*)mbox.latin1());
40 if ( err != MAILIMAP_NO_ERROR ) { 40 if ( err != MAILIMAP_NO_ERROR ) {
41 m_Lastmbox = ""; 41 m_Lastmbox = "";
42 return err; 42 return err;
43 } 43 }
44 m_Lastmbox = mbox; 44 m_Lastmbox = mbox;
45 return err; 45 return err;
46} 46}
47 47
48void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 48void IMAPwrapper::imap_progress( size_t current, size_t maximum )
49{ 49{
50 qApp->processEvents();
51 return; 50 return;
52 //qDebug("imap progress %d of %d ",current,maximum ); 51 //qDebug("imap progress %d of %d ",current,maximum );
53 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); 52 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
54 //qApp->processEvents() 53 //qApp->processEvents()
55 static unsigned int last = 0; 54 static unsigned int last = 0;
56 if ( last != current ) 55 if ( last != current )
57 IMAPwrapper::progress(); 56 IMAPwrapper::progress();
58 last = current; 57 last = current;
59} 58}
60void IMAPwrapper::progress( QString m ) 59void IMAPwrapper::progress( QString m )
61{ 60{
62 static QString mProgrMess; 61 static QString mProgrMess;
@@ -149,43 +148,42 @@ void IMAPwrapper::login(bool tryTLS) // = true)
149 if ( QDialog::Accepted == login.exec() ) { 148 if ( QDialog::Accepted == login.exec() ) {
150 // ok 149 // ok
151 user = login.getUser(); 150 user = login.getUser();
152 pass = login.getPassword(); 151 pass = login.getPassword();
153 } else { 152 } else {
154 // cancel 153 // cancel
155 return; 154 return;
156 } 155 }
157 } else { 156 } else {
158 user = account->getUser(); 157 user = account->getUser();
159 pass = account->getPassword(); 158 pass = account->getPassword();
160 } 159 }
161
162 m_imap = mailimap_new( 20, &imap_progress ); 160 m_imap = mailimap_new( 20, &imap_progress );
163 161
164 /* connect */ 162 /* connect */
165 bool ssl = false; 163 bool ssl = false;
166 bool try_tls = false; 164 bool try_tls = false;
167 bool force_tls = false; 165 bool force_tls = false;
168 166
169 if ( account->ConnectionType() == 2 ) { 167 if ( account->ConnectionType() == 2 ) {
170 ssl = true; 168 ssl = true;
171 } 169 }
172 if (account->ConnectionType()==1) { 170 if (account->ConnectionType()==1) {
173 force_tls = true; 171 force_tls = true;
174 } 172 }
175 173
176 if ( ssl ) { 174 if ( ssl ) {
177 qDebug("using ssl "); 175 //qDebug("using ssl ");
178 err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); 176 err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port );
179 qDebug("back "); 177 //qDebug("back ");
180 } else { 178 } else {
181 err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); 179 err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port );
182 } 180 }
183 181
184 if ( err != MAILIMAP_NO_ERROR && 182 if ( err != MAILIMAP_NO_ERROR &&
185 err != MAILIMAP_NO_ERROR_AUTHENTICATED && 183 err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
186 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 184 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
187 QString failure = ""; 185 QString failure = "";
188 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { 186 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
189 failure="Connection refused"; 187 failure="Connection refused";
190 } else { 188 } else {
191 failure="Unknown failure"; 189 failure="Unknown failure";