summaryrefslogtreecommitdiff
path: root/ymir/mlmmj-expose.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-06-02 02:47:52 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-06-02 02:47:52 +0200
commitcac41719d3fb1640a2d43862afe6e85b88d26b95 (patch)
tree9bf8e6e4ffd7d885c9c3e2533d481b01024e8f8a /ymir/mlmmj-expose.nix
parent81ea9bb24b55d10254416f1649a57fe9c0d4af21 (diff)
downloadnixos-cac41719d3fb1640a2d43862afe6e85b88d26b95.tar
nixos-cac41719d3fb1640a2d43862afe6e85b88d26b95.tar.gz
nixos-cac41719d3fb1640a2d43862afe6e85b88d26b95.tar.bz2
nixos-cac41719d3fb1640a2d43862afe6e85b88d26b95.tar.xz
nixos-cac41719d3fb1640a2d43862afe6e85b88d26b95.zip
filename not dir
Diffstat (limited to 'ymir/mlmmj-expose.nix')
-rw-r--r--ymir/mlmmj-expose.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix
index 3f4298cb..53e18b1d 100644
--- a/ymir/mlmmj-expose.nix
+++ b/ymir/mlmmj-expose.nix
@@ -61,7 +61,7 @@ let
61 "mlmmj-get-exposed" -> do 61 "mlmmj-get-exposed" -> do
62 args <- getArgs 62 args <- getArgs
63 case args of 63 case args of
64 listDir : (map toLower -> ident) : (map (map toLower) -> recipients) -> do 64 (dropTrailingPathSeparator -> listDir) : (map toLower -> ident) : (map (map toLower) -> recipients) -> do
65 setCurrentDirectory listDir 65 setCurrentDirectory listDir
66 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e) 66 key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e)
67 identities <- (lines <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) 67 identities <- (lines <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e)
@@ -69,7 +69,7 @@ let
69 subscribers <- getSubscribers 69 subscribers <- getSubscribers
70 forM_ recipients (\recipient -> do { 70 forM_ recipients (\recipient -> do {
71 unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’"; 71 unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’";
72 encryptMsg CBC key (CLBS.pack . show $ (ident, recipient)) >>= putStrLn . (\ext -> takeDirectory listDir ++ "+" ++ ext ++ "@subs.lists.yggdrasil.li") . CBS.unpack . massage . Base64.encode . LBS.toStrict; 72 encryptMsg CBC key (CLBS.pack . show $ (ident, recipient)) >>= putStrLn . (\ext -> takeFileName listDir ++ "+" ++ ext ++ "@subs.lists.yggdrasil.li") . CBS.unpack . massage . Base64.encode . LBS.toStrict;
73 }) 73 })
74 _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <senderIdentity> [<recipient> [...]])") >> exitWith (ExitFailure 2) 74 _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <senderIdentity> [<recipient> [...]])") >> exitWith (ExitFailure 2)
75 _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) 75 _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2)