[imp] Updated Patch for Purge Messages On Delete
Ed
engineer@mca.k12.pa.us
Mon, 29 Jul 2002 20:15:51 -0400
The following patch is based on my previous patch, but has been updated to
work with the latest CVS. This patch also adds the following:
In the prefs.php.dist, the purge on delete option is defaulted to off.
When the purge on delete option is enabled, Show Deleted/Purge Messages
link is hidden.
When Show Deleted is not available, the Undelete link is hidden.
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 29 Jul 2002 23:56:02 -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' => 0,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("When deleting messages, purge them instead of marking
them as deleted?")
);
Index: imp/lib/Mailbox.php
===================================================================
RCS file: /repository/imp/lib/Mailbox.php,v
retrieving revision 1.2
diff -b -u -2 -r1.2 Mailbox.php
--- imp/lib/Mailbox.php 29 Jul 2002 22:35:48 -0000 1.2
+++ imp/lib/Mailbox.php 29 Jul 2002 23:56:04 -0000
@@ -192,4 +192,5 @@
if (!$prefs->getValue('use_trash') &&
+ !$prefs->getValue('expunge_on_delete') &&
strstr($imp['protocol'], 'imap')) {
return true;
Index: imp/lib/Message.php
===================================================================
RCS file: /repository/imp/lib/Message.php,v
retrieving revision 1.97
diff -b -u -2 -r1.97 Message.php
--- imp/lib/Message.php 29 Jul 2002 20:09:22 -0000 1.97
+++ imp/lib/Message.php 29 Jul 2002 23:56:04 -0000
@@ -657,7 +657,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) {
Index: imp/templates/mailbox/actions.inc
===================================================================
RCS file: /repository/imp/templates/mailbox/actions.inc,v
retrieving revision 2.45
diff -b -u -2 -r2.45 actions.inc
--- imp/templates/mailbox/actions.inc 25 Jul 2002 04:08:49 -0000 2.45
+++ imp/templates/mailbox/actions.inc 29 Jul 2002 23:56:24 -0000
@@ -15,5 +15,5 @@
onmouseout="status='';"><?php echo _("Delete") ?></a>
<?php endif; ?>
- <?php if (!$prefs->getValue('use_trash') && strstr($imp['protocol'],
'imap') && !$prefs->getValue('delhide')): ?> |
+ <?php if (!$prefs->getValue('use_trash') && strstr($imp['protocol'],
'imap') && $showdelete && !$prefs->getValue('delhide')): ?> |
<a class="widget" href="" onclick="Submit(<?php echo
UNDELETE_MESSAGES ?>); return false;"
onmouseover="status='<?php echo addslashes(_("Undelete")) ?>';
return true;"