# HG changeset patch # User Kim Alvefur # Date 1430515649 -7200 # Node ID 0891b4e2776656a0ef8ffdce48ee5f1ab1088965 # Parent d80d27234e38559f0e538965158147727934b675 Discard trailing whitespace diff -r d80d27234e38 -r 0891b4e27766 plugins/adhoc.lua --- a/plugins/adhoc.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/adhoc.lua Fri May 01 23:27:29 2015 +0200 @@ -25,15 +25,15 @@ return callback(command_list); end); end - + function stream:execute_command(jid, command, callback) local cmd = setmetatable({ stream = stream, jid = jid, - command = command, callback = callback + command = command, callback = callback }, command_mt); return cmd:execute(); end - + -- ACL checker for commands we provide local function has_affiliation(jid, aff) if not(aff) or aff == "user" then return true; end @@ -42,31 +42,31 @@ end -- TODO: Support 'roster', etc. end - + function stream:add_adhoc_command(name, node, handler, permission) commands[node] = adhoc.new(name, node, handler, permission); stream:add_disco_item({ jid = stream.jid, node = node, name = name }, xmlns_commands); return commands[node]; end - + local function handle_command(stanza) local command_tag = stanza.tags[1]; local node = command_tag.attr.node; - + local handler = commands[node]; if not handler then return; end - + if not has_affiliation(stanza.attr.from, handler.permission) then stream:send(verse.error_reply(stanza, "auth", "forbidden", "You don't have permission to execute this command"):up() :add_child(handler:cmdtag("canceled") :tag("note", {type="error"}):text("You don't have permission to execute this command"))); return true end - + -- User has permission now execute the command return adhoc.handle_cmd(handler, { send = function (d) return stream:send(d) end }, stanza); end - + stream:hook("iq/"..xmlns_commands, function (stanza) local type = stanza.attr.type; local name = stanza.tags[1].name; @@ -106,9 +106,9 @@ node = self.command, sessionid = self.sessionid }); - + if form then iq:add_child(form); end - + self.stream:send_iq(iq, function (result) self:_process_response(result); end); diff -r d80d27234e38 -r 0891b4e27766 plugins/archive.lua --- a/plugins/archive.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/archive.lua Fri May 01 23:27:29 2015 +0200 @@ -27,7 +27,7 @@ local query_st = st.iq{ type="set", to = where } :tag("query", { xmlns = xmlns_mam, queryid = queryid }); - + local qstart, qend = tonumber(query_params["start"]), tonumber(query_params["end"]); query_params["start"] = qstart and datetime(qstart); query_params["end"] = qend and datetime(qend); diff -r d80d27234e38 -r 0891b4e27766 plugins/compression.lua --- a/plugins/compression.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/compression.lua Fri May 01 23:27:29 2015 +0200 @@ -1,6 +1,6 @@ -- Copyright (C) 2009-2010 Matthew Wild -- Copyright (C) 2009-2010 Tobias Markmann --- +-- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- @@ -53,7 +53,7 @@ return; end session.conn:write(compressed); - end; + end; end -- setup decompression for a stream @@ -101,16 +101,16 @@ -- create deflate and inflate streams local deflate_stream = get_deflate_stream(stream); if not deflate_stream then return end - + local inflate_stream = get_inflate_stream(stream); if not inflate_stream then return end - + -- setup compression for stream.w setup_compression(stream, deflate_stream); - + -- setup decompression for stream.data setup_decompression(stream, inflate_stream); - + stream.compressed = true; stream:reopen(); elseif stanza.name == "failure" then diff -r d80d27234e38 -r 0891b4e27766 plugins/disco.lua --- a/plugins/disco.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/disco.lua Fri May 01 23:27:29 2015 +0200 @@ -1,7 +1,7 @@ -- Verse XMPP Library -- Copyright (C) 2010 Hubert Chathi -- Copyright (C) 2010 Matthew Wild --- +-- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- @@ -118,7 +118,7 @@ }) end }) - + function stream:set_identity(identity, node) self.disco.info[node or false].identities = { identity }; stream:resend_presence(); @@ -135,7 +135,7 @@ self.disco.info[node or false].features[feature] = true; stream:resend_presence(); end - + function stream:remove_disco_feature(feature, node) local feature = feature.var or feature; self.disco.info[node or false].features[feature] = nil; @@ -181,13 +181,13 @@ end return cached_disco.features[feature] or false; end - + function stream:get_local_services(category, type) local host_disco = self.disco.cache[self.host]; if not(host_disco) or not(host_disco.items) then return nil, "no-cache"; end - + local results = {}; for _, service in ipairs(host_disco.items) do if self:jid_has_identity(service.jid, category, type) then @@ -196,7 +196,7 @@ end return results; end - + function stream:disco_local_services(callback) self:disco_items(self.host, nil, function (items) if not items then @@ -209,7 +209,7 @@ return callback(items); end end - + for _, item in ipairs(items) do if item.jid then n_items = n_items + 1; @@ -221,7 +221,7 @@ end end); end - + function stream:disco_info(jid, node, callback) local disco_request = verse.iq({ to = jid, type = "get" }) :tag("query", { xmlns = xmlns_disco_info, node = node }); @@ -229,9 +229,9 @@ if result.attr.type == "error" then return callback(nil, result:get_error()); end - + local identities, features = {}, {}; - + for tag in result:get_child("query", xmlns_disco_info):childtags() do if tag.name == "identity" then identities[tag.attr.category.."/"..tag.attr.type] = tag.attr.name or true; @@ -239,7 +239,7 @@ features[tag.attr.var] = true; end end - + if not self.disco.cache[jid] then self.disco.cache[jid] = { nodes = {} }; @@ -258,7 +258,7 @@ return callback(self.disco.cache[jid]); end); end - + function stream:disco_items(jid, node, callback) local disco_request = verse.iq({ to = jid, type = "get" }) :tag("query", { xmlns = xmlns_disco_items, node = node }); @@ -276,11 +276,11 @@ }); end end - + if not self.disco.cache[jid] then self.disco.cache[jid] = { nodes = {} }; end - + if node then if not self.disco.cache[jid].nodes[node] then self.disco.cache[jid].nodes[node] = { nodes = {} }; @@ -292,7 +292,7 @@ return callback(disco_items); end); end - + stream:hook("iq/"..xmlns_disco_info, function (stanza) local query = stanza.tags[1]; if stanza.attr.type == 'get' and query.name == "query" then @@ -337,7 +337,7 @@ return true end end); - + local initial_disco_started; stream:hook("ready", function () if initial_disco_started then return; end @@ -358,7 +358,7 @@ end); return true; end, 50); - + stream:hook("presence-out", function (presence) if not presence:get_child("c", xmlns_caps) then presence:reset():add_child(stream:caps()):reset(); diff -r d80d27234e38 -r 0891b4e27766 plugins/groupchat.lua --- a/plugins/groupchat.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/groupchat.lua Fri May 01 23:27:29 2015 +0200 @@ -11,7 +11,7 @@ function verse.plugins.groupchat(stream) stream:add_plugin("presence") stream.rooms = {}; - + stream:hook("stanza", function (stanza) local room_jid = jid.bare(stanza.attr.from); if not room_jid then return end @@ -37,7 +37,7 @@ return ret or (stanza.name == "message") or nil; end end, 500); - + function stream:join_room(jid, nick, opts) if not nick then return false, "no nickname supplied" diff -r d80d27234e38 -r 0891b4e27766 plugins/jingle.lua --- a/plugins/jingle.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/jingle.lua Fri May 01 23:27:29 2015 +0200 @@ -16,7 +16,7 @@ stream:hook("ready", function () stream:add_disco_feature(xmlns_jingle); end, 10); - + function stream:jingle(to) return verse.eventable(setmetatable(base or { role = "initiator"; @@ -25,20 +25,20 @@ stream = stream; }, jingle_mt)); end - + function stream:register_jingle_transport(transport) -- transport is a function that receives a -- element, and returns a connection -- We wait for 'connected' on that connection, -- and use :send() and 'incoming-raw'. end - + function stream:register_jingle_content_type(content) -- Call content() for every 'incoming-raw'? -- I think content() returns the object we return -- on jingle:accept() end - + local function handle_incoming_jingle(stanza) local jingle_tag = stanza:get_child("jingle", xmlns_jingle); local sid = jingle_tag.attr.sid; @@ -57,21 +57,21 @@ stream:send(reply); return; end - + -- Ok, session-initiate, new session - + -- Create new Jingle object local sid = jingle_tag.attr.sid; - + local jingle = verse.eventable{ role = "receiver"; peer = stanza.attr.from; sid = sid; stream = stream; }; - + setmetatable(jingle, jingle_mt); - + local content_tag; local content, transport; for tag in jingle_tag:childtags() do @@ -84,10 +84,10 @@ content = desc_handler; end end - + local transport_tag = tag:child_with_name("transport"); local transport_xmlns = transport_tag.attr.xmlns; - + transport = stream:event("jingle/transport/"..transport_xmlns, jingle, transport_tag); if content and transport then content_tag = tag; @@ -100,23 +100,23 @@ stream:send(verse.error_reply(stanza, "cancel", "feature-not-implemented", "The specified content is not supported")); return true; end - + if not transport then -- FIXME: Refuse session, no transport stream:send(verse.error_reply(stanza, "cancel", "feature-not-implemented", "The specified transport is not supported")); return true; end - + stream:send(verse.reply(stanza)); - + jingle.content_tag = content_tag; jingle.creator, jingle.name = content_tag.attr.creator, content_tag.attr.name; jingle.content, jingle.transport = content, transport; - + function jingle:decline() -- FIXME: Decline session end - + stream:hook("jingle/"..sid, function (stanza) if stanza.attr.from ~= jingle.peer then return false; @@ -124,11 +124,11 @@ local jingle_tag = stanza:get_child("jingle", xmlns_jingle); return jingle:handle_command(jingle_tag); end); - + stream:event("jingle", jingle); return true; end - + function jingle_mt:handle_command(jingle_tag) local action = jingle_tag.attr.action; stream:debug("Handling Jingle command: %s", action); @@ -166,7 +166,7 @@ self.stream:send_iq(stanza, callback); end end - + function jingle_mt:accept(options) local accept_stanza = verse.iq({ to = self.peer, type = "set" }) :tag("jingle", { @@ -176,13 +176,13 @@ responder = stream.jid, }) :tag("content", { creator = self.creator, name = self.name }); - + local content_accept_tag = self.content:generate_accept(self.content_tag:child_with_name("description"), options); accept_stanza:add_child(content_accept_tag); - + local transport_accept_tag = self.transport:generate_accept(self.content_tag:child_with_name("transport"), options); accept_stanza:add_child(transport_accept_tag); - + local jingle = self; stream:send_iq(accept_stanza, function (result) if result.attr.type == "error" then @@ -197,7 +197,7 @@ end); end); end - + stream:hook("iq/"..xmlns_jingle, handle_incoming_jingle); return true; @@ -207,26 +207,26 @@ local session_initiate = verse.iq({ to = self.peer, type = "set" }) :tag("jingle", { xmlns = xmlns_jingle, action = "session-initiate", initiator = self.stream.jid, sid = self.sid }); - + -- Content tag session_initiate:tag("content", { creator = self.role, name = name }); - + -- Need description element from someone who can turn 'content' into XML local description = self.stream:event("jingle/describe/"..name, content); - + if not description then return false, "Unknown content type"; end - + session_initiate:add_child(description); - + -- FIXME: Sort transports by 1) recipient caps 2) priority (SOCKS vs IBB, etc.) -- Fixed to s5b in the meantime local transport = self.stream:event("jingle/transport/".."urn:xmpp:jingle:transports:s5b:1", self); self.transport = transport; - + session_initiate:add_child(transport:generate_initiate()); - + self.stream:debug("Hooking %s", "jingle/"..self.sid); self.stream:hook("jingle/"..self.sid, function (stanza) if stanza.attr.from ~= self.peer then @@ -235,7 +235,7 @@ local jingle_tag = stanza:get_child("jingle", xmlns_jingle); return self:handle_command(jingle_tag) end); - + self.stream:send_iq(session_initiate, function (result) if result.attr.type == "error" then self.state = "terminated"; diff -r d80d27234e38 -r 0891b4e27766 plugins/jingle_ft.lua --- a/plugins/jingle_ft.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/jingle_ft.lua Fri May 01 23:27:29 2015 +0200 @@ -9,9 +9,9 @@ stream:hook("ready", function () stream:add_disco_feature(xmlns_jingle_ft); end, 10); - + local ft_content = { type = "file" }; - + function ft_content:generate_accept(description, options) if options and options.save_file then self.jingle:hook("connected", function () @@ -19,10 +19,10 @@ self.jingle:set_sink(sink); end); end - + return description; end - + local ft_mt = { __index = ft_content }; stream:hook("jingle/content/"..xmlns_jingle_ft, function (jingle, description_tag) local file_tag = description_tag:get_child("file"); @@ -32,10 +32,10 @@ desc = file_tag:get_child_text("desc"); date = file_tag:get_child_text("date"); }; - + return setmetatable({ jingle = jingle, file = file }, ft_mt); end); - + stream:hook("jingle/describe/file", function (file_info) -- Return local date; @@ -54,12 +54,12 @@ function stream:send_file(to, filename) local file, err = io.open(filename); if not file then return file, err; end - + local file_size = file:seek("end", 0); file:seek("set", 0); - + local source = ltn12.source.file(file); - + local jingle = self:jingle(to); jingle:offer("file", { filename = filename:match("[^"..dirsep.."]+$"); diff -r d80d27234e38 -r 0891b4e27766 plugins/jingle_s5b.lua --- a/plugins/jingle_s5b.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/jingle_s5b.lua Fri May 01 23:27:29 2015 +0200 @@ -12,7 +12,7 @@ end local function receive_connection_response(data) conn:unhook("incoming-raw", receive_connection_response); - + if data:sub(1, 2) ~= "\005\000" then return conn:event("error", "connection-failure"); end @@ -47,7 +47,7 @@ --Attempt to connect to the next host local function attempt_next_streamhost(event) if event then - return callback(nil, event.reason); + return callback(nil, event.reason); end -- First connect, or the last connect failed if conn.current_host < #conn.streamhosts then @@ -58,7 +58,7 @@ conn.streamhosts[conn.current_host].port ); if not ok then - conn:debug("Error connecting to proxy (%s:%s): %s", + conn:debug("Error connecting to proxy (%s:%s): %s", conn.streamhosts[conn.current_host].host, conn.streamhosts[conn.current_host].port, err @@ -90,7 +90,7 @@ end, 10); local s5b = {}; - + function s5b:generate_initiate() self.s5b_sid = uuid_generate(); local transport = verse.stanza("transport", { xmlns = xmlns_s5b, @@ -104,13 +104,13 @@ stream:debug("Have %d proxies", p) return transport; end - + function s5b:generate_accept(initiate_transport) local candidates = {}; self.s5b_peer_candidates = candidates; self.s5b_mode = initiate_transport.attr.mode or "tcp"; self.s5b_sid = initiate_transport.attr.sid or self.jingle.sid; - + -- Import the list of candidates the initiator offered us for candidate in initiate_transport:childtags() do --if candidate.attr.jid == "asterix4@jabber.lagaule.org/Gajim" @@ -125,21 +125,21 @@ }; --end end - + -- Import our own candidates -- TODO ^ local transport = verse.stanza("transport", { xmlns = xmlns_s5b }); return transport; end - + function s5b:connect(callback) stream:warn("Connecting!"); - + local streamhost_array = {}; for cid, streamhost in pairs(self.s5b_peer_candidates or {}) do streamhost_array[#streamhost_array+1] = streamhost; end - + if #streamhost_array > 0 then self.connecting_peer_candidates = true; local function onconnect(streamhost, conn) @@ -156,7 +156,7 @@ self.onconnect_callback = callback; end end - + function s5b:info_received(jingle_tag) stream:warn("Info received"); local content_tag = jingle_tag:child_with_name("content"); @@ -171,7 +171,7 @@ self.jingle.stream:send_iq(verse.iq({ to = streamhost.jid, type = "set" }) :tag("query", { xmlns = xmlns_bytestreams, sid = self.s5b_sid }) :tag("activate"):text(self.jingle.peer), function (result) - + if result.attr.type == "result" then self.jingle:send_command("transport-info", verse.stanza("content", content_tag.attr) :tag("transport", { xmlns = xmlns_s5b, sid = self.s5b_sid }) @@ -184,7 +184,7 @@ end); end end - + -- FIXME: Another assumption that cid==jid, and that it was our candidate self.jingle.stream:debug("CID: %s", self.jingle.stream.proxy65.available_streamhosts[candidate_used.attr.cid]); local streamhost_array = { @@ -198,13 +198,13 @@ self.onconnect_callback(self.conn); end end - + function s5b:disconnect() if self.conn then self.conn:close(); end end - + function s5b:handle_accepted(jingle_tag) end diff -r d80d27234e38 -r 0891b4e27766 plugins/legacy.lua --- a/plugins/legacy.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/legacy.lua Fri May 01 23:27:29 2015 +0200 @@ -51,14 +51,14 @@ end end); end - + function handle_opened(attr) if not attr.version then stream:send_iq(verse.iq({type="get"}) :tag("query", { xmlns = "jabber:iq:auth" }) :tag("username"):text(stream.username), handle_auth_form); - + end end stream:hook("opened", handle_opened); diff -r d80d27234e38 -r 0891b4e27766 plugins/pep.lua --- a/plugins/pep.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/pep.lua Fri May 01 23:27:29 2015 +0200 @@ -7,11 +7,11 @@ stream:add_plugin("disco"); stream:add_plugin("pubsub"); stream.pep = {}; - + stream:hook("pubsub/event", function(event) return stream:event("pep/"..event.node, { from = event.from, item = event.item.tags[1] } ); end); - + function stream:hook_pep(node, callback, priority) local handlers = stream.events._handlers["pep/"..node]; if not(handlers) or #handlers == 0 then @@ -19,7 +19,7 @@ end stream:hook("pep/"..node, callback, priority); end - + function stream:unhook_pep(node, callback) stream:unhook("pep/"..node, callback); local handlers = stream.events._handlers["pep/"..node]; @@ -27,7 +27,7 @@ stream:remove_disco_feature(node.."+notify"); end end - + function stream:publish_pep(item, node) return stream.pubsub:service(nil):node(node or item.attr.xmlns):publish(nil, nil, item) end diff -r d80d27234e38 -r 0891b4e27766 plugins/ping.lua --- a/plugins/ping.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/ping.lua Fri May 01 23:27:29 2015 +0200 @@ -5,7 +5,7 @@ function verse.plugins.ping(stream) function stream:ping(jid, callback) local t = socket.gettime(); - stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }), + stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }), function (reply) if reply.attr.type == "error" then local type, condition, text = reply:get_error(); diff -r d80d27234e38 -r 0891b4e27766 plugins/private.lua --- a/plugins/private.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/private.lua Fri May 01 23:27:29 2015 +0200 @@ -18,7 +18,7 @@ end self:send_iq(iq, callback); end - + function stream:private_get(name, xmlns, callback) self:send_iq(verse.iq({type="get"}) :tag("query", { xmlns = xmlns_private }) diff -r d80d27234e38 -r 0891b4e27766 plugins/proxy65.lua --- a/plugins/proxy65.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/proxy65.lua Fri May 01 23:27:29 2015 +0200 @@ -19,12 +19,12 @@ outstanding_proxies = outstanding_proxies + 1; stream:send_iq(verse.iq({ to = service.jid, type = "get" }) :tag("query", { xmlns = xmlns_bytestreams }), function (result) - + outstanding_proxies = outstanding_proxies - 1; if result.attr.type == "result" then local streamhost = result:get_child("query", xmlns_bytestreams) :get_child("streamhost").attr; - + stream.proxy65.available_streamhosts[streamhost.jid] = { jid = streamhost.jid; host = streamhost.host; @@ -43,14 +43,14 @@ streamhosts = {}, current_host = 0; }); - + -- Parse hosts from request for tag in request.tags[1]:childtags() do if tag.name == "streamhost" then - table.insert(conn.streamhosts, tag.attr); + table.insert(conn.streamhosts, tag.attr); end end - + --Attempt to connect to the next host local function attempt_next_streamhost() -- First connect, or the last connect failed @@ -68,7 +68,7 @@ stream:send(verse.error_reply(request, "cancel", "item-not-found")); -- Let disconnected event fall through to user handlers... end - + function conn:accept() conn:hook("disconnected", attempt_next_streamhost, 100); -- When this event fires, we're connected to a streamhost @@ -94,14 +94,14 @@ target_jid = target_jid; bytestream_sid = uuid.generate(); }); - + local request = verse.iq{type="set", to = target_jid} :tag("query", { xmlns = xmlns_bytestreams, mode = "tcp", sid = conn.bytestream_sid }); for _, proxy in ipairs(proxies or self.proxies) do request:tag("streamhost", proxy):up(); end - - + + self.stream:send_iq(request, function (reply) if reply.attr.type == "error" then local type, condition, text = reply:get_error(); @@ -123,7 +123,7 @@ if not (host and port) then --FIXME: Emit error end - + conn:connect(host, port); local function handle_proxy_connected() @@ -158,7 +158,7 @@ end local function receive_connection_response(data) conn:unhook("incoming-raw", receive_connection_response); - + if data:sub(1, 2) ~= "\005\000" then return conn:event("error", "connection-failure"); end diff -r d80d27234e38 -r 0891b4e27766 plugins/roster.lua --- a/plugins/roster.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/roster.lua Fri May 01 23:27:29 2015 +0200 @@ -24,7 +24,7 @@ local function item_lua2xml(item_table) local xml_item = verse.stanza("item", { xmlns = xmlns_roster }); for k, v in pairs(item_table) do - if k ~= "groups" then + if k ~= "groups" then xml_item.attr[k] = v; else for i = 1,#v do diff -r d80d27234e38 -r 0891b4e27766 plugins/sasl.lua --- a/plugins/sasl.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/sasl.lua Fri May 01 23:27:29 2015 +0200 @@ -48,7 +48,7 @@ stream:send(auth_stanza); return true; end - + local function handle_sasl(sasl_stanza) if sasl_stanza.name == "failure" then local err = sasl_stanza.tags[1]; @@ -71,10 +71,10 @@ end return true; end - + stream:hook("stream-features", handle_features, 300); stream:hook("stream/"..xmlns_sasl, handle_sasl); - + return true; end diff -r d80d27234e38 -r 0891b4e27766 plugins/session.lua --- a/plugins/session.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/session.lua Fri May 01 23:27:29 2015 +0200 @@ -3,7 +3,7 @@ local xmlns_session = "urn:ietf:params:xml:ns:xmpp-session"; function verse.plugins.session(stream) - + local function handle_features(features) local session_feature = features:get_child("session", xmlns_session); if session_feature and not session_feature:get_child("optional") then @@ -25,6 +25,6 @@ end end stream:hook("stream-features", handle_features); - + return true; end diff -r d80d27234e38 -r 0891b4e27766 plugins/smacks.lua --- a/plugins/smacks.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/smacks.lua Fri May 01 23:27:29 2015 +0200 @@ -9,10 +9,10 @@ local last_ack = 0; local last_stanza_time = now(); local timer_active; - + -- State for incoming stanzas local handled_stanza_count = 0; - + -- Catch incoming stanzas local function incoming_stanza(stanza) if stanza.attr.xmlns == "jabber:client" or not stanza.attr.xmlns then @@ -59,14 +59,14 @@ end); return true; end - end + end -- Graceful shutdown local function on_close() stream.resumption_token = nil; stream:unhook("disconnected", on_disconnect); end - + local function handle_sm_command(stanza) if stanza.name == "r" then -- Request for acks for stanzas we received stream:debug("Ack requested... acking %d handled stanzas", handled_stanza_count); diff -r d80d27234e38 -r 0891b4e27766 plugins/tls.lua --- a/plugins/tls.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/tls.lua Fri May 01 23:27:29 2015 +0200 @@ -31,6 +31,6 @@ stream:hook("stream-features", handle_features, 400); stream:hook("stream/"..xmlns_tls, handle_tls); stream:hook("status", handle_status, 400); - + return true; end diff -r d80d27234e38 -r 0891b4e27766 plugins/vcard_update.lua --- a/plugins/vcard_update.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/vcard_update.lua Fri May 01 23:27:29 2015 +0200 @@ -32,7 +32,7 @@ local x_vcard_update; - function update_vcard_photo(vCard) + function update_vcard_photo(vCard) local data; for i=1,#vCard do if vCard[i].name == "PHOTO" then diff -r d80d27234e38 -r 0891b4e27766 plugins/version.lua --- a/plugins/version.lua Fri May 01 21:46:24 2015 +0200 +++ b/plugins/version.lua Fri May 01 23:27:29 2015 +0200 @@ -26,11 +26,11 @@ stream:send(reply); return true; end); - + function stream:query_version(target_jid, callback) callback = callback or function (version) return stream:event("version/response", version); end stream:send_iq(verse.iq({ type = "get", to = target_jid }) - :tag("query", { xmlns = xmlns_version }), + :tag("query", { xmlns = xmlns_version }), function (reply) if reply.attr.type == "result" then local query = reply:get_child("query", xmlns_version);