aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-06-04 08:06:36 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-06-04 08:06:36 +0800
commit9773d74ec175f335918279c65f36294cc9bfc9f0 (patch)
treeb9e7a7404e36171a1c3f5e5a4e832aceeb0221f9
parentb0d3a768d1197ef3fdd2f5884d981a23c367d594 (diff)
downloadgsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.tar
gsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.tar.gz
gsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.tar.bz2
gsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.tar.lz
gsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.tar.xz
gsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.tar.zst
gsoc2013-evolution-9773d74ec175f335918279c65f36294cc9bfc9f0.zip
Changed to check everything from the composer before the message is
2002-06-03 Not Zed <NotZed@Ximian.com> * mail-callbacks.c (composer_get_message): Changed to check everything from the composer before the message is requested. Otherwise we could end up signing/encrypting it twice, etc. * mail-format.c (handle_multipart_signed): removed some dead wood. svn path=/trunk/; revision=17094
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/mail-callbacks.c128
-rw-r--r--mail/mail-format.c2
3 files changed, 72 insertions, 66 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5b238f41c5..46caa2cb9b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2002-06-03 Not Zed <NotZed@Ximian.com>
+
+ * mail-callbacks.c (composer_get_message): Changed to check
+ everything from the composer before the message is requested.
+ Otherwise we could end up signing/encrypting it twice, etc.
+
+ * mail-format.c (handle_multipart_signed): removed some dead wood.
+
2002-06-03 Jeffrey Stedfast <fejj@ximian.com>
* component-factory.c (request_quit): Prompt the user to see if he
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 674877c442..5570430d1b 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -366,44 +366,51 @@ composer_sent_cb (char *uri, CamelMimeMessage *message, gboolean sent, void *dat
static CamelMimeMessage *
composer_get_message (EMsgComposer *composer)
{
- static char *recipient_type[] = {
- CAMEL_RECIPIENT_TYPE_TO,
- CAMEL_RECIPIENT_TYPE_CC,
- CAMEL_RECIPIENT_TYPE_BCC
- };
- const CamelInternetAddress *iaddr;
const MailConfigAccount *account;
- CamelMimeMessage *message;
- EDestination **recipients;
- const char *subject;
- int num_addrs, i;
-
- message = e_msg_composer_get_message (composer);
- if (message == NULL)
- return NULL;
-
- /* Add info about the sending account */
- account = e_msg_composer_get_preferred_account (composer);
-
- if (account) {
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
- 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);
- if (account->id->organization)
- camel_medium_set_header (CAMEL_MEDIUM (message), "Organization", account->id->organization);
- }
-
+ CamelMimeMessage *message = NULL;
+ EDestination **recipients, **recipients_bcc;
+ char *subject;
+ int i;
+ int hidden = 0, shown = 0;
+ int num = 0, num_bcc = 0;
+
+ /* We should do all of the validity checks based on the composer, and not on
+ the created message, as extra interaction may occur when we get the message
+ (e.g. to get a passphrase to sign a message) */
+
/* get the message recipients */
- recipients = e_msg_composer_get_recipients (composer);
-
- /* Check for recipients */
- for (num_addrs = 0, i = 0; i < 3; i++) {
- iaddr = camel_mime_message_get_recipients (message, recipient_type[i]);
- num_addrs += iaddr ? camel_address_length (CAMEL_ADDRESS (iaddr)) : 0;
+ recipients = e_msg_composer_get_recipients(composer);
+
+ /* see which ones are visible/present, etc */
+ if (recipients) {
+ for (i=0; recipients[i] != NULL;i++) {
+ const char *addr = e_destination_get_address(recipients[i]);
+
+ if (addr && addr[0]) {
+ num++;
+ if (e_destination_is_evolution_list(recipients[i])
+ && !e_destination_list_show_addresses(recipients[i])) {
+ hidden++;
+ } else {
+ shown++;
+ }
+ }
+ }
}
-
+
+ recipients_bcc = e_msg_composer_get_bcc(composer);
+ if (recipients_bcc) {
+ for (i=0; recipients_bcc[i] != NULL;i++) {
+ const char *addr = e_destination_get_address(recipients_bcc[i]);
+
+ if (addr && addr[0])
+ num_bcc++;
+ }
+ e_destination_freev (recipients_bcc);
+ }
+
/* I'm sensing a lack of love, er, I mean recipients. */
- if (num_addrs == 0) {
+ if (num == 0) {
GtkWidget *message_box;
message_box = gnome_message_box_new (_("You must specify recipients in order to "
@@ -413,33 +420,13 @@ composer_get_message (EMsgComposer *composer)
NULL);
gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
-
- camel_object_unref (CAMEL_OBJECT (message));
- message = NULL;
goto finished;
}
- if (iaddr && num_addrs == camel_address_length (CAMEL_ADDRESS (iaddr))) {
- /* this means that the only recipients are Bcc's */
-
- /* OK, this is an abusive hack. If someone sends a mail with a
- hidden contact list on the To: line and no other recipients,
- they will unknowingly create a message with only bcc: recipients.
- We try to detect this and pass a flag to ask_confirm_for_only_bcc,
- so that it can present the user with a dialog whose text has been
- modified to reflect this situation. */
-
- const char *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
- gboolean hidden_list_case = FALSE;
-
- if (to_header && !strcmp (to_header, "Undisclosed-Recipient:;"))
- hidden_list_case = TRUE;
-
- if (!ask_confirm_for_only_bcc (composer, hidden_list_case)) {
- camel_object_unref (CAMEL_OBJECT (message));
- message = NULL;
+ if (num == num_bcc || shown == 0) {
+ /* this means that the only recipients are Bcc's */
+ if (!ask_confirm_for_only_bcc (composer, shown == 0))
goto finished;
- }
}
/* Only show this warning if our default is to send html. If it isn't, we've
@@ -456,23 +443,36 @@ composer_get_message (EMsgComposer *composer)
if (html_problem) {
html_problem = !ask_confirm_for_unwanted_html_mail (composer, recipients);
- if (html_problem) {
- camel_object_unref (CAMEL_OBJECT (message));
- message = NULL;
+ if (html_problem)
goto finished;
- }
}
}
/* Check for no subject */
- subject = camel_mime_message_get_subject (message);
+ subject = e_msg_composer_get_subject(composer);
if (subject == NULL || subject[0] == '\0') {
if (!ask_confirm_for_empty_subject (composer)) {
- camel_object_unref (CAMEL_OBJECT (message));
- message = NULL;
+ g_free(subject);
goto finished;
}
}
+ g_free(subject);
+
+ /* actually get the message now, this will sign/encrypt etc */
+ message = e_msg_composer_get_message (composer);
+ if (message == NULL)
+ goto finished;
+
+ /* Add info about the sending account */
+ account = e_msg_composer_get_preferred_account (composer);
+
+ if (account) {
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
+ 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);
+ if (account->id->organization)
+ camel_medium_set_header (CAMEL_MEDIUM (message), "Organization", account->id->organization);
+ }
/* Get the message recipients and 'touch' them, boosting their use scores */
e_destination_touchv (recipients);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index e7ca110766..03bd1991c5 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1756,10 +1756,8 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
{
CamelMimePart *subpart;
CamelDataWrapper *wrapper;
- /*CamelMultipart *mp;*/
CamelMultipartSigned *mps;
gboolean output = FALSE;
- int nparts, i;
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));