summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-11-03 00:50:32 -0400
committerJoe Crayne <joe@jerkface.net>2018-11-03 00:50:32 -0400
commit041571f971326a94d389f81845c434b2bd6fd365 (patch)
treef8098a333e8fd79731469853dbc39da4f0b30e58 /examples/dhtd.hs
parent42061ac9d48a09de2cc3c09e2f6d9c60a7ec45b6 (diff)
Implemented showKey for xmpp/tox connection manager.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 892fc88c..bef09b75 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -1693,8 +1693,7 @@ onNewToxSession sv ssvar ContactInfo{accounts} addrTox netcrypto = do
1693selectManager :: Maybe (t -> ToxManager clientAddress) -> Manager Tcp.TCPStatus T.Text -> T.Text -> Manager Pending T.Text 1693selectManager :: Maybe (t -> ToxManager clientAddress) -> Manager Tcp.TCPStatus T.Text -> T.Text -> Manager Pending T.Text
1694selectManager mtman tcp profile = case T.splitAt 43 profile of 1694selectManager mtman tcp profile = case T.splitAt 43 profile of
1695 (k,".tox") | Just tman <- mtman 1695 (k,".tox") | Just tman <- mtman
1696 -> let _ = _ 1696 -> let -- The following error call is safe because the toxConnections field
1697 -- The following error call is safe because the toxConnections field
1698 -- does not make use of the PresenceState passed to tman. 1697 -- does not make use of the PresenceState passed to tman.
1699 tox = toxConnections $ tman $ error "PresenseState" 1698 tox = toxConnections $ tman $ error "PresenseState"
1700 tkey them = do 1699 tkey them = do
@@ -1724,6 +1723,7 @@ selectManager mtman tcp profile = case T.splitAt 43 profile of
1724 dput XMan $ "reverseAddress(tox)" ++ show (T.take 8 k,paddr) ++ ": " ++ show r 1723 dput XMan $ "reverseAddress(tox)" ++ show (T.take 8 k,paddr) ++ ": " ++ show r
1725 return r 1724 return r
1726 1725
1726 , showKey = \key -> T.unpack key ++ ".tox"
1727 , setPolicy = \them -> case tkey them of 1727 , setPolicy = \them -> case tkey them of
1728 Just tk -> \p -> setPolicy tox tk p 1728 Just tk -> \p -> setPolicy tox tk p
1729 Nothing -> \p -> return () 1729 Nothing -> \p -> return ()
@@ -1745,6 +1745,7 @@ selectManager mtman tcp profile = case T.splitAt 43 profile of
1745 dput XMan $ "reverseAddress(tcp) " ++ show (profile,paddr) 1745 dput XMan $ "reverseAddress(tcp) " ++ show (profile,paddr)
1746 reverseAddress tcp paddr 1746 reverseAddress tcp paddr
1747 1747
1748 , showKey = showKey tcp
1748 , setPolicy = setPolicy tcp 1749 , setPolicy = setPolicy tcp
1749 , status = \k -> fmap XMPPStatus <$> status tcp k 1750 , status = \k -> fmap XMPPStatus <$> status tcp k
1750 , connections = connections tcp 1751 , connections = connections tcp