net/connhandlers.lua
author Matthew Wild <mwild1@gmail.com>
Thu, 02 Oct 2008 01:08:58 +0100
changeset 38 3fdfd6e0cb4e
permissions -rw-r--r--
SASL! (but before you get too excited, no resource binding yet. And yes, there are still plenty of rough edges to the code...) ((eg. must move <stream:features> out of xmlhandlers.lua o_O ))
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     1
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     2
local lxp = require "lxp"
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     3
local init_xmlhandlers = require "core.xmlhandlers"
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     4
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     5
module "connhandlers"
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     6
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     7
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     8
function new(name, session)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
     9
	if name == "xmpp-client" then
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    10
		local parser = lxp.new(init_xmlhandlers(session), ":");
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    11
		local parse = parser.parse;
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    12
		return { data = function (self, data) return parse(parser, data); end, parser = parser }
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    13
	end
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    14
end
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    15
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
    16
return _M;