Changeset

8072:194409dcba22

mod_presence: Use get_child_text on priority child element (fixes #552)
author Kim Alvefur <zash@zash.se>
date Mon, 10 Apr 2017 20:28:02 +0200
parents 8071:c3790ca4144f
children 8073:7361412a9664
files plugins/mod_presence.lua
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Mon Apr 10 20:04:07 2017 +0200
+++ b/plugins/mod_presence.lua	Mon Apr 10 20:28:02 2017 +0200
@@ -40,14 +40,11 @@
 			priority[1] = "0";
 		end
 	end
-	local priority = stanza:get_child("priority");
-	if priority and #priority > 0 then
-		priority = t_concat(priority);
-		if s_find(priority, "^[+-]?[0-9]+$") then
-			priority = tonumber(priority);
-			if priority < -128 then priority = -128 end
-			if priority > 127 then priority = 127 end
-		else priority = 0; end
+	local priority = stanza:get_child_text("priority");
+	if priority and s_find(priority, "^[+-]?[0-9]+$") then
+		priority = tonumber(priority);
+		if priority < -128 then priority = -128 end
+		if priority > 127 then priority = 127 end
 	else priority = 0; end
 	if full_sessions[origin.full_jid] then -- if user is still connected
 		origin.send(stanza); -- reflect their presence back to them