aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-26 03:29:06 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-26 03:29:06 +0000
commit9cfa2fe191348aa9e5800cde5b05eab8f6868100 (patch)
tree280afe4c6629378b30171c44ff869e8f634f39e2
parent78cffc8a02012c14644a08fb07dd05c760dcba06 (diff)
parentf68d335729ced9399427793ef17de847f21f8d4d (diff)
downloadprosody-9cfa2fe191348aa9e5800cde5b05eab8f6868100.tar.gz
prosody-9cfa2fe191348aa9e5800cde5b05eab8f6868100.zip
Merge from waqas
-rw-r--r--core/discomanager.lua13
-rw-r--r--plugins/mod_disco.lua3
-rw-r--r--plugins/mod_legacyauth.lua2
-rw-r--r--plugins/mod_private.lua2
-rw-r--r--plugins/mod_register.lua2
-rw-r--r--plugins/mod_roster.lua2
-rw-r--r--plugins/mod_uptime.lua4
-rw-r--r--plugins/mod_vcard.lua2
-rw-r--r--plugins/mod_version.lua2
9 files changed, 30 insertions, 2 deletions
diff --git a/core/discomanager.lua b/core/discomanager.lua
index 5f7b3c78..ce0010d8 100644
--- a/core/discomanager.lua
+++ b/core/discomanager.lua
@@ -5,6 +5,7 @@ local jid_split = require "util.jid".split;
local jid_bare = require "util.jid".bare;
local usermanager_user_exists = require "core.usermanager".user_exists;
local rostermanager_is_contact_subscribed = require "core.rostermanager".is_contact_subscribed;
+local print = print;
do
helper:addDiscoInfoHandler("*host", function(reply, to, from, node)
@@ -36,4 +37,16 @@ function addDiscoInfoHandler(jid, func)
return helper:addDiscoInfoHandler(jid, func);
end
+function set(plugin, var, origin)
+ -- TODO handle origin and host based on plugin.
+ local handler = function(reply, to, from, node) -- service discovery
+ if #node == 0 then
+ reply:tag("feature", {var = var}):up();
+ return true;
+ end
+ end
+ addDiscoInfoHandler("*node", handler);
+ addDiscoInfoHandler("*host", handler);
+end
+
return _M;
diff --git a/plugins/mod_disco.lua b/plugins/mod_disco.lua
index 261650ce..fd93ecf3 100644
--- a/plugins/mod_disco.lua
+++ b/plugins/mod_disco.lua
@@ -1,6 +1,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)
session.send(discomanager_handle(stanza));
end);
diff --git a/plugins/mod_legacyauth.lua b/plugins/mod_legacyauth.lua
index 59549cf7..02621af7 100644
--- a/plugins/mod_legacyauth.lua
+++ b/plugins/mod_legacyauth.lua
@@ -2,6 +2,8 @@
local st = require "util.stanza";
local t_concat = table.concat;
+require "core.discomanager".set("legacyauth", "jabber:iq:auth");
+
add_iq_handler("c2s_unauthed", "jabber:iq:auth",
function (session, stanza)
local username = stanza.tags[1]:child_with_name("username");
diff --git a/plugins/mod_private.lua b/plugins/mod_private.lua
index f463f543..f07f8197 100644
--- a/plugins/mod_private.lua
+++ b/plugins/mod_private.lua
@@ -4,6 +4,8 @@ local st = require "util.stanza"
local jid_split = require "util.jid".split;
local datamanager = require "util.datamanager"
+require "core.discomanager".set("private", "jabber:iq:private");
+
add_iq_handler("c2s", "jabber:iq:private",
function (session, stanza)
local type = stanza.attr.type;
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index c2b85bae..0974725d 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -4,6 +4,8 @@ local usermanager_user_exists = require "core.usermanager".user_exists;
local usermanager_create_user = require "core.usermanager".create_user;
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)
if stanza.tags[1].name == "query" then
local query = stanza.tags[1];
diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua
index 24d858e7..23223a65 100644
--- a/plugins/mod_roster.lua
+++ b/plugins/mod_roster.lua
@@ -9,6 +9,8 @@ local rm_remove_from_roster = require "core.rostermanager".remove_from_roster;
local rm_add_to_roster = require "core.rostermanager".add_to_roster;
local rm_roster_push = require "core.rostermanager".roster_push;
+require "core.discomanager".set("roster", "jabber:iq:roster");
+
add_iq_handler("c2s", "jabber:iq:roster",
function (session, stanza)
if stanza.tags[1].name == "query" then
diff --git a/plugins/mod_uptime.lua b/plugins/mod_uptime.lua
index 043f6514..9c2cb45d 100644
--- a/plugins/mod_uptime.lua
+++ b/plugins/mod_uptime.lua
@@ -6,6 +6,8 @@ local t_concat = table.concat;
local start_time = os.time();
+require "core.discomanager".set("uptime", "jabber:iq:last");
+
add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last",
function (origin, stanza)
if stanza.tags[1].name == "query" then
@@ -20,5 +22,3 @@ add_iq_handler({"c2s", "s2sin"}, "jabber:iq:last",
end
end
end);
-
-
diff --git a/plugins/mod_vcard.lua b/plugins/mod_vcard.lua
index d2f2c7ba..1d9b3d63 100644
--- a/plugins/mod_vcard.lua
+++ b/plugins/mod_vcard.lua
@@ -8,6 +8,8 @@ local t_concat, t_insert = table.concat, table.insert;
require "util.jid"
local jid_split = jid.split;
+require "core.discomanager".set("vcard", "vcard-temp");
+
add_iq_handler({"c2s", "s2sin"}, "vcard-temp",
function (session, stanza)
if stanza.tags[1].name == "vCard" then
diff --git a/plugins/mod_version.lua b/plugins/mod_version.lua
index d3599678..2f68fa07 100644
--- a/plugins/mod_version.lua
+++ b/plugins/mod_version.lua
@@ -5,6 +5,8 @@ local log = require "util.logger".init("mod_version");
local xmlns_version = "jabber:iq:version"
+require "core.discomanager".set("version", xmlns_version);
+
local function handle_version_request(session, stanza)
if stanza.attr.type == "get" then
session.send(st.reply(stanza):query(xmlns_version)