From 23856c9d4ecec38ae530adf1996b00968dbbfb17 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 24 Jul 2012 04:06:08 -0400
Subject: [PATCH] Fix performance issue in message_headers_output hook handling, Update version number

---
 plugins/managesieve/Changelog       |    3 ++-
 plugins/managesieve/managesieve.php |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 14de0d0..c015ee4 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,7 +1,8 @@
-* version 5.2 [2012-07-23]
+* version 5.2 [2012-07-24]
 -----------------------------------------------------------
 - Added GUI for variables setting - RFC5229 (patch from Paweł Słowik)
 - Fixed scrollbars in Larry's iframes
+- Fix performance issue in message_headers_output hook handling
 
 * version 5.1 [2012-06-21]
 -----------------------------------------------------------
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 70b280d..8ef5f3f 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -62,7 +62,7 @@
         "x-beenthere",
     );
 
-    const VERSION = '5.0';
+    const VERSION = '5.2';
     const PROGNAME = 'Roundcube (Managesieve)';
 
 
@@ -143,6 +143,13 @@
      */
     function mail_headers($args)
     {
+        // this hook can be executed many times
+        if ($this->mail_headers_done) {
+            return $args;
+        }
+
+        $this->mail_headers_done = true;
+
         $headers = $args['headers'];
         $ret     = array();
 

--
Gitblit v1.9.1