aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-03-30 07:46:55 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-03-30 07:46:55 +0800
commit424506262d215dfe306aea0d0fe86833d08b82a4 (patch)
treeeb1a374e5b456d1d546b0c0f4b5a4d0d6280a7de /mail
parentb912dd5436413b55dc4500dd7d2b8afcdd433727 (diff)
downloadgsoc2013-evolution-424506262d215dfe306aea0d0fe86833d08b82a4.tar.gz
gsoc2013-evolution-424506262d215dfe306aea0d0fe86833d08b82a4.tar.zst
gsoc2013-evolution-424506262d215dfe306aea0d0fe86833d08b82a4.zip
Added #include <libgnome/gnome-paper.h>
2001-03-29 Jon Trowbridge <trow@ximian.com> * printing/e-contact-print.c: Added #include <libgnome/gnome-paper.h> * printing/e-contact-print-envelope.c: Added #include <time.h> and #include <libgnome/gnome-paper.h> * gui/component/select-names/e-select-names-completion.c (match_email): Better handle matching of "nameless" contacts. * backend/ebook/e-destination.c (e_destination_get_string): Better handle the case of a "nameless" contact. 2001-03-29 Jon Trowbridge <trow@ximian.com> * camel-filter-driver.c (camel_filter_driver_filter_message): Save the source URL using camel_mime_message_set_source. * camel-mime-message.c (camel_mime_message_set_source): Renamed camel_mime_message_set_identity to this. Sets the X-Evolution-Source header. (camel_mime_message_get_source): Returns the X-Evolution-Source header. 2001-03-29 Jon Trowbridge <trow@ximian.com> * mail-callbacks.c: Added #include <time.h> to get things to compile. * mail-callbacks.c (mail_generate_reply): Look at the X-Evolution-Source header, and try to find a corresponding account. If this works, send the mail from this account. If not, use the default account. * mail-ops.c (send_queue_send): Strip out the X-Evolution-Source header before sending. * mail-config.c (mail_config_get_account_by_source_url): Added. Look up accounts by source URL. svn path=/trunk/; revision=9032
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog16
-rw-r--r--mail/mail-callbacks.c13
-rw-r--r--mail/mail-config.c32
-rw-r--r--mail/mail-config.h13
-rw-r--r--mail/mail-ops.c3
5 files changed, 66 insertions, 11 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0b785db609..34855d075b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,19 @@
+2001-03-29 Jon Trowbridge <trow@ximian.com>
+
+ * mail-callbacks.c: Added #include <time.h> to get things
+ to compile.
+
+ * mail-callbacks.c (mail_generate_reply): Look at the
+ X-Evolution-Source header, and try to find a corresponding
+ account. If this works, send the mail from this account.
+ If not, use the default account.
+
+ * mail-ops.c (send_queue_send): Strip out the X-Evolution-Source
+ header before sending.
+
+ * mail-config.c (mail_config_get_account_by_source_url): Added.
+ Look up accounts by source URL.
+
2001-03-29 Dan Winship <danw@ximian.com>
* mail-format.c (call_handler_function): if called with a
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index dee9791098..0fc6596f88 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -30,10 +30,12 @@
#endif
#include <errno.h>
+#include <time.h>
#include <libgnome/gnome-paper.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-stock.h>
+#include <libgnome/gnome-paper.h>
#include <libgnomeprint/gnome-print-master.h>
#include <libgnomeprint/gnome-print-master-preview.h>
#include <gal/e-table/e-table.h>
@@ -286,7 +288,7 @@ composer_sent_cb(char *uri, CamelMimeMessage *message, gboolean sent, void *data
camel_object_unref (CAMEL_OBJECT (message));
}
-CamelMimeMessage *
+static CamelMimeMessage *
composer_get_message (EMsgComposer *composer)
{
CamelMimeMessage *message;
@@ -558,7 +560,7 @@ static EMsgComposer *
mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
{
const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs;
- const char *name = NULL, *address = NULL;
+ const char *name = NULL, *address = NULL, *source = NULL;
const char *message_id, *references;
char *text, *subject, *date_str;
const MailConfigAccount *me = NULL;
@@ -569,8 +571,11 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
gchar *sig_file = NULL;
time_t date;
int offset;
+
+ source = camel_mime_message_get_source (message);
+ me = mail_config_get_account_by_source_url (source);
- id = mail_config_get_default_identity ();
+ id = me ? me->id : mail_config_get_default_identity ();
if (id)
sig_file = id->signature;
@@ -607,7 +612,7 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
if (to_all) {
cc = list_add_addresses (cc, to_addrs, accounts, &me);
cc = list_add_addresses (cc, cc_addrs, accounts, me ? NULL : &me);
- } else {
+ } else if (me == NULL) {
me = guess_me (to_addrs, cc_addrs, accounts);
}
diff --git a/mail/mail-config.c b/mail/mail-config.c
index be685ba180..38d84fc0e7 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -772,6 +772,38 @@ mail_config_get_account_by_name (const char *account_name)
return NULL;
}
+/*
+ We do a strncmp on the MIN of the url lengths rather than a straight strcmp because
+ I've observed extra stuff getting stuck on the end of urls in camel. Hopefully
+ this work-around won't lead to any weirdness.
+*/
+
+const MailConfigAccount *
+mail_config_get_account_by_source_url (const char *source_url)
+{
+ const MailConfigAccount *account;
+ GSList *l;
+ gint src_len;
+
+ g_return_val_if_fail (source_url != NULL, NULL);
+
+ src_len = strlen (source_url);
+
+ l = config->accounts;
+ while (l) {
+ account = l->data;
+ if (account
+ && account->source
+ && account->source->url
+ && !strncmp (account->source->url, source_url, MIN (src_len, strlen (account->source->url))))
+ return account;
+
+ l = l->next;
+ }
+
+ return NULL;
+}
+
const GSList *
mail_config_get_accounts (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 60dc23465f..889037012f 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -112,12 +112,13 @@ void mail_config_set_pgp_type (gint pgp_type);
const char *mail_config_get_pgp_path (void);
void mail_config_set_pgp_path (const char *pgp_path);
-const MailConfigAccount *mail_config_get_default_account (void);
-const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);
-const GSList *mail_config_get_accounts (void);
-void mail_config_add_account (MailConfigAccount *account);
-const GSList *mail_config_remove_account (MailConfigAccount *account);
-void mail_config_set_default_account (const MailConfigAccount *account);
+const MailConfigAccount *mail_config_get_default_account (void);
+const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);
+const MailConfigAccount *mail_config_get_account_by_source_url (const char *url);
+const GSList *mail_config_get_accounts (void);
+void mail_config_add_account (MailConfigAccount *account);
+const GSList *mail_config_remove_account (MailConfigAccount *account);
+void mail_config_set_default_account (const MailConfigAccount *account);
const MailConfigIdentity *mail_config_get_default_identity (void);
const MailConfigService *mail_config_get_default_transport (void);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index a0bf80ce92..40f3a72309 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -495,8 +495,9 @@ mail_send_message(CamelMimeMessage *message, const char *destination, CamelFilte
camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer", version);
camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);
- /* Remove the X-Evolution header so we don't send our flags too ;-) */
+ /* Remove the X-Evolution and X-Evolution-Source headers so we don't send our flags & other info too ;-) */
camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution");
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Source");
/* Get information about the account this was composed by. */
header = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account");