*/
public function getEvent()
{
+ // Check the socket is still active
+ if (feof($this->socket)) {
+ throw new Phergie_Driver_Exception(
+ 'EOF detected on socket',
+ Phergie_Driver_Exception::ERR_CONNECTION_READ_FAILED
+ );
+ }
+
// Check for a new event on the current connection
$buffer = fgets($this->socket, 512);
case 'privmsg':
case 'notice':
- $ctcp = substr(strstr($args, ':'), 1);
- if (substr($ctcp, 0, 1) === "\x01" && substr($ctcp, -1) === "\x01") {
+ $args = $this->parseArguments($args, 2);
+ list($source, $ctcp) = $args;
+ if (substr($ctcp, 0, 1) === "\001" && substr($ctcp, -1) === "\001") {
$ctcp = substr($ctcp, 1, -1);
$reply = ($cmd == 'notice');
list($cmd, $args) = array_pad(explode(' ', $ctcp, 2), 2, null);
}
break;
case 'action':
- $args = array($this->getConnection()->getNick(), $args);
+ $args = array($source, $args);
break;
default:
if ($reply) {
$cmd .= 'Response';
}
- $args = array($this->getConnection()->getNick(), $ctcp);
+ $args = array($source, $args);
break;
}
- } else {
- $args = $this->parseArguments($args, 2);
}
break;