Diff

plugins/version.lua @ 29:0d275519eff4

verse.plugins.version: Fix for handling of version requests
author Matthew Wild <mwild1@gmail.com>
date Wed, 09 Dec 2009 20:57:18 +0000
parent 27:a4a6a33a34c1
child 33:4581b2e61429
line wrap: on
line diff
--- a/plugins/version.lua	Wed Dec 09 20:55:34 2009 +0000
+++ b/plugins/version.lua	Wed Dec 09 20:57:18 2009 +0000
@@ -1,6 +1,6 @@
 local xmlns_version = "jabber:iq:version";
 
-local function set_version(version_info)
+local function set_version(self, version_info)
 	self.name = version_info.name;
 	self.version = version_info.version;
 	self.platform = version_info.platform;
@@ -8,9 +8,9 @@
 
 function verse.plugins.version(stream)
 	stream.version = { set = set_version };
-	stream:hook("iq/"..xmlns_version, function (event)
-		if event.stanza.attr.type ~= "get" then return; end
-		local reply = verse.reply(event.stanza)
+	stream:hook("iq/"..xmlns_version, function (stanza)
+		if stanza.attr.type ~= "get" then return; end
+		local reply = verse.reply(stanza)
 			:tag("query", { xmlns = xmlns_version });
 		if stream.version.name then
 			reply:tag("name"):text(tostring(stream.version.name)):up();
@@ -21,6 +21,7 @@
 		if stream.version.platform then
 			reply:tag("os"):text(stream.version.platform);
 		end
+		stream:send(reply);
 	end);
 	
 	function stream:query_version(target_jid, callback)