Add another level to disposition_send_mdn pref
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 6 Apr 2010 19:15:45 +0000 (13:15 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 6 Apr 2010 19:20:10 +0000 (13:20 -0600)
Given that many spam messages are sent requesting MDNs, it is probably
best no to have MDNs sent out automatically by default.  So add a "MDNs
allowed, but prompt first", which will be the default.

imp/config/prefs.php.dist
imp/lib/Ui/Message.php

index 3ae89d8..5da230d 100644 (file)
@@ -1026,8 +1026,13 @@ $_prefs['disposition_send_mdn'] = array(
     // Locked by default
     'locked' => true,
     'shared' => false,
-    'type' => 'checkbox',
-    'desc' => _("Prompt to send read receipt when requested by the sender?"),
+    'type' => 'enum',
+    'enum' => array(
+        0 => _("Never send read receipt"),
+        1 => _("Always prompt"),
+        2 => _("Prompt only if necessary; otherwise automatically send")
+    ),
+    'desc' => _("Prompt to send read receipt (a/k/a message disposition notification) when requested by the sender?"),
     'help' => 'prefs-disposition_send_mdn'
 );
 
index 5fe6330..99660d2 100644 (file)
@@ -68,8 +68,9 @@ class IMP_Ui_Message
      */
     public function MDNCheck($mailbox, $uid, $headers, $confirmed = false)
     {
-        if (!$GLOBALS['prefs']->getValue('disposition_send_mdn') ||
-            $GLOBALS['imp_imap']->isReadOnly($mailbox)) {
+        $pref_val = $GLOBALS['prefs']->getValue('disposition_send_mdn');
+
+        if (!$pref_val || $GLOBALS['imp_imap']->isReadOnly($mailbox)) {
             return false;
         }
 
@@ -107,7 +108,9 @@ class IMP_Ui_Message
         }
 
         /* See if we need to query the user. */
-        if ($mdn->userConfirmationNeeded() && !$confirmed) {
+        if (!$confirmed &&
+            ((intval($pref_val) == 1) ||
+             $mdn->userConfirmationNeeded())) {
             return true;
         }