From a153b3c26704686bf9a3f2255d9aeb3c5f6aa2b1 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 27 Nov 2008 03:12:12 +0000 Subject: Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store. --- plugins/mod_dialback.lua | 8 ++++---- plugins/mod_disco.lua | 4 ++-- plugins/mod_legacyauth.lua | 4 ++-- plugins/mod_ping.lua | 2 +- plugins/mod_private.lua | 2 +- plugins/mod_register.lua | 4 ++-- plugins/mod_roster.lua | 4 ++-- plugins/mod_saslauth.lua | 12 ++++++------ plugins/mod_selftests.lua | 2 +- plugins/mod_time.lua | 4 ++-- plugins/mod_tls.lua | 4 ++-- plugins/mod_uptime.lua | 2 +- plugins/mod_vcard.lua | 4 ++-- plugins/mod_version.lua | 4 ++-- 14 files changed, 30 insertions(+), 30 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 87ac303b..e7804962 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -8,7 +8,7 @@ local log = require "util.logger".init("mod_dialback"); local xmlns_dialback = "jabber:server:dialback"; -add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, +module:add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, function (origin, stanza) -- We are being asked to verify the key, to ensure it was generated by us log("debug", "verifying dialback key..."); @@ -26,7 +26,7 @@ add_handler({"s2sin_unauthed", "s2sin"}, "verify", xmlns_dialback, origin.sends2s(format("%s", attr.to, attr.from, attr.id, type, stanza[1])); end); -add_handler("s2sin_unauthed", "result", xmlns_dialback, +module:add_handler("s2sin_unauthed", "result", xmlns_dialback, function (origin, stanza) -- he wants to be identified through dialback -- We need to check the key with the Authoritative server @@ -42,7 +42,7 @@ add_handler("s2sin_unauthed", "result", xmlns_dialback, hosts[origin.to_host].s2sout[origin.from_host].dialback_verifying = origin; end); -add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, +module:add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, function (origin, stanza) if origin.dialback_verifying then local valid; @@ -64,7 +64,7 @@ add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback, end end); -add_handler({ "s2sout_unauthed", "s2sout" }, "result", xmlns_dialback, +module:add_handler({ "s2sout_unauthed", "s2sout" }, "result", xmlns_dialback, function (origin, stanza) if stanza.attr.type == "valid" then s2s_make_authenticated(origin); diff --git a/plugins/mod_disco.lua b/plugins/mod_disco.lua index fd93ecf3..fd9f2836 100644 --- a/plugins/mod_disco.lua +++ b/plugins/mod_disco.lua @@ -4,9 +4,9 @@ local discomanager_handle = require "core.discomanager".handle; require "core.discomanager".set("disco", "http://jabber.org/protocol/disco#info"); require "core.discomanager".set("disco", "http://jabber.org/protocol/disco#items"); -add_iq_handler({"c2s", "s2sin"}, "http://jabber.org/protocol/disco#info", function (session, stanza) +module:add_iq_handler({"c2s", "s2sin"}, "http://jabber.org/protocol/disco#info", function (session, stanza) session.send(discomanager_handle(stanza)); end); -add_iq_handler({"c2s", "s2sin"}, "http://jabber.org/protocol/disco#items", function (session, stanza) +module:add_iq_handler({"c2s", "s2sin"}, "http://jabber.org/protocol/disco#items", function (session, stanza) session.send(discomanager_handle(stanza)); end); diff --git a/plugins/mod_legacyauth.lua b/plugins/mod_legacyauth.lua index 02621af7..81e2ff7f 100644 --- a/plugins/mod_legacyauth.lua +++ b/plugins/mod_legacyauth.lua @@ -4,7 +4,7 @@ local t_concat = table.concat; require "core.discomanager".set("legacyauth", "jabber:iq:auth"); -add_iq_handler("c2s_unauthed", "jabber:iq:auth", +module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", function (session, stanza) local username = stanza.tags[1]:child_with_name("username"); local password = stanza.tags[1]:child_with_name("password"); @@ -43,4 +43,4 @@ add_iq_handler("c2s_unauthed", "jabber:iq:auth", end end - end); \ No newline at end of file + end); diff --git a/plugins/mod_ping.lua b/plugins/mod_ping.lua index c13282ff..8306078c 100644 --- a/plugins/mod_ping.lua +++ b/plugins/mod_ping.lua @@ -3,7 +3,7 @@ local st = require "util.stanza"; require "core.discomanager".set("ping", "urn:xmpp:ping"); -add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:ping", +module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:ping", function(session, stanza) if stanza.attr.type == "get" then session.send(st.reply(stanza)); diff --git a/plugins/mod_private.lua b/plugins/mod_private.lua index f07f8197..dd717d8d 100644 --- a/plugins/mod_private.lua +++ b/plugins/mod_private.lua @@ -6,7 +6,7 @@ local datamanager = require "util.datamanager" require "core.discomanager".set("private", "jabber:iq:private"); -add_iq_handler("c2s", "jabber:iq:private", +module:add_iq_handler("c2s", "jabber:iq:private", function (session, stanza) local type = stanza.attr.type; local query = stanza.tags[1]; diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index 0974725d..5769bd80 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -6,7 +6,7 @@ local datamanager_store = require "util.datamanager".store; require "core.discomanager".set("register", "jabber:iq:register"); -add_iq_handler("c2s", "jabber:iq:register", function (session, stanza) +module:add_iq_handler("c2s", "jabber:iq:register", function (session, stanza) if stanza.tags[1].name == "query" then local query = stanza.tags[1]; if stanza.attr.type == "get" then @@ -73,7 +73,7 @@ add_iq_handler("c2s", "jabber:iq:register", function (session, stanza) end; end); -add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza) +module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza) if stanza.tags[1].name == "query" then local query = stanza.tags[1]; if stanza.attr.type == "get" then diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua index 23223a65..0b52e43e 100644 --- a/plugins/mod_roster.lua +++ b/plugins/mod_roster.lua @@ -11,7 +11,7 @@ local rm_roster_push = require "core.rostermanager".roster_push; require "core.discomanager".set("roster", "jabber:iq:roster"); -add_iq_handler("c2s", "jabber:iq:roster", +module:add_iq_handler("c2s", "jabber:iq:roster", function (session, stanza) if stanza.tags[1].name == "query" then if stanza.attr.type == "get" then @@ -103,4 +103,4 @@ add_iq_handler("c2s", "jabber:iq:roster", return true; end end - end); \ No newline at end of file + end); diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 7ca4308b..f549d0b9 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -79,14 +79,14 @@ function sasl_handler(session, stanza) session.send(s); end -add_handler("c2s_unauthed", "auth", xmlns_sasl, sasl_handler); -add_handler("c2s_unauthed", "abort", xmlns_sasl, sasl_handler); -add_handler("c2s_unauthed", "response", xmlns_sasl, sasl_handler); +module:add_handler("c2s_unauthed", "auth", xmlns_sasl, sasl_handler); +module:add_handler("c2s_unauthed", "abort", xmlns_sasl, sasl_handler); +module:add_handler("c2s_unauthed", "response", xmlns_sasl, sasl_handler); local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' }; local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' }; local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' }; -add_event_hook("stream-features", +module:add_event_hook("stream-features", function (session, features) if not session.username then features:tag("mechanisms", mechanisms_attr); @@ -100,7 +100,7 @@ add_event_hook("stream-features", end end); -add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind", +module:add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind", function (session, stanza) log("debug", "Client tried to bind to a resource"); local resource; @@ -123,7 +123,7 @@ add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind", end end); -add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-session", +module:add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-session", function (session, stanza) log("debug", "Client tried to bind to a resource"); session.send(st.reply(stanza)); diff --git a/plugins/mod_selftests.lua b/plugins/mod_selftests.lua index 8aa70952..4d44d2fd 100644 --- a/plugins/mod_selftests.lua +++ b/plugins/mod_selftests.lua @@ -36,7 +36,7 @@ if tests_jid and host then local our_origin = hosts[host]; - add_event_hook("server-started", + module:add_event_hook("server-started", function () local id = st.new_id(); local ping_attr = { xmlns = 'urn:xmpp:ping' }; diff --git a/plugins/mod_time.lua b/plugins/mod_time.lua index bf079692..68224421 100644 --- a/plugins/mod_time.lua +++ b/plugins/mod_time.lua @@ -7,7 +7,7 @@ local legacy = require "util.datetime".legacy; require "core.discomanager".set("time", "urn:xmpp:time"); -add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time", +module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time", function(session, stanza) if stanza.attr.type == "get" then session.send(st.reply(stanza):tag("time", {xmlns="urn:xmpp:time"}) @@ -20,7 +20,7 @@ add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:time", require "core.discomanager".set("time", "jabber:iq:time"); -add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time", +module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:time", function(session, stanza) if stanza.attr.type == "get" then session.send(st.reply(stanza):tag("query", {xmlns="jabber:iq:time"}) diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index cc46d556..d5f3157b 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -9,7 +9,7 @@ local log = require "util.logger".init("mod_starttls"); local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; -add_handler("c2s_unauthed", "starttls", xmlns_starttls, +module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, function (session, stanza) if session.conn.starttls then session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); @@ -25,7 +25,7 @@ add_handler("c2s_unauthed", "starttls", xmlns_starttls, end); local starttls_attr = { xmlns = xmlns_starttls }; -add_event_hook("stream-features", +module:add_event_hook("stream-features", function (session, features) if session.conn.starttls then features:tag("starttls", starttls_attr):up(); diff --git a/plugins/mod_uptime.lua b/plugins/mod_uptime.lua index 9c2cb45d..4b4c28d1 100644 --- a/plugins/mod_uptime.lua +++ b/plugins/mod_uptime.lua @@ -8,7 +8,7 @@ local start_time = os.time(); require "core.discomanager".set("uptime", "jabber:iq:last"); -add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last", +module:add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last", function (origin, stanza) if stanza.tags[1].name == "query" then if stanza.attr.type == "get" then diff --git a/plugins/mod_vcard.lua b/plugins/mod_vcard.lua index 1d9b3d63..844a2406 100644 --- a/plugins/mod_vcard.lua +++ b/plugins/mod_vcard.lua @@ -10,7 +10,7 @@ local jid_split = jid.split; require "core.discomanager".set("vcard", "vcard-temp"); -add_iq_handler({"c2s", "s2sin"}, "vcard-temp", +module:add_iq_handler({"c2s", "s2sin"}, "vcard-temp", function (session, stanza) if stanza.tags[1].name == "vCard" then local to = stanza.attr.to; @@ -46,7 +46,7 @@ add_iq_handler({"c2s", "s2sin"}, "vcard-temp", end); local feature_vcard_attr = { var='vcard-temp' }; -add_event_hook("stream-features", +module:add_event_hook("stream-features", function (session, features) if session.type == "c2s" then features:tag("feature", feature_vcard_attr):up(); diff --git a/plugins/mod_version.lua b/plugins/mod_version.lua index 2f68fa07..11278a53 100644 --- a/plugins/mod_version.lua +++ b/plugins/mod_version.lua @@ -16,5 +16,5 @@ local function handle_version_request(session, stanza) end end -add_iq_handler("c2s", xmlns_version, handle_version_request); -add_iq_handler("s2sin", xmlns_version, handle_version_request); +module:add_iq_handler("c2s", xmlns_version, handle_version_request); +module:add_iq_handler("s2sin", xmlns_version, handle_version_request); -- cgit v1.2.3