diff options
Diffstat (limited to 'ymir')
-rw-r--r-- | ymir/mlmmj-expose.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ymir/mlmmj-expose.nix b/ymir/mlmmj-expose.nix index d48bed18..2158cd35 100644 --- a/ymir/mlmmj-expose.nix +++ b/ymir/mlmmj-expose.nix | |||
@@ -39,11 +39,11 @@ let | |||
39 | [listDir, (Base64.decodeLenient -> extension)] -> do | 39 | [listDir, (Base64.decodeLenient -> extension)] -> do |
40 | setCurrentDirectory listDir | 40 | setCurrentDirectory listDir |
41 | key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e) | 41 | key <- (BS.readFile "exposed.key") `catchIOError` (\e -> if isDoesNotExistError e then randomKey >>= (\k -> BS.writeFile "exposed.key" k >> return k) else ioError e) |
42 | let (((map toLower -> ident), (map toLower -> recipient)) :: (String, String)) = read . CLBS.unpack $ decryptMsg CBC key recipientExt | 42 | let ((map toLower -> ident), (map toLower -> recipient)) = read . CLBS.unpack $ decryptMsg CBC key extension |
43 | identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) | 43 | identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) |
44 | unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" | 44 | unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" |
45 | subscribers <- getSubscribers | 45 | subscribers <- getSubscribers |
46 | unless (recipient `elem` subscribers) . dio $ "Unknown recipient: ‘" ++ recipient ++ "’" | 46 | unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’" |
47 | getContents >>= writeFile "queue/exposed" | 47 | getContents >>= writeFile "queue/exposed" |
48 | callProcess "${pkgs.mlmmj}/bin/mlmmj-send" ["-L", listDir, "-l", "6", "-m", "queue/exposed", "-T", recipient] | 48 | callProcess "${pkgs.mlmmj}/bin/mlmmj-send" ["-L", listDir, "-l", "6", "-m", "queue/exposed", "-T", recipient] |
49 | _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <recipientExtension>)") >> exitWith (ExitFailure 2) | 49 | _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <recipientExtension>)") >> exitWith (ExitFailure 2) |
@@ -66,7 +66,7 @@ let | |||
66 | identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) | 66 | identities <- (read <$> readFile "exposed.ids") `catchIOError` (\e -> if isDoesNotExistError e then return [] else ioError e) |
67 | unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" | 67 | unless (ident `elem` identities) . die $ "Unknown sender: ‘" ++ ident ++ "’" |
68 | subscribers <- getSubscribers | 68 | subscribers <- getSubscribers |
69 | unless (recipient `elem` subscribers) . dio $ "Unknown recipient: ‘" ++ recipient ++ "’" | 69 | unless (recipient `elem` subscribers) . die $ "Unknown recipient: ‘" ++ recipient ++ "’" |
70 | encryptMsg CBC key (CLBS.pack . show $ (ident, recipient)) >>= CLBS.putStrLn | 70 | encryptMsg CBC key (CLBS.pack . show $ (ident, recipient)) >>= CLBS.putStrLn |
71 | _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <senderIdentity> <recipient>)") >> exitWith (ExitFailure 2) | 71 | _ -> hPutStrLn stderr ("Called without expected arguments (<listDirectory> <senderIdentity> <recipient>)") >> exitWith (ExitFailure 2) |
72 | _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) | 72 | _ -> hPutStrLn stderr ("Called under unsupported name ‘" ++ progName ++ "’") >> exitWith (ExitFailure 2) |