Software /
code /
verse
Changeset
161:b177bcea2006
squishy, verse.client, verse.component, verse.bosh: Port to util.xmppstream instead of xmlhandlers which has been removed from Prosody. Also remove util.ztact from squishy for the same reason.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 14 Dec 2010 16:04:29 +0000 |
parents | 160:5cbbfe42212e |
children | 162:2950079d4319 |
files | bosh.lua client.lua component.lua squishy |
diffstat | 4 files changed, 18 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/bosh.lua Sun Dec 05 01:06:29 2010 +0000 +++ b/bosh.lua Tue Dec 14 16:04:29 2010 +0000 @@ -1,5 +1,5 @@ -local init_xmlhandlers = require "core.xmlhandlers"; +local new_xmpp_stream = require "util.xmppstream".new; local st = require "util.stanza"; require "net.httpclient_listener"; -- Required for net.http to work local http = require "net.http"; @@ -186,8 +186,8 @@ return; end local session = { notopen = true, log = self.log }; - local parser = lxp.new(init_xmlhandlers(session, stream_callbacks), "\1"); - parser:parse(response); + local stream = new_xmpp_stream(session, stream_callbacks); + stream:feed(response); return session.payload; end
--- a/client.lua Sun Dec 05 01:06:29 2010 +0000 +++ b/client.lua Tue Dec 14 16:04:29 2010 +0000 @@ -10,7 +10,7 @@ verse.message, verse.presence, verse.iq, verse.stanza, verse.reply, verse.error_reply = st.message, st.presence, st.iq, st.stanza, st.reply, st.error_reply; -local init_xmlhandlers = require "core.xmlhandlers"; +local new_xmpp_stream = require "util.xmppstream".new; local xmlns_stream = "http://etherx.jabber.org/streams"; @@ -46,12 +46,12 @@ end function stream:reset() - -- Reset stream - local parser = lxp.new(init_xmlhandlers(self, stream_callbacks), "\1"); - self.parser = parser; - + if self.stream then + self.stream:reset(); + else + self.stream = new_xmpp_stream(self, stream_callbacks); + end self.notopen = true; - return true; end @@ -66,7 +66,7 @@ self:add_plugin("session"); function self.data(conn, data) - local ok, err = self.parser:parse(data); + local ok, err = self.stream:feed(data); if ok then return; end stream:debug("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); stream:close("xml-not-well-formed");
--- a/component.lua Sun Dec 05 01:06:29 2010 +0000 +++ b/component.lua Tue Dec 14 16:04:29 2010 +0000 @@ -10,7 +10,7 @@ verse.message, verse.presence, verse.iq, verse.stanza, verse.reply, verse.error_reply = st.message, st.presence, st.iq, st.stanza, st.reply, st.error_reply; -local init_xmlhandlers = require "core.xmlhandlers"; +local new_xmpp_stream = require "util.xmppstream".new; local xmlns_stream = "http://etherx.jabber.org/streams"; local xmlns_component = "jabber:component:accept"; @@ -43,12 +43,12 @@ end function stream:reset() - -- Reset stream - local parser = lxp.new(init_xmlhandlers(self, stream_callbacks), "\1"); - self.parser = parser; - + if self.stream then + self.stream:reset(); + else + self.stream = new_xmpp_stream(self, stream_callbacks); + end self.notopen = true; - return true; end @@ -57,7 +57,7 @@ self.username, self.host, self.resource = jid_split(jid); function self.data(conn, data) - local ok, err = self.parser:parse(data); + local ok, err = self.stream:feed(data); if ok then return; end stream:debug("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); stream:close("xml-not-well-formed");
--- a/squishy Sun Dec 05 01:06:29 2010 +0000 +++ b/squishy Tue Dec 14 16:04:29 2010 +0000 @@ -21,11 +21,10 @@ Module "net.dns" "net/dns.lua" Module "net.adns" "net/adns.lua" Module "net.server" "net/server_select.lua" -Module "core.xmlhandlers" "core/xmlhandlers.lua" +Module "util.xmppstream" "util/xmppstream.lua" Module "util.jid" "util/jid.lua" Module "util.events" "util/events.lua" Module "util.dataforms" "util/dataforms.lua" -Module "util.ztact" "util/ztact.lua" -- Verse plugins Module "verse.plugins.tls" "plugins/tls.lua"