Beispiel #1
0
 /**
  * The centralized function which will properly initialise all initial
  * bots to be initialised into the Nuwani Bot system.
  * 
  * @param array $aBotList The bots that have to be initialised
  */
 public function Initialize($aBotList)
 {
     foreach ($aBotList as $aBotInfo) {
         $pBot = new Bot($aBotInfo['Nickname']);
         $pBot->setNetwork($aBotInfo['Network']);
         $bindIp = isset($aBotInfo['BindIP']) ? $aBotInfo['BindIP'] : null;
         $network = $pBot->getNetwork();
         $network['Port'] = $aBotInfo['SSL'] !== false ? $aBotInfo['SSL'] : $network['Port'];
         // Old behavior.
         $pBot['Socket']->setServerInfo($network['Address'], $network['Port'], $aBotInfo['SSL'] !== false, false, $bindIp);
         $pBot->getSecurityManager()->initialize($pBot, $aBotInfo['Users']);
         $pBot->setBotInfo($aBotInfo);
         $pBot->connect();
     }
     if (function_exists('pcntl_signal_dispatch')) {
         pcntl_signal(SIGTERM, array($this, 'onCatchSignal'));
         pcntl_signal(SIGINT, array($this, 'onCatchSignal'));
         pcntl_signal(SIGTERM, array($this, 'onCatchSignal'));
         $this->m_bDispatchSignals = true;
     } else {
         $this->m_bDispatchSignals = false;
     }
 }