Some code cleanups to read_body.php
[squirrelmail.git] / plugins / filters / filters.php
index 2f3ac1a59fa5eeb467f27ca025e6a7a626cda228..4d88d6f7510d979be53537ca79b785daa57f06f6 100644 (file)
@@ -25,7 +25,6 @@
  * $Id$
  */
 
-
 function filters_SaveCache () {
     global $data_dir, $SpamFilters_DNScache;
 
@@ -53,7 +52,6 @@ function filters_SaveCache () {
     fclose($fp);
 }
 
-
 function filters_LoadCache () {
     global $data_dir, $SpamFilters_DNScache;
 
@@ -165,8 +163,8 @@ function filters_bulkquery($filters_spam_scan, $filters, $read) {
 
 function start_filters() {
     global $mailbox, $username, $key, $imapServerAddress, $imapPort, $imap,
-        $imap_general, $filters, $imap_stream, $imapConnection,
-    $UseSeparateImapConnection, $AllowSpamFilters;
+           $imap_general, $filters, $imap_stream, $imapConnection,
+           $UseSeparateImapConnection, $AllowSpamFilters;
 
 #    if ($mailbox == 'INBOX') {
         // Detect if we have already connected to IMAP or not.
@@ -200,7 +198,6 @@ function start_filters() {
 #    }
 }
 
-
 function user_filters($imap_stream) {
     global $data_dir, $username;
     $filters = load_filters();
@@ -233,7 +230,7 @@ function user_filters($imap_stream) {
     // Clean out the mailbox whether or not auto_expunge is on
     // That way it looks like it was redirected properly
     if (count($id)) {
-       sqimap_mailbox_expunge($imap_stream, 'INBOX');
+        sqimap_mailbox_expunge($imap_stream, 'INBOX');
     }
 }
 
@@ -259,6 +256,8 @@ function filter_search_and_delete($imap, $where, $what, $where_to, $user_scan, $
         $where = trim($where . ' ' . $what[0]);
         $what  = addslashes(trim($what[1]));
     }
+    $search_str .= ' ' . $where . ' {' . strlen($what) . "}\r\n"
+                 . $what . "\r\n";
 
     /* read data back from IMAP */
     $read = sqimap_run_command($imap, $search_str, true, $response, $message, $uid_support);
@@ -417,7 +416,6 @@ function spam_filters($imap_stream) {
 
 }
 
-
 // Does the loop through each enabled filter for the specified IP address.
 // IP format:  $a.$b.$c.$d
 function filters_spam_check_site($a, $b, $c, $d, &$filters) {