diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-04 06:59:57 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-04 07:06:52 -0400 |
commit | be4aea4b72b9544c4a982a883d7b66698d58272d (patch) | |
tree | 4a71fc0f1fde35fc290ba22ecbf441ba8b0ec801 /lib/KeyRing/BuildKeyDB.hs | |
parent | 90d53ed9167c1263909d4488d940d585339d353c (diff) |
Make ready for ascii-armor support.
Diffstat (limited to 'lib/KeyRing/BuildKeyDB.hs')
-rw-r--r-- | lib/KeyRing/BuildKeyDB.hs | 24 |
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 | ||
298 | isring :: FileType -> Bool | 298 | isring :: FileType -> Bool |
299 | isring (KeyRingFile {}) = True | 299 | isring (PGPPackets {}) = True |
300 | isring _ = False | 300 | isring _ = False |
301 | 301 | ||
302 | readPacketsFromFile :: InputFileContext -> InputFile -> IO Message | 302 | readPacketsFromFile :: InputFileContext -> InputFile -> IO (PacketsCodec, Message) |
303 | readPacketsFromFile ctx fname = do | 303 | readPacketsFromFile 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 | ||
318 | readPacketsFromWallet :: | 318 | readPacketsFromWallet :: |