From b5770d982d2cb7d95ae400172a8bb1ca923a0de4 Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 16 Jun 2013 22:28:06 -0400 Subject: removed some debug noise. --- Presence/XMPPServer.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Presence/XMPPServer.hs') diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index 05b12b73..5008213c 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs @@ -24,11 +24,14 @@ import AdaptServer import Text.XML.HaXml.Lex (xmlLex) import Text.XML.HaXml.Parse (xmlParseWith,element,{-doctypedecl,-}processinginstruction,elemOpenTag,elemCloseTag) import Text.XML.HaXml.Types as Hax (ElemTag,QName(..),Namespace(..),Element(..),Content(..),AttValue(..)) +import qualified Text.XML.HaXml.Pretty as PP +import Text.PrettyPrint import Data.Maybe import Debug.Trace import Control.Arrow import LocalPeerCred import Network.Socket +import Data.String @@ -135,7 +138,7 @@ iqresponse host (Elem _ attrs content) = do guard (hasElem "session" content) Just (iqresult host id Nothing)) - "get" -> trace ("iq-get "++show (attrs,content)) $ do + "get" -> {- trace ("iq-get "++show (attrs,content)) $ -} do (tag,as) <- lookup (N "xmlns") (anytagattrs content) xmlns <- fmap pack $ listToMaybe . astring $ as let servicekind = case tag of { (N s) -> pack s ; _ -> "query" } @@ -173,8 +176,10 @@ doCon st elem cont = do host = "localhost" hsend r = do hPutStrLn h r - L.putStrLn $ "SENT:\n" <++> r + L.putStrLn $ "\nOUT:\n" <++> r + putStrLn $ (show $ hang (text "\nIN:") 2 $ pp elem) ++ "\n" + case elem of OpenTag _ -> hsend (greet host) @@ -189,7 +194,6 @@ doCon st elem cont = do _ -> return () -- putStrLn $ "unhandled: "++show v - putStrLn (show elem) cont () instance Show Hax.ElemTag where @@ -202,6 +206,9 @@ data XmppObject e i t c | CloseTag c deriving Show +pp (Element e) = PP.element e +pp o = fromString (show o) + streamName = QN (Namespace {nsPrefix= "stream" , nsURI="http://etherx.jabber.org/streams" }) "stream" xmppParse ls = -- cgit v1.2.3