Software /
code /
prosody
Diff
util/stanza.lua @ 7758:2b305ec8c146
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 Dec 2016 11:13:05 +0100 |
parent | 7256:9fbb9fbf7e52 |
parent | 7750:e58524240b30 |
child | 8382:e5d00bf4a4d5 |
line wrap: on
line diff
--- a/util/stanza.lua Sun Nov 27 01:06:23 2016 +0100 +++ b/util/stanza.lua Fri Dec 02 11:13:05 2016 +0100 @@ -14,6 +14,7 @@ local s_match = string.match; local tostring = tostring; local setmetatable = setmetatable; +local getmetatable = getmetatable; local pairs = pairs; local ipairs = ipairs; local type = type; @@ -45,6 +46,10 @@ return setmetatable(stanza, stanza_mt); end +local function is_stanza(s) + return getmetatable(s) == stanza_mt; +end + function stanza_mt:query(xmlns) return self:tag("query", { xmlns = xmlns }); end @@ -422,6 +427,7 @@ return { stanza_mt = stanza_mt; stanza = new_stanza; + is_stanza = is_stanza; new_id = new_id; preserialize = preserialize; deserialize = deserialize;