]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/commitdiff
Channel: add optional $object_detail_level argument to getAll() and get().
authorBram Matthys <redacted>
Mon, 27 Mar 2023 08:31:04 +0000 (10:31 +0200)
committerBram Matthys <redacted>
Mon, 27 Mar 2023 08:33:10 +0000 (10:33 +0200)
This decides the amount of detail that is returned, see under
"Structure of a channel" at https://www.unrealircd.org/docs/JSON-RPC:Channel

Only works in UnrealIRCd 6.0.8 or later, simply ignored in earlier versions.

lib/Channel.php

index 4e9db459b661f1877cadf8d1074f872b1a7ecc23..7a6a68e81b0d83d77b5ddeb8dc59d0c8d6c1397d 100644 (file)
@@ -21,9 +21,11 @@ class Channel
      * @return stdClass|array|bool
      * @throws Exception
      */
-    public function getAll(): stdClass|array|bool
+    public function getAll(int $object_detail_level=1): stdClass|array|bool
     {
-        $response = $this->connection->query('channel.list');
+        $response = $this->connection->query('channel.list', [
+            'object_detail_level' => $object_detail_level,
+        ]);
 
         if(!is_bool($response)) {
             return $response->list;
@@ -37,9 +39,12 @@ class Channel
      *
      * @return stdClass|array|bool
      */
-    public function get(string $channel): stdClass|array|bool
+    public function get(string $channel, int $object_detail_level=3): stdClass|array|bool
     {
-        $response = $this->connection->query('channel.get', ['channel' => $channel]);
+        $response = $this->connection->query('channel.get', [
+            'channel' => $channel,
+            'object_detail_level' => $object_detail_level,
+        ]);
 
         if (!is_bool($response)) {
             return $response->channel;