summaryrefslogtreecommitdiff
path: root/plugins/Irc
diff options
context:
space:
mode:
authorLuke Fitzgerald <lw.fitzgerald@googlemail.com>2010-08-05 10:48:15 -0700
committerLuke Fitzgerald <lw.fitzgerald@googlemail.com>2010-08-05 10:48:41 -0700
commit1f3dbe11989a320be6f82e9d02e8c2dbd7b1cb4d (patch)
tree6c8c53973717a5d11690fe0b623d763e164640ed /plugins/Irc
parentcb34d9519753913138d3831d16687e03d729dabc (diff)
Bot responds to channel commands via PM
Diffstat (limited to 'plugins/Irc')
-rw-r--r--plugins/Irc/IrcPlugin.php11
-rw-r--r--plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php3
-rw-r--r--plugins/Irc/ircmanager.php15
3 files changed, 12 insertions, 17 deletions
diff --git a/plugins/Irc/IrcPlugin.php b/plugins/Irc/IrcPlugin.php
index 855aa3305..5b5cab2ec 100644
--- a/plugins/Irc/IrcPlugin.php
+++ b/plugins/Irc/IrcPlugin.php
@@ -179,7 +179,16 @@ class IrcPlugin extends ImPlugin {
* @return true if processing completed, false if message should be reprocessed
*/
public function receive_raw_message($data) {
- $this->handle_incoming($data['sender'], $data['message']);
+ if (strpos($data['source'], '#') === 0) {
+ $message = $data['message'];
+ $nickpos = strpos($message, $this->nick);
+ $colonpos = strpos($message, ':', $nickpos);
+ if ($nickpos === 0 && $colonpos == strlen($this->nick)) {
+ $this->handle_incoming($data['sender'], substr($message, $colonpos+1));
+ }
+ } else {
+ $this->handle_incoming($data['sender'], $data['message']);
+ }
return true;
}
diff --git a/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php b/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php
index 694fefc06..ec2b42746 100644
--- a/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php
+++ b/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php
@@ -72,9 +72,10 @@ class Phergie_Plugin_Statusnet extends Phergie_Plugin_Abstract {
if ($this->messageCallback !== NULL) {
$event = $this->getEvent();
$source = $event->getSource();
+ $sender = $event->getNick();
$message = trim($event->getText());
- call_user_func($this->messageCallback, array('sender' => $source, 'message' => $message));
+ call_user_func($this->messageCallback, array('source' => $source, 'sender' => $sender, 'message' => $message));
}
}
diff --git a/plugins/Irc/ircmanager.php b/plugins/Irc/ircmanager.php
index 51996bef9..2ceb9db2c 100644
--- a/plugins/Irc/ircmanager.php
+++ b/plugins/Irc/ircmanager.php
@@ -65,21 +65,6 @@ class IrcManager extends ImManager {
}
/**
- * Idle processing for io manager's execution loop.
- * Send keepalive pings to server.
- *
- * @return void
- */
- public function idle() {
- // Call Phergie's doTick methods if necessary
- try {
- $this->conn->handleEvents();
- } catch (Phergie_Driver_Exception $e) {
- $this->conn->reconnect();
- }
- }
-
- /**
* Process IRC events that have come in over the wire.
*
* @param resource $socket