summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-12-03 10:59:18 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-01 23:22:52 -0500
commite5d0ed4f539bc07a8bdf89f20d940e592475a0a6 (patch)
tree4e9ebdc9f1d3d424b1501da670f05c1bdf08b2da
parent5ed2793f19883c2e90609a145346a4359ad4e1d2 (diff)
Less restrictive jabber id parse.
-rw-r--r--dht/src/Network/Tox/NodeId.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/dht/src/Network/Tox/NodeId.hs b/dht/src/Network/Tox/NodeId.hs
index 68888fdd..6c82ce09 100644
--- a/dht/src/Network/Tox/NodeId.hs
+++ b/dht/src/Network/Tox/NodeId.hs
@@ -575,9 +575,9 @@ parseNoSpamJID jid = do
575 (u,h) <- maybe (Left "Invalid JID.") Right 575 (u,h) <- maybe (Left "Invalid JID.") Right
576 $ let (mu,h,_) = splitJID jid 576 $ let (mu,h,_) = splitJID jid
577 in fmap (, h) mu 577 in fmap (, h) mu
578 based <- case splitAt 52 $ Text.unpack h of 578 based <- case stripSuffix ".tox" h of
579 (base32,".tox") -> Right base32 579 Just base32 -> Right $ Text.unpack base32
580 _ -> Left "Hostname should be 52 z-base32 digits followed by .tox." 580 _ -> Left "Hostname should be 52 z-base32 digits followed by .tox."
581 pub <- id2key <$> readEither based 581 pub <- id2key <$> readEither based
582 let ustr = Text.unpack u 582 let ustr = Text.unpack u
583 case ustr of 583 case ustr of