Browse files

extra data support

  • Loading branch information...
apage43 committed Sep 18, 2010
1 parent e375931 commit 3eb49c767c2001010e899e0d1282a3d7c167cdfc
Showing with 5 additions and 3 deletions.
  1. +2 −1
  2. +3 −2 src/couchmail.clj
@@ -21,4 +21,5 @@ Send email to be stored to couchdb in MIME to the couchmail.Store Nail with the
Example .fetchmailrc:
poll protocol imap user "" password "hunter2" mda "/usr/local/bin/ng couchmail.Store" ssl
+couchmail.Store optionally excepts as a third parameter an aribtrary json blob to merge with imported mail. For example, to tag all mail from my work email account in a [mailbag]( bag, I can use a fetchmailrc line like this:
+ poll protocol imap user "" password "hunter2" mda "/usr/local/bin/ng couchmail.Store '{\x22bags\x22:[\x22work\x22]}'" ssl
@@ -73,6 +73,7 @@
(defn Store-nailMain [ctx]
(let [args (seq (.getArgs ctx))
- dburl (if (= 1 (count args)) (first args) "")]
- (http/post dburl {:body (json-str (simplify-message (create-message (.in ctx)))) :content-type :json})
+ dburl (if (< 0 (count args)) (first args) "")
+ merged (if (< 1 (count args)) (read-json (second args)) {})]
+ (http/post dburl {:body (json-str (merge merged (simplify-message (create-message (.in ctx))))) :content-type :json})
(println "OK")))

0 comments on commit 3eb49c7

Please sign in to comment.