Diff

plugins/muc/muc.lib.lua @ 2503:bb6b0bd7f2cf

MUC: Converted some local functions into methods.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 26 Jan 2010 02:29:32 +0500
parent 2416:89be536aae25
child 2504:8b12ee9a5027
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Tue Jan 26 02:11:50 2010 +0500
+++ b/plugins/muc/muc.lib.lua	Tue Jan 26 02:29:32 2010 +0500
@@ -183,12 +183,12 @@
 	end
 end
 
-local function room_get_disco_info(self, stanza)
+function room_mt:get_disco_info(stanza)
 	return st.reply(stanza):query("http://jabber.org/protocol/disco#info")
 		:tag("identity", {category="conference", type="text"}):up()
 		:tag("feature", {var="http://jabber.org/protocol/muc"});
 end
-local function room_get_disco_items(self, stanza)
+function room_mt:get_disco_items(stanza)
 	local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#items");
 	for room_jid in pairs(self._occupants) do
 		reply:tag("item", {jid = room_jid, name = room_jid:match("/(.*)")}):up();
@@ -502,9 +502,9 @@
 	local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns;
 	if stanza.name == "iq" then
 		if xmlns == "http://jabber.org/protocol/disco#info" and type == "get" then
-			origin.send(room_get_disco_info(self, stanza));
+			origin.send(self:get_disco_info(stanza));
 		elseif xmlns == "http://jabber.org/protocol/disco#items" and type == "get" then
-			origin.send(room_get_disco_items(self, stanza));
+			origin.send(self:get_disco_items(stanza));
 		elseif xmlns == "http://jabber.org/protocol/muc#admin" then
 			local actor = stanza.attr.from;
 			local affiliation = self:get_affiliation(actor);