Jelajahi Sumber

Added a search by header option to filters -- needs error checking on the searchstring

bbice 23 tahun lalu
induk
melakukan
62df102b70
2 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 5 0
      plugins/filters/filters.php
  2. 3 0
      plugins/filters/options.php

+ 5 - 0
plugins/filters/filters.php

@@ -333,6 +333,11 @@ function filter_search_and_delete($imap, $where, $what, $where_to) {
     } else {
         $search_str = "SEARCH CHARSET US-ASCII ALL ";
     }
+    if ($where == "Header") {
+       $what = explode(':', $what);
+       $where = trim($where . ' ' . $what[0]);
+       $what = addslashes(trim($what[1]));
+    }
     $search_str .= $where . ' {' . strlen($what) . "}\r\n" . $what . "\r\n";
     
     fputs ($imap, "a001 $search_str");

+ 3 - 0
plugins/filters/options.php

@@ -96,6 +96,9 @@
         $sel = (($L && $filters[$theid]['where'] == 'Subject')?'selected':'');
         echo "<option value=\"Subject\" $sel>" . _ ("Subject") . '</option>';
 
+        $sel = (($L && $filters[$theid]['where'] == 'Header')?'selected':'');
+        echo "<option value=\"Header\" $sel>" . _ ("Header") . '</option>';
+
         echo         '</select>'.
                 '</td>'.
             '</tr>'.