Valerie Pond [Tue, 10 Jan 2023 05:08:49 +0000 (05:08 +0000)]
Add nameban to Connection.php and various bugfixes
In many cases on a failed lookup such as if a nick didn't exist, this threw an exception which halted things. Also in some cases there weren't bool checks when there needed to be for such catches
Bram Matthys [Mon, 9 Jan 2023 12:02:15 +0000 (13:02 +0100)]
Make the *.get/*.add/*.delete calls return the channel/user/.. directly.
So:
$user = $rpc->user()->get("Syzop");
if ($user->client->name == "Syzop")
..
Becomes:
$user = $rpc->user()->get("Syzop");
if ($user->name == "Syzop")
..
And:
$spamfilter = $rpc->spamfilter()->add(...etc...)
Then not dump $spamfilter->tkl but simply $spamfilter.
Bram Matthys [Sat, 7 Jan 2023 18:42:05 +0000 (19:42 +0100)]
Add all the new RPC calls in 6.0.6-git at the moment:
== channel ==
public function set_mode(string $channel, string $modes, string $parameters): stdClass|array|bool
public function set_topic(string $channel, string $topic,
string $set_by=null, string $set_at=null): stdClass|array|bool
public function kick(string $channel, string $nick, string $reason): stdClass|array|bool
See also https://www.unrealircd.org/docs/JSON-RPC:Channel
== user ==
public function set_nick(string $nick, string $newnick): stdClass|array|bool
public function set_username(string $nick, string $username): stdClass|array|bool
public function set_realname(string $nick, string $realname): stdClass|array|bool
public function set_vhost(string $nick, string $vhost): stdClass|array|bool
public function set_mode(string $nick, string $mode, bool $hidden = false): stdClass|array|bool
public function set_snomask(string $nick, string $snomask, bool $hidden = false): stdClass|array|bool
public function set_oper(string $nick, string $oper_account, string $oper_class,
string $class = null, string $modes = null,
string $snomask = null, string $vhost = null): stdClass|array|bool
public function join(string $nick, string $channel,
string $key = null, bool $force = false): stdClass|array|bool
public function part(string $nick, string $channel, bool $force = false): stdClass|array|bool
public function quit(string $nick, string $reason): stdClass|array|bool
public function kill(string $nick, string $reason): stdClass|array|bool
See also https://www.unrealircd.org/docs/JSON-RPC:User
Bram Matthys [Fri, 6 Jan 2023 14:24:17 +0000 (15:24 +0100)]
Don't use arrays in parameters but use explicit options everwhere.
For example in ServerBan, from:
public function add(string $user, array $params): stdClass;
To:
public function add(string $name, string $type, string $duration, string $reason): stdClass;
As the whole point of having these PHP functions is that it is immediately
transparent which things you need to pass.
Bram Matthys [Fri, 6 Jan 2023 14:06:13 +0000 (15:06 +0100)]
Major API break:
* Change all the ->get() to ->getAll()
and all the ->show() to ->get()
.. eg for User, Channel, etc.
* You now only create an API connection once, as it was always
intended:
$rpc = new UnrealIRCd\Connection(..)
* You can then either use the non-connection classes like this:
$user = new User($rpc);
$result = $user->getAll();
Or simply use this style:
$result = $rpc->user()->getAll();
* More breakage to come