Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 2527:3fe3dbb27b6f
MUC: Have get_error_condition() use the new stanza:get_error() (muc.lib.lua 11 lines shorter \o/)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 29 Jan 2010 14:26:54 +0000 |
| parents | 8b12ee9a5027 |
| children | 3365ed0ed5bd |
comparison
equal
deleted
inserted
replaced
| 2526:401ff68413a1 | 2527:3fe3dbb27b6f |
|---|---|
| 57 ["remote-server-not-found"] = true; | 57 ["remote-server-not-found"] = true; |
| 58 ["remote-server-timeout"] = true; | 58 ["remote-server-timeout"] = true; |
| 59 ["service-unavailable"] = true; | 59 ["service-unavailable"] = true; |
| 60 ["malformed error"] = true; | 60 ["malformed error"] = true; |
| 61 }; | 61 }; |
| 62 | |
| 62 local function get_error_condition(stanza) | 63 local function get_error_condition(stanza) |
| 63 for _, tag in ipairs(stanza.tags) do | 64 local _, condition = stanza:get_error(); |
| 64 if tag.name == "error" and (not(tag.attr.xmlns) or tag.attr.xmlns == "jabber:client") then | 65 return condition or "malformed error"; |
| 65 for _, cond in ipairs(tag.tags) do | 66 end |
| 66 if cond.attr.xmlns == "urn:ietf:params:xml:ns:xmpp-stanzas" then | 67 |
| 67 return cond.name; | |
| 68 end | |
| 69 end | |
| 70 return "malformed error"; | |
| 71 end | |
| 72 end | |
| 73 return "malformed error"; | |
| 74 end | |
| 75 local function is_kickable_error(stanza) | 68 local function is_kickable_error(stanza) |
| 76 local cond = get_error_condition(stanza); | 69 local cond = get_error_condition(stanza); |
| 77 return kickable_error_conditions[cond] and cond; | 70 return kickable_error_conditions[cond] and cond; |
| 78 end | 71 end |
| 79 local function getUsingPath(stanza, path, getText) | 72 local function getUsingPath(stanza, path, getText) |
