diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kiki.hs | 19 |
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 | ||
337 | data Peer = | 337 | data 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 | |||
556 | newtype UidHostname = UidHostname Char8.ByteString | 555 | newtype UidHostname = UidHostname Char8.ByteString |
557 | newtype ResolvableHostname = ResolvableHostname Char8.ByteString | 556 | newtype ResolvableHostname = ResolvableHostname Char8.ByteString |
558 | 557 | ||
559 | chooseOneName :: Hostnames -> Maybe UidHostname | ||
560 | chooseOneName (Hostnames _ (n:_) _ _) = Just $ coerce n | ||
561 | chooseOneName _ = Nothing | ||
562 | |||
563 | listPeers :: KeyRingRuntime -> [Peer] | 558 | listPeers :: KeyRingRuntime -> [Peer] |
564 | listPeers rt = map conv . filter notme . mapMaybe namedContact . Map.elems . byKeyKey . rtKeyDB $ rt | 559 | listPeers 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 | ||
574 | writePublicKeyFiles :: KeyRingRuntime -> FileWriter -> String -> MyIdentity -> IO () | 569 | writePublicKeyFiles :: KeyRingRuntime -> FileWriter -> String -> MyIdentity -> IO () |
575 | writePublicKeyFiles rt fw grip myId = do | 570 | writePublicKeyFiles rt fw grip myId = do |