From 25dcc0b87ac3ab29a4cc35ded91386558b4bc637 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 7 Nov 2000 12:33:01 +0000 Subject: God, I sure wish people would listen when i'm saying i'm changing and API. 2000-11-07 Not Zed * mail-display.c (on_object_requested): God, I sure wish people would listen when i'm saying i'm changing and API. I mean I even mailed everyone and everything. Can't see any changelog either. 2000-11-06 Not Zed * mail-autofilter.c (rule_from_message): Updates for api changes. * mail-tools.c (mail_tool_generate_forward_subject): Fixed for api changes. Sigh, whoever wrote the multithread code of the mailer, had little idea. You can't just lock for getting a const value, until you are finished with it, cause the owner still owns it. Fixed this too. Yuck, what a horrid forwarding format, can we change this, or make it configurable? The mail headers show who forwarded it, we dont need to duplicate it in that UGLY subject. * mail-format.c (write_field_to_stream): Removed some jeffness. dont g_strdup stuff we dont need to, and remove the value_is_encoded thing since we can get the unencoded address now. (write_address): New function to write an address field. (write_headers): Uses write_address to write addresses, cleaner, fixed the god-awful unreadable indenting too. (handle_text_plain): Use a 'smarter' printf format, so we dont need to allocate and copy substrings unecessarily (esp since they're about to be allocated any copied another few times anyway *sigh*). (write_field_to_stream): Commented out the isprint check, which afaik serves no purpose. (list_add_addresses): New function to build a list of display-ready addresses. Although I think the composer then uses these as internet-ready addresses. It should probably take a list of CamelAddress's if thats what it wants. (mail_generate_reply): Cleaned up the address list creation stuff a heap, and fixes for camel api changes. Also fixed a small memory leak as a side effect (fulladdr wasn't freed if it was the same as the sender). * mail-display.c (on_object_requested): Changed for interface changes to the from address. I think passing the encoded (internet version) of the address is right here. svn path=/trunk/; revision=6475 --- mail/mail-tools.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'mail/mail-tools.c') diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 0ab7862200..25b353016e 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -345,25 +345,29 @@ mail_tool_set_uid_flags (CamelFolder *folder, const char *uid, guint32 mask, gui mail_tool_camel_lock_down (); } -gchar * +char * mail_tool_generate_forward_subject (CamelMimeMessage *msg) { - const gchar *from; - const gchar *subject; - gchar *fwd_subj; + const char *subject; + char *fwd_subj, *fromstr; + const CamelInternetAddress *from; + /* we need to lock around the whole function, as we are + only getting references to the message's data */ mail_tool_camel_lock_up(); - from = camel_mime_message_get_from (msg); - subject = camel_mime_message_get_subject (msg); - mail_tool_camel_lock_down(); + + from = camel_mime_message_get_from(msg); + subject = camel_mime_message_get_subject(msg); if (from) { + fromstr = camel_address_format((CamelAddress *)from); if (subject && *subject) { - fwd_subj = g_strdup_printf ("[%s] %s", from, subject); + fwd_subj = g_strdup_printf ("[%s] %s", fromstr, subject); } else { fwd_subj = g_strdup_printf (_("[%s] (forwarded message)"), - from); + fromstr); } + g_free(fromstr); } else { if (subject && *subject) { if (strncmp (subject, "Fwd: ", 5) == 0) @@ -373,6 +377,8 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) fwd_subj = g_strdup (_("Fwd: (no subject)")); } + mail_tool_camel_lock_down(); + return fwd_subj; } -- cgit