summaryrefslogtreecommitdiff
path: root/Presence/Presence.hs
diff options
context:
space:
mode:
authorjim@bo <jim@bo>2018-06-20 22:40:37 -0400
committerjim@bo <jim@bo>2018-06-20 22:43:47 -0400
commit825962518c6ad00279fc23e8e1dec746980e483f (patch)
tree68c135bdffd879835c48cce3d397e8edf99b53f4 /Presence/Presence.hs
parent09aa079fbab069f177e08b5239bf684d312eb00a (diff)
More DPut stuff
* verbose/quiet without args shows report * verbose all - sets all tags verbose * quiet all - sets all tags quiet * XMisc defaults to verbose, everything else quiet * new XMan tag for ToxManager related stuff * s/hputStrLn stderr/dput XMisc/ in daemon code
Diffstat (limited to 'Presence/Presence.hs')
-rw-r--r--Presence/Presence.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Presence/Presence.hs b/Presence/Presence.hs
index 2f59a52f..18bde516 100644
--- a/Presence/Presence.hs
+++ b/Presence/Presence.hs
@@ -62,6 +62,7 @@ import Util
62import qualified Connection 62import qualified Connection
63import Network.Tox.NodeId (id2key,key2id) 63import Network.Tox.NodeId (id2key,key2id)
64import Crypto.Tox (decodeSecret) 64import Crypto.Tox (decodeSecret)
65import DPut
65 66
66isPeerKey :: ConnectionKey -> Bool 67isPeerKey :: ConnectionKey -> Bool
67isPeerKey k = case k of { PeerKey {} -> True ; _ -> False } 68isPeerKey k = case k of { PeerKey {} -> True ; _ -> False }
@@ -239,23 +240,23 @@ chooseResourceName state k addr clientsNameForMe desired = do
239#endif 240#endif
240 cfs <- map Text.pack <$> listDirectory cdir `catchIOError` (\e -> return []) 241 cfs <- map Text.pack <$> listDirectory cdir `catchIOError` (\e -> return [])
241 let profiles = filter (\f -> Text.toLower f == Text.toLower wanted_profile0) cfs 242 let profiles = filter (\f -> Text.toLower f == Text.toLower wanted_profile0) cfs
242 -- hPutStrLn stderr $ "Toxmpp profile " ++ show (user,wanted_profile0,profiles,cfs) 243 -- dput XMisc $ "Toxmpp profile " ++ show (user,wanted_profile0,profiles,cfs)
243 let wanted_profile = head $ profiles ++ [wanted_profile0] 244 let wanted_profile = head $ profiles ++ [wanted_profile0]
244 secs <- configText ConfigFiles.getSecrets user wanted_profile 245 secs <- configText ConfigFiles.getSecrets user wanted_profile
245 case secs of 246 case secs of
246 sec:_ | Just s <- decodeSecret (Text.encodeUtf8 sec) 247 sec:_ | Just s <- decodeSecret (Text.encodeUtf8 sec)
247 , map toLower (show $ key2id $ toPublic s) == map toLower (Text.unpack pub) 248 , map toLower (show $ key2id $ toPublic s) == map toLower (Text.unpack pub)
248 -> do activateAccount toxman k wanted_profile s 249 -> do activateAccount toxman k wanted_profile s
249 hPutStrLn stderr $ "loaded tox secret " ++ show sec 250 dput XMisc $ "loaded tox secret " ++ show sec
250 return wanted_profile 251 return wanted_profile
251 _ -> do 252 _ -> do
252 -- XXX: We should probably fail to connect when an 253 -- XXX: We should probably fail to connect when an
253 -- invalid Tox profile is used. For now, we'll 254 -- invalid Tox profile is used. For now, we'll
254 -- fall back to the Unix account login. 255 -- fall back to the Unix account login.
255 hPutStrLn stderr "failed to find tox secret" 256 dput XMisc "failed to find tox secret"
256 return "." 257 return "."
257 ("*.tox","") -> do 258 ("*.tox","") -> do
258 hPutStrLn stderr $ "TODO: Match single tox key profile or generate first." 259 dput XMisc $ "TODO: Match single tox key profile or generate first."
259 -- TODO: Match single tox key profile or generate first. 260 -- TODO: Match single tox key profile or generate first.
260 _todo 261 _todo
261 _ -> return "." 262 _ -> return "."