This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Netham45
Pages: 1 ... 38 39 [40] 41 42 ... 123
586
« on: May 12, 2011, 04:50:29 am »
I'm going to add a 'Classic' mode that makes it look as it does now. The current look isn't even finalized, I'm still not sure I like it.
587
« on: May 11, 2011, 10:07:45 pm »
I have sending disabled. Kickbann'd the bot earlier.
588
« on: May 11, 2011, 06:47:27 pm »
You could always try advertising on the site. Google adsense is relatively painless to set up.
589
« on: May 11, 2011, 05:54:38 pm »
Good point, I'll prolly leave them seperate for that.
590
« on: May 11, 2011, 05:48:59 pm »
I'd like to merge the bots(Spybot45 & OmnomIRC) into one bot for simplicity purposes on my end, any ideas/thoughts about that?
591
« on: May 11, 2011, 03:40:40 am »
The current version requests the chat log every 4.5 seconds. That's 4300 bytes or 4.3KB every 5 seconds.
4.3 * 12 = 51.6kb/min 51.6 * 60 = 3,096kb(3MB)/hr
One of the userlist files that refreshes every 15 seconds is 700 bytes.
700*4=2800b(2.8kb)/min
2.8*60 = 168kb/hr
3096+168 = 3264kb/hr
The other userlist is about 800b every 15 seconds.
800*4=3200b/m 3.2*60 = 192kb/hr 3264kb/hr+192kb/hr = 3456 kb/hour, or 3.4MB in usage.
The new Omnom engine uses 2,067 bytes for the initial request(only ran once per tab), and uses at max 500 bytes about every 30 seconds afterwards(45 second timeout, guesstimating the messages averaged in bring that to 30).
500 * 2 = 1000b/m 1000*60 = 60,000b(6kb/h)/h 60,000+2067 = 62,067b/hour
62kb is 1/55th of 3456kb, meaning the new Omnom engline should use about 1/55th of the bandwidth on your end, or what lasted you about a minute and 6 seconds on the old OmnomIRC will now last you for an hour on the new one.
592
« on: May 11, 2011, 03:14:14 am »
Haven't done anything with it yet. Not sure if I'm going to keep that bot, mIRC with a SQL plugin is looking like it'd be a lot more reliable with considerable less work. I have a beta-ish version of the new OmnomIRC up at http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=14The userlist and the messagebox are using the old method still in that, but I'm hoping to have it all converted to the new stuffs by the end of the week.
593
« on: May 10, 2011, 11:12:14 pm »
Yea, it's going to replace the OmnomIRC bot in the chan.
594
« on: May 10, 2011, 11:11:45 pm »
fix'd.
595
« on: May 10, 2011, 08:34:50 pm »
IRC Bot! (Not quite done, as with everything else. Still need to track userlists, and add sending.) <?PHP function sql_query() { global $sqlConnection; $params = func_get_args(); $query = $params[0]; $args = Array(); for ($i=1;$i<count($params);$i++) $args[$i-1] = htmlspecialchars(mysql_real_escape_string(trim($params[$i]),$sqlConnection)); $result = mysql_query(vsprintf($query,$args),$sqlConnection); if (!$result) die(mysql_error() . "Query: " . vsprintf($query,$args)); return $result; }
function getMessage($parts,$start,$trim) { if($trim) $message = substr($parts[$start++],1); for ($i = $start; $i < count($parts);$i++) $message = $message . " " . $parts[$i]; $message = trim($message); return $message; }
function parseMsg($allMessage) { global $socket,$hasIdent,$ident; $lines = explode("\n",$allMessage); foreach ($lines as $Message) { $parts = explode(" ",$Message); preg_match("/:(.*)!(.*)@(.*)/",$parts[0],$info); $channel = strtolower($parts[2]); if (strtolower($parts[0]) == "ping") socket_write($socket,"PONG " . trim($parts[1]) . "\n"); switch(strtolower($parts[1])) { case "privmsg": $message = getMessage($parts,3,true); if ($message == "!quit") socket_write($socket,"QUIT :Requested!\n"); if (preg_match("/ACTION (.*)/",$message,$messageA)) addLine($info[1],'','action',$messageA[1],$channel); else addLine($info[1],'','message',$message,$channel); break; case "join": addLine($info[1],'','join','',$channel); break; case "part": $message = getMessage($parts,3,true); addLine($info[1],'','part',$message,$channel); break; case "mode": $message = getMessage($parts,3,false); addLine($info[1],'','mode',$message,$channel); break; case "kick": $message = getMessage($parts,4,true); addLine($info[1],$parts[3],"kick",$message,$channel); break; case "quit": $message = getMessage($parts,2,true); addLine($info[1],$parts[3],"quit",$message,''); break; case "376": socket_write($socket,"JOIN #omnimaga-test\n"); break; } } } function addLine($name1,$name2,$type,$message,$channel) { global $socket; $curPosArr = mysql_fetch_array(sql_query("SELECT MAX('line_number') FROM `irc_lines`")); $curPos = $curPosArr[0]+ 1; sql_query("INSERT INTO `irc_lines` (`name1`,`name2`,`message`,`type`,`channel`) VALUES ('%s','%s','%s','%s','%s')",$name1,$name2,$message,$type,$channel); sql_query("DELETE FROM `irc_lines` WHERE `line_number` < %s",$curPos - 1000); } ?>
<?PHP error_reporting(0); $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if (!socket_connect($socket,"irc.mzima.net",6667)) die("Could not connect. Error: " . socket_last_error()); $sqlConnection = mysql_connect("localhost","OmnomIRC","-snip-"); if (!$sqlConnection) die("Could not connect to SQL DB."); if (!mysql_select_db("omnomirc",$sqlConnection)) die('Invalid query: ' . mysql_error());
$ident = "PASS none\nUSER OmnomIRC OmnomIRC OmnomIRC :OmnomIRC\nNICK Omnom_Dev\n";
sleep(1); socket_write($socket,$ident); while ($recBuf = socket_read($socket,1024)) { echo $recBuf; parseMsg($recBuf); } socket_close($socket); ?>
Edit: Here's what I got of my server-side update scripts too(I just need to add chan support to these, which is going to be easy.): <?PHP header('Content-type: text/javascript'); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); $curLine = $_GET['count']; $sqlConnection = mysql_connect("localhost","OmnomIRC","-snip-"); if (!$sqlConnection) die("Could not connect to SQL DB."); if (!mysql_select_db("omnomirc",$sqlConnection)) die('Invalid query: ' . mysql_error()); function sql_query() { global $sqlConnection; $params = func_get_args(); $query = $params[0]; $args = Array(); for ($i=1;$i<count($params);$i++) $args[$i-1] = mysql_real_escape_string($params[$i],$sqlConnection); $result = mysql_query(vsprintf($query,$args),$sqlConnection); if (!$result) die(mysql_error() . "Query: " . vsprintf($query,$args)); return $result; } $curLineArr = mysql_fetch_array(sql_query("SELECT MAX(`line_number`) FROM `irc_lines`")); $curLine = $curLineArr[0] - $curLine; $destLine = $curLineArr[0]; for ($curLine;$curLine <= $destLine;$curLine++) { $result = mysql_fetch_array(sql_query("SELECT * FROM `irc_lines` WHERE `line_number` = %s",$curLine)); echo "addLineStart('"; switch (strtolower($result['type'])) { case "message": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result['message'])) . ':' . base64_encode("0");break; case "action": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result['message'])) . ':' . base64_encode("0");break; case "join": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1']));break; case "part": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; case "kick": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["name2"])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; case "quit": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; case "mode": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; } echo "');\n"; } mysql_close($sqlConnection); ?>
<?PHP header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); $curLine = $_GET['lineNum']; $sqlConnection = mysql_connect("localhost","OmnomIRC","-snip-"); if (!$sqlConnection) die("Could not connect to SQL DB."); if (!mysql_select_db("omnomirc",$sqlConnection)) die('Invalid query: ' . mysql_error()); function sql_query() { global $sqlConnection; $params = func_get_args(); $query = $params[0]; $args = Array(); for ($i=1;$i<count($params);$i++) $args[$i-1] = mysql_real_escape_string($params[$i],$sqlConnection); $result = mysql_query(vsprintf($query,$args),$sqlConnection); if (!$result) die(mysql_error() . "Query: " . vsprintf($query,$args)); return $result; } while (true) { $result = mysql_fetch_array(sql_query("SELECT * FROM `irc_lines` WHERE `line_number` = %s",$curLine + 1)); if (!isset($result[0])) {sleep(1); continue;} switch (strtolower($result['type'])) { case "message": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result['message'])) . ':' . base64_encode("0");break; case "action": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result['message'])) . ':' . base64_encode("0");break; case "join": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1']));break; case "part": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; case "kick": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["name2"])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; case "quit": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; case "mode": echo $result['line_number'] . ":" . $result['type'] . ":" . base64_encode(htmlspecialchars($result['name1'])) . ":" . base64_encode(htmlspecialchars($result["message"]));break; } break; } mysql_close($sqlConnection); ?>
Hmm, looks quite interesting. If I'm not mistaken, the loop keeps a xmlhttprequest open until it timeouts, and then starts a new request (endless loop here) ?
No, it keeps it open until my server responds. It shouldn't time out at all. I have a random-length sleep() on the script that's spewing data for testing.
It does actually time out after 45 seconds, to prevent a large number of lingering PHP scripts running on my server.
596
« on: May 10, 2011, 08:33:25 pm »
I don't have SQL access from my server to 1and1, they don't open it like Aspiration does. I'd be able to make it use the PHP mod, though(the previous version of spybot)
597
« on: May 10, 2011, 06:04:51 pm »
If it merges with Omni, yea. If it stays on 1and1, no. I don't have SQL access to 1and1.
598
« on: May 10, 2011, 06:03:58 pm »
No, it keeps it open until my server responds. It shouldn't time out at all. I have a random-length sleep() on the script that's spewing data for testing.
599
« on: May 10, 2011, 04:33:55 pm »
The logs will still be available, but I won't be relying on them for OmnomIRC. I got most of the client-side parser done, I believe. Just need to add a few things to make it tell between Omnom and Non-Omnom users, cookies, and such. messageList = Array(); userList = Array(); curLine = 0; messageBox = document.getElementById("MessageBox"); Lines = Array(); //****************************** // Start Request Loop functions //****************************** function startLoop() { xmlhttp=getAjaxObject(); if (xmlhttp==null) { alert ("Your browser does not support AJAX! Please update for OmnomIRC compatibility."); return; } xmlhttp.onreadystatechange=getIncomingLine; sendRequest(); } function sendRequest() { url = "http://omnom.omnimaga.org/OmnomIRC_Dev/Update.php?lineNum=" + curLine; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function getIncomingLine() { if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") { addLine(xmlhttp.responseText); sendRequest(); } } function getAjaxObject() { xmlhttp=new XMLHttpRequest(); //Decent Browsers if (!xmlhttp || xmlhttp == undefined || xmlhttp == null) xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); //IE7+ if (!xmlhttp || xmlhttp == undefined || xmlhttp == null) xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); //IE6- return xmlhttp; } //****************************** // End Request Loop functions //******************************
//****************************** // Start Line adding functions //****************************** function addLineStart(message) { setCurLine(message); Lines[Lines.length] = message; }
function addLine(message) { var i = 1; setCurLine(message); for (i;i<Lines.length;i++) { Lines[i-1] = Lines[i]; } Lines[i-1] = message; parseMessages(); }
function setCurLine(message) { curLine = message.split(":")[0]; } //****************************** // End Line Adding Functions //******************************
//****************************** // Parser Start //****************************** function parseMessages() { text = ""; var i = 0; for (i = 0;i<Lines.length;i++) { text = text + parse(Lines[i]); } messageBox.innerHTML = text; }
function parse(message) { a = message; parts = message.split(":"); type = parts[1]; for (i = 2;i < parts.length;i++) parts[i] = atob(parts[i]); //De-base64 it. ***** WILL NOT WORK IN IE ***** switch (type) { case "join": return join(parts[2]);break; case "part": return part(parts[2],parts[3]);break; case "quit": return quit(parts[2],parts[3]);break; case "kick": return kick(parts[2],parts[3],parts[4]);break; case "message": return sendMessage(parts[2],parts[3],parts[4]);break; case "action": return action(parts[2],parts[3],parts[4]);break; case "mode": return mode(parts[2],parts[3]);break; } return ""; }
function join(name) { return name + " has joined #omnimaga" + "\n<br/>"; } function part(name,reason) { return name + " has left #omnimaga (" + reason + ")" + "\n<br/>"; } function quit(name,reason) { return name + " has quit IRC (" + reason + ")" + "\n<br/>"; } function kick(kicker,kicked,reason) { return kicker + " has kicked " + kicked + " from #omnimaga (" + reason + ")" + "\n<br/>"; } function sendMessage(name,message,isOmnom) { return "<" + name + "> " + message + "\n<br/>"; } function action(name,action) { return " * " + name + " " + action + "\n<br/>"; } function mode(name,mode) { return name + " set #omnimaga mode " + mode + "\n<br/>"; } //****************************** // Parser End //****************************** function load() { var body= document.getElementsByTagName('body')[0]; var script= document.createElement('script'); script.type= 'text/javascript'; script.src= 'Load.php?count=17'; script.onload= function(){parseMessages();startLoop();}; body.appendChild(script); } window.onLoad = load();
Edit: I have a preview of it available at http://omnom.omnimaga.org/OmnomIRC_Dev/OmnomIRCv2.html (Just spewing randomly generated data now)
600
« on: May 10, 2011, 02:52:30 pm »
Got it done, posted the source to it in the source thread. Now if Omni hangs making a post, it's not mah fault.
Pages: 1 ... 38 39 [40] 41 42 ... 123
|