Software /
code /
verse
Changeset
290:e898d0fe77f7
Merge with Zash
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 30 Mar 2012 03:58:20 +0100 |
parents | 289:8bbe0d6dfd11 (diff) 281:1669dd08032a (current diff) |
children | 291:b78137f5118e |
files | |
diffstat | 7 files changed, 27 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/client.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/client.lua Fri Mar 30 03:58:20 2012 +0100 @@ -88,6 +88,7 @@ end); self:hook("stanza", function (stanza) + local ret; if stanza.attr.xmlns == nil or stanza.attr.xmlns == "jabber:client" then if stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns;
--- a/component.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/component.lua Fri Mar 30 03:58:20 2012 +0100 @@ -78,6 +78,7 @@ end); self:hook("stanza", function (stanza) + local ret; if stanza.attr.xmlns == nil or stanza.attr.xmlns == "jabber:client" then if stanza.name == "iq" and (stanza.attr.type == "get" or stanza.attr.type == "set") then local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns;
--- a/doc/example_carbons.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/doc/example_carbons.lua Fri Mar 30 03:58:20 2012 +0100 @@ -1,6 +1,8 @@ local xmlns_carbons = "urn:xmpp:carbons:1"; local xmlns_forward = "urn:xmpp:forward:0"; +local function datetime(t) return os_date("!%Y-%m-%dT%H:%M:%SZ", t); end + -- This line squishes verse each time you run, -- handy if you're hacking on Verse itself --os.execute("squish --minify-level=none verse"); @@ -24,7 +26,7 @@ c:hook("carbon", function(carbon) local dir, ts, st = carbon.dir, carbon.timestamp, carbon.stanza; - print("", ts, dir:upper()); + print("", datetime(ts), dir:upper()); print(st); end);
--- a/plugins/carbons.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/plugins/carbons.lua Fri Mar 30 03:58:20 2012 +0100 @@ -2,8 +2,8 @@ local xmlns_carbons = "urn:xmpp:carbons:1"; local xmlns_forward = "urn:xmpp:forward:0"; -local os_date = os.date; -local datetime = function(t) return os_date("!%Y-%m-%dT%H:%M:%SZ", t); end +local os_time = os.time; +local parse_datetime = require "util.datetime".parse; local bare_jid = require "util.jid".bare; -- TODO Check disco for support @@ -49,14 +49,17 @@ stream:hook("message", function(stanza) local carbon_dir = stanza:get_child(nil, xmlns_carbons); if stanza.attr.from == my_bare and carbon_dir then - carbon_dir = carbon_dir and carbon_dir.name; + carbon_dir = carbon_dir.name; local fwd = stanza:get_child("forwarded", xmlns_forward); local fwd_stanza = fwd and fwd:get_child("message", "jabber:client"); + local delay = fwd:get_child("delay", "urn:xmpp:delay"); + local stamp = delay and delay.attr.stamp; + stamp = stamp and parse_datetime(stamp); if fwd_stanza then return stream:event("carbon", { dir = carbon_dir, stanza = fwd_stanza, - timestamp = nil or datetime(), -- TODO check for delay tag + timestamp = stamp or os_time(), }); end end
--- a/plugins/jingle_ibb.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/plugins/jingle_ibb.lua Fri Mar 30 03:58:20 2012 +0100 @@ -11,7 +11,7 @@ local ibb_conn = {}; local ibb_conn_mt = { __index = ibb_conn }; -function new_ibb(stream) +local function new_ibb(stream) local conn = setmetatable({ stream = stream }, ibb_conn_mt) conn = verse.eventable(conn); return conn;
--- a/plugins/jingle_s5b.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/plugins/jingle_s5b.lua Fri Mar 30 03:58:20 2012 +0100 @@ -1,5 +1,7 @@ +local verse = require "verse"; local xmlns_s5b = "urn:xmpp:jingle:transports:s5b:1"; +local xmlns_bytestreams = "http://jabber.org/protocol/bytestreams"; local sha1 = require "util.sha1".sha1; local uuid_generate = require "util.uuid".generate;
--- a/plugins/pubsub.lua Fri Mar 30 03:57:03 2012 +0100 +++ b/plugins/pubsub.lua Fri Mar 30 03:58:20 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