From 5cd226bdc93bdf74b41744b18512afedc86e213d Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 3 Mar 2014 16:09:12 -0500 Subject: improved readibility for unsplitJID --- xmppServer.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'xmppServer.hs') 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) import LocalPeerCred import XMPPServer -unsplitJID (n,h,r) = jid - where - jid0 = maybe h (\n->n<>"@"<>h) n - jid = maybe jid0 (\r->jid0<>"/"<>r) r - type UserName = Text type ResourceName = Text +unsplitJID :: (Maybe UserName,Text,Maybe ResourceName) -> Text +unsplitJID (n,h,r) = username <> h <> resource + where + username = maybe "" (<>"@") n + resource = maybe "" ("/"<>) r + splitJID :: Text -> (Maybe UserName,Text,Maybe ResourceName) splitJID bjid = let xs = splitAll '@' bjid -- cgit v1.2.3