From a2cb306981d8665f1a3907933d52793f8a216053 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 30 Dec 2009 07:33:15 -0500
Subject: [PATCH] - Managesieve: Fix requires generation for multiple actions (#1486397)

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

diff --git a/CHANGELOG b/CHANGELOG
index 419cb75..0ecd1c6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Managesieve: Fix requires generation for multiple actions (#1486397)
 - Fix LDAP problem with special characters in RDN (#1486320)
 - Improved handling of message parts of type message/rfc822
 - Updated TinyMCE to 3.2.7
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 2b46e9f..85b3728 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,3 +1,5 @@
+- Fix requires generation when many modules are used
+
 * version 2.0 [2009-11-02]
 -----------------------------------------------------------
 - Added 'managesieve_debug' option
diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php
index a8290b1..fb76452 100644
--- a/plugins/managesieve/lib/rcube_sieve.php
+++ b/plugins/managesieve/lib/rcube_sieve.php
@@ -448,6 +448,7 @@
   
 	  // action(s)
 	  foreach ($rule['actions'] as $action)
+          {
 	    switch ($action['type'])
 	    {
 	      case 'fileinto':
@@ -491,12 +492,13 @@
 		  $script .= " \"" . $this->_escape_string($action['reason']) . "\";\n";
 	      break;
 	    }
-	  
+
+	    if ($extension && !isset($exts[$extension]))
+	      $exts[$extension] = $extension;
+	  }
+
 	  $script .= "}\n";
 	  $idx++;
-
-	  if ($extension && !isset($exts[$extension]))
-	    $exts[$extension] = $extension;
 	}
       
       // requires

--
Gitblit v1.9.1