Beispiel #1
0
 public function priv_admin($line, $args)
 {
     if ($args['nargs'] < 2) {
         return;
     }
     if ($this->ircClass->getClientConf('dccadminpass') == "") {
         return;
     }
     if (md5($args['arg1']) != $this->ircClass->getClientConf('dccadminpass')) {
         return;
     }
     $query = substr($args['query'], strlen($args['arg1']) + 1);
     $myArgs = parser::createLine($query);
     switch ($args['arg2']) {
         case "chatme":
             $port = $this->dccClass->addChat($line['fromNick'], null, null, true, null);
             if ($port === false) {
                 $this->ircClass->notice($line['fromNick'], "Error starting chat, please try again.", 1);
             }
             break;
         default:
             $chat = new chat_wrapper($line['fromNick'], $this->ircClass);
             $cmdList = $this->parserClass->getCmdList();
             $cmdLower = $myArgs['cmd'];
             if (isset($cmdList['dcc'][$cmdLower])) {
                 if ($myArgs['nargs'] < $cmdList['dcc'][$cmdLower]['numArgs']) {
                     $chat->dccSend("Usage: " . $cmdLower . " " . $cmdList['dcc'][$cmdLower]['usage']);
                     break;
                 }
                 $module = $cmdList['dcc'][$cmdLower]['module'];
                 $class = $cmdList['file'][$module]['class'];
                 $func = $cmdList['dcc'][$cmdLower]['function'];
                 $class->{$func}($chat, $myArgs);
                 $chat->dccSend("ADMIN " . irc::myStrToUpper($cmdLower) . " Requested");
             } else {
                 $chat->dccSend("Invalid Command: " . $myArgs['cmd']);
             }
             break;
     }
 }
Beispiel #2
0
 function dccParse($line, $vars, $txt)
 {
     $cVars = count($vars);
     if ($cVars < 1) {
         return;
     }
     $cmd = irc::myStrToUpper($vars[0]);
     switch ($cmd) {
         case "CHAT":
             if ($cVars == 4) {
                 $iplong = long2ip((double) $vars[2]);
                 $port = $vars[3];
                 $this->dccClass->addChat($line['fromNick'], $iplong, (int) $port, false, null);
             }
             break;
         case "SEND":
             if ($this->ircClass->getClientConf('upload') != 'yes') {
                 $this->ircClass->notice($line['fromNick'], "DCC: I do not accept dcc transfers at this time.", 0);
                 break;
             }
             if ($cVars >= 5) {
                 //Some bastard sent a file with spaces.  Shit. Ass.
                 if (strpos($query, chr(34)) !== false) {
                     $first = strpos($query, chr(34));
                     $second = strpos($query, chr(34), $first + 1);
                     $filename = substr($query, $first + 1, $second - $first - 1);
                     $query = str_replace("\"" . $filename . "\"", "file.ext", $query);
                     $vars = explode(chr(32), $query);
                 } else {
                     $filename = $vars[1];
                 }
                 $iplong = long2ip((double) $vars[2]);
                 $port = $vars[3];
                 $filesize = $vars[4];
                 $this->dccClass->addFile($line['fromNick'], $iplong, (int) $port, DOWNLOAD, $filename, $filesize);
             }
             break;
         case "ACCEPT":
             if ($cVars == 4) {
                 $port = $vars[2];
                 $bytes = $vars[3];
                 $this->dccClass->dccAccept($port, $bytes);
             }
             break;
         case "RESUME":
             if ($cVars == 4) {
                 $port = $vars[2];
                 $bytes = $vars[3];
                 $this->dccClass->dccResume($port, $bytes);
             }
             break;
     }
 }