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 /kmicromail/libmailwrapper | |
parent | 55413f404aa7a59bfbf38f9f91fabb595eca57ad (diff) | |
download | kdepimpi-cc67ce39cdd7730caee878da3b191d76cad9479f.zip kdepimpi-cc67ce39cdd7730caee878da3b191d76cad9479f.tar.gz kdepimpi-cc67ce39cdd7730caee878da3b191d76cad9479f.tar.bz2 |
better error handling
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 23 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 4 |
2 files changed, 15 insertions, 12 deletions
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 | |||
@@ -103,5 +103,5 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { | |||
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; |
@@ -119,6 +119,6 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { | |||
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; |
@@ -131,9 +131,9 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { | |||
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); |
@@ -144,4 +144,5 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { | |||
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 | ||
@@ -317,16 +318,17 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) | |||
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(); |
@@ -335,4 +337,5 @@ void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later | |||
335 | mailmime_free( mimeMail ); | 337 | mailmime_free( mimeMail ); |
336 | } | 338 | } |
339 | return result; | ||
337 | } | 340 | } |
338 | 341 | ||
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 | |||
@@ -24,5 +24,5 @@ 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 | ||
@@ -41,5 +41,5 @@ protected: | |||
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); |