summaryrefslogtreecommitdiff
path: root/dht/ToxManager.hs
diff options
context:
space:
mode:
Diffstat (limited to 'dht/ToxManager.hs')
-rw-r--r--dht/ToxManager.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/dht/ToxManager.hs b/dht/ToxManager.hs
index dceb9210..51567b27 100644
--- a/dht/ToxManager.hs
+++ b/dht/ToxManager.hs
@@ -89,6 +89,13 @@ stringToKey_ s = let (xs,ys) = break (==':') s
89 them <- readMaybe (drop 1 ys) 89 them <- readMaybe (drop 1 ys)
90 return $ ToxContact me them 90 return $ ToxContact me them
91 91
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
92-- | 99-- |
93-- 100--
94-- These hooks will be invoked in order to connect to *.tox hosts in a user's 101-- These hooks will be invoked in order to connect to *.tox hosts in a user's
@@ -139,7 +146,7 @@ toxman ssvar announcer toxbkts tox presence = ToxManager
139 , deactivateAccount = \k pubname -> do 146 , deactivateAccount = \k pubname -> do
140 dput XMan $ "toxman DECTIVATE (todo) 1 " ++ show pubname 147 dput XMan $ "toxman DECTIVATE (todo) 1 " ++ show pubname
141 let ContactInfo{ accounts } = Tox.toxContactInfo tox 148 let ContactInfo{ accounts } = Tox.toxContactInfo tox
142 mpubid = readMaybe $ T.unpack $ T.take 43 pubname 149 mpubid = readMaybe $ T.unpack $ dropExtension pubname
143 bStopped <- fmap (fromMaybe Nothing) $ atomically $ do 150 bStopped <- fmap (fromMaybe Nothing) $ atomically $ do
144 forM mpubid $ \pubid -> do 151 forM mpubid $ \pubid -> do
145 refs <- do 152 refs <- do