Software /
code /
prosody
Comparison
util/stanza.lua @ 242:f15afbcbc55c
Add new top_tag() method to stanzas
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 13 Nov 2008 03:47:44 +0000 |
parent | 209:e9de0803676d |
child | 251:5b6dec537914 |
comparison
equal
deleted
inserted
replaced
241:021ccf988f3b | 242:f15afbcbc55c |
---|---|
103 for k, v in pairs(t.attr) do if type(k) == "string" then attr_string = attr_string .. s_format(" %s='%s'", k, tostring(v)); end end | 103 for k, v in pairs(t.attr) do if type(k) == "string" then attr_string = attr_string .. s_format(" %s='%s'", k, tostring(v)); end end |
104 end | 104 end |
105 return s_format("<%s%s>%s</%s>", t.name, attr_string, children_text, t.name); | 105 return s_format("<%s%s>%s</%s>", t.name, attr_string, children_text, t.name); |
106 end | 106 end |
107 | 107 |
108 function stanza_mt.top_tag(t) | |
109 local attr_string = ""; | |
110 if t.attr then | |
111 for k, v in pairs(t.attr) do if type(k) == "string" then attr_string = attr_string .. s_format(" %s='%s'", k, tostring(v)); end end | |
112 end | |
113 return s_format("<%s%s>", t.name, attr_string); | |
114 end | |
115 | |
108 function stanza_mt.__add(s1, s2) | 116 function stanza_mt.__add(s1, s2) |
109 return s1:add_direct_child(s2); | 117 return s1:add_direct_child(s2); |
110 end | 118 end |
111 | 119 |
112 | 120 |