From: Michael M Slusarz Date: Wed, 18 Nov 2009 22:41:13 +0000 (-0700) Subject: Bug #8221: Fix innocent reporting X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7f52cfe330ff812639803818a34d074546ec3f5e;p=horde.git Bug #8221: Fix innocent reporting Also, break preferences into 2 to reduce confusion. --- diff --git a/imp/config/prefs.php.dist b/imp/config/prefs.php.dist index 0c00d97d4..41197ea41 100644 --- a/imp/config/prefs.php.dist +++ b/imp/config/prefs.php.dist @@ -113,7 +113,7 @@ $prefGroups['delmove'] = array( 'label' => _("Deleting and Moving Messages"), 'desc' => _("Set preferences for what happens when you move and delete messages."), 'members' => array('mailbox_return', 'delete_spam_after_report', - 'empty_spam_menu') + 'move_ham_after_report', 'empty_spam_menu') ); if (!$is_pop3) { $prefGroups['delmove']['members'] = array_merge( @@ -834,14 +834,31 @@ $_prefs['delete_spam_after_report'] = array( 'type' => 'enum', 'enum' => array( 0 => _("Nothing"), - 1 => _("Delete spam messages") + 1 => _("Delete message") ), - 'desc' => _("What should we do with spam messages after they have been reported as spam or innocent?"), + 'desc' => _("What should we do with spam messages after they have been reported as spam?"), 'help' => 'prefs-delete_spam_after_report' ); if (!$is_pop3) { $_prefs['delete_spam_after_report']['enum'][2] = - _("Move spam messages to spam folder and innocent messages to INBOX"); + _("Move to spam folder"); +} + +// What should we do with spam messages after reporting them as innocent? +$_prefs['move_ham_after_report'] = array( + 'value' => 0, + 'locked' => false, + 'shared' => false, + 'type' => 'enum', + 'enum' => array( + 0 => _("Nothing") + ), + 'desc' => _("What should we do with spam messages after they have been reported as innocent?"), + 'help' => 'prefs-move_ham_after_report' +); +if (!$is_pop3) { + $_prefs['move_ham_after_report']['enum'][1] = + _("Move to Inbox"); } // Replace image tags in inline viewed HTML messages with blank images? diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 31fd1e9da..491a2ad15 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,8 @@ v5.0-git -------- +[mms] Split ham/spam reporting actions into two separate preferences (Request + #8221). [mms] Add vertical-pane preview layout to DIMP. [mms] Wrap content-related MIME parts in a border when viewing inline to indicate their relationship. @@ -114,6 +116,8 @@ v5.0-git v4.3.6-cvs ---------- +[mms] For messages marked as innocent but not moved to Inbox, don't report + them as deleted within the current mailbox (Bug #8221). [jan] Don't show address book preference group if address books are disabled (Bug #8692). [mms] Save References/In-Reply-To header info when saving a draft (Bug #8661). diff --git a/imp/lib/Spam.php b/imp/lib/Spam.php index 5e304ecb8..5933ea68c 100644 --- a/imp/lib/Spam.php +++ b/imp/lib/Spam.php @@ -166,26 +166,26 @@ class IMP_Spam break; case 'notspam': - $msg = sprintf(_("The message \"%s\" has been reported as spam."), $subject); + $msg = sprintf(_("The message \"%s\" has been reported as innocent."), $subject); break; } } elseif ($action == 'spam') { $msg = sprintf(_("%d messages have been reported as spam."), $report_count); } else { - $msg = sprintf(_("%d messages have been reported as not spam."), $report_count); + $msg = sprintf(_("%d messages have been reported as innocent."), $report_count); } $notification->push($msg, 'horde.message'); - /* Delete spam after report. */ - $delete_spam = $GLOBALS['prefs']->getValue('delete_spam_after_report'); - if ($delete_spam) { - $imp_message = IMP_Message::singleton(); - switch ($delete_spam) { - case 1: - if ($action == 'spam') { + /* Delete/move message after report. */ + switch ($action) { + case 'spam': + if ($result = $GLOBALS['prefs']->getValue('delete_spam_after_report')) { + $imp_message = IMP_Message::singleton(); + switch ($result) { + case 1: $msg_count = $imp_message->delete($indices); if ($msg_count === false) { - $delete_spam = 0; + $result = 0; } else { if ($msg_count == 1) { $notification->push(_("The message has been deleted."), 'horde.message'); @@ -193,24 +193,34 @@ class IMP_Spam $notification->push(sprintf(_("%d messages have been deleted."), $msg_count), 'horde.message'); } } - } - break; + break; - case 2: - $targetMbox = ($action == 'spam') ? IMP::folderPref($GLOBALS['prefs']->getValue('spam_folder'), true) : 'INBOX'; - if ($targetMbox) { - if ($imp_message->copy($targetMbox, 'move', $indices, true) === false) { - $delete_spam = 0; + case 2: + $targetMbox = IMP::folderPref($GLOBALS['prefs']->getValue('spam_folder'), true); + if ($targetMbox) { + if (!$imp_message->copy($targetMbox, 'move', $indices, true)) { + $result = 0; + } + } else { + $notification->push(_("Could not move message to spam mailbox - no spam mailbox defined in preferences."), 'horde.error'); + $result = 0; } - } else { - $notification->push(_("Could not move message to spam mailbox - no spam mailbox defined in preferences."), 'horde.error'); - $delete_spam = 0; + break; + } + } + break; + + case 'notspam': + if ($result = $GLOBALS['prefs']->getValue('move_ham_after_report')) { + $imp_message = IMP_Message::singleton(); + if (!$imp_message->copy('INBOX', 'move', $indices)) { + $result = 0; } - break; } + break; } - return $delete_spam; + return $result; } } diff --git a/imp/locale/en_US/help.xml b/imp/locale/en_US/help.xml index a0fc21137..2a4cb738a 100644 --- a/imp/locale/en_US/help.xml +++ b/imp/locale/en_US/help.xml @@ -778,16 +778,29 @@ Preferences: Delete Spam After Reporting - You may elect to do one of three items after reporting a message as either spam or innocent. + You may elect to do one of three items after reporting a message as spam. - First, you can decide to do nothing - the message will be reported as either spam or innocent but will otherwise remain unchanged in your mailbox. + First, you can decide to do nothing - the message will be reported as spam but will otherwise remain unchanged in your mailbox. - Second, if reporting a message as spam, you can instead have the message be immediately deleted. This setting has no effect on reporting a message as innocent. + Second, if reporting a message as spam, you can instead have the message be immediately deleted. - Third, after reporting a message as spam the message will be deleted from the current mailbox and moved to your spam folder. Alternatively, if reporting a message as innocent the message will be deleted from the current mailbox and moved to your INBOX. + Third, after reporting a message as spam the message will be deleted from the current mailbox and moved to your spam folder. + + + + + Preferences: Move Spam After Reporting As Innocent + + You may elect to do one of two items after reporting a message previously maked as spam as innocent. + + + First, you can decide to do nothing - the message will be reported as innocent but will otherwise remain unchanged in your mailbox. + + + Second, if reporting a message as innocent the message will be deleted from the current mailbox and moved to your Inbox.