View Issue Details

IDProjectCategoryView StatusLast Update
0006327unrealjson-rpcpublic2023-09-09 09:20
Reporterarmyn Assigned Tosyzop  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Product Version6.1.1.1 
Summary0006327: $user->user->channels; does it no longer exist in unrealircd-rpc?
Description
   [0] => stdClass Object
        (
            [name] => Bonvivant_
            [id] => 001JL99U5
            [hostname] => 72.53.x.x
            [ip] => 72.53.x.x
            [details] => [email protected]
            [server_port] => 6697
            [client_port] => 40518
            [connected_since] => 2023-08-15T09:23:46.000Z
            [idle_since] => 2023-08-15T09:23:46.000Z
            [user] => stdClass Object
                (
                    [username] => o-cqb-cae3db7c8-1
                    [realname] => 50/H/ca
                    [vhost] => D4044E1C.F59D439D.7B739A37.IP
                    [cloakedhost] => D4044E1C.F59D439D.7B739A37.IP
                    [servername] => irc.xxx.com
                    [reputation] => 799
                    [security-groups] => Array
                        (
                            [0] => known-users
                            [1] => webirc-users
                            [2] => tls-and-known-users
                            [3] => tls-users
                        )

                    [modes] => ipwxzI
                )

            [tls] => stdClass Object
                (
                    [cipher] => TLSv1.2-ECDHE-RSA-AES256-GCM-SHA384
                )

            [geoip] => stdClass Object
                (
                    [country_code] => CA
                )

        )
--------

Command unrealircd-rpc :
$users = $rpc->user()->getAll();

foreach ($users as $user) {
        //echo "Name : " . $user->name . "
";
        $name = $user->name ?? '';
        $id = $user->id ?? '';
        $channels = $user->user->channels ?? '';
...
}

A few months ago, there was a $user->user->channels; does it no longer exist?
It doesn't return any data anymore because it no longer exists; it used to display all the channels where each user was present

TagsNo tags attached.
3rd party modules

Activities

syzop

2023-09-09 09:17

administrator   ~0023011

Last edited: 2023-09-09 09:18

In the UnrealIRCd 6.1.0 release notes it is described like this:
*The JSON-RPC calls channel.list, channel.get, user.list and user.get now support an optional argument object_detail_level which specifies how detailed the Channel and User response object will be. Especially useful if you don't need all the details in the list calls.

It is missing some information that is important. The commit did show more details, though. And it explains the "breaking change" for user.list, the thing you hit :), see below :

commit abb6fcfcb527f2f28b3e328a043ccc9cdd9f93c7
Author: Bram Matthys <[email protected]>
Date: Mon Mar 27 13:08:16 2023 +0200

    RPC: user.list and user.get now have optional object_detail_level.
    This is an integer which decides the amount of details in the response object.
    
    See https://www.unrealircd.org/docs/JSON-RPC:User#Structure_of_a_client_object
    
    Especially for user.list it can be a good idea to ask for less detail if
    you don't need all the information. It's up to you...
    
    When 'object_detail_level' is not specified in the request, then:
    * For user.list it defaults to 2, which is a "breaking change" in the sense
      that it leaves out the "channels" field. To see the "channels" field you
      would have to use level 4.
    * For user.get it defaults to 4, which results in the same output as 6.0.7.
    * This makes sense so user.list is shorter than user.get, just like we
      already did in channel.list and channel.get.
    
    By the way, this is all documented in the API calls at
    https://www.unrealircd.org/docs/JSON-RPC:User
    and for channels at https://www.unrealircd.org/docs/JSON-RPC:Channel

syzop

2023-09-09 09:20

administrator   ~0023012

So your:
$users = $rpc->user()->getAll();
Needs to be:
$users = $rpc->user()->getAll(4);

As the definition is now:
public function getAll(int $object_detail_level=2): stdClass|array|bool

That should resolve your problem. Sorry for the delay, vacation :)

Issue History

Date Modified Username Field Change
2023-08-15 11:44 armyn New Issue
2023-09-09 09:17 syzop Note Added: 0023011
2023-09-09 09:18 syzop Note Edited: 0023011
2023-09-09 09:20 syzop Note Added: 0023012
2023-09-09 09:20 syzop Assigned To => syzop
2023-09-09 09:20 syzop Status new => closed
2023-09-09 09:20 syzop Resolution open => no change required