summaryrefslogtreecommitdiff
path: root/dht/ToxManager.hs
diff options
context:
space:
mode:
Diffstat (limited to 'dht/ToxManager.hs')
-rw-r--r--dht/ToxManager.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/dht/ToxManager.hs b/dht/ToxManager.hs
index 51567b27..408b12d2 100644
--- a/dht/ToxManager.hs
+++ b/dht/ToxManager.hs
@@ -9,6 +9,7 @@ module ToxManager where
9import Announcer 9import Announcer
10import Announcer.Tox 10import Announcer.Tox
11import ClientState 11import ClientState
12import Codec.AsciiKey256
12import ConfigFiles 13import ConfigFiles
13import Control.Arrow 14import Control.Arrow
14import Control.Concurrent.STM 15import Control.Concurrent.STM
@@ -89,13 +90,6 @@ stringToKey_ s = let (xs,ys) = break (==':') s
89 them <- readMaybe (drop 1 ys) 90 them <- readMaybe (drop 1 ys)
90 return $ ToxContact me them 91 return $ ToxContact me them
91 92
92dropExtension :: T.Text -> T.Text
93dropExtension pubname = case T.dropWhileEnd (/='.') pubname of
94 x | T.null x -> pubname
95 | otherwise -> case T.dropEnd 1 pubname of
96 y | T.null y -> pubname -- Avoid changing "." to empty string.
97 | otherwise -> y
98
99-- | 93-- |
100-- 94--
101-- These hooks will be invoked in order to connect to *.tox hosts in a user's 95-- These hooks will be invoked in order to connect to *.tox hosts in a user's
@@ -146,7 +140,7 @@ toxman ssvar announcer toxbkts tox presence = ToxManager
146 , deactivateAccount = \k pubname -> do 140 , deactivateAccount = \k pubname -> do
147 dput XMan $ "toxman DECTIVATE (todo) 1 " ++ show pubname 141 dput XMan $ "toxman DECTIVATE (todo) 1 " ++ show pubname
148 let ContactInfo{ accounts } = Tox.toxContactInfo tox 142 let ContactInfo{ accounts } = Tox.toxContactInfo tox
149 mpubid = readMaybe $ T.unpack $ dropExtension pubname 143 mpubid = stripSuffix ".tox" pubname >>= readMaybe . T.unpack
150 bStopped <- fmap (fromMaybe Nothing) $ atomically $ do 144 bStopped <- fmap (fromMaybe Nothing) $ atomically $ do
151 forM mpubid $ \pubid -> do 145 forM mpubid $ \pubid -> do
152 refs <- do 146 refs <- do