IRC user list..
| From: | Bruce Markey | Date: | Thu, 05 Jun 2003 20:48:54 +0000 |
| Subject: | IRC user list.. | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5837@lists.php.net to get a copy of this message | ||
Thanks for the suggestions.. I went with the smartirc class and almost have
what I want working but have two questions..
<?php
// Report all PHP errors, good for debugging
error_reporting(E_ALL);
// Include SmartIRC class
include_once('smartirc/SmartIRC.php');
// Create instance of class
$irc = &new Net_SmartIRC();
// Start benchmark and debug
$irc->setChannelSynching(TRUE);
$irc->startBenchmark();
$irc->setDebug(SMARTIRC_DEBUG_NONE);
$irc->setUseSockets(FALSE);
$irc->setBenchmark(TRUE);
// Connect to IRC server
$irc->connect('irc.freenode.net', 6667);
// Pass mandatory information to server
$irc->login('j1ttersbot', 'j1ttersbot', 0, 'j1ttersbot');
// Join to channel (you need to do this because if channel is secret or
private, or the users on the channel are invisible, then you won't get list
of users, or it won't be complete)
//$irc->join('#yahoorefugees');
// Waiting for real JOIN event before we go further
//$resultar = $irc->listenFor(SMARTIRC_TYPE_JOIN);
// Get list of names on channel
$irc->who('#yahoorefugees');
// Waiting for list
$resultar = $irc->listenFor(SMARTIRC_TYPE_WHO);
// Disconnect from server and stop benchmark
$irc->disconnect();
$irc->stopBenchmark();
foreach($resultar as $nick) echo $nick."<br>";
?>
Doing it this way works and gives me a listing, but as stated in the docs I
do not get invisible users. What is different about issuing a /who command
this way, if i do it in mirc for example i get all users. Second if i
change this to actually join the room by doing an $irc->join then an
$irc->names Then I listenFor (SMARTIRC_TYPE_NAME) I basically get an empty
array. So I guess my question is why do I have to join the room persay and
if I do what am i missing to not get the array resultar filled?
Thanks
Bruce