"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7328/resources/prosody-plugins/mod_roster_command.patch" (8 Jun 2023, 2486 Bytes) of package /linux/misc/jitsi-meet-7328.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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