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.
$response = $this->connection->query('channel.get', ['channel' => $channel]);
if (!is_bool($response)) {
$response = $this->connection->query('channel.get', ['channel' => $channel]);
if (!is_bool($response)) {
+ return $response->channel;
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
if ($set_by)
$query['set_by'] = $set_by;
if ($set_by)
$query['set_by'] = $set_by;
- return $this->connection->query('name_ban.add', $query);
+ $response = $this->connection->query('name_ban.add', $query);
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
*/
public function delete(string $name): stdClass|array|bool
{
*/
public function delete(string $name): stdClass|array|bool
{
- return $this->connection->query('name_ban.del', [
+ $response = $this->connection->query('name_ban.del', [
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
]);
if (!is_bool($response)) {
]);
if (!is_bool($response)) {
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
*/
public function add(string $name, string $type, string $duration, string $reason): stdClass|array|bool
{
*/
public function add(string $name, string $type, string $duration, string $reason): stdClass|array|bool
{
- return $this->connection->query('server_ban.add', [
+ $response = $this->connection->query('server_ban.add', [
'name' => $name,
'type' => $type,
'reason' => $reason,
'duration_string' => $duration ?? '1d',
]);
'name' => $name,
'type' => $type,
'reason' => $reason,
'duration_string' => $duration ?? '1d',
]);
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
*/
public function delete(string $name, string $type): stdClass|array|bool
{
*/
public function delete(string $name, string $type): stdClass|array|bool
{
- return $this->connection->query('server_ban.del', [
+ $response = $this->connection->query('server_ban.del', [
'name' => $name,
'type' => $type,
]);
'name' => $name,
'type' => $type,
]);
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
]);
if (!is_bool($response)) {
]);
if (!is_bool($response)) {
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
*/
public function add(string $name, string $match_type, string $spamfilter_targets, string $ban_action, string $ban_duration, string $reason): stdClass|array|bool
{
*/
public function add(string $name, string $match_type, string $spamfilter_targets, string $ban_action, string $ban_duration, string $reason): stdClass|array|bool
{
- return $this->connection->query('spamfilter.add', [
+ $response = $this->connection->query('spamfilter.add', [
'name' => $name,
'match_type' => $match_type,
'spamfilter_targets' => $spamfilter_targets,
'name' => $name,
'match_type' => $match_type,
'spamfilter_targets' => $spamfilter_targets,
'ban_duration' => $ban_duration,
'reason' => $reason,
]);
'ban_duration' => $ban_duration,
'reason' => $reason,
]);
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
*/
public function delete(string $name, string $match_type, string $spamfilter_targets, string $ban_action): stdClass|array|bool
{
*/
public function delete(string $name, string $match_type, string $spamfilter_targets, string $ban_action): stdClass|array|bool
{
- return $this->connection->query('spamfilter.del', [
+ $response = $this->connection->query('spamfilter.del', [
'name' => $name,
'match_type' => $match_type,
'spamfilter_targets' => $spamfilter_targets,
'ban_action' => $ban_action,
]);
'name' => $name,
'match_type' => $match_type,
'spamfilter_targets' => $spamfilter_targets,
'ban_action' => $ban_action,
]);
+ if (property_exists($response, 'tkl'))
+ return $response->tkl;
+ return FALSE;
]);
if (!is_bool($response)) {
]);
if (!is_bool($response)) {
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
$response = $this->connection->query('user.get', ['nick' => $nick]);
if (!is_bool($response)) {
$response = $this->connection->query('user.get', ['nick' => $nick]);
if (!is_bool($response)) {
+ return $response->client;
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');