Software /
code /
prosody-modules
Comparison
mod_roster_command/mod_roster_command.lua @ 4326:f6fdefc5c6ac
mod_roster_command: Fix subscription when the "user JID" is a bare domain.
Do not attempt to update the roster when the user is bare domain (e.g. a
component), since they don't have rosters and the attempt results in an error:
$ prosodyctl mod_roster_command subscribe proxy.example.com contact@example.com
xxxxxxxxxxFailed to execute command: Error: /usr/lib/prosody/core/rostermanager.lua:104: attempt to concatenate local 'username' (a nil value)
stack traceback:
/usr/lib/prosody/core/rostermanager.lua:104: in function 'load_roster'
/usr/lib/prosody/core/rostermanager.lua:305: in function 'set_contact_pending_out'
mod_roster_command.lua:44: in function 'subscribe'
author | Boris Grozev <boris@jitsi.org> |
---|---|
date | Tue, 05 Jan 2021 13:15:00 -0600 |
parent | 1948:2748aa8f36e0 |
comparison
equal
deleted
inserted
replaced
4325:9b95241c6ae5 | 4326:f6fdefc5c6ac |
---|---|
38 end | 38 end |
39 if hosts[user_host].users.name == "null" then | 39 if hosts[user_host].users.name == "null" then |
40 storagemanager.initialize_host(user_host); | 40 storagemanager.initialize_host(user_host); |
41 usermanager.initialize_host(user_host); | 41 usermanager.initialize_host(user_host); |
42 end | 42 end |
43 -- Update user's roster to say subscription request is pending... | 43 -- Update user's roster to say subscription request is pending. Bare hosts (e.g. components) don't have rosters. |
44 rostermanager.set_contact_pending_out(user_username, user_host, contact_jid); | 44 if user_username ~= nil then |
45 rostermanager.set_contact_pending_out(user_username, user_host, contact_jid); | |
46 end | |
45 if hosts[contact_host] then | 47 if hosts[contact_host] then |
46 if contact_host ~= user_host and hosts[contact_host].users.name == "null" then | 48 if contact_host ~= user_host and hosts[contact_host].users.name == "null" then |
47 storagemanager.initialize_host(contact_host); | 49 storagemanager.initialize_host(contact_host); |
48 usermanager.initialize_host(contact_host); | 50 usermanager.initialize_host(contact_host); |
49 end | 51 end |
50 -- Update contact's roster to say subscription request is pending... | 52 -- Update contact's roster to say subscription request is pending... |
51 rostermanager.set_contact_pending_in(contact_username, contact_host, user_jid); | 53 rostermanager.set_contact_pending_in(contact_username, contact_host, user_jid); |
52 -- Update contact's roster to say subscription request approved... | 54 -- Update contact's roster to say subscription request approved... |
53 rostermanager.subscribed(contact_username, contact_host, user_jid); | 55 rostermanager.subscribed(contact_username, contact_host, user_jid); |
54 -- Update user's roster to say subscription request approved... | 56 -- Update user's roster to say subscription request approved. Bare hosts (e.g. components) don't have rosters. |
55 rostermanager.process_inbound_subscription_approval(user_username, user_host, contact_jid); | 57 if user_username ~= nil then |
58 rostermanager.process_inbound_subscription_approval(user_username, user_host, contact_jid); | |
59 end | |
56 end | 60 end |
57 end | 61 end |
58 | 62 |
59 -- Make a mutual subscription between jid1 and jid2. Each JID will see | 63 -- Make a mutual subscription between jid1 and jid2. Each JID will see |
60 -- when the other one is online. | 64 -- when the other one is online. |