]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blobdiff - lib/Server.php
Make query() throw an error when the request timed out (defined as >10sec).
[irc/unrealircd/unrealircd-rpc-php.git] / lib / Server.php
index 37a9058867fc8a01a5f5801b425ac59ad196f97e..b1460a61b6c5185e4f28a1190793cb0429a6a32a 100644 (file)
@@ -37,9 +37,9 @@ class Server
      * @return stdClass|array|bool
      * @throws Exception
      */
-    public function get(string $nick): stdClass|array|bool
+    public function get(string $server = null): stdClass|array|bool
     {
-        $response = $this->connection->query('server.get', ['server' => $nick]);
+        $response = $this->connection->query('server.get', ['server' => $server]);
 
         if (!is_bool($response)) {
             return $response->server;
@@ -80,11 +80,28 @@ class Server
      * @return stdClass|array|bool
      * @throws Exception
      */
-    public function disconnect(string $name): stdClass|array|bool
+    public function disconnect(string $name, string $reason = "No reason"): stdClass|array|bool
     {
         return $this->connection->query('server.disconnect', [
             'link' => $name,
+            'reason' => $reason
         ]);
     }
+    
+    
+    /**
+     * List modules on the server
+     *
+     * @return stdClass|array|bool
+     * @throws Exception
+     */
+    public function module_list($name = NULL): stdClass|array|bool
+    {
+        $arr = [];
+        if ($name)
+            $arr['server'] = $name;
+        
+        return $this->connection->query('server.module_list', $arr);
+    }
 
 }