diff options
Diffstat (limited to 'dht/ToxManager.hs')
-rw-r--r-- | dht/ToxManager.hs | 10 |
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 | |||
9 | import Announcer | 9 | import Announcer |
10 | import Announcer.Tox | 10 | import Announcer.Tox |
11 | import ClientState | 11 | import ClientState |
12 | import Codec.AsciiKey256 | ||
12 | import ConfigFiles | 13 | import ConfigFiles |
13 | import Control.Arrow | 14 | import Control.Arrow |
14 | import Control.Concurrent.STM | 15 | import 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 | ||
92 | dropExtension :: T.Text -> T.Text | ||
93 | dropExtension 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 |