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/FGConsole.hs | 2 +- Presence/XMPPServer.hs | 13 ++++++++++--- Presence/monitortty.c | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Presence/FGConsole.hs b/Presence/FGConsole.hs index 93b9a590..c72addff 100644 --- a/Presence/FGConsole.hs +++ b/Presence/FGConsole.hs @@ -37,7 +37,7 @@ monitorTTY handler = do (do threadWaitRead rfd (cs,cnt) <- fdRead rfd 1 - forM_ cs (handler . unsafeCoerce . trace "read byte") + forM_ cs (handler . unsafeCoerce {- . trace "read byte" -}) monitor) `E.catch` \(e :: IOException) -> do 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 = diff --git a/Presence/monitortty.c b/Presence/monitortty.c index 90e23464..7b5dc82c 100644 --- a/Presence/monitortty.c +++ b/Presence/monitortty.c @@ -76,7 +76,7 @@ void vt_wait(int tty_fd) { memset(&vt,'\0',sizeof(vt)); vt.event = VT_EVENT_SWITCH; int res; - printf("started wait\n"); + // printf("started wait\n"); res = ioctl (tty_fd, VT_WAITEVENT, &vt); if (res==-1) { printf("vt_wait error fd=%i\n",tty_fd); @@ -84,7 +84,7 @@ void vt_wait(int tty_fd) { // printf("vt_wait: %u - %s\n", errno, errmsg(errno)); sleep(1); } - printf("finished wait\n"); + // printf("finished wait\n"); } int8_t get_active(int tty_fd) { -- cgit v1.2.3