summaryrefslogtreecommitdiff
path: root/Presence
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-06-16 22:28:06 -0400
committerjoe <joe@jerkface.net>2013-06-16 22:28:06 -0400
commitb5770d982d2cb7d95ae400172a8bb1ca923a0de4 (patch)
treec2931f2d63d7ecd9e45d2e5457cc0d633fddeeb3 /Presence
parent41c757e3e851ba197248df18f144805babc4e1f9 (diff)
removed some debug noise.
Diffstat (limited to 'Presence')
-rw-r--r--Presence/FGConsole.hs2
-rw-r--r--Presence/XMPPServer.hs13
-rw-r--r--Presence/monitortty.c4
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
37 (do 37 (do
38 threadWaitRead rfd 38 threadWaitRead rfd
39 (cs,cnt) <- fdRead rfd 1 39 (cs,cnt) <- fdRead rfd 1
40 forM_ cs (handler . unsafeCoerce . trace "read byte") 40 forM_ cs (handler . unsafeCoerce {- . trace "read byte" -})
41 monitor) 41 monitor)
42 `E.catch` 42 `E.catch`
43 \(e :: IOException) -> do 43 \(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
24import Text.XML.HaXml.Lex (xmlLex) 24import Text.XML.HaXml.Lex (xmlLex)
25import Text.XML.HaXml.Parse (xmlParseWith,element,{-doctypedecl,-}processinginstruction,elemOpenTag,elemCloseTag) 25import Text.XML.HaXml.Parse (xmlParseWith,element,{-doctypedecl,-}processinginstruction,elemOpenTag,elemCloseTag)
26import Text.XML.HaXml.Types as Hax (ElemTag,QName(..),Namespace(..),Element(..),Content(..),AttValue(..)) 26import Text.XML.HaXml.Types as Hax (ElemTag,QName(..),Namespace(..),Element(..),Content(..),AttValue(..))
27import qualified Text.XML.HaXml.Pretty as PP
28import Text.PrettyPrint
27import Data.Maybe 29import Data.Maybe
28import Debug.Trace 30import Debug.Trace
29import Control.Arrow 31import Control.Arrow
30import LocalPeerCred 32import LocalPeerCred
31import Network.Socket 33import Network.Socket
34import Data.String
32 35
33 36
34 37
@@ -135,7 +138,7 @@ iqresponse host (Elem _ attrs content) = do
135 guard (hasElem "session" content) 138 guard (hasElem "session" content)
136 Just (iqresult host id Nothing)) 139 Just (iqresult host id Nothing))
137 140
138 "get" -> trace ("iq-get "++show (attrs,content)) $ do 141 "get" -> {- trace ("iq-get "++show (attrs,content)) $ -} do
139 (tag,as) <- lookup (N "xmlns") (anytagattrs content) 142 (tag,as) <- lookup (N "xmlns") (anytagattrs content)
140 xmlns <- fmap pack $ listToMaybe . astring $ as 143 xmlns <- fmap pack $ listToMaybe . astring $ as
141 let servicekind = case tag of { (N s) -> pack s ; _ -> "query" } 144 let servicekind = case tag of { (N s) -> pack s ; _ -> "query" }
@@ -173,8 +176,10 @@ doCon st elem cont = do
173 host = "localhost" 176 host = "localhost"
174 hsend r = do 177 hsend r = do
175 hPutStrLn h r 178 hPutStrLn h r
176 L.putStrLn $ "SENT:\n" <++> r 179 L.putStrLn $ "\nOUT:\n" <++> r
177 180
181 putStrLn $ (show $ hang (text "\nIN:") 2 $ pp elem) ++ "\n"
182
178 case elem of 183 case elem of
179 OpenTag _ -> 184 OpenTag _ ->
180 hsend (greet host) 185 hsend (greet host)
@@ -189,7 +194,6 @@ doCon st elem cont = do
189 194
190 _ -> return () -- putStrLn $ "unhandled: "++show v 195 _ -> return () -- putStrLn $ "unhandled: "++show v
191 196
192 putStrLn (show elem)
193 cont () 197 cont ()
194 198
195instance Show Hax.ElemTag where 199instance Show Hax.ElemTag where
@@ -202,6 +206,9 @@ data XmppObject e i t c
202 | CloseTag c 206 | CloseTag c
203 deriving Show 207 deriving Show
204 208
209pp (Element e) = PP.element e
210pp o = fromString (show o)
211
205streamName = QN (Namespace {nsPrefix= "stream" , nsURI="http://etherx.jabber.org/streams" }) "stream" 212streamName = QN (Namespace {nsPrefix= "stream" , nsURI="http://etherx.jabber.org/streams" }) "stream"
206 213
207xmppParse ls = 214xmppParse 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) {
76 memset(&vt,'\0',sizeof(vt)); 76 memset(&vt,'\0',sizeof(vt));
77 vt.event = VT_EVENT_SWITCH; 77 vt.event = VT_EVENT_SWITCH;
78 int res; 78 int res;
79 printf("started wait\n"); 79 // printf("started wait\n");
80 res = ioctl (tty_fd, VT_WAITEVENT, &vt); 80 res = ioctl (tty_fd, VT_WAITEVENT, &vt);
81 if (res==-1) { 81 if (res==-1) {
82 printf("vt_wait error fd=%i\n",tty_fd); 82 printf("vt_wait error fd=%i\n",tty_fd);
@@ -84,7 +84,7 @@ void vt_wait(int tty_fd) {
84 // printf("vt_wait: %u - %s\n", errno, errmsg(errno)); 84 // printf("vt_wait: %u - %s\n", errno, errmsg(errno));
85 sleep(1); 85 sleep(1);
86 } 86 }
87 printf("finished wait\n"); 87 // printf("finished wait\n");
88} 88}
89 89
90int8_t get_active(int tty_fd) { 90int8_t get_active(int tty_fd) {