Skip to content
Browse files

Merge pull request #246 from Drarok/drarok/targeted-reminders

Implementation of targeted reminders.
  • Loading branch information...
2 parents 07f9145 + e2e5d83 commit 374618cb35e0711a06e2e4160f911824f0c79744 @elazar elazar committed Jan 24, 2013
Showing with 18 additions and 0 deletions.
  1. +18 −0 Phergie/Plugin/Remind.php
View
18 Phergie/Plugin/Remind.php
@@ -30,6 +30,7 @@
* @link http://pear.phergie.org/package/Phergie_Plugin_Remind
* @uses Phergie_Plugin_Command pear.phergie.org
* @uses Phergie_Plugin_Time pear.phergie.org
+ * @uses Phergie_Plugin_Remind pear.phergie.org optional
* @uses extension PDO
* @uses extension pdo_sqlite
*/
@@ -48,6 +49,13 @@ class Phergie_Plugin_Remind extends Phergie_Plugin_Abstract
protected $remindOnJoin = false;
/**
+ * Respond *only* to targeted reminders or not.
+ *
+ * @var bool
+ */
+ protected $onlyTargetedReminders = false;
+
+ /**
* PDO resource for a SQLite database containing the reminders.
*
* @var resource
@@ -100,6 +108,11 @@ public function onLoad()
$this->remindOnJoin = (bool) $this->config['remind.remind_on_join'];
}
+ if (isset($this->config['remind.only_targeted_reminders'])) {
+ $plugins->getPlugin('Message');
+ $this->onlyTargetedReminders = (bool) $this->config['remind.only_targeted_reminders'];
+ }
+
try {
$this->db = new PDO('sqlite:' . $path);
$this->createTables();
@@ -195,6 +208,11 @@ public function onCommandRemind($recipient, $message)
*/
protected function handleRemind($recipient, $message)
{
+ // Don't do anything if we are only responding to targeted reminders and this isn't a targeted message.
+ if ($this->onlyTargetedReminders && ! $this->plugins->message->isTargetedMessage()) {
+ return;
+ }
+
$source = $this->getEvent()->getSource();
$nick = $this->getEvent()->getNick();

0 comments on commit 374618c

Please sign in to comment.
Something went wrong with that request. Please try again.