Comparison

plugins/mod_register.lua @ 438:193f9dd64f17

Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Nov 2008 03:12:12 +0000
parent 421:63be85693710
child 519:cccd610a0ef9
comparison
equal deleted inserted replaced
437:c1a720db2157 438:193f9dd64f17
4 local usermanager_create_user = require "core.usermanager".create_user; 4 local usermanager_create_user = require "core.usermanager".create_user;
5 local datamanager_store = require "util.datamanager".store; 5 local datamanager_store = require "util.datamanager".store;
6 6
7 require "core.discomanager".set("register", "jabber:iq:register"); 7 require "core.discomanager".set("register", "jabber:iq:register");
8 8
9 add_iq_handler("c2s", "jabber:iq:register", function (session, stanza) 9 module:add_iq_handler("c2s", "jabber:iq:register", function (session, stanza)
10 if stanza.tags[1].name == "query" then 10 if stanza.tags[1].name == "query" then
11 local query = stanza.tags[1]; 11 local query = stanza.tags[1];
12 if stanza.attr.type == "get" then 12 if stanza.attr.type == "get" then
13 local reply = st.reply(stanza); 13 local reply = st.reply(stanza);
14 reply:tag("query", {xmlns = "jabber:iq:register"}) 14 reply:tag("query", {xmlns = "jabber:iq:register"})
71 else 71 else
72 session.send(st.error_reply(stanza, "cancel", "service-unavailable")); 72 session.send(st.error_reply(stanza, "cancel", "service-unavailable"));
73 end; 73 end;
74 end); 74 end);
75 75
76 add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza) 76 module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza)
77 if stanza.tags[1].name == "query" then 77 if stanza.tags[1].name == "query" then
78 local query = stanza.tags[1]; 78 local query = stanza.tags[1];
79 if stanza.attr.type == "get" then 79 if stanza.attr.type == "get" then
80 local reply = st.reply(stanza); 80 local reply = st.reply(stanza);
81 reply:tag("query", {xmlns = "jabber:iq:register"}) 81 reply:tag("query", {xmlns = "jabber:iq:register"})