Comparison

plugins/mod_privacy.lua @ 4231:a99f82db692a

mod_privacy: Remove unused function, sendUnavailable
author Matthew Wild <mwild1@gmail.com>
date Tue, 29 Mar 2011 14:57:50 +0100
parent 3453:fba130c16818
child 4232:582fe508214f
comparison
equal deleted inserted replaced
4230:23b68616b6d8 4231:a99f82db692a
39 if user then 39 if user then
40 for resource, session in pairs(user.sessions) do 40 for resource, session in pairs(user.sessions) do
41 if resource ~= origin.resource and session.activePrivacyList == nil then 41 if resource ~= origin.resource and session.activePrivacyList == nil then
42 return true; 42 return true;
43 end 43 end
44 end
45 end
46 end
47
48 function sendUnavailable(origin, to, from)
49 --[[ example unavailable presence stanza
50 <presence from="node@host/resource" type="unavailable" to="node@host" >
51 <status>Logged out</status>
52 </presence>
53 ]]--
54 local presence = st.presence({from=from, type="unavailable"});
55 presence:tag("status"):text("Logged out");
56
57 local node, host = jid_bare(to);
58 local bare = node .. "@" .. host;
59
60 local user = bare_sessions[bare];
61 if user then
62 for resource, session in pairs(user.sessions) do
63 presence.attr.to = session.full_jid;
64 module:log("debug", "send unavailable to: %s; from: %s", tostring(presence.attr.to), tostring(presence.attr.from));
65 origin.send(presence);
66 end 44 end
67 end 45 end
68 end 46 end
69 47
70 function declineList(privacy_lists, origin, stanza, which) 48 function declineList(privacy_lists, origin, stanza, which)