Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Interfaces\Connection Interface Reference

Interface for connections. More...

+ Inheritance diagram for Erebot\Interfaces\Connection:

Public Member Functions

 connect ()
 
 disconnect ($quitMessage=null)
 
 getBot ()
 
 getConfig ($chan)
 
 getIO ()
 
 getSocket ()
 
 isConnected ()
 

Detailed Description

Interface for connections.

Definition at line 27 of file Connection.php.

Member Function Documentation

Erebot\Interfaces\Connection::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.

Implemented in Erebot\IrcConnection, Erebot\Prompt, Erebot\Identd\Server, and Erebot\Identd\Worker.

Erebot\Interfaces\Connection::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.

Implemented in Erebot\IrcConnection, Erebot\Prompt, Erebot\Identd\Server, and Erebot\Identd\Worker.

Erebot\Interfaces\Connection::getBot ( )

Returns the bot instance this connection is associated with.

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

Implemented in Erebot\IrcConnection, Erebot\Prompt, Erebot\Identd\Worker, and Erebot\Identd\Server.

Erebot\Interfaces\Connection::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.

Implemented in Erebot\IrcConnection, Erebot\Prompt, Erebot\Identd\Worker, and Erebot\Identd\Server.

Erebot\Interfaces\Connection::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.

Implemented in Erebot\IrcConnection, Erebot\Identd\Worker, Erebot\Prompt, and Erebot\Identd\Server.

Erebot\Interfaces\Connection::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.

Implemented in Erebot\IrcConnection, Erebot\Prompt, Erebot\Identd\Worker, and Erebot\Identd\Server.

Erebot\Interfaces\Connection::isConnected ( )

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

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

Implemented in Erebot\IrcConnection, Erebot\Prompt, Erebot\Identd\Worker, and Erebot\Identd\Server.


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