Pārlūkot izejas kodu

If no filters defined, and spam filters are not enabled, don't bother
issuing a possibly costly IMAP STATUS call to INBOX.

jangliss 20 gadi atpakaļ
vecāks
revīzija
4935d499b7
2 mainītis faili ar 23 papildinājumiem un 1 dzēšanām
  1. 2 0
      ChangeLog
  2. 21 1
      plugins/filters/filters.php

+ 2 - 0
ChangeLog

@@ -458,6 +458,8 @@ Version 1.5.1 -- CVS
     IE6 browsers.
   - Rare case of session being destroyed causing PHP errors, so ensure session
     is restarted.
+  - If you don't have any filters defined, and spam filters are disabled, no
+    point issuing a STATUS call on INBOX for the filters plugin.
 
 Version 1.5.0 - 2 February 2004
 -------------------------------

+ 21 - 1
plugins/filters/filters.php

@@ -192,6 +192,26 @@ function start_filters() {
     sqgetGlobalVar('username', $username, SQ_SESSION);
     sqgetGlobalVar('key',      $key,      SQ_COOKIE);
 
+    $filters = load_filters();
+
+    // No point running spam filters if there aren't any to run //
+    if ($AllowSpamFilters) {
+        $spamfilters = load_spam_filters();
+
+        $AllowSpamFilters = false;
+        foreach($spamfilters as $key=>$value) {
+            if ($value['enabled'] == 'yes') {
+                $AllowSpamFilters = true;
+                break;
+            }
+        }
+    }
+
+    if (!$AllowSpamFilters && empty($filters)) {
+        return;
+    }
+
+
     // Detect if we have already connected to IMAP or not.
     // Also check if we are forced to use a separate IMAP connection
     if ((!isset($imap_stream) && !isset($imapConnection)) ||
@@ -883,4 +903,4 @@ function do_error($string) {
     echo "</font></p>\n";
 }
 
-?>
+?>