It looks like the prosody issue tracker is currently unable to send confirmation emails so I'm sending this here:

*What steps will reproduce the problem?*
1. Enable the hats module on the muc component
2. Add a hat using the ad-hoc command in gajim
3. See error

*What is the expected output?*
No errors and hat appears

*What do you see instead?*
```
prosody[1431]: c2s5f0ad8459c70: Traceback[c2s]: /usr/lib/prosody/modules/muc/hats.lib.lua:31: attempt to index a nil value (local 'legacy_hats_el')
                       stack traceback:
/usr/lib/prosody/modules/muc/hats.lib.lua:31: in field '?'
                       /usr/lib/prosody/util/events.lua:81: in function </usr/lib/prosody/util/events.lua:77>
                       (...tail calls...)
/usr/lib/prosody/modules/muc/muc.lib.lua:241: in method 'publicise_occupant_status'
/usr/lib/prosody/modules/muc/muc.lib.lua:1507: in method 'set_affiliation'
...ib/prosody/modules/mod_muc_hats_api/mod_muc_hats_api.lua:25: in field 'add_user_hat' ...rosody/modules/mod_muc_hats_adhoc/mod_muc_hats_adhoc.lua:31: in function <...rosody/modules/mod_muc_hats_adhoc/mod_muc_hats_adhoc.lua:26>
                       (...tail calls...)
/usr/lib/prosody/modules/adhoc/adhoc.lib.lua:51: in upvalue 'adhoc_handle_cmd'
/usr/lib/prosody/modules/adhoc/mod_adhoc.lua:72: in field '?'
                       /usr/lib/prosody/util/events.lua:81: in function </usr/lib/prosody/util/events.lua:77>
                       (...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_c2s.lua:355: in upvalue 'func'                        /usr/lib/prosody/util/async.lua:149: in function </usr/lib/prosody/util/async.lua:147>
```
I think this also prevents people from joining.

*What version of the product are you using? On what operating system?*
prosody-hg: r13522+.ccd6199cc6a2+-1
Arch Linux

*Please provide any additional information below:*
It looks like this was last changed here: https://hg.prosody.im/trunk/rev/f9171624fd03 .  Should line 1.16 read `legacy_hats_el` or something?  Right now it looks like I'm hitting a circumstance where `legacy_hats_el` does not get set, so the `legacy_hats_el:tag` call errors.

I'm very unfamiliar with the MUC hats code, but attached is a patch that may properly fix the issue.

--
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prosody-dev/fff79c59-b09a-4fed-875c-617f30772f3e%40jmad.org.
# HG changeset patch
# User Aidan Epstein <[email protected]>
# Date 1727552322 25200
#      Sat Sep 28 12:38:42 2024 -0700
# Node ID 328bea338503b8ef716b22e94afce36499acdc2b
# Parent  ccd6199cc6a2110454f04a75b062957157aa0e6b
MUC: Fix error with nonlegacy hats.

diff -r ccd6199cc6a2 -r 328bea338503 plugins/muc/hats.lib.lua
--- a/plugins/muc/hats.lib.lua	Sat Sep 21 22:07:36 2024 +0200
+++ b/plugins/muc/hats.lib.lua	Sat Sep 28 12:38:42 2024 -0700
@@ -25,7 +25,7 @@
 			hats_el:tag("hat", { uri = hat_id, title = hat_data.title }):up();
 
 			if hats_compat then
-				if not hats_el then
+				if not legacy_hats_el then
 					legacy_hats_el = st.stanza("hats", { xmlns = xmlns_hats_legacy });
 				end
 				legacy_hats_el:tag("hat", { uri = hat_id, title = hat_data.title }):up();

Reply via email to