Changeset

3084:9b17449fb5f4

mod_presence: Added option 'ignore_presence_priority'.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 22 May 2010 03:20:43 +0500
parents 3083:cb15fa9242f9
children 3085:cf01b0725272
files plugins/mod_presence.lua
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Fri May 21 19:45:33 2010 +0100
+++ b/plugins/mod_presence.lua	Sat May 22 03:20:43 2010 +0500
@@ -62,7 +62,17 @@
 	end
 end
 
+local ignore_presence_priority = module:get_option("ignore_presence_priority");
+
 function handle_normal_presence(origin, stanza, core_route_stanza)
+	if ignore_presence_priority then
+		local priority = stanza:child_with_name("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
+			priority[1] = "0";
+		end
+	end
 	if full_sessions[origin.full_jid] then -- if user is still connected
 		origin.send(stanza); -- reflect their presence back to them
 	end