Explorar o código

Add ability to filter on the Message body, or if text appears any where in the message (Header or Body).
The strings are already translated via our search form
This should close Feature Request # 509443

Jimmy Conner %!s(int64=20) %!d(string=hai) anos
pai
achega
056aa987f5
Modificáronse 2 ficheiros con 12 adicións e 0 borrados
  1. 6 0
      plugins/filters/filters.php
  2. 6 0
      plugins/filters/options.php

+ 6 - 0
plugins/filters/filters.php

@@ -240,6 +240,12 @@ function user_filters($imap_stream) {
                   $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan, $expunge);
             $expunge = filter_search_and_delete($imap_stream, 'CC',
                   $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan, $expunge);
+        } else if ($filters[$i]['where'] == 'Header and Body') {
+            $expunge = filter_search_and_delete($imap_stream, 'TEXT',
+                  $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan, $expunge);
+        } else if ($filters[$i]['where'] == 'Message Body') {
+            $expunge = filter_search_and_delete($imap_stream, 'BODY',
+                  $filters[$i]['what'], $filters[$i]['folder'], $filters_user_scan, $expunge);                  
         } else {
             /*
             *  If it's a normal TO, CC, SUBJECT, or FROM, then handle it

+ 6 - 0
plugins/filters/options.php

@@ -191,6 +191,12 @@ if (sqgetGlobalVar('filter_submit',$filter_submit,SQ_POST)) {
         $sel = (($L && $filters[$theid]['where'] == 'Subject')?' selected="selected"':'');
         echo "<option value=\"Subject\"$sel>" . _("Subject") . '</option>';
 
+        $sel = (($L && $filters[$theid]['where'] == 'Message Body')?' selected="selected"':'');
+        echo "<option value=\"Message Body\"$sel>" . _("Message Body") . '</option>';
+
+        $sel = (($L && $filters[$theid]['where'] == 'Header and Body')?' selected="selected"':'');
+        echo "<option value=\"Header and Body\"$sel>" . _("Header and Body") . '</option>';
+
         $sel = (($L && $filters[$theid]['where'] == 'Header')?' selected="selected"':'');
         echo "<option value=\"Header\"$sel>" . _("Header") . '</option>';