A class that can parse IRC messages and produce events to match the commands in those messages.
More...
|
const | STRIP_ALL = 0xFF |
| Strip all forms of styles from the text.
|
|
const | STRIP_BOLD = 0x02 |
| Strip the bold attribute from the text.
|
|
const | STRIP_COLORS = 0x01 |
| Strip (mIRC/pIRCh) colors from the text.
|
|
const | STRIP_NONE = 0x00 |
| Do not strip anything from the text.
|
|
const | STRIP_RESET = 0x10 |
| Strip the reset control character from the text.
|
|
const | STRIP_REVERSE = 0x08 |
| Strip the reverse attribute from the text.
|
|
const | STRIP_UNDERLINE = 0x04 |
| Strip the underline attribute from the text.
|
|
|
| handle255 ($origin, $msg) |
|
| handle600 ($origin, $msg) |
|
| handle601 ($origin, $msg) |
|
| handle604 ($origin, $msg) |
|
| handle605 ($origin, $msg) |
|
| handleINVITE ($origin, $msg) |
|
| handleJOIN ($origin, $msg) |
|
| handleKICK ($origin, $msg) |
|
| handleMODE ($origin, $msg) |
|
| handleNICK ($origin, $msg) |
|
| handleNOTICE ($origin, $msg) |
|
| handlePART ($origin, $msg) |
|
| handlePING ($origin, $msg) |
|
| handlePONG ($origin, $msg) |
|
| handlePRIVMSG ($origin, $msg) |
|
| handleQUIT ($origin, $msg) |
|
| handleTOPIC ($origin, $msg) |
|
| noticeOrPrivmsg ($origin, $msg, $mapping) |
|
| watchList ($event, $msg) |
|
|
| $connection |
| IRC connection that will send us some messages to parse.
|
|
| $eventsMapping |
| Mappings from (lowercase) interface names to actual classes.
|
|
A class that can parse IRC messages and produce events to match the commands in those messages.
Definition at line 29 of file IrcParser.php.
Erebot\IrcParser::__construct |
( |
\Erebot\Interfaces\Connection |
$connection | ) |
|
Constructor.
- Parameters
-
Erebot::Interfaces::Connection | $connection | The connection associated with this parser. Every event created by this parser will reference this connection. |
- Warning
- Do not ask this parser to parse messages coming from a different connection that the one it was constructed with or the results will be unpredictable.
Definition at line 68 of file IrcParser.php.
static Erebot\IrcParser::ctcpUnquote |
( |
|
$msg | ) |
|
|
staticprotected |
Erebot\IrcParser::getEventClass |
( |
|
$iface | ) |
|
- Note
- As a special shortcut, you may use an exclamation point ("!") in the interface name, which will be replaced by the text "\\Erebot\\Interfaces\\Event\\". Hence, to retrieve the class used to create events with the "Erebot::Interfaces::Event::Op" interface, it is enough to simply pass "!Op" as the value for $iface.
Definition at line 196 of file IrcParser.php.
Erebot\IrcParser::getEventClasses |
( |
| ) |
|
- Note
- The interfaces' name will be returned in lowercase, while the classes' name is returned using the same spelling as when it was set.
Definition at line 215 of file IrcParser.php.
Erebot\IrcParser::handle255 |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message with numeric 255.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
- Todo:
- Use a NumericEventHandler instead, even though it is less effective.
Definition at line 726 of file IrcParser.php.
Erebot\IrcParser::handle600 |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message with numeric 600.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
- Todo:
- Use a NumericEventHandler instead, even though it is less effective.
Definition at line 752 of file IrcParser.php.
Erebot\IrcParser::handle601 |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message with numeric 601.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
- Todo:
- Use a NumericEventHandler instead, even though it is less effective.
Definition at line 772 of file IrcParser.php.
Erebot\IrcParser::handle604 |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message with numeric 604.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
- Todo:
- Use a NumericEventHandler instead, even though it is less effective.
Definition at line 792 of file IrcParser.php.
Erebot\IrcParser::handle605 |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message with numeric 605.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
- Todo:
- Use a NumericEventHandler instead, even though it is less effective.
Definition at line 812 of file IrcParser.php.
Erebot\IrcParser::handleINVITE |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type INVITE.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 415 of file IrcParser.php.
Erebot\IrcParser::handleJOIN |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type JOIN.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 434 of file IrcParser.php.
Erebot\IrcParser::handleKICK |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type KICK.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 453 of file IrcParser.php.
Erebot\IrcParser::handleMODE |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a (user or channel-related) message of type MODE.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 473 of file IrcParser.php.
Erebot\IrcParser::handleNICK |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type NICK.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 558 of file IrcParser.php.
Erebot\IrcParser::handleNOTICE |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a (user or channel-related) message of type NOTICE.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 578 of file IrcParser.php.
Erebot\IrcParser::handlePART |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type PART.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 600 of file IrcParser.php.
Erebot\IrcParser::handlePING |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type PING.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 624 of file IrcParser.php.
Erebot\IrcParser::handlePONG |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type PONG.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 643 of file IrcParser.php.
Erebot\IrcParser::handlePRIVMSG |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a (user or channel-related) message of type PRIVMSG.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 663 of file IrcParser.php.
Erebot\IrcParser::handleQUIT |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type QUIT.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 685 of file IrcParser.php.
Erebot\IrcParser::handleTOPIC |
( |
|
$origin, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message of type TOPIC.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 704 of file IrcParser.php.
Erebot\IrcParser::makeEvent |
( |
|
$iface | ) |
|
Erebot\IrcParser::noticeOrPrivmsg |
( |
|
$origin, |
|
|
|
$msg, |
|
|
|
$mapping |
|
) |
| |
|
protected |
Process a NOTICE or PRIVMSG message.
- Parameters
-
string | $origin | Origin of the message to process. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
array | $mapping | A mapping of types to a list of event names. Each list should contain two items. The first one if the name of the event to use when the message is targeted at an IRC user. The second one is used for messages targeted at IRC channels. The following (case-sensitive) types must appear in the mapping: 'ctcp' (for CTCP messages), 'action' (for the special ACTION CTCP message) and 'normal' for regular messages. |
Definition at line 347 of file IrcParser.php.
Erebot\IrcParser::parseLine |
( |
|
$msg | ) |
|
- Warning
- Do not ask this parser to parse messages coming from a different connection that the one it was constructed with or the results will be unpredictable.
Definition at line 276 of file IrcParser.php.
Erebot\IrcParser::setEventClass |
( |
|
$iface, |
|
|
|
$cls |
|
) |
| |
- Note
- As a special shortcut, you may use an exclamation point ("!") in the interface name, which will be replaced by the text "\\Erebot\\Interfaces\\Event\\". Hence, to change the class used to create events with the "Erebot::Interfaces::Event::Op" interface, it is enough to simply pass "!Op" as the value for $iface. The $cls is always left unaffected.
Definition at line 247 of file IrcParser.php.
Erebot\IrcParser::setEventClasses |
( |
|
$events | ) |
|
- Note
- As a special shortcut, you may use an exclamation point ("!") in any interface name, which will be replaced by the text "\\Erebot\\Interfaces\\Event\\".
Definition at line 228 of file IrcParser.php.
static Erebot\IrcParser::stripCodes |
( |
|
$text, |
|
|
|
$strip = self::STRIP_ALL |
|
) |
| |
|
static |
Strips IRC styles from a text.
- Parameters
-
string | $text | The text from which styles must be stripped. |
int | $strip | A bitwise OR of the codes of the styles we want to strip. The default is to strip all forms of styles from the text. See also the Erebot::IrcParser::STRIP_* constants. |
- Return values
-
string | The text with all the styles specified in $strip stripped. |
Definition at line 88 of file IrcParser.php.
Erebot\IrcParser::watchList |
( |
|
$event, |
|
|
|
$msg |
|
) |
| |
|
protected |
Processes a message related to the WATCH list.
- Parameters
-
string | $event | Interface name for the event to produce. |
Erebot::Interfaces::IrcTextWrapper | $msg | The message to process, wrapped in a special object that makes it easier to analyze each token separately. |
Definition at line 829 of file IrcParser.php.
The documentation for this class was generated from the following file: