diff options
-rw-r--r-- | addressbook/ChangeLog | 13 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.c | 12 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-completion.c | 5 | ||||
-rw-r--r-- | addressbook/printing/e-contact-print-envelope.c | 2 | ||||
-rw-r--r-- | addressbook/printing/e-contact-print.c | 1 | ||||
-rw-r--r-- | camel/ChangeLog | 11 | ||||
-rw-r--r-- | camel/camel-filter-driver.c | 3 | ||||
-rw-r--r-- | camel/camel-mime-message.c | 18 | ||||
-rw-r--r-- | camel/camel-mime-message.h | 3 | ||||
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 13 | ||||
-rw-r--r-- | mail/mail-config.c | 32 | ||||
-rw-r--r-- | mail/mail-config.h | 13 | ||||
-rw-r--r-- | mail/mail-ops.c | 3 |
14 files changed, 129 insertions, 16 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 879c6353aa..be0475a5aa 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,16 @@ +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 Kjartan Maraas <kmaraas@gnome.org> * *.*: Clean up #includes. Replace <gnome.h>, <bonobo.h> and diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index c652564442..3b7ad60189 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -206,7 +206,19 @@ e_destination_get_string (const EDestination *dest) if (priv->card) { priv->string = e_card_name_to_string (priv->card->name); + if (priv->string) { + g_strstrip (priv->string); + if (*(priv->string) == '\0') { + g_free (priv->string); + priv->string = NULL; + } + } + + if (priv->string == NULL) + priv->string = g_strdup (e_destination_get_email (dest)); + if (priv->string == NULL) + priv->string = g_strdup (_("???")); } } diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index 17f4e0e790..88ab176bf6 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -139,7 +139,10 @@ match_email (ESelectNamesCompletion *comp, EDestination *dest, double *score) gchar *name, *str; *score = len * 2; /* 2 points for each matching character */ name = e_card_name_to_string (card->name); - str = g_strdup_printf ("<%s> %s", email, name); + if (name && *name) + str = g_strdup_printf ("<%s> %s", email, name); + else + str = g_strdup (email); g_free (name); return str; } diff --git a/addressbook/printing/e-contact-print-envelope.c b/addressbook/printing/e-contact-print-envelope.c index af6c92d638..43d40b81cb 100644 --- a/addressbook/printing/e-contact-print-envelope.c +++ b/addressbook/printing/e-contact-print-envelope.c @@ -20,6 +20,8 @@ * Boston, MA 02111-1307, USA. */ +#include <time.h> +#include <libgnome/gnome-paper.h> #include <libgnomeprint/gnome-print.h> #include <libgnomeprint/gnome-print-dialog.h> #include <libgnomeprint/gnome-print-master.h> diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index 32333fcab1..ce0ec6db3f 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -29,6 +29,7 @@ #include <gnome-xml/xmlmemory.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-util.h> +#include <libgnome/gnome-paper.h> #include <libgnomeprint/gnome-print.h> #include <libgnomeprint/gnome-print-dialog.h> #include <libgnomeprint/gnome-print-master.h> diff --git a/camel/ChangeLog b/camel/ChangeLog index f250eba4eb..0106940ea4 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,14 @@ +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 Kjartan Maraas <kmaraas@gnome.org> * broken-date-parser.c: #include <stdio.h>, <stdlib.h> and <string.h> diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index db1f86314e..6c650d3c2c 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -849,7 +849,8 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage p->uid = uid; p->source = source; - /* camel_mime_message_set_identity (message, source_url); */ + if (camel_mime_message_get_source (message) == NULL) + camel_mime_message_set_source (message, source_url); node = (struct _filter_rule *)p->rules.head; while (node->next) { diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index 3728921612..1437744260 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -28,6 +28,7 @@ #include <config.h> #endif +#include <ctype.h> #include <stdio.h> #include <string.h> @@ -401,10 +402,23 @@ camel_mime_message_set_recipients(CamelMimeMessage *mime_message, const char *ty } void -camel_mime_message_set_identity(CamelMimeMessage *mime_message, const char *identity) +camel_mime_message_set_source(CamelMimeMessage *mime_message, const char *src) { g_assert (mime_message); - camel_medium_add_header (CAMEL_MEDIUM (mime_message), "X-Evolution-Identity", identity); + camel_medium_add_header (CAMEL_MEDIUM (mime_message), "X-Evolution-Source", src); +} + +const char * +camel_mime_message_get_source(CamelMimeMessage *mime_message) +{ + const char *src; + g_assert(mime_message); + src = camel_medium_get_header (CAMEL_MEDIUM (mime_message), "X-Evolution-Source"); + if (src) { + while (*src && isspace ((gint) *src)) + ++src; + } + return src; } const CamelInternetAddress * diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h index 8d24245638..47c390a5a5 100644 --- a/camel/camel-mime-message.h +++ b/camel/camel-mime-message.h @@ -115,8 +115,9 @@ void camel_mime_message_set_recipients (CamelMimeMess const char *type, const CamelInternetAddress *r); -void camel_mime_message_set_identity (CamelMimeMessage *mime_message, +void camel_mime_message_set_source (CamelMimeMessage *mime_message, const char *identity); +const char *camel_mime_message_get_source (CamelMimeMessage *mime_message); /* utility functions */ 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"); |