# HG changeset patch # User Kim Alvefur # Date 1330975134 -3600 # Node ID 39ce7535887c8c9326200855ca190b8b0e1ac8a7 # Parent 52b971d9ebc3f772555120fcbec744aa7ebee50e plugins.pubsub: Add a local variable to save some table lookups diff -r 52b971d9ebc3 -r 39ce7535887c plugins/pubsub.lua --- a/plugins/pubsub.lua Mon Mar 05 20:13:33 2012 +0100 +++ b/plugins/pubsub.lua Mon Mar 05 20:18:54 2012 +0100 @@ -14,13 +14,14 @@ function verse.plugins.pubsub(stream) stream.pubsub = setmetatable({ stream = stream }, pubsub_mt); stream:hook("message", function (message) + local m_from = message.attr.from; for pubsub_event in message:childtags("event", xmlns_pubsub_event) do local items = pubsub_event:get_child("items"); if items then local node = items.attr.node; for item in items:childtags("item") do stream:event("pubsub/event", { - from = message.attr.from; + from = m_from; node = node; item = item; }); @@ -165,7 +166,16 @@ function pubsub_node:configure(config, callback) if config ~= nil then error("Not implemented yet."); - -- if config == true then + --[[ + if config == true then + self.stream:send_iq(pubsub_iq("get", self.service, nil, "configure", self.node) + , function(reply) + local form = reply:get_child("pubsub"):get_child("configure"):get_cild("x"); + local config = callback(require"util.dataforms".something(form)) + self.stream:send_iq(pubsub_iq("set", config, ...)) + end); + end + --]] -- fetch form and pass it to the callback -- which would process it and pass it back -- and then we submit it