Changeset

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 11094:03fdf41fd948
children 11096:dd1713862c20
files util/error.lua
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/error.lua	Sun Sep 27 00:17:48 2020 +0200
+++ b/util/error.lua	Mon Sep 28 01:55:35 2020 +0200
@@ -98,12 +98,17 @@
 	context.stanza = stanza;
 	context.by = error_tag.attr.by or stanza.attr.from;
 
+	local uri;
+	if condition == "gone" or condition == "redirect" then
+		uri = error_tag:get_child_text(condition, "urn:ietf:params:xml:ns:xmpp-stanzas");
+	end
+
 	return new({
 		type = error_type or "cancel";
 		condition = condition or "undefined-condition";
 		text = text;
-		extra = (extra_tag or condition == "gone") and {
-			uri = error_tag:get_child_text("gone", "urn:ietf:params:xml:ns:xmpp-stanzas");
+		extra = (extra_tag or uri) and {
+			uri = uri;
 			tag = extra_tag;
 		} or nil;
 	}, context, nil, source);