plugins/mod_pep.lua

changeset 1428
02e97e716675
parent 1425
8187f72b7425
child 1429
51cfb152cb38
equal deleted inserted replaced
1427:3bcab7c71edf 1428:02e97e716675
43 for jid, item in pairs(session.roster) do 43 for jid, item in pairs(session.roster) do
44 if jid and jid ~= "pending" and (item.subscription == 'from' or item.subscription == 'both') then 44 if jid and jid ~= "pending" and (item.subscription == 'from' or item.subscription == 'both') then
45 stanza.attr.to = jid; 45 stanza.attr.to = jid;
46 core_route_stanza(session, stanza); 46 core_route_stanza(session, stanza);
47 end 47 end
48 end
49 end
50
51 local function get_caps_hash_from_presence(stanza, current)
52 if not stanza.attr.type then
53 for _, child in pairs(stanza.tags) do
54 if child.name == "c" and child.attr.xmlns == "http://jabber.org/protocol/caps" then
55 local attr = child.attr;
56 if attr.hash then -- new caps
57 if attr.hash == 'sha-1' and attr.node and attr.ver then return attr.ver, attr.node.."#"..attr.ver; end
58 else -- legacy caps
59 if attr.node and attr.ver then return attr.node.."#"..attr.ver.."#"..(attr.ext or ""), attr.node.."#"..attr.ver; end
60 end
61 return; -- bad caps format
62 end
63 end
64 return current; -- no caps, could mean caps optimization, so return current
48 end 65 end
49 end 66 end
50 67
51 module:hook("presence/bare", function(event) 68 module:hook("presence/bare", function(event)
52 -- inbound presence to bare JID recieved 69 -- inbound presence to bare JID recieved

mercurial