1 local verse = require "verse"; |
1 local verse = require "verse"; |
|
2 local st = require "util.stanza"; |
2 |
3 |
3 function verse.plugins.presence(stream) |
4 function verse.plugins.presence(stream) |
4 stream.last_presence = nil; |
5 stream.last_presence = nil; |
5 |
6 |
6 stream:hook("presence-out", function (presence) |
7 stream:hook("presence-out", function (presence) |
7 if not presence.attr.to then |
8 if not presence.attr.to then |
8 stream.last_presence = presence; -- Cache non-directed presence |
9 -- Clone so we don't add stuff over and over..? |
|
10 stream.last_presence = st.clone(presence); -- Cache non-directed presence |
9 end |
11 end |
10 end, 1); |
12 end, 1); |
11 |
13 |
12 function stream:resend_presence() |
14 function stream:resend_presence() |
13 if self.last_presence then |
15 if self.last_presence then |