Home » Networking » Net_SmartIRC
Helps you communicate with IRC networks in whatever way you might need, whether in a CLI program or as part of a web page. Also well-suited for bot development.
This package is unmaintained.
Download latest release 1.1.14 (there might be newer Composer installable version)
License: LGPL
Description
SmartIRC is your go-to library for interfacing with IRC networks. All you need is PHP 5.3 or later.
Full feature list:
-------------------------------------
- Fully object-oriented programmed
- Your bot class can be inline in the same file you call SmartIRC from, or included as an external file
- Every received IRC message is parsed into an object you can easily get information from
(containing the following info: rawmessage, from, nick, ident, host, type, params, message, channel)
- Make your bots using Action Handlers and Time Handlers, which register custom callbacks when various events happen or on time intervals, respectively – or, extend the Net_SmartIRC class to add (or override) handlers directly using individual server message types
- Flood protection which uses a send buffer with a queue that has 3 priority levels (high, medium, low) plus a bypass level (critical)
- Nick collision detection and handling
- Auto-retry during initial connection attempt
- Auto-reconnect if connection is lost, which will re-join to the channels it was in before
- Debugging/logging system with log levels (destination can be file, stdout, syslog or browserout)
- Supports PHP as old as 5.3.0
- Channel syncing (tracking of users/modes/topic etc in objects)
- Customizable CTCP VERSION reply
Documentation
Maintainers
- Mirco Bauer (meebey) — lead, inactive
- Garrett Whitehorn (garrettw) — lead, active
- Amir Mohammad Saied (amir) — lead, inactive
- CHAILLAN Nicolas (nicos) — contributor, inactive
Dependencies
Required
- PHP (>= 5.3.0)
- PEAR Installer (>= 1.7.0)
Releases
- 1.1.14 (stable, 2019-07-25)
Release notes
License: LGPL
* Merge PR #10: (Composer fix) Added global keyword for $SMARTIRC_nreplycodes [diddledan]
- 1.1.13 (stable, 2018-05-09)
Release notes
License: LGPL
* Corrected return value of isConnected() to match docs [garrettw]
- 1.1.12 (stable, 2018-05-08)
Release notes
License: LGPL
* Fix composer autoload path [glen]
* Fix PHP notices [glen]
* Implement Feature #23746: added method to get connection status [garrettw]
* Updated HTML documentation [garrettw] - 1.1.11 (stable, 2017-06-15)
Release notes
License: LGPL
* Fix regression: Allow time handlers to be invoked correctly [timdream]
* Fixed old spelling mistakes in documentation [klemens] - 1.1.10 (stable, 2016-12-25)
Release notes
License: LGPL
* Fix Bug #21018: removed reference assignment in _adduser() [garrettw]
* Fix Bug #21109: corrected for error in official fwrite() docs [garrettw]
* Tweaked API for action/time handlers; you can pass callables now [garrettw]
* Updated HTML documentation [garrettw] - 1.1.9 (stable, 2015-11-25)
Release notes
License: LGPL
* Fix Bug #20971: forgot to remove deprecated method call [garrettw]
* Fix Bug #20972: added usermode parsing on reconnect [garrettw]
* Fix Bug #20973: added time handler calls to reconnect() [garrettw]
* Fix Bug #20974: improved reconnect() to avoid recursion/stack overflows [garrettw]
* Updated HTML documentation [garrettw] - 1.1.8 (stable, 2015-07-31)
Release notes
License: LGPL
* Fix Bug #20522: Bug in messagehandler.php on line 521 [garrettw]
* Fix Bug #20524: Bug in messagehandler.php on line 141 [garrettw] - 1.1.7 (stable, 2015-04-18)
Release notes
License: LGPL
* Added fluency (some methods now return $this) [garrettw]
* Unknown message codes can now be handled instead of failing [garrettw]
* Improved setRunAsDaemon() [garrettw]
* Fix strict warning on stream_select [markcarver]
* Updated HTML documentation [garrettw] - 1.1.6 (stable, 2015-01-17)
Release notes
License: LGPL
* Fix Bug #20475: NAMREPLY/WHOREPLY being parsed incorrectly [garrettw]
* Fix Bug #20485: odd case where stream_select() has data and fgets() doesn't [garrettw]
* Fix Bug #20486: "Illegal string offset" error in _removeuser() [garrettw]
* Fix Bug #20487: RPL_OMOTDSTART and RPL_OMOTD occurred twice in defines.php [garrettw]
* Fix untracked bug: channel's users not added to array of their channelmode [garrettw]
* loadModule() can now load classes that already exist; no longer forces use of external files [garrettw]
* listenFor() can now take an additional parameter: the regex to match on [garrettw]
* Improved code for action/time handlers [garrettw]
* Updated HTML documentation [garrettw] - 1.1.5 (stable, 2014-12-26)
Release notes
License: LGPL
* Fix Bug #20469: array syntax mismatch [garrettw]
- 1.1.4 (stable, 2014-11-02)
Release notes
License: LGPL
* Fix Bug #2309: Channel list message parsing error [garrettw]
* Implement Feature #7321: Please Add SSL support [garrettw]
* Implement Feature #20429: IPv6 socket support [garrettw]
* Eschewed socket_*() functions in favor of stream_*() functions, thereby deprecating setUseSockets() [garrettw]
* Fix untracked bug: unloadModule() still didn't work right [garrettw]
* unregisterActionId() and unregisterTimeId() now accept arrays of IDs [garrettw]
* Updated HTML documentation [garrettw] - 1.1.3 (stable, 2014-10-23)
Release notes
License: LGPL
* Fix Bug #20428: setBindAddress sets wrong variable [garrettw]
* Fix untracked bug: loadModule() and unloadModule() don't work right [garrettw]
* Added loadedModules() method which returns an array of the loaded module names, since $_modules isn't accessible publicly [garrettw]
* Updated HTML documentation [garrettw] - 1.1.2 (stable, 2014-10-03)
Release notes
License: LGPL
* Corrected package structure [garrettw]
- 1.1.1 (stable, 2014-10-03)
Release notes
License: LGPL
* Fix Bug #20419: Need a getter for the current bot nick [garrettw]
* Tweaked a few execution modifiers [garrettw]
* Removed limit on number of high-priority messages that can be sent before other priorities [garrettw]
* Tweaked logger output [garrettw]
* Updated HTML documentation [garrettw] - 1.1.0 (stable, 2014-09-04)
Release notes
License: LGPL
* Fix Bug #12539: Flaw in timeout detection. [garrettw]
* Fix Bug #13079: Does not support founder/admin/half-op modes [garrettw]
* Fix Bug #14924: delayed timer with real socket [garrettw]
* Fix Bug #16531: Nickname changes wrong [garrettw]
* Fix Bug #17729: patch: Removed define_syslog_variables and avoided warning for socket
blocking [garrettw]
* Fix Bug #17769: file included with relative path [doconnor]
* Fix Bug #18586: Register Action Handle only accepts one class [garrettw]
* Fix Bug #18774: not compatible in strict mode [doconnor]
* Implement Feature #16755: Not possible to join more than one chanel even if "$channelarray" is
correctly [garrettw]
* Implement Feature #18025: Bind IP for Net_SmartIRC_base::connect()? [garrettw]
* Implement Feature #18403: Bug fixes, code formatting, added features [garrettw]
* Silenced PHP warnings when socket_select() receives a signal [garrettw]
* Added ability to dynamically reload client if user code supports it [garrettw]
* Added ability to pass arguments from user code to modules [garrettw]
* Added ability to send custom raw commands immediately after login() info [garrettw] - 1.0.2 (stable, 2010-10-25)
Release notes
License: LGPL
Automatically built QA release
Req #16526 Colour and bold codes are not supported - giggsey - 1.0.1 (stable, 2009-07-18)
Release notes
License: LGPL
QA release
Updated to package 2.0Bug #1950 Constructor calls ignore_user_abort(true) - undocumented and not always desired amir
Bug #3064 Doesn't work with php 5.0.3 meebey
Request #4727 Req Regarding Examples amir
Bug #5220 connect() returns in some situations no false amir
Bug #6525 When joining empty channel channel array is wrong amir
Bug #9848 fix for "Only variable references..." warning amir
Bug #10118 quit command doesn't disconnect the socket amir
Request #10119 Req CTCP version reply should be fully configurable amir
Request #13056 Allow multiple actionhandlers to execute amir - 1.0.0 (stable, 2005-05-27)
- 0.5.5p1 (stable, 2003-07-23)
- 0.5.5 (stable, 2003-07-23)
Release notes
License: LGPL
v0.5.5:
-------
fixes:
- fixed a bug in _rawreceive()
messages were parsed wrong which caused problems with kick reasons.
(thx to sniper for reporting this).
- fixed bug in message()
CTCP ACTION messages had missing \001 at the end.
- fixed a bug in quit(), which caused quit messages not to be sent to the server.
- fixed reconnect() bug, it sent the channel join requests right after connect(),
and tried to join a channel without a name.
- fixes in ChannelSync code
When a user joins a channel after SmartIRC, no WHO info is updated in the user object.
Fixed wrong update of channel mode when rpl_channelmodeis received.
Fixed bug in _mode() method, which caused wrong handling of mode changes.
Topic updates are now tracked (thanks to sniper).
Fixed bug which caused fatal errors with ChannelSync enabled
(closes sf.net bug #705269).
Fixed bug in _event_mode(), unhandled modes were stored wrong.
Fixed bug in _event_rpl_namreply(), which caused that the first char of the first nick
of a namreply got cut (closes sf.net bug #747832).
- fixed bug in _checktimer()
Which caused problems when a timehandler is unregistered.
- fixed _gettye()
It wasn't recognizing SMARTIRC_TYPE_ACTION.
- removed if(!$obj) check for newly created objects (closes PHP bug #24622),
required for PHP 4.1.2 compatibility.changes:
- removed all irc commands from SmartIRC.php
they have now their own file (SmartIRC/irccommands.php).
- Net_SmartIRC_messagehandler class now extends Net_SmartIRC_irccommands.
- removed the 1. parameter (&$irc) of all message handlers, not needed anymore.
- renamed class Net_SmartIRC_user to Net_SmartIRC_channeluser,
added class Net_SmartIRC_ircuser.
- added prefix _event to all message handlers (needed because of class restructuring).
- tweaked filling of the ircdata objects.
- log() now checks the passed debug level bitwise.
- $data->message will be null instead of random garbage,
if the IRC message has no colon (the message part),
- All methods that depend on ChannelSync mode, checks if it's enabled.
- Optimized the usage of time() for $this->_lastrx.
- updated the URL of a SmartIRC based bot (atbs).
- _loggedin is now set to false when the socket is dead,
required for proper working reconnect().
- on a reconnect(), the logfile won't be overwritten anymore.
- updated phpdoc tags.
- all access to the channel array now uses strtolower() for the key.
- fixed typo in function name setChannelSynching(),
now it's called setChannelSyncing() with a BC wrapper.
- removed all SMARTIRC_ prefixes for debug output.
- changed isJoined($channel) to isJoined($channel, $nickname)
for checking if the specified user is joined.
- removed "destructors", because they don't free the memory.new:
- added isOpped() isVoiced() isBanned().
- added debug output and debug level for the messageparser.
- reconnect() uses now the channel key if one exists.
- added channel key syncing in _mode().
- when an actionhandler message regex has a leading '/' then the regex is used as it is,
this allows complex perl regex's.
- added message type SMARTIRC_TYPE_CTCP_REQUEST and SMARTIRC_CTCTP_REPLY for more advanced CTCP.
- added new log destinations SMARTIRC_NONE and SMARTIRC_BROWSEROUT
(for firendly browseroutput). When the script is called from a browser,
the BROWSEROUT will automatic be used (closed sf.net bug #708155).
- added error handling for socket_select() in _rawreceive().
- added getMessage() to Net_SmartIRC_Error class.
- added debug level for ChannelSync code (SMARTIRC_DEBUG_CHANNELSYNCING).
- added filename and linenumber to debug output.
- added key property to channel class.
- added to all IRC commands optional $priority parameter with default value SMARTIRC_MEDIUM.
- added isError() for more advanced errorhandling, needed for encapsulation.
- added _isValidType() method, which checks for valid SMARTIRC_TYPE_* types. - 0.5.1 (stable, 2003-01-17)
Release notes
License: LGPL
v0.5.1:
-------
fixes:
- major bugs in ChannelSynching fixed.
- fsocks support fixed.
- setUseSocket() method fixed.
If false was passed as parameter, it tried to load the socket extension.
Also warnings are now suppressed with @ in front of dl().
- fixed a typo in reconnect().
- missing SMARTIRC_DEBUG_CHANNELSYNCHING constant added.changes:
- new design for HTML documentation used (PEAR template).
- moved all examples to their own directory (examples/).
- moved the documentation to docs/HTML/.
- added new file descriptions to README.
- removed not needed parts of DOCUMENTATION (most is now in the HTML version).
- updated the HTML documentation.new:
- example5/6/7.php added.
- setAutoRetry() method added.
Autoretrying of connecting to the IRC server, is now supported. - 0.5.0 (beta, 2003-01-06)
Release notes
License: LGPL
v0.5.0
------
fixes:
- fixed critical bug in the main _rawreceive() for() loop, messages were lost.changes:
- License changed from GPL to LGPL.
- updated in all files the copyright year.
- changed documentation tags in front of all methods to the phpDocumentator compatible format.
- improved connect() errorhandling.
- changed login() parameters to $nick, $realname, $usermode = 0, $username = null, $password = null.
- changed join() parameters to $channelarray, $key = null.
- changed kick() parameters to $channel, $nicknamearray, $reason = null.
- changed listenFor() parameters to $messagetype
return value is now the result, instead the of a reference to the result parameter.
- sendbuffer has now 3 queues: high, medium and low
high sends 2 messages, then 1 of medium
low is only send if high _and_ medium is empty.
- select() call for sockets is strongly optimizednew:
- phpDocumentator package tags.
- include() for messagehandler.php (needed for the new API).
- setChannelSynching() method, for enabling the channel synching.
- setCtcpVersion() method, for changing the ctcp version reply string.
- setReceiveTimeout() method, for changing the receive timeout.
- setTransmitTimeout() method, for changing the transmit timeout.
- setAutoReconnect() method, for enabling the autoreconnect feature.
- channel variable, a reference to _channels because $object->channel("#chan")->topic is not possible in PHP4 (ZE1).
- reconnect() method, it will reconnect and also join all channels.
- channel() method, getting a reference to the channel, only if channelsynching is on.
- added ident, host, messageex and rawmessageex variables to the Net_SmartIRC_data class.
- class Net_SmartIRC_user, stores info about one user, only used if channelsynching is on.
- class Net_SmartIRC_channel, stores info about one channel, only used if channelsynching is on.
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #891 | Closed | Bug | 2004-02-26 | PEAR QA: improvement for get_class()-usage | |
| #1466 | Closed | Bug | 2004-05-21 | array_key_exists warning | |
| #1708 | Wont fix | Req | 2004-06-23 | Multiple server support | |
| #1743 | Closed | Bug | 2004-06-29 | declare+pcntl_signal semantics cause fatal error in Net_SmartIRC | |
| #1950 | Closed | Bug | 2004-07-22 | Constructor calls ignore_user_abort(true) - undocumented and not always desired | |
| #2042 | Closed | Bug | 2004-08-02 | examples use wrong path for include/require | |
| #2201 | Closed | Bug | 2004-08-23 | Bad $data infos if client is IPV6 | |
| #2309 | Closed | Bug | 2004-09-10 | Channel list message parsing error | |
| #2602 | Closed | Bug | 2004-10-23 | Notice about undefined variable _usersyncing | |
| #3064 | Closed | Bug | 2004-12-30 | Doesn't work with php 5.0.3 | |
| #4727 | Closed | Req | 2005-07-01 | Regarding Examples | |
| #5220 | Closed | Bug | 2005-08-27 | connect() returns in some situations no false | |
| #6525 | Closed | Bug | 2006-01-19 | When joining empty channel channel array is wrong | |
| #6650 | Bogus | Bug | 1.0.0 | 2006-01-31 | Channel synching problem |
| #7321 | Closed | Req | 1.0.0 | 2006-04-06 | Please Add SSL support |
| #7349 | Bogus | Bug | 1.0.0 | 2006-04-09 | whois |
| #9848 | Closed | Bug | 1.0.0 | 2007-01-16 | fix for "Only variable references..." warning |
| #9857 | Spam | Bug | 1.0.0 | 2007-01-17 | it not functions |
| #10118 | Closed | Bug | 1.0.0 | 2007-02-18 | quit command doesn't disconnect the socket |
| #10119 | Closed | Req | 1.0.0 | 2007-02-18 | CTCP version reply should be fully configurable |
| #12539 | Closed | Bug | 1.0.0 | 2007-11-28 | Flaw in timeout detection. |
| #13056 | Closed | Req | 1.0.0 | 2008-02-04 | Allow multiple actionhandlers to execute |
| #13078 | Duplicate | Bug | 1.0.0 | 2008-02-06 | Does not support founder/admin/half-op modes |
| #13079 | Closed | Bug | 1.0.0 | 2008-02-06 | Does not support founder/admin/half-op modes |
| #14924 | Closed | Bug | 1.0.0 | 2008-10-30 | delayed timer with real socket |
| #16526 | Bogus | Req | 1.0.1 | 2009-08-15 | Colour and bold codes are not supported |
| #16531 | Closed | Bug | 1.0.1 | 2009-08-17 | Nickname changes wrong |
| #16754 | Duplicate | Req | 1.0.1 | 2009-11-01 | Corrected "function join" with altered code when joining multiple channels |
| #16755 | Closed | Req | 1.0.1 | 2009-11-01 | Not possible to join more than one chanel even if "$channelarray" is correctly |
| #17729 | Closed | Bug | SVN | 2010-08-17 | patch: Removed define_syslog_variables and avoided warning for socket blocking |
| #17769 | Closed | Bug | 1.0.1 | 2010-08-20 | file included with relative path |
| #18025 | Closed | Req | 1.0.2 | 2010-11-03 | Bind IP for Net_SmartIRC_base::connect()? |
| #18403 | Closed | Req | 1.0.2 | 2011-03-28 | Bug fixes, code formatting, added features |
| #18586 | Closed | Bug | 1.0.2 | 2011-06-04 | Register Action Handle only accepts one class |
| #18774 | Closed | Bug | 1.0.2 | 2011-09-01 | not compatible in strict mode |
| #20419 | Closed | Bug | 1.1.0 | 2014-10-02 | Need a getter for the current bot nick |
| #20428 | Closed | Bug | 1.1.2 | 2014-10-17 | setBindAddress sets wrong variable |
| #20429 | Closed | Req | 1.1.2 | 2014-10-17 | IPv6 socket support |
| #20469 | Closed | Bug | 1.1.4 | 2014-12-18 | Uses php 5.4 syntax, but pear dependency is 5.3.0 |
| #20475 | Closed | Bug | 1.1.5 | 2014-12-29 | Channel not containing nicks |
| #20476 | Closed | Bug | 1.1.5 | 2014-12-29 | JOIN not correct |
| #20485 | Closed | Bug | 1.1.5 | 2015-01-14 | PHP Notice: Uninitialized string offset: -1 in Net/SmartIRC.php on line 1683 |
| #20486 | Closed | Bug | SVN | 2015-01-15 | Illegal string offset 'xxx in Net/SmartIRC.php on line 2634 |
| #20487 | Closed | Bug | SVN | 2015-01-15 | Constant SMARTIRC_RPL_OMOTDSTART already defined |
| #20522 | Closed | Bug | SVN | 2015-03-23 | Bug in messagehandler.php on line 521 |
| #20523 | No Feedback | Bug | 2015-03-23 | Bug in messagehandler.php on line 113 | |
| #20524 | Closed | Bug | SVN | 2015-03-23 | Bug in messagehandler on line 141 |
| #20925 | Bogus | Req | 1.1.7 | 2015-07-26 | SSL Support |
| #20971 | Closed | Bug | 1.1.8 | 2015-10-25 | interal use of _delayReconnect |
| #20972 | Closed | Bug | 1.1.8 | 2015-10-25 | reconnect & usermode |
| #20973 | Closed | Bug | 1.1.8 | 2015-10-26 | timehandlers not called when not connected |
| #20974 | Closed | Bug | 1.1.8 | 2015-10-26 | reconnect is not indefinite |
| #20986 | Closed | Bug | 1.1.9 | 2015-11-28 | fix php notice |
| #21018 | Closed | Bug | 1.1.9 | 2016-01-10 | ChannelSync and references |
| #21109 | Closed | Bug | 1.1.9 | 2016-09-05 | IRC bot not working with Slack |
| #21163 | No Feedback | Bug | 1.1.10 | 2017-01-15 | process burns cpu |
| #23746 | Closed | Req | 1.1.11 | 2018-05-01 | time handlers: need to know online state |