diff options
Diffstat (limited to 'kiki.hs')
-rw-r--r-- | kiki.hs | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -1214,11 +1214,35 @@ main = do | |||
1214 | 1214 | ||
1215 | cross_merge keyrings $ \(secfile,fstkey) db -> do | 1215 | cross_merge keyrings $ \(secfile,fstkey) db -> do |
1216 | let grip = grip0 `mplus` (fingerprint <$> fstkey) | 1216 | let grip = grip0 `mplus` (fingerprint <$> fstkey) |
1217 | |||
1218 | let get_use_db = maybe (return db) import_db | ||
1219 | $ Map.lookup "--import" margs | ||
1220 | import_db _ = do | ||
1221 | forM_ to_alters $ \(_,KeyData c _ _ _) -> | ||
1222 | warn $ pubring ++ ": new "++showPacket (packet c) | ||
1223 | let db' = Map.union (Map.fromList altered) | ||
1224 | db | ||
1225 | return db' | ||
1226 | where | ||
1227 | to_alters = filter (dont_have . snd) $ Map.toList db | ||
1228 | altered = map (second append_loc) to_alters | ||
1229 | append_loc (KeyData p a b c) = KeyData p' a b c | ||
1230 | where p' = p { locations = Map.insert pubring | ||
1231 | (origin (packet p) (-1)) | ||
1232 | (locations p) | ||
1233 | } | ||
1234 | dont_have (KeyData p _ _ _) = not . Map.member pubring | ||
1235 | $ locations p | ||
1236 | use_db <- get_use_db | ||
1237 | |||
1238 | let ret_db = Just use_db | ||
1239 | |||
1217 | let shspec = Map.fromList [("--show-wk", show_wk secfile grip) | 1240 | let shspec = Map.fromList [("--show-wk", show_wk secfile grip) |
1218 | ,("--show-all",show_all )] | 1241 | ,("--show-all",show_all )] |
1219 | shargs = mapMaybe (\x -> listToMaybe x >>= \x ->Map.lookup x shspec) sargs | 1242 | shargs = mapMaybe (\x -> listToMaybe x >>= \x ->Map.lookup x shspec) sargs |
1220 | forM_ shargs $ \cmd -> cmd db | 1243 | |
1221 | return . Just $ db | 1244 | forM_ shargs $ \cmd -> cmd use_db |
1245 | return $ ret_db | ||
1222 | 1246 | ||
1223 | return() | 1247 | return() |
1224 | where | 1248 | where |