if(is_a($this->bot, "P10_User")) {
$this->uplink->join($this->bot, "#java", (P10_Channel::USERPRIV_OPED | P10_Channel::USERPRIV_VOICE));
$this->uplink->join($this->bot, "#dev", P10_Channel::USERPRIV_VOICE);
+ $this->uplink->join($this->bot, "#CoderCom", P10_Channel::USERPRIV_VOICE);
}
} else {
$this->bot = $old;
public function loop() {
foreach($this->execcache as $id => $entry) {
if(!$this->checkstate($entry)) {
- unlink("tmp/debug_".$entry['id'].".java");
- unlink("tmp/debug_".$entry['id'].".class");
+ unlink("tmp/Debug_".$entry['id'].".java");
+ unlink("tmp/Debug_".$entry['id'].".class");
unset($this->execcache[$id]);
}
}
$entry=array();
$entry['channel'] = $channel;
$entry['id'] = rand(1, 999999);
- $fp = fopen("tmp/debug_".$entry['id'].".c", "w");
- $javacode = "import java.*;
- @SuppressWarnings("unused")
- public class Debug_".$entry['id']." {
- ".$exp[1]."
+ if(preg_match("#pastebin\.com/([a-zA-Z0-9]*)$#i", $exp[1])) {
+ $pasteid = explode("/", $exp[1]);
+ $pasteid = $pasteid[count($pasteid)-1];
+ $javacontent = file_get_contents("http://pastebin.com/download.php?i=".$pasteid);
+ if(preg_match("#Unknown Paste ID!#i", $javacontent)) {
+ $this->uplink->notice($this->bot, $user, "Unknown Paste ID!");
+ return;
}
- ";
+ $javacode = "import java.*;
+ @SuppressWarnings(\"unused\")
+ public class Debug_".$entry['id']." {
+ ".$javacontent."
+ }
+ ";
+ } else {
+ $javacode = "import java.*;
+ @SuppressWarnings(\"unused\")
+ public class Debug_".$entry['id']." {
+ ".$exp[1]."
+ }
+ ";
+ };
+ $fp = fopen("tmp/Debug_".$entry['id'].".java", "w");
fwrite($fp, $javacode);
fclose($fp);
- $err = shell_exec("javac tmp/debug_".$entry['id'].".java 2>&1");
+ $err = shell_exec("javac tmp/Debug_".$entry['id'].".java 2>&1");
if($err) {
$err=str_replace("\r","",$err);
$lines=explode("\n",$err);
$this->uplink->privmsg($this->bot, $entry['channel'], $line);
}
}
- if(!file_exists("tmp/debug_".$entry['id'].".class")) {
- unlink("tmp/debug_".$entry['id'].".java");
+ if(!file_exists("tmp/Debug_".$entry['id'].".class")) {
+ unlink("tmp/Debug_".$entry['id'].".java");
break;
}
$descriptor = array(0 => array("pipe", "r"),1 => array("pipe", "w"),2 => array("pipe", "w"));
- $entry['proc'] = proc_open('java tmp/debug_'.$entry['id'].'.class', $descriptor, $entry['pipes']);
+ $entry['proc'] = proc_open('java -classpath tmp Debug_'.$entry['id'], $descriptor, $entry['pipes']);
if(!is_resource($entry['proc'])) {
$this->uplink->notice($this->bot, $user, "error while loading c!");
return;