author | zautrix <zautrix> | 2004-07-03 19:26:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 19:26:15 (UTC) |
commit | cc67ce39cdd7730caee878da3b191d76cad9479f (patch) (unidiff) | |
tree | a19e8297fdf060845e1a81b58afe5272a58c3b61 | |
parent | 55413f404aa7a59bfbf38f9f91fabb595eca57ad (diff) | |
download | kdepimpi-cc67ce39cdd7730caee878da3b191d76cad9479f.zip kdepimpi-cc67ce39cdd7730caee878da3b191d76cad9479f.tar.gz kdepimpi-cc67ce39cdd7730caee878da3b191d76cad9479f.tar.bz2 |
better error handling
-rw-r--r-- | kmicromail/composemail.cpp | 14 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 23 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 4 |
3 files changed, 25 insertions, 16 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 2c2e279..ca4f247 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -100,64 +100,64 @@ void ComposeMail::saveAsDraft() | |||
100 | mail->setTo( toLine->text() ); | 100 | mail->setTo( toLine->text() ); |
101 | mail->setName(senderNameEdit->text()); | 101 | mail->setName(senderNameEdit->text()); |
102 | mail->setCC( ccLine->text() ); | 102 | mail->setCC( ccLine->text() ); |
103 | mail->setBCC( bccLine->text() ); | 103 | mail->setBCC( bccLine->text() ); |
104 | mail->setReply( replyLine->text() ); | 104 | mail->setReply( replyLine->text() ); |
105 | mail->setSubject( subjectLine->text() ); | 105 | mail->setSubject( subjectLine->text() ); |
106 | if (!m_replyid.isEmpty()) { | 106 | if (!m_replyid.isEmpty()) { |
107 | QStringList ids; | 107 | QStringList ids; |
108 | ids.append(m_replyid); | 108 | ids.append(m_replyid); |
109 | mail->setInreply(ids); | 109 | mail->setInreply(ids); |
110 | } | 110 | } |
111 | QString txt = message->text(); | 111 | QString txt = message->text(); |
112 | if ( !sigMultiLine->text().isEmpty() ) { | 112 | if ( !sigMultiLine->text().isEmpty() ) { |
113 | txt.append( "\n--\n" ); | 113 | txt.append( "\n--\n" ); |
114 | txt.append( sigMultiLine->text() ); | 114 | txt.append( sigMultiLine->text() ); |
115 | } | 115 | } |
116 | mail->setMessage( txt ); | 116 | mail->setMessage( txt ); |
117 | 117 | ||
118 | /* only use the default drafts folder name! */ | 118 | /* only use the default drafts folder name! */ |
119 | Storemail wrapper(AbstractMail::draftFolder()); | 119 | Storemail wrapper(AbstractMail::draftFolder()); |
120 | wrapper.storeMail(mail); | 120 | wrapper.storeMail(mail); |
121 | 121 | ||
122 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 122 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
123 | /* attachments we will ignore! */ | 123 | /* attachments we will ignore! */ |
124 | if ( it != NULL ) { | 124 | if ( it != 0 ) { |
125 | if ( warnAttach ) | 125 | if ( warnAttach ) |
126 | QMessageBox::warning(0,tr("Store message"), | 126 | QMessageBox::warning(0,tr("Store message"), |
127 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 127 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
128 | warnAttach = false; | 128 | warnAttach = false; |
129 | } | 129 | } |
130 | setStatus( tr("Mail saved as draft!") ); | 130 | setStatus( tr("Mail saved as draft!") ); |
131 | } | 131 | } |
132 | void ComposeMail::clearStatus() | 132 | void ComposeMail::clearStatus() |
133 | { | 133 | { |
134 | topLevelWidget()->setCaption( tr("Compose mail") ); | 134 | topLevelWidget()->setCaption( tr("Compose mail") ); |
135 | } | 135 | } |
136 | void ComposeMail::setStatus( QString status ) | 136 | void ComposeMail::setStatus( QString status ) |
137 | { | 137 | { |
138 | topLevelWidget()->setCaption( status ); | 138 | topLevelWidget()->setCaption( status ); |
139 | QTimer::singleShot ( 5000, this, SLOT( clearStatus() ) ) ; | 139 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
140 | } | 140 | } |
141 | void ComposeMail::pickAddress( QLineEdit *line ) | 141 | void ComposeMail::pickAddress( QLineEdit *line ) |
142 | { | 142 | { |
143 | //qDebug(" ComposeMail::pickAddress "); | 143 | //qDebug(" ComposeMail::pickAddress "); |
144 | QString names ;//= AddressPicker::getNames(); | 144 | QString names ;//= AddressPicker::getNames(); |
145 | 145 | ||
146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
147 | uint i=0; | 147 | uint i=0; |
148 | for (i=0; i < list.count(); i++) { | 148 | for (i=0; i < list.count(); i++) { |
149 | if ( !list[i].preferredEmail().isEmpty()) { | 149 | if ( !list[i].preferredEmail().isEmpty()) { |
150 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 150 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
151 | if ( i < list.count() -1 ) | 151 | if ( i < list.count() -1 ) |
152 | names+= ","; | 152 | names+= ","; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | if ( line->text().isEmpty() ) { | 157 | if ( line->text().isEmpty() ) { |
158 | line->setText( names ); | 158 | line->setText( names ); |
159 | } else if ( !names.isEmpty() ) { | 159 | } else if ( !names.isEmpty() ) { |
160 | line->setText( line->text() + ", " + names ); | 160 | line->setText( line->text() + ", " + names ); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
@@ -279,55 +279,61 @@ void ComposeMail::accept() | |||
279 | mail->setTo( toLine->text() ); | 279 | mail->setTo( toLine->text() ); |
280 | } else { | 280 | } else { |
281 | QMessageBox::warning(0,tr("Sending mail"), | 281 | QMessageBox::warning(0,tr("Sending mail"), |
282 | tr("No Receiver spezified" ) ); | 282 | tr("No Receiver spezified" ) ); |
283 | return; | 283 | return; |
284 | } | 284 | } |
285 | 285 | ||
286 | mail->setName(senderNameEdit->text()); | 286 | mail->setName(senderNameEdit->text()); |
287 | mail->setCC( ccLine->text() ); | 287 | mail->setCC( ccLine->text() ); |
288 | mail->setBCC( bccLine->text() ); | 288 | mail->setBCC( bccLine->text() ); |
289 | mail->setReply( replyLine->text() ); | 289 | mail->setReply( replyLine->text() ); |
290 | mail->setSubject( subjectLine->text() ); | 290 | mail->setSubject( subjectLine->text() ); |
291 | if (!m_replyid.isEmpty()) { | 291 | if (!m_replyid.isEmpty()) { |
292 | QStringList ids; | 292 | QStringList ids; |
293 | ids.append(m_replyid); | 293 | ids.append(m_replyid); |
294 | mail->setInreply(ids); | 294 | mail->setInreply(ids); |
295 | } | 295 | } |
296 | QString txt = message->text(); | 296 | QString txt = message->text(); |
297 | if ( !sigMultiLine->text().isEmpty() ) { | 297 | if ( !sigMultiLine->text().isEmpty() ) { |
298 | txt.append( "\n--\n" ); | 298 | txt.append( "\n--\n" ); |
299 | txt.append( sigMultiLine->text() ); | 299 | txt.append( sigMultiLine->text() ); |
300 | } | 300 | } |
301 | mail->setMessage( txt ); | 301 | mail->setMessage( txt ); |
302 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 302 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
303 | while ( it != NULL ) { | 303 | while ( it != 0 ) { |
304 | mail->addAttachment( it->getAttachment() ); | 304 | mail->addAttachment( it->getAttachment() ); |
305 | it = (AttachViewItem *) it->nextSibling(); | 305 | it = (AttachViewItem *) it->nextSibling(); |
306 | } | 306 | } |
307 | 307 | ||
308 | SMTPwrapper wrapper( smtp ); | 308 | SMTPwrapper wrapper( smtp ); |
309 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); | 309 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
310 | setStatus( tr ("Mail sent")); | ||
311 | else { | ||
312 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | ||
313 | return; | ||
314 | } | ||
315 | |||
310 | 316 | ||
311 | QDialog::accept(); | 317 | QDialog::accept(); |
312 | } | 318 | } |
313 | 319 | ||
314 | void ComposeMail::reject() | 320 | void ComposeMail::reject() |
315 | { | 321 | { |
316 | //qDebug("ComposeMail::reject() "); | 322 | //qDebug("ComposeMail::reject() "); |
317 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 323 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
318 | tr("Store message into drafts?"), | 324 | tr("Store message into drafts?"), |
319 | tr("Yes"), | 325 | tr("Yes"), |
320 | tr("No")); | 326 | tr("No")); |
321 | 327 | ||
322 | //qDebug("button %d ", yesno); | 328 | //qDebug("button %d ", yesno); |
323 | if (yesno == 0) { | 329 | if (yesno == 0) { |
324 | saveAsDraft(); | 330 | saveAsDraft(); |
325 | } | 331 | } |
326 | if (yesno == 2) { | 332 | if (yesno == 2) { |
327 | qDebug("return "); | 333 | qDebug("return "); |
328 | return; | 334 | return; |
329 | } | 335 | } |
330 | QDialog::reject(); | 336 | QDialog::reject(); |
331 | } | 337 | } |
332 | 338 | ||
333 | ComposeMail::~ComposeMail() | 339 | ComposeMail::~ComposeMail() |
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 04a21ea..6a1b505 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp | |||
@@ -81,89 +81,90 @@ QString SMTPwrapper::mailsmtpError( int errnum ) { | |||
81 | return tr( "Connection refused" ); | 81 | return tr( "Connection refused" ); |
82 | default: | 82 | default: |
83 | return tr( "Unknown error code" ); | 83 | return tr( "Unknown error code" ); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | void SMTPwrapper::progress( size_t current, size_t maximum ) { | 88 | void SMTPwrapper::progress( size_t current, size_t maximum ) { |
89 | if (SMTPwrapper::sendProgress) { | 89 | if (SMTPwrapper::sendProgress) { |
90 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 90 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
91 | qApp->processEvents(); | 91 | qApp->processEvents(); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { | 95 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { |
96 | if (!mail) | 96 | if (!mail) |
97 | return; | 97 | return; |
98 | QString localfolders = AbstractMail::defaultLocalfolder(); | 98 | QString localfolders = AbstractMail::defaultLocalfolder(); |
99 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 99 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
100 | wrap->createMbox(box); | 100 | wrap->createMbox(box); |
101 | wrap->storeMessage(mail,length,box); | 101 | wrap->storeMessage(mail,length,box); |
102 | delete wrap; | 102 | delete wrap; |
103 | } | 103 | } |
104 | 104 | ||
105 | void SMTPwrapper::smtpSend( mailmime *mail,bool later) { | 105 | bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { |
106 | clist *rcpts = 0; | 106 | clist *rcpts = 0; |
107 | char *from, *data; | 107 | char *from, *data; |
108 | size_t size; | 108 | size_t size; |
109 | 109 | ||
110 | from = data = 0; | 110 | from = data = 0; |
111 | 111 | ||
112 | mailmessage * msg = 0; | 112 | mailmessage * msg = 0; |
113 | msg = mime_message_init(mail); | 113 | msg = mime_message_init(mail); |
114 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 114 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
115 | int r = mailmessage_fetch(msg,&data,&size); | 115 | int r = mailmessage_fetch(msg,&data,&size); |
116 | mime_message_detach_mime(msg); | 116 | mime_message_detach_mime(msg); |
117 | mailmessage_free(msg); | 117 | mailmessage_free(msg); |
118 | if (r != MAIL_NO_ERROR || !data) { | 118 | if (r != MAIL_NO_ERROR || !data) { |
119 | if (data) | 119 | if (data) |
120 | free(data); | 120 | free(data); |
121 | ; // odebug << "Error fetching mime..." << oendl; | 121 | qDebug("Error fetching mime... "); |
122 | return; | 122 | return false; |
123 | } | 123 | } |
124 | msg = 0; | 124 | msg = 0; |
125 | if (later) { | 125 | if (later) { |
126 | storeMail(data,size,"Outgoing"); | 126 | storeMail(data,size,"Outgoing"); |
127 | if (data) | 127 | if (data) |
128 | free( data ); | 128 | free( data ); |
129 | Config cfg( "mail" ); | 129 | Config cfg( "mail" ); |
130 | cfg.setGroup( "Status" ); | 130 | cfg.setGroup( "Status" ); |
131 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 131 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
132 | emit queuedMails( m_queuedMail ); | 132 | emit queuedMails( m_queuedMail ); |
133 | return; | 133 | return true; |
134 | } | 134 | } |
135 | from = getFrom( mail ); | 135 | from = getFrom( mail ); |
136 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 136 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
137 | smtpSend(from,rcpts,data,size); | 137 | bool result = smtpSend(from,rcpts,data,size); |
138 | if (data) { | 138 | if (data) { |
139 | free(data); | 139 | free(data); |
140 | } | 140 | } |
141 | if (from) { | 141 | if (from) { |
142 | free(from); | 142 | free(from); |
143 | } | 143 | } |
144 | if (rcpts) | 144 | if (rcpts) |
145 | smtp_address_list_free( rcpts ); | 145 | smtp_address_list_free( rcpts ); |
146 | return result; | ||
146 | } | 147 | } |
147 | 148 | ||
148 | void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) | 149 | void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) |
149 | { | 150 | { |
150 | if (data) { | 151 | if (data) { |
151 | storeMail(data,size,"Sendfailed"); | 152 | storeMail(data,size,"Sendfailed"); |
152 | } | 153 | } |
153 | if (failuremessage) { | 154 | if (failuremessage) { |
154 | QMessageBox::critical(0,tr("Error sending mail"), | 155 | QMessageBox::critical(0,tr("Error sending mail"), |
155 | tr("<center>%1</center>").arg(failuremessage)); | 156 | tr("<center>%1</center>").arg(failuremessage)); |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
159 | int SMTPwrapper::start_smtp_tls() | 160 | int SMTPwrapper::start_smtp_tls() |
160 | { | 161 | { |
161 | if (!m_smtp) { | 162 | if (!m_smtp) { |
162 | return MAILSMTP_ERROR_IN_PROCESSING; | 163 | return MAILSMTP_ERROR_IN_PROCESSING; |
163 | } | 164 | } |
164 | int err = mailesmtp_starttls(m_smtp); | 165 | int err = mailesmtp_starttls(m_smtp); |
165 | if (err != MAILSMTP_NO_ERROR) return err; | 166 | if (err != MAILSMTP_NO_ERROR) return err; |
166 | mailstream_low * low; | 167 | mailstream_low * low; |
167 | mailstream_low * new_low; | 168 | mailstream_low * new_low; |
168 | low = mailstream_get_low(m_smtp->stream); | 169 | low = mailstream_get_low(m_smtp->stream); |
169 | if (!low) { | 170 | if (!low) { |
@@ -295,66 +296,68 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) | |||
295 | QString failuretext = ""; | 296 | QString failuretext = ""; |
296 | 297 | ||
297 | connect_server(); | 298 | connect_server(); |
298 | 299 | ||
299 | result = 1; | 300 | result = 1; |
300 | if (m_smtp) { | 301 | if (m_smtp) { |
301 | err = mailsmtp_send( m_smtp, from, rcpts, data, size ); | 302 | err = mailsmtp_send( m_smtp, from, rcpts, data, size ); |
302 | if ( err != MAILSMTP_NO_ERROR ) { | 303 | if ( err != MAILSMTP_NO_ERROR ) { |
303 | failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); | 304 | failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); |
304 | result = 0; | 305 | result = 0; |
305 | } | 306 | } |
306 | } else { | 307 | } else { |
307 | result = 0; | 308 | result = 0; |
308 | } | 309 | } |
309 | 310 | ||
310 | if (!result) { | 311 | if (!result) { |
311 | storeFailedMail(data,size,failuretext); | 312 | storeFailedMail(data,size,failuretext); |
312 | } else { | 313 | } else { |
313 | ; // odebug << "Mail sent." << oendl; | 314 | ; // odebug << "Mail sent." << oendl; |
314 | storeMail(data,size,"Sent"); | 315 | storeMail(data,size,"Sent"); |
315 | } | 316 | } |
316 | return result; | 317 | return result; |
317 | } | 318 | } |
318 | 319 | ||
319 | void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) | 320 | bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) |
320 | { | 321 | { |
321 | mailmime * mimeMail; | 322 | mailmime * mimeMail; |
322 | 323 | bool result = true; | |
323 | mimeMail = createMimeMail(mail ); | 324 | mimeMail = createMimeMail(mail ); |
324 | if ( mimeMail == NULL ) { | 325 | if ( mimeMail == 0 ) { |
325 | ; // odebug << "sendMail: error creating mime mail" << oendl; | 326 | qDebug("SMTP wrapper:Error creating mail! "); |
327 | return false; | ||
326 | } else { | 328 | } else { |
327 | sendProgress = new progressMailSend(); | 329 | sendProgress = new progressMailSend(); |
328 | sendProgress->show(); | 330 | sendProgress->show(); |
329 | sendProgress->setMaxMails(1); | 331 | sendProgress->setMaxMails(1); |
330 | smtpSend( mimeMail,later); | 332 | result = smtpSend( mimeMail,later); |
331 | ; // odebug << "Clean up done" << oendl; | 333 | ; // odebug << "Clean up done" << oendl; |
332 | sendProgress->hide(); | 334 | sendProgress->hide(); |
333 | delete sendProgress; | 335 | delete sendProgress; |
334 | sendProgress = 0; | 336 | sendProgress = 0; |
335 | mailmime_free( mimeMail ); | 337 | mailmime_free( mimeMail ); |
336 | } | 338 | } |
339 | return result; | ||
337 | } | 340 | } |
338 | 341 | ||
339 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { | 342 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { |
340 | size_t curTok = 0; | 343 | size_t curTok = 0; |
341 | mailimf_fields *fields = 0; | 344 | mailimf_fields *fields = 0; |
342 | mailimf_field*ffrom = 0; | 345 | mailimf_field*ffrom = 0; |
343 | clist *rcpts = 0; | 346 | clist *rcpts = 0; |
344 | char*from = 0; | 347 | char*from = 0; |
345 | int res = 0; | 348 | int res = 0; |
346 | 349 | ||
347 | encodedString * data = wrap->fetchRawBody(which); | 350 | encodedString * data = wrap->fetchRawBody(which); |
348 | if (!data) | 351 | if (!data) |
349 | return 0; | 352 | return 0; |
350 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); | 353 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); |
351 | if (err != MAILIMF_NO_ERROR) { | 354 | if (err != MAILIMF_NO_ERROR) { |
352 | delete data; | 355 | delete data; |
353 | delete wrap; | 356 | delete wrap; |
354 | return 0; | 357 | return 0; |
355 | } | 358 | } |
356 | 359 | ||
357 | rcpts = createRcptList( fields ); | 360 | rcpts = createRcptList( fields ); |
358 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); | 361 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); |
359 | from = getFrom(ffrom); | 362 | from = getFrom(ffrom); |
360 | 363 | ||
diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h index 6c5bbe8..105cbf5 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.h +++ b/kmicromail/libmailwrapper/smtpwrapper.h | |||
@@ -2,62 +2,62 @@ | |||
2 | #ifndef SMTPwrapper_H | 2 | #ifndef SMTPwrapper_H |
3 | #define SMTPwrapper_H | 3 | #define SMTPwrapper_H |
4 | 4 | ||
5 | #include <qpe/applnk.h> | 5 | #include <qpe/applnk.h> |
6 | 6 | ||
7 | #include <qbitarray.h> | 7 | #include <qbitarray.h> |
8 | #include <qdatetime.h> | 8 | #include <qdatetime.h> |
9 | #include <libetpan/clist.h> | 9 | #include <libetpan/clist.h> |
10 | 10 | ||
11 | #include "settings.h" | 11 | #include "settings.h" |
12 | #include "generatemail.h" | 12 | #include "generatemail.h" |
13 | 13 | ||
14 | #include <opie2/osmartpointer.h> | 14 | #include <opie2/osmartpointer.h> |
15 | 15 | ||
16 | class SMTPaccount; | 16 | class SMTPaccount; |
17 | class AbstractMail; | 17 | class AbstractMail; |
18 | 18 | ||
19 | class SMTPwrapper : public Generatemail | 19 | class SMTPwrapper : public Generatemail |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | SMTPwrapper(SMTPaccount * aSmtp); | 24 | SMTPwrapper(SMTPaccount * aSmtp); |
25 | virtual ~SMTPwrapper(); | 25 | virtual ~SMTPwrapper(); |
26 | void sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); | 26 | bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); |
27 | bool flushOutbox(); | 27 | bool flushOutbox(); |
28 | 28 | ||
29 | static progressMailSend*sendProgress; | 29 | static progressMailSend*sendProgress; |
30 | 30 | ||
31 | signals: | 31 | signals: |
32 | void queuedMails( int ); | 32 | void queuedMails( int ); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | mailsmtp *m_smtp; | 35 | mailsmtp *m_smtp; |
36 | SMTPaccount * m_SmtpAccount; | 36 | SMTPaccount * m_SmtpAccount; |
37 | 37 | ||
38 | void connect_server(); | 38 | void connect_server(); |
39 | void disc_server(); | 39 | void disc_server(); |
40 | int start_smtp_tls(); | 40 | int start_smtp_tls(); |
41 | 41 | ||
42 | 42 | ||
43 | void smtpSend( mailmime *mail,bool later); | 43 | bool smtpSend( mailmime *mail,bool later); |
44 | 44 | ||
45 | static void storeMail(const char*mail, size_t length, const QString&box); | 45 | static void storeMail(const char*mail, size_t length, const QString&box); |
46 | static QString mailsmtpError( int err ); | 46 | static QString mailsmtpError( int err ); |
47 | static void progress( size_t current, size_t maximum ); | 47 | static void progress( size_t current, size_t maximum ); |
48 | 48 | ||
49 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size); | 49 | int smtpSend(char*from,clist*rcpts,const char*data,size_t size); |
50 | 50 | ||
51 | void storeMail(mailmime*mail, const QString&box); | 51 | void storeMail(mailmime*mail, const QString&box); |
52 | 52 | ||
53 | int sendQueuedMail(AbstractMail*wrap,const Opie::Core::OSmartPointer<RecMail>&which); | 53 | int sendQueuedMail(AbstractMail*wrap,const Opie::Core::OSmartPointer<RecMail>&which); |
54 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); | 54 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); |
55 | 55 | ||
56 | int m_queuedMail; | 56 | int m_queuedMail; |
57 | 57 | ||
58 | protected slots: | 58 | protected slots: |
59 | void emitQCop( int queued ); | 59 | void emitQCop( int queued ); |
60 | 60 | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | #endif | 63 | #endif |