summaryrefslogtreecommitdiff
path: root/ToxManager.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ToxManager.hs')
-rw-r--r--ToxManager.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/ToxManager.hs b/ToxManager.hs
index cd835983..04695894 100644
--- a/ToxManager.hs
+++ b/ToxManager.hs
@@ -30,6 +30,7 @@ import System.IO
30import Text.Read 30import Text.Read
31import ToxToXMPP 31import ToxToXMPP
32import XMPPServer (ConnectionKey) 32import XMPPServer (ConnectionKey)
33import DPut
33 34
34#ifdef THREAD_DEBUG 35#ifdef THREAD_DEBUG
35import Control.Concurrent.Lifted.Instrument 36import Control.Concurrent.Lifted.Instrument
@@ -64,7 +65,7 @@ toxman :: Announcer
64 -> ToxManager ConnectionKey 65 -> ToxManager ConnectionKey
65toxman announcer toxbkts tox presence = ToxManager 66toxman announcer toxbkts tox presence = ToxManager
66 { activateAccount = \k pubname seckey -> do 67 { activateAccount = \k pubname seckey -> do
67 hPutStrLn stderr $ "toxman ACTIVATE " ++ show (Tox.key2id $ toPublic seckey) 68 dput XMan $ "toxman ACTIVATE " ++ show (Tox.key2id $ toPublic seckey)
68 let ContactInfo{ accounts } = Tox.toxContactInfo tox 69 let ContactInfo{ accounts } = Tox.toxContactInfo tox
69 pub = toPublic seckey 70 pub = toPublic seckey
70 pubid = Tox.key2id pub 71 pubid = Tox.key2id pub
@@ -100,7 +101,7 @@ toxman announcer toxbkts tox presence = ToxManager
100 return () 101 return ()
101 102
102 , deactivateAccount = \k pubname -> do 103 , deactivateAccount = \k pubname -> do
103 hPutStrLn stderr $ "toxman DECTIVATE (todo) 1 " ++ show pubname 104 dput XMan $ "toxman DECTIVATE (todo) 1 " ++ show pubname
104 let ContactInfo{ accounts } = Tox.toxContactInfo tox 105 let ContactInfo{ accounts } = Tox.toxContactInfo tox
105 mpubid = readMaybe $ T.unpack $ T.take 43 pubname 106 mpubid = readMaybe $ T.unpack $ T.take 43 pubname
106 bStopped <- fmap (fromMaybe Nothing) $ atomically $ do 107 bStopped <- fmap (fromMaybe Nothing) $ atomically $ do
@@ -122,7 +123,7 @@ toxman announcer toxbkts tox presence = ToxManager
122 return (akey,bkts) 123 return (akey,bkts)
123 else return Nothing 124 else return Nothing
124 forM_ bStopped $ \kbkts -> do 125 forM_ bStopped $ \kbkts -> do
125 hPutStrLn stderr $ "toxman DECTIVATE (todo) 3 " ++ show pubname 126 dput XMan $ "toxman DECTIVATE (todo) 3 " ++ show pubname
126 let Just pubid = mpubid 127 let Just pubid = mpubid
127 pub = Tox.id2key pubid 128 pub = Tox.id2key pubid
128 forM_ kbkts $ \(akey,bkts) -> do 129 forM_ kbkts $ \(akey,bkts) -> do
@@ -141,7 +142,7 @@ toxman announcer toxbkts tox presence = ToxManager
141 let m = do meid <- readMaybe $ T.unpack $ T.take 43 me 142 let m = do meid <- readMaybe $ T.unpack $ T.take 43 me
142 themid <- readMaybe $ T.unpack $ T.take 43 them 143 themid <- readMaybe $ T.unpack $ T.take 43 them
143 return $ Tox.Key meid themid 144 return $ Tox.Key meid themid
144 hPutStrLn stderr $ "toxman ConnectionPolicy " ++ show (me,them,p,fmap (const ()) m) 145 dput XMan $ "toxman ConnectionPolicy " ++ show (me,them,p,fmap (const ()) m)
145 forM_ m $ \k -> do 146 forM_ m $ \k -> do
146 setPolicy (Tox.toxMgr tox) k p 147 setPolicy (Tox.toxMgr tox) k p
147 case p of 148 case p of