Changeset

250:a5ac643a7fd6

added local verse var to all plugins
author mva <mva@mva.name>
date Fri, 02 Dec 2011 11:02:02 +0600
parents 249:00891a675634
children 251:e44ddcd84234
files plugins/adhoc.lua plugins/bind.lua plugins/blocking.lua plugins/carbons.lua plugins/compression.lua plugins/disco.lua plugins/groupchat.lua plugins/jingle.lua plugins/jingle_ft.lua plugins/jingle_ibb.lua plugins/keepalive.lua plugins/legacy.lua plugins/pep.lua plugins/ping.lua plugins/presence.lua plugins/private.lua plugins/pubsub.lua plugins/register.lua plugins/roster.lua plugins/session.lua plugins/smacks.lua plugins/tls.lua plugins/uptime.lua plugins/vcard.lua plugins/vcard_update.lua plugins/version.lua
diffstat 26 files changed, 83 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/adhoc.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/adhoc.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,4 @@
+local verse = require "verse";
 local adhoc = require "lib.adhoc";
 
 local xmlns_commands = "http://jabber.org/protocol/commands";
--- a/plugins/bind.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/bind.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_bind = "urn:ietf:params:xml:ns:xmpp-bind";
 
 function verse.plugins.bind(stream)
@@ -23,4 +25,3 @@
 	stream:hook("stream-features", handle_features, 200);
 	return true;
 end
-
--- a/plugins/blocking.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/blocking.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_blocking = "urn:xmpp:blocking";
 
 function verse.plugins.blocking(stream)
--- a/plugins/carbons.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/carbons.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_carbons = "urn:xmpp:carbons:1";
 local xmlns_forward = "urn:xmpp:forward:0";
 local os_date = os.date;
--- a/plugins/compression.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/compression.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -5,6 +5,7 @@
 -- COPYING file in the source package for more information.
 --
 
+local verse = require "verse";
 local zlib = require "zlib";
 
 local xmlns_compression_feature = "http://jabber.org/features/compress"
--- a/plugins/disco.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/disco.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -6,8 +6,9 @@
 -- COPYING file in the source package for more information.
 --
 
-local b64 = require("mime").b64
-local sha1 = require("util.sha1").sha1
+local verse = require "verse";
+local b64 = require("mime").b64;
+local sha1 = require("util.sha1").sha1;
 
 local xmlns_caps = "http://jabber.org/protocol/caps";
 local xmlns_disco = "http://jabber.org/protocol/disco";
--- a/plugins/groupchat.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/groupchat.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,4 @@
+local verse = require "verse";
 local events = require "events";
 
 local room_mt = {};
--- a/plugins/jingle.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/jingle.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,4 @@
+local verse = require "verse";
 local sha1 = require "util.sha1".sha1;
 local timer = require "util.timer";
 local uuid_generate = require "util.uuid".generate;
--- a/plugins/jingle_ft.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/jingle_ft.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,4 @@
+local verse = require "verse";
 local ltn12 = require "ltn12";
 
 local dirsep = package.config:sub(1,1);
--- a/plugins/jingle_ibb.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/jingle_ibb.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,10 +1,12 @@
+local verse = require "verse";
+local base64 = require "util.encodings".base64;
+local uuid_generate = require "util.uuid".generate;
+
 local xmlns_jingle_ibb = "urn:xmpp:jingle:transports:ibb:1";
 local xmlns_ibb = "http://jabber.org/protocol/ibb";
-local base64 = require "util.encodings".base64;
 assert(base64.encode("This is a test.") == "VGhpcyBpcyBhIHRlc3Qu", "Base64 encoding failed");
 assert(base64.decode("VGhpcyBpcyBhIHRlc3Qu") == "This is a test.", "Base64 decoding failed");
 local t_concat = table.concat
-local uuid_generate = require "util.uuid".generate;
 
 local ibb_conn = {};
 local ibb_conn_mt = { __index = ibb_conn };
