summaryrefslogtreecommitdiff
path: root/xmppServer.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-03-03 16:09:12 -0500
committerjoe <joe@jerkface.net>2014-03-03 16:09:12 -0500
commit5cd226bdc93bdf74b41744b18512afedc86e213d (patch)
tree94527dfbcfd0cf69dd3b9d9e06e41fe8a18fba87 /xmppServer.hs
parentcbb711a2859916fab96ddceabc8e9a9a0105476b (diff)
improved readibility for unsplitJID
Diffstat (limited to 'xmppServer.hs')
-rw-r--r--xmppServer.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/xmppServer.hs b/xmppServer.hs
index b5d54344..64d34ff6 100644
--- a/xmppServer.hs
+++ b/xmppServer.hs
@@ -36,14 +36,15 @@ import UTmp (ProcessID,users)
36import LocalPeerCred 36import LocalPeerCred
37import XMPPServer 37import XMPPServer
38 38
39unsplitJID (n,h,r) = jid
40 where
41 jid0 = maybe h (\n->n<>"@"<>h) n
42 jid = maybe jid0 (\r->jid0<>"/"<>r) r
43
44type UserName = Text 39type UserName = Text
45type ResourceName = Text 40type ResourceName = Text
46 41
42unsplitJID :: (Maybe UserName,Text,Maybe ResourceName) -> Text
43unsplitJID (n,h,r) = username <> h <> resource
44 where
45 username = maybe "" (<>"@") n
46 resource = maybe "" ("/"<>) r
47
47splitJID :: Text -> (Maybe UserName,Text,Maybe ResourceName) 48splitJID :: Text -> (Maybe UserName,Text,Maybe ResourceName)
48splitJID bjid = 49splitJID bjid =
49 let xs = splitAll '@' bjid 50 let xs = splitAll '@' bjid