mod_muc: Replace getText() with get_child_text(), 1 insertion, 12 deletions!
authorMatthew Wild <mwild1@gmail.com>
Tue, 21 May 2013 09:48:59 +0100
changeset 5611 e043d4d65423
parent 5610 f73d5fb4ea13
child 5612 5404832d6f7a
mod_muc: Replace getText() with get_child_text(), 1 insertion, 12 deletions!
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Mon May 20 15:33:57 2013 +0100
+++ b/plugins/muc/muc.lib.lua	Tue May 21 09:48:59 2013 +0100
@@ -72,17 +72,6 @@
 	local cond = get_error_condition(stanza);
 	return kickable_error_conditions[cond] and cond;
 end
-local function getUsingPath(stanza, path, getText)
-	local tag = stanza;
-	for _, name in ipairs(path) do
-		if type(tag) ~= 'table' then return; end
-		tag = tag:child_with_name(name);
-	end
-	if tag and getText then tag = table.concat(tag); end
-	return tag;
-end
-local function getTag(stanza, path) return getUsingPath(stanza, path); end
-local function getText(stanza, path) return getUsingPath(stanza, path, true); end
 -----------
 
 local room_mt = {};
@@ -867,7 +856,7 @@
 		else
 			local from = stanza.attr.from;
 			stanza.attr.from = current_nick;
-			local subject = getText(stanza, {"subject"});
+			local subject = stanza:get_child_text("subject");
 			if subject then
 				if occupant.role == "moderator" or
 					( self._data.changesubject and occupant.role == "participant" ) then -- and participant