throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
+
+ /**
+ * Set and unset modes on a channel.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_mode(string $channel, string $modes, string $parameters): stdClass|array|bool
+ {
+ return $this->connection->query('channel.set_mode', [
+ 'channel' => $channel,
+ 'modes' => $modes,
+ 'parameters' => $parameters,
+ ]);
+ }
+
+ /**
+ * Set the channel topic.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_topic(string $channel, string $topic,
+ string $set_by=null, string $set_at=null): stdClass|array|bool
+ {
+ return $this->connection->query('channel.set_topic', [
+ 'channel' => $channel,
+ 'topic' => $topic,
+ 'set_by' => $set_by,
+ 'set_at' => $set_at,
+ ]);
+ }
+
+ /**
+ * Kick a user from the channel.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function kick(string $channel, string $nick, string $reason): stdClass|array|bool
+ {
+ return $this->connection->query('user.kick', [
+ 'nick' => $nick,
+ 'channel' => $channel,
+ 'reason' => $reason,
+ ]);
+ }
}
throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
+
+ /**
+ * Set the nickname of a user (changes the nick)
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_nick(string $nick, string $newnick): stdClass|array|bool
+ {
+ return $this->connection->query('user.set_nick', [
+ 'nick' => $nick,
+ 'newnick' => $newnick,
+ ]);
+ }
+
+ /**
+ * Set the username/ident of a user
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_username(string $nick, string $username): stdClass|array|bool
+ {
+ return $this->connection->query('user.set_username', [
+ 'nick' => $nick,
+ 'username' => $username,
+ ]);
+ }
+
+ /**
+ * Set the realname/gecos of a user
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_realname(string $nick, string $realname): stdClass|array|bool
+ {
+ return $this->connection->query('user.set_realname', [
+ 'nick' => $nick,
+ 'realname' => $realname,
+ ]);
+ }
+
+ /**
+ * Set a virtual host (vhost) on the user
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_vhost(string $nick, string $vhost): stdClass|array|bool
+ {
+ return $this->connection->query('user.set_vhost', [
+ 'nick' => $nick,
+ 'vhost' => $vhost,
+ ]);
+ }
+
+ /**
+ * Change the user modes of a user.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_mode(string $nick, string $mode, bool $hidden = false): stdClass|array|bool
+ {
+ return $this->connection->query('user.set_mode', [
+ 'nick' => $nick,
+ 'modes' => $mode,
+ 'hidden' => $hidden,
+ ]);
+ }
+
+ /**
+ * Change the snomask of a user (oper).
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function set_snomask(string $nick, string $snomask, bool $hidden = false): stdClass|array|bool
+ {
+ return $this->connection->query('user.set_snomask', [
+ 'nick' => $nick,
+ 'snomask' => $snomask,
+ 'hidden' => $hidden,
+ ]);
+ }
+
+ /**
+ * Make user an IRC Operator (oper).
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ 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
+ {
+ return $this->connection->query('user.set_oper', [
+ 'nick' => $nick,
+ 'oper_account' => $oper_account,
+ 'oper_class' => $oper_class,
+ 'class' => $class,
+ 'modes' => $modes,
+ 'snomask' => $snomask,
+ 'vhost' => $vhost,
+ ]);
+ }
+
+ /**
+ * Join a user to a channel.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function join(string $nick, string $channel,
+ string $key = null, bool $force = false): stdClass|array|bool
+ {
+ return $this->connection->query('user.join', [
+ 'nick' => $nick,
+ 'channel' => $channel,
+ 'key' => $key,
+ 'force' => $force,
+ ]);
+ }
+
+ /**
+ * Part a user from a channel.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function part(string $nick, string $channel, bool $force = false): stdClass|array|bool
+ {
+ return $this->connection->query('user.part', [
+ 'nick' => $nick,
+ 'channel' => $channel,
+ 'force' => $force,
+ ]);
+ }
+
+ /**
+ * Quit a user from IRC. Pretend it is a normal QUIT.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function quit(string $nick, string $reason): stdClass|array|bool
+ {
+ return $this->connection->query('user.quit', [
+ 'nick' => $nick,
+ 'reason' => $reason,
+ ]);
+ }
+
+ /**
+ * Kill a user from IRC. Show that the user is forcefully removed.
+ *
+ * @return stdClass|array|bool
+ * @throws Exception
+ */
+ public function kill(string $nick, string $reason): stdClass|array|bool
+ {
+ return $this->connection->query('user.kill', [
+ 'nick' => $nick,
+ 'reason' => $reason,
+ ]);
+ }
}