Browse files

enabled logging for incoming packets; only send <?xml on initial commit

  • Loading branch information...
1 parent 356f39a commit d25cf399d31d5f0847d6ebcd14504b5b5ea91231 @tmm1 committed Jun 4, 2008
Showing with 7 additions and 7 deletions.
  1. +7 −7 xmpp4em.rb
View
14 xmpp4em.rb
@@ -31,12 +31,6 @@ def connection_completed
include EventMachine::XmlPushParser
- def start_document
- end
-
- def end_document
- end
-
def start_element name, attrs
e = REXML::Element.new(name)
e.add_attributes attrs
@@ -71,6 +65,11 @@ def error *args
p ['error', *args]
end
+ def receive_data data
+ log "<< #{data}"
+ super
+ end
+
def send data, &blk
log ">> #{data}"
send_data data.to_s
@@ -81,8 +80,9 @@ def unbind
end
def init
+ send "<?xml version='1.0' ?>" unless @started
@started = false
- send "<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0' to='#{@host}'>"
+ send "<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0' to='#{@host}'>"
end
private

0 comments on commit d25cf39

Please sign in to comment.