Software /
code /
prosody
Comparison
plugins/mod_csi_simple.lua @ 9651:989cf872d5c0 0.11
mod_csi: Set session.state to simplify CSI modules
Moved here from mod_csi_simple
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 27 Nov 2018 19:34:21 +0100 |
parent | 9650:db6bcafd76c9 |
child | 9767:57ceffb13963 |
comparison
equal
deleted
inserted
replaced
9650:db6bcafd76c9 | 9651:989cf872d5c0 |
---|---|
69 return true; | 69 return true; |
70 end, -1); | 70 end, -1); |
71 | 71 |
72 module:hook("csi-client-inactive", function (event) | 72 module:hook("csi-client-inactive", function (event) |
73 local session = event.origin; | 73 local session = event.origin; |
74 session.state = "inactive"; | |
75 if session.pump then | 74 if session.pump then |
76 session.pump:pause(); | 75 session.pump:pause(); |
77 else | 76 else |
78 local bare_jid = jid.join(session.username, session.host); | 77 local bare_jid = jid.join(session.username, session.host); |
79 local send = session.send; | 78 local send = session.send; |
97 end | 96 end |
98 end); | 97 end); |
99 | 98 |
100 module:hook("csi-client-active", function (event) | 99 module:hook("csi-client-active", function (event) |
101 local session = event.origin; | 100 local session = event.origin; |
102 session.state = "active"; | |
103 if session.pump then | 101 if session.pump then |
104 session.pump:resume(); | 102 session.pump:resume(); |
105 end | 103 end |
106 end); | 104 end); |
107 | 105 |