plugins/presence.lua

changeset 197
7e98cf2c1d8d
parent 191
e0664081654c
child 250
a5ac643a7fd6
equal deleted inserted replaced
196:eb9d69d3f0b5 197:7e98cf2c1d8d
1 local st = require "util.stanza"
2 function verse.plugins.presence(stream) 1 function verse.plugins.presence(stream)
3 stream.last_presence = nil; 2 stream.last_presence = nil;
4 3
5 stream:hook("presence-out", function (presence) 4 stream:hook("presence-out", function (presence)
6 if not presence.attr.to then 5 if not presence.attr.to then
12 if last_presence then 11 if last_presence then
13 stream:send(last_presence); 12 stream:send(last_presence);
14 end 13 end
15 end 14 end
16 15
17 -- Becase I didn't find util.stanza in the client code.
18 -- And, then the name fits better :)
19 -- // Zash
20 function stream:set_status(opts) 16 function stream:set_status(opts)
21 local p = st.presence(); 17 local p = verse.presence();
22 if type(opts) == "table" then 18 if type(opts) == "table" then
23 if opts.show then 19 if opts.show then
24 p:tag("show"):text(opts.show):up(); 20 p:tag("show"):text(opts.show):up();
25 end 21 end
26 if opts.prio then 22 if opts.prio then

mercurial