Bug #8221: Fix innocent reporting
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Nov 2009 22:41:13 +0000 (15:41 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Nov 2009 22:41:57 +0000 (15:41 -0700)
Also, break preferences into 2 to reduce confusion.

imp/config/prefs.php.dist
imp/docs/CHANGES
imp/lib/Spam.php
imp/locale/en_US/help.xml

index 0c00d97..41197ea 100644 (file)
@@ -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?
index 31fd1e9..491a2ad 100644 (file)
@@ -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).
index 5e304ec..5933ea6 100644 (file)
@@ -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;
     }
 
 }
index a0fc211..2a4cb73 100644 (file)
 <entry id="prefs-delete_spam_after_report">
     <title>Preferences: Delete Spam After Reporting</title>
     <para>
-    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.
     </para>
     <para>
-    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.
     </para>
     <para>
-    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.
     </para>
     <para>
-    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.
+    </para>
+</entry>
+
+<entry id="prefs-move_ham_after_report">
+    <title>Preferences: Move Spam After Reporting As Innocent</title>
+    <para>
+    You may elect to do one of two items after reporting a message previously maked as spam as innocent.
+    </para>
+    <para>
+    First, you can decide to do nothing - the message will be reported as innocent but will otherwise remain unchanged in your mailbox.
+    </para>
+    <para>
+    Second, if reporting a message as innocent the message will be deleted from the current mailbox and moved to your Inbox.
     </para>
 </entry>