diff options
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 27 |
2 files changed, 26 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index fb9f6135f9..208dd6ec7c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-06-21 Jeffrey Stedfast <fejj@ximian.com> + + * mail-callbacks.c (composer_get_message): Allow the message to be + sent even if there are no To recipients but only as long as there + are other recipients defined. + 2001-06-21 Jason Leach <jleach@ximian.com> * component-factory.c (mail_remove_storage): Deregister the @@ -6,7 +12,7 @@ 2001-06-20 Kjartan Maraas <kmaraas@gnome.org> - * folder-browser.c: More than on accel key is a tad + * folder-browser.c: More than one accel key is a tad confusing. 2001-06-19 Jeffrey Stedfast <fejj@ximian.com> diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 0bfd8b7305..f685368e4d 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -291,18 +291,29 @@ composer_sent_cb(char *uri, CamelMimeMessage *message, gboolean sent, void *data static CamelMimeMessage * composer_get_message (EMsgComposer *composer) { - CamelMimeMessage *message; + static char *recipient_type[] = { + CAMEL_RECIPIENT_TYPE_TO, + CAMEL_RECIPIENT_TYPE_CC, + CAMEL_RECIPIENT_TYPE_BCC + }; const CamelInternetAddress *iaddr; - const char *subject; const MailConfigAccount *account; + CamelMimeMessage *message; + const char *subject; + int num_addrs, i; message = e_msg_composer_get_message (composer); if (message == NULL) return NULL; - /* Check for no recipients */ - iaddr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); - if (!iaddr || CAMEL_ADDRESS (iaddr)->addresses->len == 0) { + /* Check for recipients */ + for (num_addrs = 0, i = 0; i < 3 && num_addrs == 0; i++) { + iaddr = camel_mime_message_get_recipients (message, recipient_type[i]); + num_addrs += iaddr ? camel_address_length (CAMEL_ADDRESS (iaddr)) : 0; + } + + /* I'm sensing a lack of love, er, I mean recipients. */ + if (num_addrs == 0) { GtkWidget *message_box; message_box = gnome_message_box_new (_("You must specify recipients in order to " @@ -325,7 +336,7 @@ composer_get_message (EMsgComposer *composer) return NULL; } } - + /* Add info about the sending account */ account = e_msg_composer_get_preferred_account (composer); if (account) { @@ -333,7 +344,7 @@ composer_get_message (EMsgComposer *composer) camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url); camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri); } - + return message; } @@ -359,7 +370,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data) if (!message) return; transport = mail_config_get_default_transport (); - + send = g_malloc (sizeof (*send)); send->psd = psd; send->composer = composer; |