De Kus wrote:That will be time when web providers will start banning it
. Seriously. Web providers don't intent to offer IRC bots in their web hosting service and these would seriously eat up resources (not to mention execution time and memory limits might addionally make problems).
Hotnsour requires two things: the PHP CLI engine, and the
sockets extension. The attraction of Hotnsour is not meant to be an out-of-the-box, trick-your-webhost-provider solution where you open run.php and start running a botnet
. The advantage, however, is in the accessibility to the scripter.
De Kus wrote:Addionally the eggdrop core in C will always be faster than your PHP code, if you dislike TCL so much then discard any scripts but the config file and code everything as a C or C++ module.
All good points; however IRC is a text-based, easy-to-parse protocol, and one does not require huge amounts of memory or number of clock cycles to run a client.
I've yet to run specific memory and performance tests between a PHP and Tcl implementation, but PHP has a notoriously good reputation with stability and resource management. Despite the school of thought which considers "compiled" scripting languages such as JSP and ASP a better choice for scalability, PHP has been shown to scale just as well when dealing with tons of server requests.
But again, the disparity between running a multilayered complex script system such as the one that powers forum.egghelp.org, versus a sole process keeping a connection or two alive with an IRC daemon is enough to strike down the notion that PHP is inefficient for the job (IRC). Memory hog? Perhaps. Unstable? Definitely not - I can personally attest to running a Hotnsour process for literally months without any (apparent) memory leak.
However - and this is a direct response to your comment about writing the modules in C/C++ - the key benefit of programming in PHP is native object oriented programming support, its string manipulation and ease-of-typecast variable handling; Tcl is inherently not OOP, as far as I understand. The inspiration comes from Perl scripts from the IRC client
Irssi, which provides a layer of abstraction to the scripter, not unlike what Hotnsour has to offer:
Code: Select all
// Typical script using C-type argument vector ($argv).
// $argc is also available. Certain variables are set
// prior to calling this script, such as $channel, $from,
// and $from_full.
switch ($argv[0]) {
case "!wz":
case "!wzf":
include 'scripts/weather.sc';
break;
case "!spam":
$irc->privmsg("#eggdrop", "we rule!");
break;
case "!op":
switch ($from) { // primitive whitelist
case "hotnsour":
$irc->op($channel, $from);
break;
default:
$irc->privmsg($channel, "no way jose!");
break;
}
break;
default:
break;
}
(I would actually like to see the Tcl equivalent, if possible
).
Hotnsour is friendly/friendlier to rapid development, although the best Tcl coder here could probably argue otherwise. The number of steps it could possibly take to reload/recode a script is as simple as changing the line and saving the script; the Hotnsour engine will detect a change and updates its code cache immediately. For an eggdrop, the HANGUP signal has to be sent so the bot rehashes. From what I imagine this cuts down on the efficiency of reworking scripts.
I appreciate the feedback, and
KrzychuG, yes, it is certainly not the first incarnation of a PHP bot, but hopefully the most intuitive and comprehensive.