diff options
author | Luke Fitzgerald <lw.fitzgerald@googlemail.com> | 2010-08-07 13:25:05 -0700 |
---|---|---|
committer | Luke Fitzgerald <lw.fitzgerald@googlemail.com> | 2010-08-07 13:25:05 -0700 |
commit | e23ad0bdb34418161b46d4b15a5306ceb6a8a5a1 (patch) | |
tree | 45bce87ab0d512ec55f629d8cad89107106c7bd5 /plugins/Irc/extlib/phergie | |
parent | a6e865c47ad923f2c4cf97b1966f9eb9baad4553 (diff) |
Commands can now be whitelisted to allow response to the channel
Diffstat (limited to 'plugins/Irc/extlib/phergie')
-rw-r--r-- | plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php b/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php index ec2b42746..fb75f1d79 100644 --- a/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php +++ b/plugins/Irc/extlib/phergie/Phergie/Plugin/Statusnet.php @@ -75,7 +75,18 @@ class Phergie_Plugin_Statusnet extends Phergie_Plugin_Abstract { $sender = $event->getNick();
$message = trim($event->getText());
- call_user_func($this->messageCallback, array('source' => $source, 'sender' => $sender, 'message' => $message));
+ if (strpos($source, '#') === 0) {
+ $botNick = $this->getConnection()->getNick();
+ $nickPos = strpos($message, $botNick);
+ $nickLen = strlen($botNick);
+ $colonPos = strpos($message, ':', $nickLen);
+ $commandStr = trim(substr($message, $colonPos+1));
+ if ($nickPos === 0 && $colonPos == $nickLen && !empty($commandStr)) {
+ call_user_func($this->messageCallback, array('source' => $source, 'sender' => $sender, 'message' => $commandStr));
+ }
+ } else {
+ call_user_func($this->messageCallback, array('source' => $source, 'sender' => $sender, 'message' => $message));
+ }
}
}
|