Call this v1.2.3

This commit is contained in:
Pentium44 2020-12-10 21:15:12 -08:00
parent e7c3be3f9e
commit 095d45ee44
5 changed files with 111 additions and 30 deletions

View File

@ -3,17 +3,70 @@ This is a simple ajax frontend with a very small footprint on web servers. IdleI
written in PHP to communicate with IRC servers. With that being said, it's not secured by TLS or
anything like that. This is in working condition!
#### Usage
###### Main features
IdleIRC is meant to be used by just chat commands. With that, it satisfies the need for multi tab
support while keeping multi channel support like IRSSI or weechat. IdleIRC not only acts as a bouncer
for your IRC user, it also supports most commands like other clients and has user accounts to allow
for login and logout without disturbing your client. It can log 24/7! IdleIRC is also extremely simple;
and I'm proud of that. It's versatile, easy to setup, and extremely effecient to use!
###### Commands in IdleIRC
* /focus [channel|user]: Funnel messages to specific channel or user (Alias: /switch; /query)
* /part (channel): Part channel, part focused channel if none specified
* /rejoin (channel): Part, and join a channel; focused channel if none is specified
* /nick [nickname]: Change your nickname
* /list [channel]: List users in a channel
* /usermode [flag(s): Sets MODE flag(s) to user
* /mode [channel] [flag(s)]: Sets MODE flag(s) for [channel]
* /channel: Prints focused channel / user (Alias: /focused)
###### Accounts and registration
User accounts are registered before client use, and make it easy to use on any PC after setup. IdleIRC
allows you to register an account. It sets up a provided username, salts (md5) your password given and
stores it within a variable within users/(username).php which can be included by IdleIRC when logging in
and verifying client operations via SESSION cookies.
* To create (after setup and installed):
*Navigate to your IdleIRC URL
*Click "create one" within the login prompt.
*Fill forms with username, and password
*Click "create account"
* To login (first user login):
*Navigate to IdleIRC URL
*Fill out login forms
*Click "login" at bottom of form
*Click "Connect to server" within the navigation bar up top
* NOTE: Once connected, you'll stay idle on window close and logout of the web client
* To disconnect IRC bouncer (after first login):
*Login using above instructions
*Click "Disconnect from server" within the nav bar
*Logout using "Logout" within the nav bar
#### Requirements
PHP 5.2+
Read-Write access for working directory
PHP 5.2+
Read-Write access for working directory
#### Installation
* Download IdleIRC
* Extract it to desired web server / htdocs directory
* Customize config.php to your liking
* Use it!
* Do a: git clone https://notabug.org/Pentium44/idleirc OR download the archive and extract it to desired location.
* Customize config.php to your liking, and set your web servers user / group read / write access to idleirc.
* Register an acount, and use it!
#### Changelog
* v1.2.3:
* CSS fixes and updates
* HTML format fixes within server.php and irc.php generation
* Added /usermode & /mode
* Fixed some PM issues with colons
* Cleaned up the documentation since its comming to a more so "stable" form
* v1.2.2:
* CSS updates
* Added IdleIRC footer
@ -43,5 +96,6 @@ anything like that. This is in working condition!
* Client supports: /join, /msg, and /me currently
* Multi user support
#### Legal stuff
Licensed via GPLv3

View File

@ -18,7 +18,7 @@ $logfile = "irclog.txt"; // Log instances for each bouncer
$ipcolor = "#00FF00";
///// NO TOUCHY SECTION /////
$version = "1.2.2"; // CWChat version
$version = "1.2.3"; // CWChat version
function doLog($string) {
file_put_contents($GLOBALS['logfile'], $string . "\r\n", FILE_APPEND);

12
irc.php
View File

@ -57,7 +57,7 @@ sleep(1);
// Continue the rest of the script here
// While script will continue as long as socket continues to be active
while($bytes = socket_recv($socket, $r_data, 2048, MSG_DONTWAIT) !== '') {
while($bytes = socket_recv($socket, $r_data, 3068, MSG_DONTWAIT) !== '') {
if($bytes !== FALSE) {
//$data = socket_read($socket, 2048, PHP_NORMAL_READ);
$data = $r_data;
@ -128,10 +128,16 @@ while($bytes = socket_recv($socket, $r_data, 2048, MSG_DONTWAIT) !== '') {
$nickMsg = explode('NICK', $data);
$msgline = "<tr><td class='userinfo'><b>$senderNick</b><br /><span style='color:$ipcolor;'>$senderIp</span></td><td> $senderNick is now known as" . $nickMsg[1] . "</td></tr>\n";
file_put_contents("$username.log", $socketFileContents . $msgline);
} else if ($ex[2] == $username && $ex[1] == "PRIVMSG" && (count(explode(":", $stringMsg[1])) > 2)) {
} else if ($ex[1] == "QUIT") {
$senderNick = get_string_between($data, ":", "!");
$senderIp = get_string_between($data, "@", " ");
$quitMsg = explode('QUIT :', $data);
$msgline = "<tr><td class='userinfo'><span style='color:$ipcolor;'>$server_address</span> ~</td><td> $senderNick left: " . $quitMsg[1] . "</td></tr>\n";
file_put_contents("$username.log", $socketFileContents . $msgline);
} else if ($ex[2] == $username && $ex[1] == "PRIVMSG") {
$senderNick = get_string_between($data, ":", "!");
$senderIp = get_string_between($data, "@", " ");
$privMsg = explode(":", $stringMsg[1]);
$privMsg = explode(" :", $stringMsg[1]);
$posprivMsg = array_splice($privMsg, 1);
$msg;

View File

@ -28,7 +28,7 @@ $servport = $_SESSION['idleirc-servport'];
// If we have a message; grab user and content and push to IRC client
if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['nick']!=""){
$nick = $usernick; // Usernick
$msg = urldecode(stripslashes(trim($_GET['msg']))); // User message content
$msg = rawurldecode(stripslashes(trim($_GET['msg']))); // User message content
$line = ""; // start with nothing
$logline = ""; // start with nothing
@ -36,13 +36,13 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
$cmd = explode(" ", $msg);
if($cmd[0]=="/msg") { // If using /msg, push private message
$prvmsg = array_splice($cmd, 2); // grab private message from string
$line .= "PRIVMSG" . " " . $cmd[1] . " "; // set for push
$line .= "PRIVMSG" . " " . trim($cmd[1]) . " :"; // set for push
$x = 0;
$logline .= "<tr><td class='userinfo'><b>$nick</b> -> " . $cmd[1] . ": </td><td>";
$logline .= "<tr><td class='userinfo'><b>$nick</b> -> " . trim($cmd[1]) . ": </td><td>";
foreach($prvmsg as $word) {
// Grab each word in the array after the privmsg username
if($x == 0) {
$line .= ":" . $word;
$line .= $word;
$logline .= $word;
} else {
$line .= " " . $word;
@ -77,13 +77,32 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
$_SESSION['idleirc-channel'] = trim($cmd[1]);
} else if ($cmd[0]=="/channel" || $cmd[0]=="/focused") {
doLog("$username: checking focused channel: " . $channel);
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span>:</td><td>Focused on $channel</td></tr>\n"; // push to client
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>Focused on $channel</td></tr>\n"; // push to client
} else if ($cmd[0]=="/nick") {
if($cmd[1]!="") {
doLog("$username: setting nick to " . $cmd[1]);
$line .= "NICK " . trim($cmd[1]) . "\n"; // set for push
//$logline .= "<tr><td class='userinfo'><b>$nick</b>:</td><td>Joining " . $cmd[1] . "</td></tr>\n"; // push to client
$_SESSION['idleirc-nick'] = trim($cmd[1]);
} else {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>Joining " . $cmd[1] . "</td></tr>\n";
}
} else if ($cmd[0]=="/usermode") {
if($cmd[1]!="") {
doLog("$username: setting usermode to " . $cmd[1]);
$line .= "MODE $nick +x" . trim($cmd[1]) . "\n"; // set for push
} else {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>Missing User MODE flags<br /> /usermode [flag(s)]</td></tr>\n";
}
} else if ($cmd[0]=="/mode") {
if($cmd[1]!="") {
if($cmd[2]!="") {
doLog("$username: setting nick to " . $cmd[1]);
$line .= "MODE " . trim($cmd[1]) . " " . trim($cmd[2]) . "\n"; // set for push
} else {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>Missing MODE flags:<br /> /mode [channel] [flag(s)]</td></tr>\n";
}
} else {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>Missing channel and flags:<br /> /mode [channel] [flag(s)]</td></tr>\n";
}
} else if ($cmd[0]=="/list") {
if($cmd[1]!="") {
@ -107,7 +126,7 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
} else if ($cmd[0] == "/part") {
doLog("$username: leaving " . trim($cmd[1]));
if ($cmd[1] != "") {
$line .= "PART " . trim($cmd[1]) . " :$username leaving...\n"; // push close command to IRC
$line .= "PART " . trim($cmd[1]) . " :$nick leaving...\n"; // push close command to IRC
//$logline .= "<tr><td class='userinfo'><b>$nick</b>: </td><td>Leaving " . trim($cmd[1]) . "</td></tr>\n"; // push to client
} else {
$line .= "PART $channel :$username leaving...\n"; // push close command to IRC
@ -116,18 +135,20 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
} else if ($cmd[0] == "/focus" || $cmd[0] == "/switch" || $cmd[0] == "/query") {
if(trim($cmd[1]) != $channel) {
$_SESSION['idleirc-channel'] = trim($cmd[1]);
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span>: </td><td>" . trim($cmd[1]) . " is focused, all messages will be sent to " . trim($cmd[1]) . "</td></tr>\n"; // push to client
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>" . trim($cmd[1]) . " is focused, all messages will be sent to " . trim($cmd[1]) . "</td></tr>\n"; // push to client
} else {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span>: </td><td>You're already focused on $channel</td></tr>\n";
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span> ~</td><td>You're already focused on $channel</td></tr>\n";
}
} else if ($cmd[0] == "/help" || $cmd[0] == "/?") {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</b></td>";
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version ~</span></td>";
$logline .= "<td>HELP: Information about $title<br />/join [channel] : Join IRC channel [channel]<br />";
$logline .= "/focus [channel|user]: Funnel messages to specific channel or user (Alias: /switch; /query)<br />";
$logline .= "/part (channel): Part channel, part focused channel if none specified<br />";
$logline .= "/rejoin (channel): Part, and join a channel; focused channel if none is specified<br />";
$logline .= "/nick [nickname]: Change your nickname<br />";
$logline .= "/list [channel]: List users in a channel<br />";
$logline .= "/usermode [flag(s): Sets MODE flag(s) to user<br />";
$logfile .= "/mode [channel] [flag(s)]: Sets MODE flag(s) for [channel]<br />";
$logline .= "/channel: Prints focused channel / user (Alias: /focused)</td></tr>\n";
} else {
// @@ This is a work in progress

View File

@ -70,18 +70,18 @@ input, button, select, textarea{
.text { font-size: 14px; }
@media only screen and (min-height: 20001px) { #msgs { height: 1700px; } }
@media only screen and (min-height: 2001px) { #msgs { height: 1700px; } }
@media only screen and (max-height: 2000px) { #msgs { height: 1600px; } }
@media only screen and (max-height: 1800px) { #msgs { height: 1500px; } }
@media only screen and (max-height: 1400px) { #msgs { height: 1100px; } }
@media only screen and (max-height: 1200px) { #msgs { height: 1000px; } }
@media only screen and (max-height: 1000px) { #msgs { height: 800px; } }
@media only screen and (max-height: 900px) { #msgs { height: 700px; } }
@media only screen and (max-height: 800px) { #msgs { height: 600px; } }
@media only screen and (max-height: 700px) { #msgs { height: 500px; } }
@media only screen and (max-height: 1800px) { #msgs { height: 1400px; } }
@media only screen and (max-height: 1400px) { #msgs { height: 1050px; } }
@media only screen and (max-height: 1200px) { #msgs { height: 900px; } }
@media only screen and (max-height: 1000px) { #msgs { height: 700px; } }
@media only screen and (max-height: 900px) { #msgs { height: 600px; } }
@media only screen and (max-height: 800px) { #msgs { height: 500px; } }
@media only screen and (max-height: 700px) { #msgs { height: 400px; } }
@media only screen and (max-height: 600px) { #msgs { height: 400px; } }
@media only screen and (max-height: 500px) { #msgs { height: 300px; } }
@media only screen and (max-height: 400px) { #msgs { height: 200px; } }
@media only screen and (max-height: 500px) { #msgs { height: 400px; } }
@media only screen and (max-height: 400px) { #msgs { height: 400px; } }
#msg {
height: 21px;