summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-21 01:01:14 -0500
committerjoe <joe@jerkface.net>2017-11-21 01:01:14 -0500
commit1023a3c21003c404b5c3fac466819953588a6887 (patch)
treea0d2a64c27823c5136a4ad1813c9d2b7ffe1a55e /examples
parent98cdeb49997d904cc9b7ce483ebce8ff9173f701 (diff)
Renamed Roster -> ContactInfo, reverted toxManager stubs.
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index ed7d5e63..73ae5a57 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -90,7 +90,7 @@ import qualified Network.Tox.Onion.Handlers as Tox
90import qualified Network.Tox.Crypto.Transport as Tox (CryptoMessage) 90import qualified Network.Tox.Crypto.Transport as Tox (CryptoMessage)
91import qualified Network.Tox.Crypto.Handlers as Tox 91import qualified Network.Tox.Crypto.Handlers as Tox
92import Data.Typeable 92import Data.Typeable
93import Roster 93import Network.Tox.ContactInfo as Tox
94import OnionRouter 94import OnionRouter
95import PingMachine 95import PingMachine
96 96
@@ -384,7 +384,7 @@ data Session = Session
384 , cryptosessions :: Tox.NetCryptoSessions 384 , cryptosessions :: Tox.NetCryptoSessions
385 , toxkeys :: TVar Tox.AnnouncedKeys 385 , toxkeys :: TVar Tox.AnnouncedKeys
386 , userkeys :: TVar [(SecretKey,PublicKey)] 386 , userkeys :: TVar [(SecretKey,PublicKey)]
387 , roster :: Roster 387 , roster :: Tox.ContactInfo
388 , connectionManager :: ConnectionManager 388 , connectionManager :: ConnectionManager
389 , onionRouter :: OnionRouter 389 , onionRouter :: OnionRouter
390 , announcer :: Announcer 390 , announcer :: Announcer
@@ -569,7 +569,7 @@ clientSession s@Session{..} sock cnum h = do
569 oldks <- atomically $ do 569 oldks <- atomically $ do
570 ks <- readTVar userkeys 570 ks <- readTVar userkeys
571 modifyTVar userkeys ((secret,pubkey):) 571 modifyTVar userkeys ((secret,pubkey):)
572 addRoster roster secret 572 Tox.addContactInfo roster secret
573 return ks 573 return ks
574 let asString = show . Tox.key2id 574 let asString = show . Tox.key2id
575 hPutClient h $ unlines $ map (mappend " " . show . Tox.key2id . snd) oldks 575 hPutClient h $ unlines $ map (mappend " " . show . Tox.key2id . snd) oldks
@@ -591,7 +591,7 @@ clientSession s@Session{..} sock cnum h = do
591 oldks <- atomically $ do 591 oldks <- atomically $ do
592 oldks <- readTVar userkeys 592 oldks <- readTVar userkeys
593 modifyTVar userkeys (pairs ++) 593 modifyTVar userkeys (pairs ++)
594 forM pairs $ \(sk,_) -> addRoster roster sk 594 forM pairs $ \(sk,_) -> Tox.addContactInfo roster sk
595 return oldks 595 return oldks
596 hPutClient h $ unlines $ map (mappend " " . show . Tox.key2id . snd) oldks 596 hPutClient h $ unlines $ map (mappend " " . show . Tox.key2id . snd) oldks
597 ++ map (mappend " *" . show . Tox.key2id .snd) pairs 597 ++ map (mappend " *" . show . Tox.key2id .snd) pairs
@@ -604,7 +604,7 @@ clientSession s@Session{..} sock cnum h = do
604 pairs = map (toPair . f) mbSecs 604 pairs = map (toPair . f) mbSecs
605 ks <- atomically $ do 605 ks <- atomically $ do
606 modifyTVar userkeys (filter (`notElem` pairs) ) 606 modifyTVar userkeys (filter (`notElem` pairs) )
607 forM pairs $ \(_,pk) -> delRoster roster pk 607 forM pairs $ \(_,pk) -> Tox.delContactInfo roster pk
608 readTVar userkeys 608 readTVar userkeys
609 hPutClient h . showReport $ map mkrow ks 609 hPutClient h . showReport $ map mkrow ks
610 610
@@ -1332,12 +1332,12 @@ main = runResourceT $ liftBaseWith $ \resT -> do
1332 installHandler sigINT (CatchOnce (atomically $ writeTVar signalQuit True)) Nothing 1332 installHandler sigINT (CatchOnce (atomically $ writeTVar signalQuit True)) Nothing
1333 let defaultToxData = do 1333 let defaultToxData = do
1334 toxids <- atomically $ newTVar [] 1334 toxids <- atomically $ newTVar []
1335 rster <- newRoster 1335 rster <- Tox.newContactInfo
1336 orouter <- newOnionRouter (hPutStrLn stderr) 1336 orouter <- newOnionRouter (hPutStrLn stderr)
1337 return (toxids, rster, orouter) 1337 return (toxids, rster, orouter)
1338 (toxids,rstr,orouter) <- fromMaybe defaultToxData $ do 1338 (toxids,rstr,orouter) <- fromMaybe defaultToxData $ do
1339 tox <- mbtox 1339 tox <- mbtox
1340 return $ return ( userKeys (Tox.toxCryptoKeys tox), Tox.toxRoster tox, Tox.toxOnionRoutes tox ) 1340 return $ return ( userKeys (Tox.toxCryptoKeys tox), Tox.toxContactInfo tox, Tox.toxOnionRoutes tox )
1341 let session = clientSession0 $ Session 1341 let session = clientSession0 $ Session
1342 { netname = concat $ take 1 $ Map.keys dhts -- initial default DHT 1342 { netname = concat $ take 1 $ Map.keys dhts -- initial default DHT
1343 , dhts = dhts -- all DHTs 1343 , dhts = dhts -- all DHTs