Comparison

core/xmlhandlers.lua @ 838:1035846d6273

core.xmlhandlers: Optimise completed stanza logic
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Feb 2009 02:26:30 +0000
parent 760:90ce865eebd8
child 844:503ca8da1000
comparison
equal deleted inserted replaced
837:86d14e7ef60c 838:1035846d6273
119 cb_error(session, "stream-error", stanza); 119 cb_error(session, "stream-error", stanza);
120 else 120 else
121 cb_error(session, "parse-error", "unexpected-element-close", name); 121 cb_error(session, "parse-error", "unexpected-element-close", name);
122 end 122 end
123 end 123 end
124 if stanza and #chardata > 0 then 124 if stanza then
125 -- We have some character data in the buffer 125 if stanza and #chardata > 0 then
126 stanza:text(t_concat(chardata)); 126 -- We have some character data in the buffer
127 chardata = {}; 127 stanza:text(t_concat(chardata));
128 end 128 chardata = {};
129 -- Complete stanza 129 end
130 if #stanza.last_add == 0 then 130 -- Complete stanza
131 cb_handlestanza(session, stanza); 131 if #stanza.last_add == 0 then
132 stanza = nil; 132 cb_handlestanza(session, stanza);
133 else 133 stanza = nil;
134 stanza:up(); 134 else
135 stanza:up();
136 end
135 end 137 end
136 end 138 end
137 return xml_handlers; 139 return xml_handlers;
138 end 140 end
139 141