summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index e2cea7a..ba78c3b 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -112,13 +112,13 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
112 int r = mailmessage_fetch(msg,&data,&size); 112 int r = mailmessage_fetch(msg,&data,&size);
113 mime_message_detach_mime(msg); 113 mime_message_detach_mime(msg);
114 mailmessage_free(msg); 114 mailmessage_free(msg);
115 if (r != MAIL_NO_ERROR || !data) { 115 if (r != MAIL_NO_ERROR || !data) {
116 if (data) 116 if (data)
117 free(data); 117 free(data);
118 qDebug("Error fetching mime..."); 118 odebug << "Error fetching mime..." << oendl;
119 return; 119 return;
120 } 120 }
121 msg = 0; 121 msg = 0;
122 if (later) { 122 if (later) {
123 storeMail(data,size,"Outgoing"); 123 storeMail(data,size,"Outgoing");
124 if (data) 124 if (data)
@@ -205,22 +205,22 @@ void SMTPwrapper::connect_server()
205 /* no failure message cause this happens when problems with memory - than we 205 /* no failure message cause this happens when problems with memory - than we
206 we can not display any messagebox */ 206 we can not display any messagebox */
207 return; 207 return;
208 } 208 }
209 209
210 int err = MAILSMTP_NO_ERROR; 210 int err = MAILSMTP_NO_ERROR;
211 qDebug( "Servername %s at port %i", server, port ); 211 odebug << "Servername " << server << " at port " << port << "" << oendl;
212 if ( ssl ) { 212 if ( ssl ) {
213 qDebug( "SSL session" ); 213 odebug << "SSL session" << oendl;
214 err = mailsmtp_ssl_connect( m_smtp, server, port ); 214 err = mailsmtp_ssl_connect( m_smtp, server, port );
215 } else { 215 } else {
216 qDebug( "No SSL session" ); 216 odebug << "No SSL session" << oendl;
217 err = mailsmtp_socket_connect( m_smtp, server, port ); 217 err = mailsmtp_socket_connect( m_smtp, server, port );
218 } 218 }
219 if ( err != MAILSMTP_NO_ERROR ) { 219 if ( err != MAILSMTP_NO_ERROR ) {
220 qDebug("Error init connection"); 220 odebug << "Error init connection" << oendl;
221 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 221 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
222 result = 0; 222 result = 0;
223 } 223 }
224 224
225 /* switch to tls after init 'cause there it will send the ehlo */ 225 /* switch to tls after init 'cause there it will send the ehlo */
226 if (result) { 226 if (result) {
@@ -243,13 +243,13 @@ void SMTPwrapper::connect_server()
243 if (!try_tls && force_tls) { 243 if (!try_tls && force_tls) {
244 result = 0; 244 result = 0;
245 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); 245 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err));
246 } 246 }
247 247
248 if (result==1 && m_SmtpAccount->getLogin() ) { 248 if (result==1 && m_SmtpAccount->getLogin() ) {
249 qDebug("smtp with auth"); 249 odebug << "smtp with auth" << oendl;
250 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 250 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
251 // get'em 251 // get'em
252 LoginDialog login( m_SmtpAccount->getUser(), 252 LoginDialog login( m_SmtpAccount->getUser(),
253 m_SmtpAccount->getPassword(), NULL, 0, true ); 253 m_SmtpAccount->getPassword(), NULL, 0, true );
254 login.show(); 254 login.show();
255 if ( QDialog::Accepted == login.exec() ) { 255 if ( QDialog::Accepted == login.exec() ) {
@@ -261,17 +261,17 @@ void SMTPwrapper::connect_server()
261 failuretext=tr("Login aborted - storing mail to localfolder"); 261 failuretext=tr("Login aborted - storing mail to localfolder");
262 } 262 }
263 } else { 263 } else {
264 user = m_SmtpAccount->getUser().latin1(); 264 user = m_SmtpAccount->getUser().latin1();
265 pass = m_SmtpAccount->getPassword().latin1(); 265 pass = m_SmtpAccount->getPassword().latin1();
266 } 266 }
267 qDebug( "session->auth: %i", m_smtp->auth); 267 odebug << "session->auth: " << m_smtp->auth << "" << oendl;
268 if (result) { 268 if (result) {
269 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass ); 269 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass );
270 if ( err == MAILSMTP_NO_ERROR ) { 270 if ( err == MAILSMTP_NO_ERROR ) {
271 qDebug("auth ok"); 271 odebug << "auth ok" << oendl;
272 } else { 272 } else {
273 failuretext = tr("Authentification failed"); 273 failuretext = tr("Authentification failed");
274 result = 0; 274 result = 0;
275 } 275 }
276 } 276 }
277 } 277 }
@@ -304,31 +304,31 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
304 result = 0; 304 result = 0;
305 } 305 }
306 306
307 if (!result) { 307 if (!result) {
308 storeFailedMail(data,size,failuretext); 308 storeFailedMail(data,size,failuretext);
309 } else { 309 } else {
310 qDebug( "Mail sent." ); 310 odebug << "Mail sent." << oendl;
311 storeMail(data,size,"Sent"); 311 storeMail(data,size,"Sent");
312 } 312 }
313 return result; 313 return result;
314} 314}
315 315
316void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 316void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
317{ 317{
318 mailmime * mimeMail; 318 mailmime * mimeMail;
319 319
320 mimeMail = createMimeMail(mail ); 320 mimeMail = createMimeMail(mail );
321 if ( mimeMail == NULL ) { 321 if ( mimeMail == NULL ) {
322 qDebug( "sendMail: error creating mime mail" ); 322 odebug << "sendMail: error creating mime mail" << oendl;
323 } else { 323 } else {
324 sendProgress = new progressMailSend(); 324 sendProgress = new progressMailSend();
325 sendProgress->show(); 325 sendProgress->show();
326 sendProgress->setMaxMails(1); 326 sendProgress->setMaxMails(1);
327 smtpSend( mimeMail,later); 327 smtpSend( mimeMail,later);
328 qDebug("Clean up done"); 328 odebug << "Clean up done" << oendl;
329 sendProgress->hide(); 329 sendProgress->hide();
330 delete sendProgress; 330 delete sendProgress;
331 sendProgress = 0; 331 sendProgress = 0;
332 mailmime_free( mimeMail ); 332 mailmime_free( mimeMail );
333 } 333 }
334} 334}
@@ -375,33 +375,33 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
375} 375}
376 376
377/* this is a special fun */ 377/* this is a special fun */
378bool SMTPwrapper::flushOutbox() { 378bool SMTPwrapper::flushOutbox() {
379 bool returnValue = true; 379 bool returnValue = true;
380 380
381 qDebug("Sending the queue"); 381 odebug << "Sending the queue" << oendl;
382 if (!m_SmtpAccount) { 382 if (!m_SmtpAccount) {
383 qDebug("No smtp account given"); 383 odebug << "No smtp account given" << oendl;
384 return false; 384 return false;
385 } 385 }
386 386
387 bool reset_user_value = false; 387 bool reset_user_value = false;
388 QString localfolders = AbstractMail::defaultLocalfolder(); 388 QString localfolders = AbstractMail::defaultLocalfolder();
389 AbstractMail*wrap = AbstractMail::getWrapper(localfolders); 389 AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
390 if (!wrap) { 390 if (!wrap) {
391 qDebug("memory error"); 391 odebug << "memory error" << oendl;
392 return false; 392 return false;
393 } 393 }
394 QString oldPw, oldUser; 394 QString oldPw, oldUser;
395 QValueList<RecMailP> mailsToSend; 395 QValueList<RecMailP> mailsToSend;
396 QValueList<RecMailP> mailsToRemove; 396 QValueList<RecMailP> mailsToRemove;
397 QString mbox("Outgoing"); 397 QString mbox("Outgoing");
398 wrap->listMessages(mbox,mailsToSend); 398 wrap->listMessages(mbox,mailsToSend);
399 if (mailsToSend.count()==0) { 399 if (mailsToSend.count()==0) {
400 delete wrap; 400 delete wrap;
401 qDebug("No mails to send"); 401 odebug << "No mails to send" << oendl;
402 return false; 402 return false;
403 } 403 }
404 404
405 oldPw = m_SmtpAccount->getPassword(); 405 oldPw = m_SmtpAccount->getPassword();
406 oldUser = m_SmtpAccount->getUser(); 406 oldUser = m_SmtpAccount->getUser();
407 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 407 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {