]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blame - lib/Rpc.php
Add $conn->rpc->info() and $conn->rpc->set_issuer("NameOfLoggedInUser")
[irc/unrealircd/unrealircd-rpc-php.git] / lib / Rpc.php
CommitLineData
c6e7dd34
BM
1<?php
2
3namespace UnrealIRCd;
4
5use Exception;
6use stdClass;
7
8class Rpc
9{
10
11 public Connection $connection;
12
13 public function __construct(Connection $conn)
14 {
15 $this->connection = $conn;
16 }
17
18 /**
19 * Get information on all RPC modules loaded.
20 *
21 * @return stdClass|array|bool
22 */
23 public function info(string $nick, string $reason): stdClass|array|bool
24 {
25 return $this->connection->query('rpc.info');
26 }
27
28 /**
29 * Set the name of the issuer that will make all the following RPC request
30 * (eg. name of logged in user on a webpanel). Requires UnreaIRCd 6.0.8+.
31 * @return stdClass|array|bool
32 */
33 public function set_issuer(string $name): stdClass|array|bool
34 {
35 return $this->connection->query('rpc.set_issuer', [
36 'name' => $name,
37 ]);
38 }
39}