]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/log
irc/unrealircd/unrealircd-rpc-php.git
17 months agoAdd Server class for interacting with servers
Valerie Pond [Wed, 11 Jan 2023 21:47:34 +0000 (21:47 +0000)] 
Add Server class for interacting with servers

17 months agoUpdate some apidoc and remove throw on user not found.
Bram Matthys [Wed, 11 Jan 2023 06:45:11 +0000 (07:45 +0100)] 
Update some apidoc and remove throw on user not found.
(yeah this whole thing needs an overhaul, later.. later..)

17 months agoActually fix some return errors mentioned in previous commit
Valerie Pond [Tue, 10 Jan 2023 05:14:00 +0000 (05:14 +0000)] 
Actually fix some return errors mentioned in previous commit

17 months agoAdd nameban to Connection.php and various bugfixes
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

17 months agoMake the *.get/*.add/*.delete calls return the channel/user/.. directly.
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.

Makes more sense, I think.

17 months agoCreate NameBan class for adding QLines
Valerie Pond [Mon, 9 Jan 2023 03:30:54 +0000 (03:30 +0000)] 
Create NameBan class for adding QLines

17 months agoAdd all the new RPC calls in 6.0.6-git at the moment:
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

17 months agoMake getAll() return the list of users without wrapping it under a 'list' item.
Bram Matthys [Fri, 6 Jan 2023 19:23:59 +0000 (20:23 +0100)] 
Make getAll() return the list of users without wrapping it under a 'list' item.

So:

     $bans = $rpc->serverban()->getAll();
-    foreach ($bans->list as $ban)
+    foreach ($bans as $ban)
         echo "There's a $ban->type on $ban->name\n";

     $users = $rpc->user()->getAll();
-    foreach ($users->list as $user)
+    foreach ($users as $user)
         echo "User $user->name\n";

     $channels = $rpc->channel()->getAll();
-    foreach ($channels->list as $channel)
+    foreach ($channels as $channel)
         echo "Channel $channel->name ($channel->num_users user[s])\n";

17 months agoAll functions now return FALSE on failure, and then errno and error can
Bram Matthys [Fri, 6 Jan 2023 19:18:46 +0000 (20:18 +0100)] 
All functions now return FALSE on failure, and then errno and error can
be checked, like:

if ($rpc->serverban()->add($user, $bantype, $duration, $reason))
    echo "SUCCESS\n";
else
    echo "FAILURE: $rpc->error ($rpc->errno)\n";

17 months agoAdd Spamfilter support
Bram Matthys [Fri, 6 Jan 2023 18:47:33 +0000 (19:47 +0100)] 
Add Spamfilter support

17 months agoAdd a small warning too :D
Bram Matthys [Fri, 6 Jan 2023 17:27:44 +0000 (18:27 +0100)] 
Add a small warning too :D

17 months agoUpdate README.
Bram Matthys [Fri, 6 Jan 2023 17:24:05 +0000 (18:24 +0100)] 
Update README.

17 months agoActually require PHP8 again, since our dependencies do too.
Bram Matthys [Fri, 6 Jan 2023 15:58:02 +0000 (16:58 +0100)] 
Actually require PHP8 again, since our dependencies do too.

17 months agoDrop PHP8 requirement (testing testing :D)
Bram Matthys [Fri, 6 Jan 2023 14:48:36 +0000 (15:48 +0100)] 
Drop PHP8 requirement (testing testing :D)

17 months agoSame as previous, explicit args, but for ServerBan and Channel
Bram Matthys [Fri, 6 Jan 2023 14:31:26 +0000 (15:31 +0100)] 
Same as previous, explicit args, but for ServerBan and Channel

17 months agoGet rid of PHP Contracts
Bram Matthys [Fri, 6 Jan 2023 14:28:50 +0000 (15:28 +0100)] 
Get rid of PHP Contracts

17 months agoDon't use arrays in parameters but use explicit options everwhere.
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.

17 months agoBan -> ServerBan part II
Bram Matthys [Fri, 6 Jan 2023 14:10:38 +0000 (15:10 +0100)] 
Ban -> ServerBan part II

17 months agoBan -> ServerBan
Bram Matthys [Fri, 6 Jan 2023 14:09:46 +0000 (15:09 +0100)] 
Ban -> ServerBan

17 months agoMajor API break:
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

21 months agoReplace a stray "response" prop with "result"
Denver F [Mon, 5 Sep 2022 15:52:23 +0000 (16:52 +0100)] 
Replace a stray "response" prop with "result"

22 months agoMerge pull request #6 from unrealircd/wip
Denver F [Sun, 21 Aug 2022 19:07:28 +0000 (20:07 +0100)] 
Merge pull request #6 from unrealircd/wip

Accidentally checked for "reply" prop instead of "result"

22 months agoAccidentally checked for "reply" prop instead of "result" 6/head
Denver F [Sun, 21 Aug 2022 19:07:13 +0000 (20:07 +0100)] 
Accidentally checked for "reply" prop instead of "result"

22 months agoMerge pull request #5 from unrealircd/wip
Denver F [Wed, 17 Aug 2022 15:36:47 +0000 (16:36 +0100)] 
Merge pull request #5 from unrealircd/wip

Wip

22 months agoAdded version to composer.json and a couple of small (hopefully non-breaking) changes 5/head
Denver F [Wed, 17 Aug 2022 15:35:25 +0000 (16:35 +0100)] 
Added version to composer.json and a couple of small (hopefully non-breaking) changes

22 months agoUpdate Connection::query to listen for a "reply" response rather than "response"...
Denver F [Wed, 17 Aug 2022 15:29:13 +0000 (16:29 +0100)] 
Update Connection::query to listen for a "reply" response rather than "response" from the rpc server.

23 months agoThis brings this branch up-to-date with the changes I made to the package in the...
Denver F [Sun, 10 Jul 2022 06:20:36 +0000 (07:20 +0100)] 
This brings this branch up-to-date with the changes I made to the package in the webpanel project.

23 months agoUse the correct parameter for gline expiry timestamp
Denver F [Sun, 10 Jul 2022 01:08:00 +0000 (02:08 +0100)] 
Use the correct parameter for gline expiry timestamp

23 months agoReturn errors from the ircd
Denver F [Sun, 10 Jul 2022 01:02:58 +0000 (02:02 +0100)] 
Return errors from the ircd

23 months agoMerge pull request #4 from unrealircd/wip
Denver F [Mon, 4 Jul 2022 18:34:01 +0000 (19:34 +0100)] 
Merge pull request #4 from unrealircd/wip

Wip

23 months agoThis should be everything working now. 4/head
Denver F [Mon, 4 Jul 2022 18:33:30 +0000 (19:33 +0100)] 
This should be everything working now.

23 months agoReturn types :<
Denver F [Mon, 4 Jul 2022 18:28:19 +0000 (19:28 +0100)] 
Return types :<

23 months agoReturn types again
Denver F [Mon, 4 Jul 2022 18:23:30 +0000 (19:23 +0100)] 
Return types again

23 months agoUpdate PHP version requirement
Denver F [Mon, 4 Jul 2022 18:22:09 +0000 (19:22 +0100)] 
Update PHP version requirement

23 months agoMore fixes on return types
Denver F [Mon, 4 Jul 2022 18:21:10 +0000 (19:21 +0100)] 
More fixes on return types

23 months agoMerge pull request #3 from unrealircd/wip
Denver F [Mon, 4 Jul 2022 18:18:27 +0000 (19:18 +0100)] 
Merge pull request #3 from unrealircd/wip

Fix querying the response object for ID when its not part of that obj…

23 months agoFix querying the response object for ID when its not part of that object. 3/head
Denver F [Mon, 4 Jul 2022 18:16:54 +0000 (19:16 +0100)] 
Fix querying the response object for ID when its not part of that object.
Remove useless code in Channel

23 months agoMerge pull request #2 from unrealircd/wip
Denver F [Mon, 4 Jul 2022 18:15:33 +0000 (19:15 +0100)] 
Merge pull request #2 from unrealircd/wip

Wip

23 months agoRemove $id from UnrealIRCd\Channel 2/head
Denver F [Mon, 4 Jul 2022 18:14:47 +0000 (19:14 +0100)] 
Remove $id from UnrealIRCd\Channel

23 months agoChange return types to \stdClass.
Denver F [Mon, 4 Jul 2022 18:14:08 +0000 (19:14 +0100)] 
Change return types to \stdClass.

23 months agoAllow any php8 version
Denver F [Mon, 4 Jul 2022 17:54:29 +0000 (18:54 +0100)] 
Allow any php8 version

23 months agoMerge pull request #1 from unrealircd/wip
Denver F [Mon, 4 Jul 2022 17:52:38 +0000 (18:52 +0100)] 
Merge pull request #1 from unrealircd/wip

Wip

23 months agoThis should be enough for some preliminary usage. 1/head
Denver F [Mon, 4 Jul 2022 17:42:56 +0000 (18:42 +0100)] 
This should be enough for some preliminary usage.

23 months agoWIP
Denver F [Sat, 2 Jul 2022 16:05:55 +0000 (17:05 +0100)] 
WIP

2 years agoUpdate installation example, use :dev-main for now.
Bram Matthys [Sun, 26 Jun 2022 15:29:58 +0000 (17:29 +0200)] 
Update installation example, use :dev-main for now.

2 years agoUpdate README
Bram Matthys [Sun, 26 Jun 2022 15:17:15 +0000 (17:17 +0200)] 
Update README

2 years agoImport of initial proof-of-concept
Bram Matthys [Sun, 26 Jun 2022 14:58:46 +0000 (16:58 +0200)] 
Import of initial proof-of-concept

2 years agoInitial commit
Bram Matthys [Sun, 26 Jun 2022 14:54:53 +0000 (14:54 +0000)] 
Initial commit