[imp] Purge Messages On Delete

Ed engineer@mca.k12.pa.us
Thu, 25 Jul 2002 15:56:32 -0400


The following patch will add an option to purge messages after a delete 
instead of marking them as deleted.  This option works only with imap servers.

Index: imp/config/prefs.php.dist
===================================================================
RCS file: /repository/imp/config/prefs.php.dist,v
retrieving revision 1.116
diff -b -u -2 -r1.116 prefs.php.dist
--- imp/config/prefs.php.dist   16 Jul 2002 13:50:02 -0000      1.116
+++ imp/config/prefs.php.dist   25 Jul 2002 19:34:10 -0000
@@ -68,5 +68,5 @@
      'desc' => _("Set preferences for what happens when you move and 
delete messages."),
      'members' => array('mailbox_return', 'use_trash', 'trashselect',
-                       'empty_trash_menu')
+                       'empty_trash_menu', 'expunge_on_delete')
  );

@@ -440,4 +440,14 @@
      'type' => 'checkbox',
      'desc' => _("Display the 'Empty Trash' link in the menubar?")
+);
+
+// should we automatically expunge deleted messages?
+// a value of 0 = no, 1 = yes
+$_prefs['expunge_on_delete'] = array(
+    'value' => 1,
+    'locked' => false,
+    'shared' => false,
+    'type' => 'checkbox',
+    'desc' => _("When deleting messages, purge them instead of marking 
them as deleted?")
  );

Index: imp/lib/Message.php
===================================================================
RCS file: /repository/imp/lib/Message.php,v
retrieving revision 1.96
diff -b -u -2 -r1.96 Message.php
--- imp/lib/Message.php 17 Jul 2002 21:27:48 -0000      1.96
+++ imp/lib/Message.php 25 Jul 2002 19:34:12 -0000
@@ -618,7 +618,8 @@
                      }
                      $return_value = false;
-                } elseif ($prefs->getValue('use_trash') &&
-                          ($folder == $trash)) {
+                } elseif (($prefs->getValue('use_trash') && ($folder == 
$trash)) ||
+                          ($prefs->getValue('expunge_on_delete'))) {
                      /* Purge messages in the trash folder immediately. */
+                    /* Purge messages immediately after delete. */
                      @imap_expunge($imp['stream']);
                  } elseif ($use_pop3) {