Mercurial > prosody-hg
comparison plugins/mod_presence.lua @ 2863:b5924a017849
mod_presence: Reflect the user's own presence back to them.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Mon, 15 Feb 2010 04:15:37 +0500 |
| parents | 56630a6c9a31 |
| children | c75c22c316d6 b7049746bd29 |
comparison
equal
deleted
inserted
replaced
| 2862:dae09dd45bed | 2863:b5924a017849 |
|---|---|
| 61 if #user.top_resources == 0 then user.top_resources = nil; end | 61 if #user.top_resources == 0 then user.top_resources = nil; end |
| 62 end | 62 end |
| 63 end | 63 end |
| 64 | 64 |
| 65 function handle_normal_presence(origin, stanza, core_route_stanza) | 65 function handle_normal_presence(origin, stanza, core_route_stanza) |
| 66 if full_sessions[origin.full_jid] then -- if user is still connected | |
| 67 origin.send(stanza); -- reflect their presence back to them | |
| 68 end | |
| 66 local roster = origin.roster; | 69 local roster = origin.roster; |
| 67 local node, host = origin.username, origin.host; | 70 local node, host = origin.username, origin.host; |
| 68 local user = bare_sessions[node.."@"..host]; | 71 local user = bare_sessions[node.."@"..host]; |
| 69 for _, res in pairs(user and user.sessions or NULL) do -- broadcast to all resources | 72 for _, res in pairs(user and user.sessions or NULL) do -- broadcast to all resources |
| 70 if res ~= origin and res.presence then -- to resource | 73 if res ~= origin and res.presence then -- to resource |
