Comparison

plugins/mod_presence.lua @ 3540:bc139431830b

Monster whitespace commit (beware the whitespace monster).
author Waqas Hussain <waqas20@gmail.com>
date Sat, 16 Oct 2010 23:00:42 +0500
parent 3518:d3399d1b484a
child 3968:048af3ee5899
comparison
equal deleted inserted replaced
3539:8bbd965267b2 3540:bc139431830b
57 for i=#priority.tags,1,-1 do priority.tags[i] = nil; end 57 for i=#priority.tags,1,-1 do priority.tags[i] = nil; end
58 for i=#priority,1,-1 do priority[i] = nil; end 58 for i=#priority,1,-1 do priority[i] = nil; end
59 priority[1] = "0"; 59 priority[1] = "0";
60 end 60 end
61 end 61 end
62 local priority = stanza:child_with_name("priority"); 62 local priority = stanza:child_with_name("priority");
63 if priority and #priority > 0 then 63 if priority and #priority > 0 then
64 priority = t_concat(priority); 64 priority = t_concat(priority);
65 if s_find(priority, "^[+-]?[0-9]+$") then 65 if s_find(priority, "^[+-]?[0-9]+$") then
66 priority = tonumber(priority); 66 priority = tonumber(priority);
67 if priority < -128 then priority = -128 end 67 if priority < -128 then priority = -128 end
68 if priority > 127 then priority = 127 end 68 if priority > 127 then priority = 127 end
69 else priority = 0; end 69 else priority = 0; end
70 else priority = 0; end 70 else priority = 0; end
71 if full_sessions[origin.full_jid] then -- if user is still connected 71 if full_sessions[origin.full_jid] then -- if user is still connected
72 origin.send(stanza); -- reflect their presence back to them 72 origin.send(stanza); -- reflect their presence back to them
73 end 73 end
74 local roster = origin.roster; 74 local roster = origin.roster;
75 local node, host = origin.username, origin.host; 75 local node, host = origin.username, origin.host;
113 request.attr.to = jid; 113 request.attr.to = jid;
114 core_post_stanza(origin, request, true); 114 core_post_stanza(origin, request, true);
115 end 115 end
116 end 116 end
117 117
118 if priority >= 0 then 118 if priority >= 0 then
119 local offline = offlinemanager.load(node, host); 119 local offline = offlinemanager.load(node, host);
120 if offline then 120 if offline then
121 for _, msg in ipairs(offline) do 121 for _, msg in ipairs(offline) do
122 origin.send(msg); -- FIXME do we need to modify to/from in any way? 122 origin.send(msg); -- FIXME do we need to modify to/from in any way?
123 end 123 end
124 offlinemanager.deleteAll(node, host); 124 offlinemanager.deleteAll(node, host);
125 end 125 end
126 end 126 end
127 end 127 end
128 if stanza.attr.type == "unavailable" then 128 if stanza.attr.type == "unavailable" then
129 origin.presence = nil; 129 origin.presence = nil;
130 if origin.priority then 130 if origin.priority then
131 origin.priority = nil; 131 origin.priority = nil;