Mercurial > prosody-modules
annotate mod_csi_compat/mod_csi_compat.lua @ 5951:d6a695abb33c
mod_ping_muc: Delay ping a configurable amount of time
If a server is restarting, checking immediately before it has a chance
to complete its restart and get ready would often fail, preventing the
possibility of transparent restarts as supported by Prosody's mod_muc.
Reconnecting immediately when a connection is closed for being idle, or
because the remote server is trying to reclaim some resources, is also
counter-productive as the connection may fail.
Also, if there is some Internet routing problem affecting s2s, it may
help to wait a bit before checking, in case the problem resolved itself
in the mean time.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 11 Aug 2024 16:10:24 +0200 |
parents | db8b256f51ff |
children |
rev | line source |
---|---|
1486
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local st = require "util.stanza"; |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 module:depends("csi"); |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 module:add_feature("google:queue"); |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 module:hook("iq-set/self/google:queue:query", function(event) |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 local origin, stanza = event.origin, event.stanza; |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 (origin.log or module._log)("debug", "Google queue invoked (CSI compat mode)") |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 local payload = stanza:get_child("query", "google:queue"); |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 if payload:get_child("enable") then |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 module:fire_event("csi-client-inactive", event); |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 elseif payload:get_child("disable") then |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 module:fire_event("csi-client-active", event); |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 end |
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 -- <flush/> is implemented as a noop, any IQ stanza would flush the queue anyways. |
1865
db8b256f51ff
mod_admin_web,mod_carbons,mod_csi_compat,mod_mam_muc,mod_tcpproxy: Explicitly return true
Kim Alvefur <zash@zash.se>
parents:
1486
diff
changeset
|
17 origin.send(st.reply(stanza)); |
db8b256f51ff
mod_admin_web,mod_carbons,mod_csi_compat,mod_mam_muc,mod_tcpproxy: Explicitly return true
Kim Alvefur <zash@zash.se>
parents:
1486
diff
changeset
|
18 return true; |
1486
b3e692ee16b5
mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 end, 10); |