mod_presence: Added option 'ignore_presence_priority'.

Sat, 22 May 2010 03:20:43 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sat, 22 May 2010 03:20:43 +0500
changeset 3084
9b17449fb5f4
parent 3083
cb15fa9242f9
child 3085
cf01b0725272

mod_presence: Added option 'ignore_presence_priority'.

plugins/mod_presence.lua file | annotate | diff | comparison | revisions
--- 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

mercurial