Diff

plugins/mod_presence.lua @ 8074:4b403f881176

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 10 Apr 2017 23:16:13 +0200
parent 8072:194409dcba22
child 8574:f89d8ec48d86
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Sun Apr 09 01:25:58 2017 +0200
+++ b/plugins/mod_presence.lua	Mon Apr 10 23:16:13 2017 +0200
@@ -36,18 +36,15 @@
 		local priority = stanza:get_child("priority");
 		if priority and priority[1] ~= "0" then
 			for i=#priority.tags,1,-1 do priority.tags[i] = nil; end
-			for i=#priority,1,-1 do priority[i] = nil; end
+			for i=#priority,2,-1 do priority[i] = nil; end
 			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