/** * Called when the message object is loaded. */ public function __construct($sString) { $this->Raw = $sString; $this->Parts = explode(' ', $sString); $this->Numeric = strtoupper($this->Parts[1]); $this->User = CoreMaster::parseHostmask(substr($this->Parts[0], 1)); $this->Payload = ($iPosition = strpos($sString, ' :', 2)) !== false ? substr($sString, $iPosition + 2) : ''; }
/** * Deals with command handlers. */ private static function CommandHandler(CoreMaster $pInstance, MessageObject $pMessage, $pEventHandler) { $sCommandName = $pInstance->pConfig->Network->delimiter . $pEventHandler->argumentPassed; $aCommandPayload = explode(' ', $pMessage->Payload, 2); if ($sCommandName != $aCommandPayload[0]) { return; } $aCommandPayload[1] = isset($aCommandPayload[1]) ? $aCommandPayload[1] : ""; $aArguments = array($pInstance->getChannel($pMessage->Parts[2]), $pInstance->getUser($pMessage->User->Nickname), $aCommandPayload[1]); return Core::invokeReflection($pEventHandler->eventCallback, $aArguments, $pInstance); }
/** * Called when there's an error - when someone decides to disconnect the bot. */ public static function onNicknameConflict(CoreMaster $pInstance, MessageObject $pMessage) { $sNewNickname = $pInstance->pSocket->pConfig->altnick . mt_rand(10, 99); $pInstance->pSocket->setSocketNickname($sNewNickname); $pInstance->triggerEvent("onNicknameConflict", $pMessage->sNewNickname); }
/** * Get the channel exception list. */ public function getExceptionList() { CoreChannel::$mTemp = array(); $pSocket = $this->internalMasterObject()->getCurrentSocket(); $pSocket->Output("MODE {$this->sChannel} +e"); $pSocket->executeCapture(function ($sString) { $pMessage = Core::getMessageObject($sString); switch ($pMessage->Numeric) { case "348": CoreChannel::$mTemp[] = (object) array('hostmaskString' => $pMessage->Parts[4], 'hostmaskObject' => CoreMaster::parseHostmask($pMessage->Parts[4]), 'modeSetter' => $pMessage->Parts[5], 'modeTime' => $pMessage->Parts[6]); return false; case "349": return true; } return false; }); $mTemp = CoreChannel::$mTemp; CoreChannel::$mTemp = null; return $mTemp; }