From fc901e96b54bc732674c9712e6f5f5c04ca83d1c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 1 Oct 2010 10:07:48 -0600 Subject: [PATCH] Improve spam message when there is no subject --- imp/lib/Spam.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/imp/lib/Spam.php b/imp/lib/Spam.php index c9e3cb23b..3e23bb794 100644 --- a/imp/lib/Spam.php +++ b/imp/lib/Spam.php @@ -167,15 +167,25 @@ class IMP_Spam /* Report what we've done. */ if ($report_count == 1) { $hdrs = $imp_contents->getHeaderOb(); - $subject = Horde_String::truncate($hdrs->getValue('subject'), 30); + if ($subject = $hdrs->getValue('subject')) { + $subject = Horde_String::truncate($subject, 30); + } elseif ($from = $hdrs->getValue('from')) { + $from = Horde_String::truncate($from, 30); + } else { + $subject = '[' . _("No Subject") . ']'; + } switch ($action) { case 'spam': - $msg = sprintf(_("The message \"%s\" has been reported as spam."), $subject); + $msg = $subject + ? sprintf(_("The message \"%s\" has been reported as spam."), $subject) + : sprintf(_("The message from \"%s\" has been reported as spam."), $from); break; case 'notspam': - $msg = sprintf(_("The message \"%s\" has been reported as innocent."), $subject); + $msg = $subject + ? sprintf(_("The message \"%s\" has been reported as innocent."), $subject) + : sprintf(_("The message from \"%s\" has been reported as innocent."), $from); break; } } elseif ($action == 'spam') { -- 2.11.0