Mercurial > prosody-modules
annotate mod_muc_thread_polyfill/mod_muc_thread_polyfill.lua @ 6352:525655adfd3e
mod_report_affiliations: Fix traceback a non-user is sending a presence
For now we won’t touch their presence instead of emiting this traceback:
error Traceback[s2s]: /usr/lib/prosody/core/rostermanager.lua:275: attempt to concatenate a nil value (local 'username')
stack traceback:
/usr/lib/prosody/core/rostermanager.lua:275: in function 'prosody.core.rostermanager.is_user_subscribed'
...ules/mod_report_affiliations/mod_report_affiliations.lua:116: in field '?'
/usr/lib/prosody/util/events.lua:81: in function </usr/lib/prosody/util/events.lua:77>
(...tail calls...)
/usr/lib/prosody/core/stanza_router.lua:184: in upvalue 'core_post_stanza'
/usr/lib/prosody/modules/mod_presence.lua:244: in function </usr/lib/prosody/modules/mod_presence.lua:231>
(...tail calls...)
/usr/lib/prosody/util/events.lua:81: in function </usr/lib/prosody/util/events.lua:77>
(...tail calls...)
/usr/lib/prosody/core/stanza_router.lua:188: in upvalue 'core_post_stanza'
/usr/lib/prosody/core/stanza_router.lua:128: in upvalue 'core_process_stanza'
/usr/lib/prosody/modules/mod_s2s.lua:818: in upvalue 'func'
/usr/lib/prosody/util/async.lua:149: in function </usr/lib/prosody/util/async.lua:147>
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Tue, 30 Dec 2025 13:19:43 +0100 |
| parents | 1a08652c3fea |
| children |
| rev | line source |
|---|---|
|
6351
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
1 local st = require "util.stanza"; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
2 local jid = require "util.jid"; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
3 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
4 local archive = module:open_store("muc_log", "archive"); |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
5 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
6 module:hook("muc-occupant-groupchat", function (event) |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
7 local stanza = event.stanza; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
8 local room = event.room; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
9 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
10 if stanza:get_child("thread") then |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
11 return; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
12 end |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
13 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
14 local reply = stanza:get_child("reply", "urn:xmpp:reply:0"); |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
15 if not reply then |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
16 return; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
17 end |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
18 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
19 local reply_id = reply.attr.id; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
20 if not reply_id then |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
21 return; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
22 end |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
23 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
24 local archived = archive:get(jid.node(room.jid), reply_id); |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
25 if not archived then |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
26 return; |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
27 end |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
28 |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
29 local parent_thread = archived:get_child("thread"); |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
30 if parent_thread then |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
31 stanza:add_child(st.clone(parent_thread)); |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
32 end |
|
1a08652c3fea
mod_muc_thread_polyfill: new module to infer threads when possible for clients that do not send them
Stephen Paul Weber <singpolyma@singpolyma.net>
parents:
diff
changeset
|
33 end); |
