[imp] Patch to delete spam after - report as spam -

Rudi Heitbaum rudi at darx.com
Wed Jul 16 06:44:54 PDT 2003


Here is an update to the patch by David Chang.

There is a problem with the previous patch in that the previous
message body was maintained. Could this be checked into the CVS tree.
I have been using David's patch for a couple of months now.

Regards

Rudi
-------------- next part --------------
? ingo/config/tests.php
Index: imp/mailbox.php
===================================================================
RCS file: /data/derwurfel/software/horde/rsync/imp/mailbox.php,v
retrieving revision 2.507
diff -c -r2.507 mailbox.php
*** imp/mailbox.php	16 Jul 2003 01:45:08 -0000	2.507
--- imp/mailbox.php	16 Jul 2003 13:38:54 -0000
***************
*** 168,173 ****
--- 168,189 ----
              $notification->push(_("1 message has been reported as spam to your system administrator."), 'horde.message');
          }
      }
+ 
+     /* Delete Spam after report */
+     if ($conf['spam']['delete_after_report'] && !empty($indices)) {
+        require_once IMP_BASE . '/lib/Message.php';
+        $imp_message = &new IMP_Message();
+        $imp_message->delete($indices);
+        /* For POP3, redirect so that refreshing the page doesn't */
+        /* delete more messages accidentally. */
+        if (strstr($imp['base_protocol'], 'pop3')) {
+           header('Location: ' . Horde::url($mailbox_url, true));
+           exit;
+        }
+        $notification->push(sprintf(_("%d message(s) have been deleted."),
+                                    $msg_count), 'horde.message');
+ 
+     }
      break;
  
  case 'message_missing':
Index: imp/message.php
===================================================================
RCS file: /data/derwurfel/software/horde/rsync/imp/message.php,v
retrieving revision 2.474
diff -c -r2.474 message.php
*** imp/message.php	17 Jun 2003 07:53:45 -0000	2.474
--- imp/message.php	16 Jul 2003 13:38:54 -0000
***************
*** 146,151 ****
--- 146,166 ----
          $notification->push(_("This message has been reported as spam to your system administrator."), 'horde.message');
      }
  
+     /* Delete Spam after report */
+     if ($conf['spam']['delete_after_report']) {
+         require_once IMP_BASE . '/lib/Message.php';
+         $imp_message = &new IMP_Message();
+         $imp_message->setMailboxObject($imp_mailbox);
+         $imp_message->delete();
+         if ($prefs->getValue('mailbox_return')) {
+             _returnToMailbox($imp_mailbox->getMessageIndex());
+             require IMP_BASE . '/mailbox.php';
+             exit;
+         }
+         unset($imp_contents);
+         unset($raw_msg);
+         $notification->push(_("The message has been deleted."), 'horde.message');
+     }
      break;
  
  case 'flag_message':
Index: imp/config/conf.xml
===================================================================
RCS file: /data/derwurfel/software/horde/rsync/imp/config/conf.xml,v
retrieving revision 1.21
diff -c -r1.21 conf.xml
*** imp/config/conf.xml	2 Jul 2003 23:06:45 -0000	1.21
--- imp/config/conf.xml	16 Jul 2003 13:38:54 -0000
***************
*** 103,108 ****
--- 103,109 ----
     <configboolean name="reporting" desc="Should we display a 'report this message as spam' link in the message view?">false</configboolean>
     <configstring name="email" required="false" desc="If so, should we report them via email?">postmaster at example.com</configstring>
     <configstring name="program" required="false" desc="Should we report them via an external program?">/usr/local/bin/spamassassin -r</configstring>
+    <configboolean name="delete_after_report" desc="Should we delete them after report?">true</configboolean>
   </configsection>
   
   <configsection name="compose">


More information about the imp mailing list