cvs: pear /Net_SmartIRC/SmartIRC example.php

From: Date: Thu, 02 Jan 2003 19:12:56 +0000
Subject: cvs: pear /Net_SmartIRC/SmartIRC example.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8050@lists.php.net to get a copy of this message
meebey Thu Jan 2 14:12:56 2003 EDT Modified files: /pear/Net_SmartIRC/SmartIRC example.php Log: changes tabs to 4 spaces (PEAR coding standard) changed the login() parameter to the new one, usermode is a new parameter Index: pear/Net_SmartIRC/SmartIRC/example.php diff -u pear/Net_SmartIRC/SmartIRC/example.php:1.1.1.1 pear/Net_SmartIRC/SmartIRC/example.php:1.2 --- pear/Net_SmartIRC/SmartIRC/example.php:1.1.1.1 Sun Dec 22 20:53:04 2002 +++ pear/Net_SmartIRC/SmartIRC/example.php Thu Jan 2 14:12:55 2003 @@ -1,9 +1,9 @@ <?php /** - * $Id: example.php,v 1.1.1.1 2002/12/23 01:53:04 meebey Exp $ - * $Revision: 1.1.1.1 $ + * $Id: example.php,v 1.2 2003/01/02 19:12:55 meebey Exp $ + * $Revision: 1.2 $ * $Author: meebey $ - * $Date: 2002/12/23 01:53:04 $ + * $Date: 2003/01/02 19:12:55 $ */ /** * Copyright (C) 2002-2003 Mirco "MEEBEY" Bauer <mail@meebey.net> <http://www.meebey.net> @@ -25,31 +25,31 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // ---EXAMPLE OF HOW TO USE Net_SmartIRC--- -// this code shows how a mini php bot could be written +// this code shows how a mini php bot which could be written include_once('../SmartIRC.php'); class mybot { - function channel_test(&$irc, &$data) - { - $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, $data->nick.': I dont like tests!'); - } + function channel_test(&$irc, &$data) + { + $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, $data->nick.': I dont like tests!'); + } - function query_test(&$irc, &$data) - { - $irc->message(SMARTIRC_TYPE_CHANNEL, '#test', $data->nick.' said "'.$data->message.'" to me!'); - $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, 'I told everyone on #test what you said!'); - } -} + function query_test(&$irc, &$data) + { + $irc->message(SMARTIRC_TYPE_CHANNEL, '#test', $data->nick.' said "'.$data->message.'" to me!'); + $irc->message(SMARTIRC_TYPE_QUERY, $data->nick, 'I told everyone on #test what you said!'); + } +} $bot = &new mybot(); $irc = &new Net_SmartIRC(); $irc->setDebug(SMARTIRC_DEBUG_ALL); -$irc->useSockets(TRUE); +$irc->setUseSockets(TRUE); $irc->registerActionhandler(SMARTIRC_TYPE_QUERY|SMARTIRC_TYPE_NOTICE, '^test', $bot, 'query_test'); $irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '^test', $bot, 'channel_test'); $irc->connect('irc.freenet.de', 6667); -$irc->login('Net_SmartIRC', 'Net_SmartIRC Client '.SMARTIRC_VERSION, 'Net_SmartIRC'); +$irc->login('Net_SmartIRC', 'Net_SmartIRC Client '.SMARTIRC_VERSION, 0, 'Net_SmartIRC'); $irc->join('#test'); $irc->listen(); $irc->disconnect();

« previous php.pear.cvs (#8050) next »