diff options
author | joe <joe@jerkface.net> | 2014-03-03 16:09:12 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-03-03 16:09:12 -0500 |
commit | 5cd226bdc93bdf74b41744b18512afedc86e213d (patch) | |
tree | 94527dfbcfd0cf69dd3b9d9e06e41fe8a18fba87 /xmppServer.hs | |
parent | cbb711a2859916fab96ddceabc8e9a9a0105476b (diff) |
improved readibility for unsplitJID
Diffstat (limited to 'xmppServer.hs')
-rw-r--r-- | xmppServer.hs | 11 |
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) | |||
36 | import LocalPeerCred | 36 | import LocalPeerCred |
37 | import XMPPServer | 37 | import XMPPServer |
38 | 38 | ||
39 | unsplitJID (n,h,r) = jid | ||
40 | where | ||
41 | jid0 = maybe h (\n->n<>"@"<>h) n | ||
42 | jid = maybe jid0 (\r->jid0<>"/"<>r) r | ||
43 | |||
44 | type UserName = Text | 39 | type UserName = Text |
45 | type ResourceName = Text | 40 | type ResourceName = Text |
46 | 41 | ||
42 | unsplitJID :: (Maybe UserName,Text,Maybe ResourceName) -> Text | ||
43 | unsplitJID (n,h,r) = username <> h <> resource | ||
44 | where | ||
45 | username = maybe "" (<>"@") n | ||
46 | resource = maybe "" ("/"<>) r | ||
47 | |||
47 | splitJID :: Text -> (Maybe UserName,Text,Maybe ResourceName) | 48 | splitJID :: Text -> (Maybe UserName,Text,Maybe ResourceName) |
48 | splitJID bjid = | 49 | splitJID bjid = |
49 | let xs = splitAll '@' bjid | 50 | let xs = splitAll '@' bjid |