public function addChat($nick, $host, $port, $admin, $handler, $fromTimer = false) { $lnick = irc::myStrToLower($nick); foreach ($this->dccList as $index => $dcc) { if ($dcc->type == CHAT) { if (irc::myStrToLower($dcc->nick) == $lnick) { $dcc->disconnect(); break; } } } $reverse = false; if ($this->ircClass->getClientConf("mircdccreverse") != "" && $fromTimer == false) { $port = intval($this->ircClass->getClientConf("mircdccreverse")); if ($port == 0) { return NULL; } $args = new argClass(); $args->arg1 = $nick; $args->arg2 = $host; $args->arg3 = $port; $args->arg4 = $admin; $args->arg5 = $handler; $args->arg7 = time(); $args->arg8 = CHAT; $this->ircClass->notice($nick, "DCC: NOTICE: This server is using the mIRC Chat Server Protocol. Please use ' /dccserver +c on " . $this->ircClass->getClientConf("mircdccreverse") . " ' to chat with me! Starting 6 second delay...", 0); $this->ircClass->sendRaw("WHOIS " . $nick); $this->timerClass->addTimer(irc::randomHash(), $this, "reverseTimer", $args, 6, false); return; } if ($fromTimer == true) { $reverse = DCC_REVERSE; // using mIRC dcc reverse protocol } if ($host == NULL || $port == NULL) { $conn = new connection(null, null, 0); $listening = true; $status = DCC_LISTENING; } else { $conn = new connection($host, $port, CONNECT_TIMEOUT); $listening = false; $status = DCC_CONNECTING; } $conn->setSocketClass($this->socketClass); $conn->setIrcClass($this->ircClass); $conn->setCallbackClass($this); $conn->setTimerClass($this->timerClass); $port = $conn->init(); if ($conn->getError()) { $this->ircClass->log("Start Chat Error: " . $conn->getErrorMsg()); return false; } $sockInt = $conn->getSockInt(); $this->chatCount++; $id = $this->highestId(); $chat = new chat($id, $nick, $admin, $sockInt, $host, $port, $handler, $reverse); $chat->setIrcClass($this->ircClass); $chat->setDccClass($this); $chat->setParserClass($this->parserClass); $chat->setSocketClass($this->socketClass); $chat->setTimerClass($this->timerClass); $chat->connection = $conn; $chat->status = $status; $chat->removed = false; $this->dccList[$sockInt] = $chat; $chat->initialize(); $conn->setCallbackClass($chat); if ($listening == true) { $this->timerClass->addTimer(irc::randomHash(), $this, "checkDccTimeout", $chat, 30, true); } else { $conn->connect(); } return $port; }