From 6d421d484821c2e92430c2702949dd2e9f5ae8a4 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 13 Jul 2019 01:41:28 -0400 Subject: peers do not need a .onion name --- lib/Kiki.hs | 19 +++++++------------ 1 file 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 data Peer = Peer - { peerContactName :: () - , peerHostnames :: Hostnames + { peerHostnames :: Hostnames , addr :: SockAddr , kd :: KeyData } @@ -556,20 +555,16 @@ rethrowKikiErrors rt = unconditionally $ return rt newtype UidHostname = UidHostname Char8.ByteString newtype ResolvableHostname = ResolvableHostname Char8.ByteString -chooseOneName :: Hostnames -> Maybe UidHostname -chooseOneName (Hostnames _ (n:_) _ _) = Just $ coerce n -chooseOneName _ = Nothing - listPeers :: KeyRingRuntime -> [Peer] listPeers rt = map conv . filter notme . mapMaybe namedContact . Map.elems . byKeyKey . rtKeyDB $ rt where - conv = \(a,b,c,d) -> Peer () b c d - kk = keykey (fromJust $ rtWorkingKey rt) - notme (_,_,_,kd) = keykey (keyPacket kd) /= kk - namedContact kd = do + conv = \(a,b,c) -> Peer a b c + kk = keykey (fromJust $ rtWorkingKey rt) + notme (_,_,kd) = keykey (keyPacket kd) /= kk + namedContact kd = do let h = getHostnames kd - n <- chooseOneName h - return (n, h, gpgipv6addr h, kd) + _ <- listToMaybe $ allNames h + return (h, gpgipv6addr h, kd) writePublicKeyFiles :: KeyRingRuntime -> FileWriter -> String -> MyIdentity -> IO () writePublicKeyFiles rt fw grip myId = do -- cgit v1.2.3