ircbot/Testcode/Client/ClientManagerTest.php

43 lines
1.1 KiB
PHP
Raw Normal View History

2010-11-21 23:48:11 +01:00
<?php
$clientManager = new Client_ClientManager();
$clientManager->registerProtocol("irc", "Irc");
$clientManager->registerProtocol("jpt", "Bot");
2010-11-21 23:48:11 +01:00
/*$freenode = $clientManager->createTcpConnection("freenode", "irc");
2010-11-21 23:48:11 +01:00
$clientManager->attachConfig(array(
"nick" => "Testinstanz",
"userident" => "uzuguck",
"channels" => array("#mstasty")
), $freenode);
$freenode->connect("irc.freenode.net", 6667);
$freenode->setReconnect(TRUE);
*/
2010-11-21 23:48:11 +01:00
$freenode = $clientManager->createTcpConnection("freenode", "irc");
2010-11-21 23:48:11 +01:00
$clientManager->attachConfig(array(
"nick" => "Testinstanz2",
"userident" => "uzuguck",
"channels" => array("#mstasty")
), $freenode);
$freenode->connect("irc.freenode.net", 6667);
/*$config_eloxoph = array(
"nick" => "Frischmilch",
"userident" => "olefolol",
"channels" => array("#eloxoph")
);
$eloxoph = $clientManager->createTcpConnection("eloxoph", "irc");
$clientManager->attachConfig($config_eloxoph, $eloxoph);
$eloxoph->connect("irc.eloxoph.com", 6667);*/
$srv = $clientManager->createTcpConnection("srv", "jpt");
2010-11-21 23:48:11 +01:00
$srv->bind("localhost", 7777);
$srv->listen();
2010-11-21 23:48:11 +01:00
while($clientManager->countActiveConnections() > 0) {
2010-11-21 23:48:11 +01:00
$clientManager->work();
}
?>