Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Identd\Server Class Reference

A server compatible with the Identification Protocol (RFC 1413). More...

+ Inheritance diagram for Erebot\Identd\Server:

Public Member Functions

 __construct (\Erebot\Interfaces\Core $bot, $connector= '0.0.0.0:113', $workerCls= '\\Erebot\\Identd\\Worker')
 
 __destruct ()
 Destructor.
 
 connect ()
 
 disconnect ($quitMessage=null)
 
 emptyReadQueue ()
 
 getBot ()
 
 getConfig ($chan)
 
 getIO ()
 
 getSocket ()
 
 isConnected ()
 
 process ()
 Processes commands queued in the input buffer.
 
 read ()
 

Protected Attributes

 $bot
 A bot object implementing the Erebot::Interfaces::Core interface.
 
 $socket
 The underlying socket, represented as a stream.
 
 $workerCls
 Class to use to process IdentD requests.
 

Detailed Description

A server compatible with the Identification Protocol (RFC 1413).

See also
http://www.ietf.org/rfc/rfc1413.txt

Definition at line 30 of file Server.php.

Constructor & Destructor Documentation

Erebot\Identd\Server::__construct ( \Erebot\Interfaces\Core  $bot,
  $connector = '0.0.0.0:113',
  $workerCls = '\\Erebot\\Identd\\Worker' 
)

Create a new instance of the IdentD server.

Parameters
Erebot::Interfaces::Core$botInstance of the bot to operate on.
string$connector(optional) A string of the form "address:port" describing the IP address and port the server should listen on. The default is to listen on port 113 (as per RFC 1413) on all available interfaces (ie. "0.0.0.0:113").
string$workerCls(optional) Instances of this class will be created to handle identification requests. The default is "Erebot::Identd::Worker".
See also
http://www.ietf.org/rfc/rfc1413.txt for information on the identification protocol.

Definition at line 63 of file Server.php.

References Erebot\Identd\Server\$bot, and Erebot\Identd\Server\$workerCls.

Member Function Documentation

Erebot\Identd\Server::connect ( )

Makes the actual connection to an IRC server, using the configuration data passed to the constructor.

Exceptions
Erebot::ConnectionFailureExceptionThrown whenever the bot fails to establish a connection to the given server.

Implements Erebot\Interfaces\Connection.

Definition at line 84 of file Server.php.

Erebot\Identd\Server::disconnect (   $quitMessage = null)

Disconnects the bot from that particular IRC server.

Parameters
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 89 of file Server.php.

Referenced by Erebot\Identd\Server\__destruct().

Erebot\Identd\Server::getBot ( )

Returns the bot instance this connection is associated with.

Return values
Erebot::Interfaces::CoreAn instance of the core class (Erebot).

Implements Erebot\Interfaces\Connection.

Definition at line 128 of file Server.php.

References Erebot\Identd\Server\$bot.

Erebot\Identd\Server::getConfig (   $chan)

Retrieves the configuration for a given channel.

Parameters
null | string$chanThe 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).
Return values
Erebot::Interfaces::Config::ChannelThe configuration for the given channel, if there is one.
Erebot::Interfaces::Config::ServerOtherwise, the configuration for the associated IRC server.
Exceptions
Erebot::NotFoundExceptionNo Erebot::Interfaces::Config::Channel object exists for the given channel.

Implements Erebot\Interfaces\Connection.

Definition at line 133 of file Server.php.

Erebot\Identd\Server::getIO ( )

Returns the object used to handle I/O (input/output) with this connection.

Note
Do not use this object directly unless you know what you're doing. Instead, use the methods from the appropriate interfaces: Erebot::Interfaces::SendingConnection for writing and Erebot::Interfaces::ReceivingConnection for reading.

Implements Erebot\Interfaces\Connection.

Definition at line 138 of file Server.php.

Erebot\Identd\Server::getSocket ( )

Returns the underlying transport implementation for this connection.

Return values
streamReturns this connection's socket, as a PHP stream.
Note
You generally don't need any sort of access to this stream, but it may be useful in cases where you need to do a select() on the connection.

Implements Erebot\Interfaces\Connection.

Definition at line 103 of file Server.php.

References Erebot\Identd\Server\$socket.

Erebot\Identd\Server::isConnected ( )

Returns whether this connection object is currently connected to a server.

Return values
booltrue if the connection is really connected, false otherwise.

Implements Erebot\Interfaces\Connection.

Definition at line 98 of file Server.php.

Erebot\Identd\Server::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 113 of file Server.php.

References Erebot\Identd\Server\$socket.


The documentation for this class was generated from the following file: