Software /
code /
verse
Changeset
283:39ce7535887c
plugins.pubsub: Add a local variable to save some table lookups
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 05 Mar 2012 20:18:54 +0100 |
parents | 282:52b971d9ebc3 |
children | 284:c78d1780f1d2 |
files | plugins/pubsub.lua |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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