--- a/plugins/keepalive.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/keepalive.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 function verse.plugins.keepalive(stream)
 	stream.keepalive_timeout = stream.keepalive_timeout or 300;
 	verse.add_task(stream.keepalive_timeout, function ()
--- a/plugins/legacy.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/legacy.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,4 @@
+local verse = require "verse";
 local uuid = require "util.uuid".generate;
 
 local xmlns_auth = "jabber:iq:auth";
--- a/plugins/pep.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/pep.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,4 @@
+local verse = require "verse";
 
 local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
 local xmlns_pubsub_event = xmlns_pubsub.."#event";
--- a/plugins/ping.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/ping.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_ping = "urn:xmpp:ping";
 
 function verse.plugins.ping(stream)
--- a/plugins/presence.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/presence.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 function verse.plugins.presence(stream)
 	stream.last_presence = nil;
 
--- a/plugins/private.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/private.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,33 +1,35 @@
--- Implements XEP-0049: Private XML Storage
-
-local xmlns_private = "jabber:iq:private";
-
-function verse.plugins.private(stream)
-	function stream:private_set(name, xmlns, data, callback)
-		local iq = verse.iq({ type = "set" })
-			:tag("query", { xmlns = xmlns_private });
-		if data then
-			if data.name == name and data.attr and data.attr.xmlns == xmlns then
-				iq:add_child(data);
-			else
-				iq:tag(name, { xmlns = xmlns })
-					:add_child(data);
-			end
-		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 })
-				:tag(name, { xmlns = xmlns }),
-			function (reply)
-				if reply.attr.type == "result" then
-					local query = reply:get_child("query", xmlns_private);
-					local result = query:get_child(name, xmlns);
-					callback(result);
-				end
-			end);
-	end
-end
-
+local verse = require "verse";
+
+-- Implements XEP-0049: Private XML Storage
+
+local xmlns_private = "jabber:iq:private";
+
+function verse.plugins.private(stream)
+	function stream:private_set(name, xmlns, data, callback)
+		local iq = verse.iq({ type = "set" })
+			:tag("query", { xmlns = xmlns_private });
+		if data then
+			if data.name == name and data.attr and data.attr.xmlns == xmlns then
+				iq:add_child(data);
+			else
+				iq:tag(name, { xmlns = xmlns })
+					:add_child(data);
+			end
+		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 })
+				:tag(name, { xmlns = xmlns }),
+			function (reply)
+				if reply.attr.type == "result" then
+					local query = reply:get_child("query", xmlns_private);
+					local result = query:get_child(name, xmlns);
+					callback(result);
+				end
+			end);
+	end
+end
+
--- a/plugins/pubsub.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/pubsub.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,4 +1,6 @@
+local verse = require "verse";
 local jid_bare = require "util.jid".bare;
+
 local t_insert = table.insert;
 
 local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
@@ -227,4 +229,3 @@
 function pubsub_node:delete(callback)
 	error("Not implemented yet.");
 end
-
--- a/plugins/register.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/register.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_register = "jabber:iq:register";
 
 function verse.plugins.register(stream)
--- a/plugins/roster.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/roster.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,6 +1,8 @@
+local verse = require "verse";
+local bare_jid = require "util.jid".bare;
+
 local xmlns_roster = "jabber:iq:roster";
 local xmlns_rosterver = "urn:xmpp:features:rosterver";
-local bare_jid = require "util.jid".bare;
 local t_insert = table.insert;
 
 function verse.plugins.roster(stream)
--- a/plugins/session.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/session.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_session = "urn:ietf:params:xml:ns:xmpp-session";
 
 function verse.plugins.session(stream)
--- a/plugins/smacks.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/smacks.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_sm = "urn:xmpp:sm:2";
 
 function verse.plugins.smacks(stream)
--- a/plugins/tls.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/tls.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_tls = "urn:ietf:params:xml:ns:xmpp-tls";
 
 function verse.plugins.tls(stream)
--- a/plugins/uptime.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/uptime.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_last = "jabber:iq:last";
 
 local function set_uptime(self, uptime_info)
--- a/plugins/vcard.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/vcard.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,5 +1,7 @@
+local verse = require "verse";
+local vcard = require "util.vcard";
+
 local xmlns_vcard = "vcard-temp";
-local vcard = require "util.vcard";
 
 function verse.plugins.vcard(stream)
 	function stream:get_vcard(jid, callback) --jid = nil for self
--- a/plugins/vcard_update.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/vcard_update.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_vcard, xmlns_vcard_update = "vcard-temp", "vcard-temp:x:update";
 
 -- MMMmmmm.. hacky
--- a/plugins/version.lua	Mon Nov 28 17:16:04 2011 +0100
+++ b/plugins/version.lua	Fri Dec 02 11:02:02 2011 +0600
@@ -1,3 +1,5 @@
+local verse = require "verse";
+
 local xmlns_version = "jabber:iq:version";
 
 local function set_version(self, version_info)