Repository: tonioo/sievelib

Issue:
stop action is wrongly implemented
It is currently declared as a control command.

Discussion:

Patch:
diff --git a/sievelib/commands.py b/sievelib/commands.py
index 5a9bf2f..acb4535 100644
--- a/sievelib/commands.py
+++ b/sievelib/commands.py
@@ -550,10 +550,6 @@ class RequireCommand(ControlCommand):
                 RequireCommand.loaded_extensions += [ext]
 
 
-class StopCommand(ControlCommand):
-    args_definition = []
-
-
 class IfCommand(ControlCommand):
     accept_children = True
 
@@ -614,6 +610,10 @@ class ActionCommand(Command):
         return (self.name, ) + tuple(args)
 
 
+class StopCommand(ActionCommand):
+    args_definition = []
+
+
 class FileintoCommand(ActionCommand):
     extension = "fileinto"
     args_definition = [


Test patch:
diff --git a/sievelib/tests/test_factory.py b/sievelib/tests/test_factory.py
index 1da42aa..f425363 100644
--- a/sievelib/tests/test_factory.py
+++ b/sievelib/tests/test_factory.py
@@ -111,6 +111,14 @@ class FactoryTestCase(unittest.TestCase):
         self.assertIn(":copy", actions[0])
         self.assertIn("Toto", actions[0])
 
+        self.fs.addfilter(
+            "ruleY",
+            [("Subject", ":contains", "aaa")],
+            [("stop",)]
+        )
+        actions = self.fs.get_filter_actions("ruleY")
+        self.assertIn("stop", actions[0])
+
     def test_add_header_filter(self):
         output = six.StringIO()
         self.fs.addfilter(
diff --git a/sievelib/tests/test_parser.py b/sievelib/tests/test_parser.py
index d5fa697..8890eac 100644
--- a/sievelib/tests/test_parser.py
+++ b/sievelib/tests/test_parser.py
@@ -189,7 +189,7 @@ noreply
 Your email has been canceled
 ============================
 .
-    stop (type: control)
+    stop (type: action)
 else (type: control)
     reject (type: action)
         text:
@@ -399,7 +399,7 @@ if (type: control)
             not (type: test)
                 not (type: test)
                     true (type: test)
-    stop (type: control)
+    stop (type: action)
 """)
 
     def test_just_one_command(self):