summaryrefslogtreecommitdiff
path: root/plugins/Imap/ImapPlugin.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-01-13 15:35:53 -0500
committerCraig Andrews <candrews@integralblue.com>2010-01-13 15:35:53 -0500
commit681065d7342f209800014a54e400a687f615640c (patch)
treeec76b81f1a2937bb5c1084a186bab96612a16c13 /plugins/Imap/ImapPlugin.php
parentc3188fd1fece2be7f7c4211d28f4a3d3a59c8fa1 (diff)
Made the IMAP plugin work in the style of the new queue/iomanagers
Diffstat (limited to 'plugins/Imap/ImapPlugin.php')
-rw-r--r--plugins/Imap/ImapPlugin.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/plugins/Imap/ImapPlugin.php b/plugins/Imap/ImapPlugin.php
index d9768b680..89a775a16 100644
--- a/plugins/Imap/ImapPlugin.php
+++ b/plugins/Imap/ImapPlugin.php
@@ -46,8 +46,6 @@ class ImapPlugin extends Plugin
public $user;
public $password;
public $poll_frequency = 60;
- public static $instances = array();
- public static $daemon_added = array();
function initialize(){
if(!isset($this->mailbox)){
@@ -63,24 +61,34 @@ class ImapPlugin extends Plugin
throw new Exception("must specify a poll_frequency");
}
- self::$instances[] = $this;
return true;
}
- function cleanup(){
- $index = array_search($this, self::$instances);
- unset(self::$instances[$index]);
- return true;
+ /**
+ * Load related modules when needed
+ *
+ * @param string $cls Name of the class to be loaded
+ *
+ * @return boolean hook value; true means continue processing, false means stop.
+ */
+ function onAutoload($cls)
+ {
+ $dir = dirname(__FILE__);
+
+ switch ($cls)
+ {
+ case 'ImapManager':
+ case 'IMAPMailHandler':
+ include_once $dir . '/'.strtolower($cls).'.php';
+ return false;
+ default:
+ return true;
+ }
}
- function onGetValidDaemons($daemons)
+ function onStartIoManagerClasses(&$classes)
{
- if(! self::$daemon_added){
- array_push($daemons, INSTALLDIR .
- '/plugins/Imap/imapdaemon.php');
- self::$daemon_added = true;
- }
- return true;
+ $classes[] = new ImapManager($this);
}
function onPluginVersion(&$versions)