diff --git a/config.php b/config.php index e03fb44..bded8a6 100755 --- a/config.php +++ b/config.php @@ -18,7 +18,7 @@ $logfile = "irclog.txt"; // Log instances for each bouncer $ipcolor = "#00FF00"; ///// NO TOUCHY SECTION ///// -$version = "1.0.0"; // CWChat version +$version = "1.1.0"; // CWChat version function doLog($string) { file_put_contents($GLOBALS['logfile'], $string . "\r\n", FILE_APPEND); diff --git a/index.php b/index.php index aded659..b35d2df 100755 --- a/index.php +++ b/index.php @@ -57,7 +57,7 @@ if (isset($_GET['register']) && $_GET['register'] == "go") { if(isset($_POST['username']) && $_POST['username'] != "") { $username = stripslashes(htmlentities($_POST['username'])); $password = md5($_POST['password']); - $channame = isset($_POST['channel']) && ($_POST['channel'] !== "") ? htmlentities(stripslashes($_POST['channel'])) : "#theroot"; + $channame = isset($_POST['channel']) && ($_POST['channel'] !== "") ? htmlentities(stripslashes($_POST['channel'])) : $default_channel; $servaddr = isset($_POST['servaddr']) && ($_POST['servaddr'] !== "") ? htmlentities(stripslashes($_POST['servaddr'])) : $server; $servport = isset($_POST['servport']) && ($_POST['servport'] !== "") ? htmlentities(stripslashes($_POST['servport'])) : $port; file_put_contents("users/$username.php", "\n"); diff --git a/server.php b/server.php index ded6bd6..db65d66 100755 --- a/server.php +++ b/server.php @@ -70,11 +70,22 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni $line .= "\x01\n"; } else if ($cmd[0]=="/join") { doLog("$username: joining " . $cmd[1]); - $line .= "JOIN" . " " . $cmd[1] . "\n"; // set for push + $line .= "JOIN" . " " . trim($cmd[1]) . "\n"; // set for push //$logline .= "$nick:Joining " . $cmd[1] . "\n"; // push to client $_SESSION['idleirc-channel'] = trim($cmd[1]); + } else if ($cmd[0] == "/rejoin") { + doLog("$username: rejoining channel"); + if ($cmd[1] != "") { + $line .= "PART " . trim($cmd[1]) . " :$username leaving...\n"; // push close command to IRC + $line .= "JOIN " . trim($cmd[1]) . "\n"; // set for push + //$logline .= "$nick: Leaving " . trim($cmd[1]) . "\n"; // push to client + } else { + $line .= "PART $channel :$username leaving...\n"; // push close command to IRC + $line .= "JOIN $channel\n"; // set for push + //$logline .= "$nick: Leaving $channel\n"; // push to client + } } else if ($cmd[0] == "/part") { - doLog("$username: leaving " . $cmd[1]); + doLog("$username: leaving " . trim($cmd[1])); if ($cmd[1] != "") { $line .= "PART " . trim($cmd[1]) . " :$username leaving...\n"; // push close command to IRC //$logline .= "$nick: Leaving " . trim($cmd[1]) . "\n"; // push to client