diff options
Diffstat (limited to 'ymir/mlmmj-expose.nix')
-rw-r--r-- | ymir/mlmmj-expose.nix | 4 |
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) |