Mercurial > prosody-hg
comparison util/error.lua @ 11095:1ea3574b19c8
util.error: Turns out <gone> wasn't alone, there's also <redirect>
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 28 Sep 2020 01:55:35 +0200 |
| parents | 03fdf41fd948 |
| children | 5b778ec095f0 |
comparison
equal
deleted
inserted
replaced
| 11094:03fdf41fd948 | 11095:1ea3574b19c8 |
|---|---|
| 96 local error_tag = stanza:get_child("error"); | 96 local error_tag = stanza:get_child("error"); |
| 97 context = context or {}; | 97 context = context or {}; |
| 98 context.stanza = stanza; | 98 context.stanza = stanza; |
| 99 context.by = error_tag.attr.by or stanza.attr.from; | 99 context.by = error_tag.attr.by or stanza.attr.from; |
| 100 | 100 |
| 101 local uri; | |
| 102 if condition == "gone" or condition == "redirect" then | |
| 103 uri = error_tag:get_child_text(condition, "urn:ietf:params:xml:ns:xmpp-stanzas"); | |
| 104 end | |
| 105 | |
| 101 return new({ | 106 return new({ |
| 102 type = error_type or "cancel"; | 107 type = error_type or "cancel"; |
| 103 condition = condition or "undefined-condition"; | 108 condition = condition or "undefined-condition"; |
| 104 text = text; | 109 text = text; |
| 105 extra = (extra_tag or condition == "gone") and { | 110 extra = (extra_tag or uri) and { |
| 106 uri = error_tag:get_child_text("gone", "urn:ietf:params:xml:ns:xmpp-stanzas"); | 111 uri = uri; |
| 107 tag = extra_tag; | 112 tag = extra_tag; |
| 108 } or nil; | 113 } or nil; |
| 109 }, context, nil, source); | 114 }, context, nil, source); |
| 110 end | 115 end |
| 111 | 116 |
