summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Kiki.hs19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs
index 9832ef9..324efc4 100644
--- a/lib/Kiki.hs
+++ b/lib/Kiki.hs
@@ -336,8 +336,7 @@ importAndRefresh root cmn cipher = do
336 336
337data Peer = 337data Peer =
338 Peer 338 Peer
339 { peerContactName :: () 339 { peerHostnames :: Hostnames
340 , peerHostnames :: Hostnames
341 , addr :: SockAddr 340 , addr :: SockAddr
342 , kd :: KeyData 341 , kd :: KeyData
343 } 342 }
@@ -556,20 +555,16 @@ rethrowKikiErrors rt = unconditionally $ return rt
556newtype UidHostname = UidHostname Char8.ByteString 555newtype UidHostname = UidHostname Char8.ByteString
557newtype ResolvableHostname = ResolvableHostname Char8.ByteString 556newtype ResolvableHostname = ResolvableHostname Char8.ByteString
558 557
559chooseOneName :: Hostnames -> Maybe UidHostname
560chooseOneName (Hostnames _ (n:_) _ _) = Just $ coerce n
561chooseOneName _ = Nothing
562
563listPeers :: KeyRingRuntime -> [Peer] 558listPeers :: KeyRingRuntime -> [Peer]
564listPeers rt = map conv . filter notme . mapMaybe namedContact . Map.elems . byKeyKey . rtKeyDB $ rt 559listPeers rt = map conv . filter notme . mapMaybe namedContact . Map.elems . byKeyKey . rtKeyDB $ rt
565 where 560 where
566 conv = \(a,b,c,d) -> Peer () b c d 561 conv = \(a,b,c) -> Peer a b c
567 kk = keykey (fromJust $ rtWorkingKey rt) 562 kk = keykey (fromJust $ rtWorkingKey rt)
568 notme (_,_,_,kd) = keykey (keyPacket kd) /= kk 563 notme (_,_,kd) = keykey (keyPacket kd) /= kk
569 namedContact kd = do 564 namedContact kd = do
570 let h = getHostnames kd 565 let h = getHostnames kd
571 n <- chooseOneName h 566 _ <- listToMaybe $ allNames h
572 return (n, h, gpgipv6addr h, kd) 567 return (h, gpgipv6addr h, kd)
573 568
574writePublicKeyFiles :: KeyRingRuntime -> FileWriter -> String -> MyIdentity -> IO () 569writePublicKeyFiles :: KeyRingRuntime -> FileWriter -> String -> MyIdentity -> IO ()
575writePublicKeyFiles rt fw grip myId = do 570writePublicKeyFiles rt fw grip myId = do