Commit 91cdeab9cf2bc438ba85a30f852f0f34eaa171b9

Authored by Marius Hanne
1 parent 43c2c05ec2
Exists in master

use maildirmake -f and subscribe in IMAP

Showing 1 changed file with 10 additions and 5 deletions Side-by-side Diff

maildrop_serializer.rb
... ... @@ -8,25 +8,30 @@
8 8 " `test -d '#{dest_folder(filter)}'`",
9 9 " if( $RETURNCODE == 1 )",
10 10 " {",
11   - " `maildirmake #{dest_folder(filter)}`",
  11 + " `maildirmake -f #{dest_folder_name(filter)} $DEFAULT`",
  12 + " `if ! grep -q INBOX.#{dest_folder_name(filter)} $DEFAULT/courierimapsubscribed; then echo INBOX.#{dest_folder_name(filter)} >> $DEFAULT/courierimapsubscribed; fi`",
12 13 " }",
13 14 " to #{dest_folder(filter)}",
14 15 " }",
15 16 "}"].join("\n")
16 17 end.join("\n\n")
17 18 end
18   -
  19 +
19 20 private
20   -
  21 +
  22 + def dest_folder_name(filter)
  23 + filter.destination_folder.sub("INBOX.", "")
  24 + end
  25 +
21 26 def dest_folder(filter)
22 27 '$DEFAULT/' << filter.destination_folder.sub(Regexp.new("(INBOX)(.*)"), '\2')
23 28 end
24   -
  29 +
25 30 def escape_expr_value(text)
26 31 text.gsub(".", "\\.").gsub("*", "\\*").gsub("[", "\\[").gsub("]", "\\]").gsub("(", "\\(").gsub(")", "\\)").
27 32 gsub("?", "\\?")
28 33 end
29   -
  34 +
30 35 def filter_expressions(filter)
31 36 fe = ""
32 37 for exp in filter.expressions