aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-22 01:16:18 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-22 01:16:18 +0800
commit1cb59bd641bb4dabf4e2fad81cb5c61611d022e4 (patch)
tree006c117b575f1e858095c1320fcac5920cc7563e /mail/mail-callbacks.c
parent09b9a3a4da1d8827a39fc2a7aad3402ff25250bf (diff)
downloadgsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.tar
gsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.tar.gz
gsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.tar.bz2
gsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.tar.lz
gsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.tar.xz
gsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.tar.zst
gsoc2013-evolution-1cb59bd641bb4dabf4e2fad81cb5c61611d022e4.zip
Allow the message to be sent even if there are no To recipients but only
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. svn path=/trunk/; revision=10363
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c27
1 files changed, 19 insertions, 8 deletions
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;