From cfad07e359064567d8723407aa0163489e21673d Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Thu, 20 Sep 2001 04:55:08 +0000 Subject: Truncate extremely long subjects. (inspired by bug #9158) 2001-09-19 Jon Trowbridge * mail-callbacks.c (mail_generate_reply): Truncate extremely long subjects. (inspired by bug #9158) * mail-tools.c (mail_tool_generate_forward_subject): Truncate extremely long subjects. (bug #9158) svn path=/trunk/; revision=13007 --- mail/mail-callbacks.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mail/mail-callbacks.c') diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 70e06df2f8..7efd2523b1 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -766,6 +766,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char EDestination **tov, **ccv; EMsgComposer *composer; time_t date; + const int max_subject_length = 1024; composer = e_msg_composer_new (); if (!composer) @@ -879,9 +880,13 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char subject = g_strdup (""); else { if (!g_strncasecmp (subject, "Re: ", 4)) - subject = g_strdup (subject); - else - subject = g_strdup_printf ("Re: %s", subject); + subject = g_strndup (subject, max_subject_length); + else { + if (strlen (subject) < max_subject_length) + subject = g_strdup_printf ("Re: %s", subject); + else + subject = g_strdup_printf ("Re: %.*s...", max_subject_length, subject); + } } tov = e_destination_list_to_vector (to); -- cgit