
Originally Posted by
HotelUnderSeige
to be honest, im not realyl sure what it is doing, it was just in the base.
Just PM me the files
update: Did you write all the OOP or get it from somewhere? There's allot of code in these files :S
upate 2:
Okay I found a bug in the first one, where you placed the new code
I think a few statements needed to be closed, because the brackets weren't matching up after I looked at it. I also re-indented some code, I hope it's organized right.
Again, it's not debugged, so it might not work.
If it fails, then reverting back to your original code is the simplest solution.
PHP Code:
<?php
/**
*
* desc : recieve an IM from the switchboard
*
* in : none
* out : a. null on fail/no message
* b. message string
*
*/
function rx_im()
{
$message = null;
$msglen = null;
stream_set_timeout($this->sb, 1);
while (!feof($this->sb))
{
$data = ($msglen) ? $this->_get($msglen) : $this->_get();
switch (substr($data, 0, 3))
{
default:
//if (empty($msglen)) continue;
$message.= strtolower($data);
if (strlen($message) >= $msglen && !empty($msglen))
{
$mesg = explode("\n", trim($message));
$last = "type 1 for people who fail, and 2 for people who win";
//if (@substr($last, 0, 10) != 'TypingUser')
if (!strstr($message, 'TypingUser'))
{
$catch = array (
'1',
'2',
'fuck you',
'fuck me',
'im not fat sorry',
'lol'
);
$response = array (
'M3GA@stoned.com, johnny10561@hotmail.com',
'HotelunderSeige',
'you to punji',
'not your fat ass',
'and im human',
'go back to thailand commi, nothing is funny there'
);
$default = array (
'speak english you dumb cunt',
"I can't understand a word you're saying.."
);
if(eregi('hey',$mesg)>0)
{
return $last;
}
else if(strlen($mesg)>0)
{
for($i=0;$i<count($catch);$i++)
{
if(eregi($catch[$i],$mesg)>0)
{
return $response[$i];
}
}
}
$msglen = null;
$message = null;
}
}
if ($this->session_start_time + 10 < time())
{
// looks like we've been idle for a while
echo 'IM timed out';
$this->im_close();
return null;
}
break;
case 'MSG':
list(,,, $msglen) = explode (' ', $data);
break;
case 'BYE':
return null;
break;
}
}
return null;
}
?>