Software /
code /
prosody
Comparison
util/stanza.lua @ 8890:3490bc478804
util.stanza: Verify that other objects added as children are valid strings
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 08 Jun 2018 17:06:21 +0200 |
parent | 8889:c4e430c69f88 |
child | 8894:7273fb6af831 |
comparison
equal
deleted
inserted
replaced
8889:c4e430c69f88 | 8890: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); |