You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mod_roster_command.patch 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # HG changeset patch
  2. # User Boris Grozev <boris@jitsi.org>
  3. # Date 1609874100 21600
  4. # Tue Jan 05 13:15:00 2021 -0600
  5. # Node ID f646babfc401494ff33f2126ef6c4df541ebf846
  6. # Parent 456b9f608fcf9667cfba1bd7bf9eba2151af50d0
  7. mod_roster_command: Fix subscription when the "user JID" is a bare domain.
  8. Do not attempt to update the roster when the user is bare domain (e.g. a
  9. component), since they don't have rosters and the attempt results in an error:
  10. $ prosodyctl mod_roster_command subscribe proxy.example.com contact@example.com
  11. xxxxxxxxxxFailed to execute command: Error: /usr/lib/prosody/core/rostermanager.lua:104: attempt to concatenate local 'username' (a nil value)
  12. stack traceback:
  13. /usr/lib/prosody/core/rostermanager.lua:104: in function 'load_roster'
  14. /usr/lib/prosody/core/rostermanager.lua:305: in function 'set_contact_pending_out'
  15. mod_roster_command.lua:44: in function 'subscribe'
  16. diff -r 456b9f608fcf -r f646babfc401 mod_roster_command/mod_roster_command.lua
  17. --- a/mod_roster_command/mod_roster_command.lua Tue Jan 05 13:49:50 2021 +0000
  18. +++ b/mod_roster_command/mod_roster_command.lua Tue Jan 05 13:15:00 2021 -0600
  19. @@ -40,8 +40,10 @@
  20. storagemanager.initialize_host(user_host);
  21. usermanager.initialize_host(user_host);
  22. end
  23. - -- Update user's roster to say subscription request is pending...
  24. - rostermanager.set_contact_pending_out(user_username, user_host, contact_jid);
  25. + -- Update user's roster to say subscription request is pending. Bare hosts (e.g. components) don't have rosters.
  26. + if user_username ~= nil then
  27. + rostermanager.set_contact_pending_out(user_username, user_host, contact_jid);
  28. + end
  29. if hosts[contact_host] then
  30. if contact_host ~= user_host and hosts[contact_host].users.name == "null" then
  31. storagemanager.initialize_host(contact_host);
  32. @@ -51,8 +53,10 @@
  33. rostermanager.set_contact_pending_in(contact_username, contact_host, user_jid);
  34. -- Update contact's roster to say subscription request approved...
  35. rostermanager.subscribed(contact_username, contact_host, user_jid);
  36. - -- Update user's roster to say subscription request approved...
  37. - rostermanager.process_inbound_subscription_approval(user_username, user_host, contact_jid);
  38. + -- Update user's roster to say subscription request approved. Bare hosts (e.g. components) don't have rosters.
  39. + if user_username ~= nil then
  40. + rostermanager.process_inbound_subscription_approval(user_username, user_host, contact_jid);
  41. + end
  42. end
  43. end