diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-09-20 12:55:08 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-09-20 12:55:08 +0800 |
commit | cfad07e359064567d8723407aa0163489e21673d (patch) | |
tree | 0d7231874644d4078b38f5c3897a10275a8e1b6f /mail | |
parent | 5abe315bb7b82aacaf0fe2afa4b12ac60284c267 (diff) | |
download | gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.tar gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.tar.gz gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.tar.bz2 gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.tar.lz gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.tar.xz gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.tar.zst gsoc2013-evolution-cfad07e359064567d8723407aa0163489e21673d.zip |
Truncate extremely long subjects. (inspired by bug #9158)
2001-09-19 Jon Trowbridge <trow@ximian.com>
* 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
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 11 | ||||
-rw-r--r-- | mail/mail-tools.c | 7 |
3 files changed, 22 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 6af11e32e9..bafdfbea98 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-09-19 Jon Trowbridge <trow@ximian.com> + + * 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) + 2001-09-19 Jeffrey Stedfast <fejj@ximian.com> * mail-send-recv.c (receive_update_got_store): Here too. 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); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 09603eb458..5e0d3ee9ee 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -206,11 +206,16 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) { const char *subject; char *fwd_subj; + const int max_subject_length = 1024; subject = camel_mime_message_get_subject(msg); if (subject && *subject) { - fwd_subj = g_strdup_printf ("[Fwd: %s]", subject); + /* Truncate insanely long subjects */ + if (strlen (subject) < max_subject_length) + fwd_subj = g_strdup_printf ("[Fwd: %s]", subject); + else + fwd_subj = g_strdup_printf ("[Fwd: %.*s...]", max_subject_length, subject); } else { const CamelInternetAddress *from; char *fromstr; |