util/stanza.lua
changeset 8893 3490bc478804
parent 8892 c4e430c69f88
child 8897 7273fb6af831
equal deleted inserted replaced
8892:c4e430c69f88 8893:3490bc478804
   135 end
   135 end
   136 
   136 
   137 function stanza_mt:add_direct_child(child)
   137 function stanza_mt:add_direct_child(child)
   138 	if is_stanza(child) then
   138 	if is_stanza(child) then
   139 		t_insert(self.tags, child);
   139 		t_insert(self.tags, child);
   140 	end
   140 		t_insert(self, child);
   141 	t_insert(self, child);
   141 	else
       
   142 		check_text(child, "text");
       
   143 		t_insert(self, child);
       
   144 	end
   142 end
   145 end
   143 
   146 
   144 function stanza_mt:add_child(child)
   147 function stanza_mt:add_child(child)
   145 	local last_add = self.last_add;
   148 	local last_add = self.last_add;
   146 	(last_add and last_add[#last_add] or self):add_direct_child(child);
   149 	(last_add and last_add[#last_add] or self):add_direct_child(child);