From 6fe0904372a25808d68000e32dac7826f9c1f0e9 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 12 Apr 2014 02:21:16 -0400 Subject: simplification --- kiki.hs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/kiki.hs b/kiki.hs index ab3faf5..496eb3c 100644 --- a/kiki.hs +++ b/kiki.hs @@ -1313,11 +1313,11 @@ cross_merge doDecrypt homespec keyrings wallets f = do , homeSpec = homespec , keyringFiles = keyrings , walletFiles = wallets - , kaction = go + , kaction = go doDecrypt f } runKeyRing it where - go rt = do + go doDecrypt f rt = do let readp n = fmap (n,) (readPacketsFromFile n) readw wk n = fmap (n,) (readPacketsFromWallet wk n) @@ -1335,15 +1335,13 @@ cross_merge doDecrypt homespec keyrings wallets f = do guard $ matchSpec (KeyGrip fp) elm return $ keyPacket (snd elm) wms <- mapM (readw wk) (rtWallets rt) - let -- db1= foldl' (uncurry . merge_) db0 wms - ts = do + let ts = do maybeToList wk (fname,xs) <- wms (_,sub,(_,m)) <- xs (tag,top) <- Map.toList m return (top,fname,sub,tag) - -- sig' <- makeSig doDecrypt top fname subkey_p tag mbsig importWalletKey db' (top,fname,sub,tag) = do doImportG doDecrypt db' @@ -1377,12 +1375,8 @@ cross_merge doDecrypt homespec keyrings wallets f = do warn $ n++": new WalletKey "++net hPutStrLn fh wip - -- unlockFiles fsns ----------- Originally, I did this to enable altering the gpg keyrings - ------------------------------- from external tools. - (db',_) <- f (rtSecring rt,grip) db (rtPubring rt) - -- lk <- relock --------------- The design is not quite safe, so it is disabled for now. + db' <- f (rtSecring rt,grip) db (rtPubring rt) let lk = (rtRings rt,[]) - ------------------------------- maybe (if n==0 then pass 1 else return (lk,db)) (return . (lk,)) db' @@ -2553,7 +2547,7 @@ main = do shargs = mapMaybe (\(x:xs) -> (,xs) <$> Map.lookup x shspec) sargs forM_ shargs $ \(cmd,args) -> cmd args use_db - return $ (ret_db,use_db) + return ret_db return() where -- cgit v1.2.3