Software /
code /
prosody
Comparison
util/stanza.lua @ 2734:7941617b15f9
util.stanza: Fixed nil global accesses.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 02 Mar 2010 00:50:54 +0500 |
parent | 2557:e5254ccd5ef8 |
child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
2733:65ad0fdb17ba | 2734:7941617b15f9 |
---|---|
245 if stanza then | 245 if stanza then |
246 local attr = stanza.attr; | 246 local attr = stanza.attr; |
247 for i=1,#attr do attr[i] = nil; end | 247 for i=1,#attr do attr[i] = nil; end |
248 local attrx = {}; | 248 local attrx = {}; |
249 for att in pairs(attr) do | 249 for att in pairs(attr) do |
250 if s_find(att, "|", 1, true) and not s_find(k, "\1", 1, true) then | 250 if s_find(att, "|", 1, true) and not s_find(att, "\1", 1, true) then |
251 local ns,na = s_match(k, "^([^|]+)|(.+)$"); | 251 local ns,na = s_match(att, "^([^|]+)|(.+)$"); |
252 attrx[ns.."\1"..na] = attr[att]; | 252 attrx[ns.."\1"..na] = attr[att]; |
253 attr[att] = nil; | 253 attr[att] = nil; |
254 end | 254 end |
255 end | 255 end |
256 for a,v in pairs(attrx) do | 256 for a,v in pairs(attrx) do |
257 attr[x] = v; | 257 attr[a] = v; |
258 end | 258 end |
259 setmetatable(stanza, stanza_mt); | 259 setmetatable(stanza, stanza_mt); |
260 for _, child in ipairs(stanza) do | 260 for _, child in ipairs(stanza) do |
261 if type(child) == "table" then | 261 if type(child) == "table" then |
262 deserialize(child); | 262 deserialize(child); |