diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-03-13 06:36:06 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-03-13 06:36:06 +0800 |
commit | a188e260964100b03a85bf56cbccc3f196b52dde (patch) | |
tree | 65f2ebfb5bc14e238292e6f0f33575b1500a62cb /camel/providers | |
parent | dadf1e0950e6f1bb809d46588957319630cc3686 (diff) | |
download | gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.tar gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.tar.gz gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.tar.bz2 gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.tar.lz gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.tar.xz gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.tar.zst gsoc2013-evolution-a188e260964100b03a85bf56cbccc3f196b52dde.zip |
Fix for bug #53497.
2004-03-12 Jeffrey Stedfast <fejj@ximian.com>
Fix for bug #53497.
* providers/smtp/camel-smtp-transport.c (smtp_helo): Instead of
unreffing the streams, call camel_service_disconnect().
(smtp_mail): Same.
(smtp_rcpt): Same.
(smtp_data): Same.
(smtp_send_to): Ignore exceptions for smtp_rset(). Also, check
that we are connected before we try to send (in Evolution's
current usage scenario, this isn't a problem but in the future if
we ever try to fire off several messages via the same smtp
connection, it may be - especially if RSET failed during the
previous send).
svn path=/trunk/; revision=25053
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 429b24e37f..35b7e858d5 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -681,6 +681,12 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message, const char *addr; int i, len; + if (!smtp_transport->connected) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED, + _("Cannot send message: service not connected.")); + return FALSE; + } + if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &addr)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot send message: sender address not valid.")); @@ -710,14 +716,14 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message, cia = CAMEL_INTERNET_ADDRESS (recipients); for (i = 0; i < len; i++) { char *enc; - + if (!camel_internet_address_get (cia, i, NULL, &addr)) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot send message: one or more invalid recipients")); camel_operation_end (NULL); return FALSE; } - + enc = camel_internet_address_encode_address(NULL, NULL, addr); if (!smtp_rcpt (smtp_transport, enc, ex)) { g_free(enc); @@ -733,7 +739,8 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message, } /* reset the service for our next transfer session */ - smtp_rset (smtp_transport, ex); + if (!smtp_rset (smtp_transport, ex)) + camel_exception_clear (ex); camel_operation_end (NULL); @@ -855,7 +862,7 @@ smtp_set_exception (CamelSmtpTransport *transport, const char *respbuf, const ch if (!respbuf) { /* we got disconnected */ - transport->connected = FALSE; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); } } @@ -933,11 +940,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) _("HELO command failed: %s"), g_strerror (errno)); camel_operation_end (NULL); - transport->connected = FALSE; - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1147,10 +1150,7 @@ smtp_mail (CamelSmtpTransport *transport, const char *sender, gboolean has_8bit_ _("MAIL FROM command failed: %s: mail not sent"), g_strerror (errno)); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1191,10 +1191,7 @@ smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException _("RCPT TO command failed: %s: mail not sent"), g_strerror (errno)); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1252,10 +1249,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept _("DATA command failed: %s: mail not sent"), g_strerror (errno)); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1315,10 +1309,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept camel_object_unref (filtered_stream); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1335,10 +1326,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept _("DATA command failed: %s: mail not sent"), g_strerror (errno)); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1376,10 +1364,7 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex) camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM, _("RSET command failed: %s"), g_strerror (errno)); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } @@ -1418,10 +1403,7 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex) camel_exception_setv (ex, errno == EINTR ? CAMEL_EXCEPTION_USER_CANCEL : CAMEL_EXCEPTION_SYSTEM, _("QUIT command failed: %s"), g_strerror (errno)); - camel_object_unref (transport->istream); - transport->istream = NULL; - camel_object_unref (transport->ostream); - transport->ostream = NULL; + camel_service_disconnect ((CamelService *) transport, FALSE, NULL); return FALSE; } |