68 session.stanza_dispatch(pres); |
68 session.stanza_dispatch(pres); |
69 end |
69 end |
70 |
70 |
71 -- Remove session/resource from user's session list |
71 -- Remove session/resource from user's session list |
72 if session.host and session.username then |
72 if session.host and session.username then |
73 if session.resource then |
73 -- FIXME: How can the below ever be nil? (but they sometimes are...) |
74 hosts[session.host].sessions[session.username].sessions[session.resource] = nil; |
|
75 end |
|
76 if hosts[session.host] and hosts[session.host].sessions[session.username] then |
74 if hosts[session.host] and hosts[session.host].sessions[session.username] then |
|
75 if session.resource then |
|
76 hosts[session.host].sessions[session.username].sessions[session.resource] = nil; |
|
77 end |
|
78 |
77 if not next(hosts[session.host].sessions[session.username].sessions) then |
79 if not next(hosts[session.host].sessions[session.username].sessions) then |
78 log("debug", "All resources of %s are now offline", session.username); |
80 log("debug", "All resources of %s are now offline", session.username); |
79 hosts[session.host].sessions[session.username] = nil; |
81 hosts[session.host].sessions[session.username] = nil; |
80 end |
82 end |
81 end |
83 end |