Mercurial > prosody-hg
comparison plugins/mod_csi.lua @ 13075:82980f6890cd
mod_csi: Always advertise feature
Was previously supposed to be conditionally advertised based on
availability of a module handling the actual optimizations, which was
removed in be9ac41f1619
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 16 Apr 2023 12:47:55 +0200 |
| parents | be9ac41f1619 |
| children | 393e265aafba |
comparison
equal
deleted
inserted
replaced
| 13074:794a5ad5495e | 13075:82980f6890cd |
|---|---|
| 2 local xmlns_csi = "urn:xmpp:csi:0"; | 2 local xmlns_csi = "urn:xmpp:csi:0"; |
| 3 local csi_feature = st.stanza("csi", { xmlns = xmlns_csi }); | 3 local csi_feature = st.stanza("csi", { xmlns = xmlns_csi }); |
| 4 | 4 |
| 5 local change = module:metric("counter", "changes", "events", "CSI state changes", {"csi_state"}); | 5 local change = module:metric("counter", "changes", "events", "CSI state changes", {"csi_state"}); |
| 6 | 6 |
| 7 local csi_handler_available = nil; | |
| 8 module:hook("stream-features", function (event) | 7 module:hook("stream-features", function (event) |
| 9 if event.origin.username and csi_handler_available then | 8 if event.origin.username then |
| 10 event.features:add_child(csi_feature); | 9 event.features:add_child(csi_feature); |
| 11 end | 10 end |
| 12 end); | 11 end); |
| 13 | 12 |
| 14 function refire_event(name) | 13 function refire_event(name) |
