Blame SOURCES/augeas-1.1.0-dovecot-mailbox.patch

c537d4
From 24364f9c9955ea10b094d6892e8c91d6b308ffe2 Mon Sep 17 00:00:00 2001
c537d4
From: =?UTF-8?q?Michael=20Haslgr=C3=BCbler?= <work-michael@haslgruebler.eu>
c537d4
Date: Wed, 21 Aug 2013 23:19:04 +0200
c537d4
Subject: [PATCH 1/3] dovecot enchancement and bug fixes
c537d4
c537d4
* add mailbox to block_names
c537d4
* fix for block_args in quotes
c537d4
* fix for block's brackets upon write
c537d4
* fixes broken tests for mailbox
c537d4
* fixes indention
c537d4
* test case for block_args with "
c537d4
* fixes broken indention
c537d4
c537d4
(cherry picked from commit e6ff9449e5af1759d6b7828ceb118882e955dca4)
c537d4
c537d4
Use Quote module in dovecot
c537d4
c537d4
* use Quote.dquote_spaces for quoting
c537d4
c537d4
(cherry picked from commit 735caf587959019d214a51a7c0cce57da9bb88f6)
c537d4
---
c537d4
 lenses/dovecot.aug            | 37 +++++++++++++++++++++++++++++++++----
c537d4
 lenses/tests/test_dovecot.aug |  6 ++++++
c537d4
 2 files changed, 39 insertions(+), 4 deletions(-)
c537d4
c537d4
diff --git a/lenses/dovecot.aug b/lenses/dovecot.aug
c537d4
index 6e5ccc9..e3558d0 100644
c537d4
--- a/lenses/dovecot.aug
c537d4
+++ b/lenses/dovecot.aug
c537d4
@@ -56,9 +56,6 @@ let value = any . (Rx.space . any)*
c537d4
 (* View: command_start *)
c537d4
 let command_start = Util.del_str "!"
c537d4
 
c537d4
-(* View: block_args 
c537d4
-Map block arguments after block name and before "{" *)
c537d4
-let block_args = Sep.space . store /[A-Za-z0-9\/\\_-]+/
c537d4
 
c537d4
 (******************************************************************
c537d4
  * Group:                        ENTRIES
c537d4
@@ -82,11 +79,43 @@ let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ]
c537d4
 Map commands started with "!". *)
c537d4
 let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ]
c537d4
 
c537d4
+(*
c537d4
+View: dquote_spaces
c537d4
+  Make double quotes mandatory if value contains spaces,
c537d4
+  and optional if value doesn't contain spaces.
c537d4
+
c537d4
+Based off Quote.dquote_spaces
c537d4
+
c537d4
+Parameters:
c537d4
+  lns1:lens - the lens before
c537d4
+  lns2:lens - the lens after
c537d4
+*)
c537d4
+let dquote_spaces (lns1:lens) (lns2:lens) =
c537d4
+     (* bare has no spaces, and is optionally quoted *)
c537d4
+     let bare = Quote.do_dquote_opt (store /[^" \t\n]+/)
c537d4
+     (* quoted has at least one space, and must be quoted *)
c537d4
+  in let quoted = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/)
c537d4
+  in [ lns1 . bare . lns2 ] | [ lns1 . quoted . lns2 ]
c537d4
+
c537d4
+let mailbox = indent
c537d4
+            . dquote_spaces
c537d4
+               (key /mailbox/ . Sep.space)
c537d4
+               (Build.block_newlines (entry) comment . eol)
c537d4
+
c537d4
+let block_ldelim_newlines_re = /[ \t]+\{([ \t\n]*\n)?/
c537d4
+
c537d4
+let block_newlines (entry:lens) (comment:lens) =
c537d4
+      let indent = del Rx.opt_space "\t"
c537d4
+   in del block_ldelim_newlines_re Build.block_ldelim_default
c537d4
+ . ((entry | comment) . (Util.empty | entry | comment)*)?
c537d4
+ . del Build.block_rdelim_newlines_re Build.block_rdelim_newlines_default
c537d4
+
c537d4
 (* View: block
c537d4
 Map block enclosed in brackets recursively. 
c537d4
 Block may be indented and have optional argument.
c537d4
 Block body may have entries, comments, empty lines, and nested blocks recursively. *)
c537d4
-let rec block = [ indent . key block_names . block_args? . Build.block_newlines (entry|block) comment . eol ]
c537d4
+let rec block = [ indent . key block_names . (Sep.space . Quote.do_dquote_opt (store /[\/A-Za-z0-9_-]+/))? . block_newlines (entry|block|mailbox) comment . eol ]
c537d4
+
c537d4
 
c537d4
 (******************************************************************
c537d4
  * Group:                   LENS AND FILTER
c537d4
diff --git a/lenses/tests/test_dovecot.aug b/lenses/tests/test_dovecot.aug
c537d4
index 2201735..33ea16f 100644
c537d4
--- a/lenses/tests/test_dovecot.aug
c537d4
+++ b/lenses/tests/test_dovecot.aug
c537d4
@@ -465,6 +465,9 @@ namespace {
c537d4
   hidden = no
c537d4
   list = yes
c537d4
   subscriptions = yes
c537d4
+  mailbox \"Sent Messages\" {
c537d4
+    special_use = \Sent
c537d4
+  }
c537d4
 }
c537d4
 
c537d4
 # Example shared namespace configuration
c537d4
@@ -533,6 +536,9 @@ test Dovecot.lns get mail_conf =
c537d4
     { "hidden" = "no" }
c537d4
     { "list" = "yes" }
c537d4
     { "subscriptions" = "yes" }
c537d4
+    { "mailbox" = "Sent Messages" 
c537d4
+      { "special_use" = "\Sent" }
c537d4
+    }
c537d4
   }
c537d4
   {  }
c537d4
   { "#comment" = "Example shared namespace configuration" }
c537d4
-- 
c537d4
1.8.5.3
c537d4