Comparison

plugins/mod_presence.lua @ 3084:9b17449fb5f4

mod_presence: Added option 'ignore_presence_priority'.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 22 May 2010 03:20:43 +0500
parent 3083:cb15fa9242f9
child 3109:34280b1544fc
comparison
equal deleted inserted replaced
3083:cb15fa9242f9 3084:9b17449fb5f4
60 user.top_resources = select_top_resources(user); 60 user.top_resources = select_top_resources(user);
61 if #user.top_resources == 0 then user.top_resources = nil; end 61 if #user.top_resources == 0 then user.top_resources = nil; end
62 end 62 end
63 end 63 end
64 64
65 local ignore_presence_priority = module:get_option("ignore_presence_priority");
66
65 function handle_normal_presence(origin, stanza, core_route_stanza) 67 function handle_normal_presence(origin, stanza, core_route_stanza)
68 if ignore_presence_priority then
69 local priority = stanza:child_with_name("priority");
70 if priority and priority[1] ~= "0" then
71 for i=#priority.tags,1,-1 do priority.tags[i] = nil; end
72 for i=#priority,1,-1 do priority[i] = nil; end
73 priority[1] = "0";
74 end
75 end
66 if full_sessions[origin.full_jid] then -- if user is still connected 76 if full_sessions[origin.full_jid] then -- if user is still connected
67 origin.send(stanza); -- reflect their presence back to them 77 origin.send(stanza); -- reflect their presence back to them
68 end 78 end
69 local roster = origin.roster; 79 local roster = origin.roster;
70 local node, host = origin.username, origin.host; 80 local node, host = origin.username, origin.host;