summaryrefslogtreecommitdiff
path: root/lib/KeyRing/BuildKeyDB.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/KeyRing/BuildKeyDB.hs')
-rw-r--r--lib/KeyRing/BuildKeyDB.hs24
1 files changed, 12 insertions, 12 deletions
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
150 readp :: InputFile -> StreamInfo -> IO (StreamInfo, Message) 150 readp :: InputFile -> StreamInfo -> IO (StreamInfo, Message)
151 readp f stream = fmap readp0 $ readPacketsFromFile ctx f 151 readp f stream = fmap readp0 $ readPacketsFromFile ctx f
152 where 152 where
153 readp0 ps = (stream { access = acc' }, ps) 153 readp0 (codec,ps) = (stream { access = acc', typ = PGPPackets codec }, ps)
154 where acc' = case access stream of 154 where acc' = case access stream of
155 AutoAccess -> 155 AutoAccess ->
156 case ps of 156 case ps of
@@ -296,23 +296,23 @@ buildKeyDB ctx grip0 keyring = do
296 296
297 297
298isring :: FileType -> Bool 298isring :: FileType -> Bool
299isring (KeyRingFile {}) = True 299isring (PGPPackets {}) = True
300isring _ = False 300isring _ = False
301 301
302readPacketsFromFile :: InputFileContext -> InputFile -> IO Message 302readPacketsFromFile :: InputFileContext -> InputFile -> IO (PacketsCodec, Message)
303readPacketsFromFile ctx fname = do 303readPacketsFromFile ctx fname = do
304 -- warn $ fname ++ ": reading..." 304 -- warn $ fname ++ ": reading..."
305 input <- readInputFileL ctx fname 305 input <- readInputFileL ctx fname
306 return $ (,) BinaryPackets $
306#if MIN_VERSION_binary(0,7,0) 307#if MIN_VERSION_binary(0,7,0)
307 return $ Message $ flip fix input $ \again some -> 308 Message $ flip fix input $ \again some ->
308 case decodeOrFail some of 309 case decodeOrFail some of
309 Right (more,_,msg ) -> msg : again more 310 Right (more,_,msg ) -> msg : again more
310 Left (_,_,_) -> 311 Left (_,_,_) ->
311 -- FIXME 312 -- TODO: try ascii armor
312 -- trace (fname++": read fail") $ 313 []
313 []
314#else 314#else
315 return $ decode input 315 decode input
316#endif 316#endif
317 317
318readPacketsFromWallet :: 318readPacketsFromWallet ::