|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
A worker process for the Identification Protocol (RFC 1413). More...
Inheritance diagram for Erebot\Identd\Worker:Public Member Functions | |
| __construct (\Erebot\Interfaces\Core $bot, $socket) | |
| __destruct () | |
| Destructor. | |
| connect () | |
| disconnect ($quitMessage=null) | |
| getBot () | |
| getConfig ($chan) | |
| getIO () | |
| getSocket () | |
| isConnected () | |
| process () | |
| Processes commands queued in the input buffer. | |
| read () | |
| write () | |
Protected Member Functions | |
| handleMessage ($line) | |
Protected Attributes | |
| $bot | |
| A bot object implementing the Erebot::Interfaces::Core interface. | |
| $io | |
| I/O manager for the socket. | |
| $socket | |
| The underlying socket, represented as a stream. | |
A worker process for the Identification Protocol (RFC 1413).
Definition at line 30 of file Worker.php.
| Erebot\Identd\Worker::__construct | ( | \Erebot\Interfaces\Core | $bot, |
| $socket | |||
| ) |
Creates a worker object capable of handling a single identification request. As soon as the request has been handled and a response has been sent, this worker will destroy itself.
| Erebot::Interfaces::Core | $bot | Instance of the bot to operate on. |
| resource | $socket | A socket connected to a client requesting an identification from our IdentD server. |
Definition at line 57 of file Worker.php.
References Erebot\Identd\Worker\$bot, Erebot\Identd\Worker\$socket, and Erebot\LineIO\EOL_WIN.
| Erebot\Identd\Worker::connect | ( | ) |
Makes the actual connection to an IRC server, using the configuration data passed to the constructor.
| Erebot::ConnectionFailureException | Thrown whenever the bot fails to establish a connection to the given server. |
Implements Erebot\Interfaces\Connection.
Definition at line 75 of file Worker.php.
| Erebot\Identd\Worker::disconnect | ( | $quitMessage = null | ) |
Disconnects the bot from that particular IRC server.
| string | $quitMessage | (optional) A message which will be visible by other users when the bot gets disconnected. If no message is given, the IrcConnector module is probed for its "quit_message" parameter. If no message is available, the bot quits with an empty string as its quit message. |
Implements Erebot\Interfaces\Connection.
Definition at line 79 of file Worker.php.
Referenced by Erebot\Identd\Worker\process().
| Erebot\Identd\Worker::getBot | ( | ) |
Returns the bot instance this connection is associated with.
| Erebot::Interfaces::Core | An instance of the core class (Erebot). |
Implements Erebot\Interfaces\Connection.
Definition at line 193 of file Worker.php.
References Erebot\Identd\Worker\$bot.
| Erebot\Identd\Worker::getConfig | ( | $chan | ) |
Retrieves the configuration for a given channel.
| null | string | $chan | The name of the IRC channel for which a configuration must be retrieved. If $chan is null, the configuration associated with this object is returned instead (an instance of the Erebot::Interfaces::Config::Server). |
| Erebot::Interfaces::Config::Channel | The configuration for the given channel, if there is one. |
| Erebot::Interfaces::Config::Server | Otherwise, the configuration for the associated IRC server. |
| Erebot::NotFoundException | No Erebot::Interfaces::Config::Channel object exists for the given channel. |
Implements Erebot\Interfaces\Connection.
Definition at line 198 of file Worker.php.
| Erebot\Identd\Worker::getIO | ( | ) |
Returns the object used to handle I/O (input/output) with this connection.
Implements Erebot\Interfaces\Connection.
Definition at line 203 of file Worker.php.
References Erebot\Identd\Worker\$io.
| Erebot\Identd\Worker::getSocket | ( | ) |
Returns the underlying transport implementation for this connection.
| stream | Returns this connection's socket, as a PHP stream. |
Implements Erebot\Interfaces\Connection.
Definition at line 184 of file Worker.php.
References Erebot\Identd\Worker\$socket.
|
protected |
Handles an IdentD request.
| string | $line | IdentD request to handle. |
| string | Message to send as the response to this request. |
| false | The request was malformed. |
Definition at line 123 of file Worker.php.
References Erebot\Identd\Worker\$socket.
Referenced by Erebot\Identd\Worker\process().
| Erebot\Identd\Worker::isConnected | ( | ) |
Returns whether this connection object is currently connected to a server.
| bool | true if the connection is really connected, false otherwise. |
Implements Erebot\Interfaces\Connection.
Definition at line 179 of file Worker.php.
| Erebot\Identd\Worker::read | ( | ) |
Processes data from the incoming buffer.
Once this method has been called, all lines awaiting processing in the incoming buffer have been transferred to the incoming FIFO. You must call Erebot::Connection::processQueuedData() after that in order to process the lines in the FIFO. This is done so that a throttling policy may be put in place if needed (eg. for an anti-flood system).
Implements Erebot\Interfaces\ReceivingConnection.
Definition at line 88 of file Worker.php.
| Erebot\Identd\Worker::write | ( | ) |
Sends a single line of data from the outgoing FIFO to the underlying socket.
This method is misnamed, because it acts on a FIFO rather than on raw data. This method can be called multiple times (such as in a loop) to send all lines in the outgoing FIFO. This is done so that a throttling policy may be put in place if needed (eg. for an anti-flood system).
Implements Erebot\Interfaces\SendingConnection.
Definition at line 189 of file Worker.php.