From be4aea4b72b9544c4a982a883d7b66698d58272d Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Thu, 4 Jul 2019 06:59:57 -0400 Subject: Make ready for ascii-armor support. --- lib/KeyRing/BuildKeyDB.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/KeyRing/BuildKeyDB.hs') diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs index ba5bafe..f5b09ca 100644 --- a/lib/KeyRing/BuildKeyDB.hs +++ b/lib/KeyRing/BuildKeyDB.hs @@ -150,7 +150,7 @@ buildKeyDB ctx grip0 keyring = do readp :: InputFile -> StreamInfo -> IO (StreamInfo, Message) readp f stream = fmap readp0 $ readPacketsFromFile ctx f where - readp0 ps = (stream { access = acc' }, ps) + readp0 (codec,ps) = (stream { access = acc', typ = PGPPackets codec }, ps) where acc' = case access stream of AutoAccess -> case ps of @@ -296,23 +296,23 @@ buildKeyDB ctx grip0 keyring = do isring :: FileType -> Bool -isring (KeyRingFile {}) = True -isring _ = False +isring (PGPPackets {}) = True +isring _ = False -readPacketsFromFile :: InputFileContext -> InputFile -> IO Message +readPacketsFromFile :: InputFileContext -> InputFile -> IO (PacketsCodec, Message) readPacketsFromFile ctx fname = do -- warn $ fname ++ ": reading..." input <- readInputFileL ctx fname + return $ (,) BinaryPackets $ #if MIN_VERSION_binary(0,7,0) - return $ Message $ flip fix input $ \again some -> - case decodeOrFail some of - Right (more,_,msg ) -> msg : again more - Left (_,_,_) -> - -- FIXME - -- trace (fname++": read fail") $ - [] + Message $ flip fix input $ \again some -> + case decodeOrFail some of + Right (more,_,msg ) -> msg : again more + Left (_,_,_) -> + -- TODO: try ascii armor + [] #else - return $ decode input + decode input #endif readPacketsFromWallet :: -- cgit v1.2.3