]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Imap/ImapPlugin.php
Merge branch 'testing' into 0.9.x
[quix0rs-gnu-social.git] / plugins / Imap / ImapPlugin.php
index d9768b680205e8e31b3aed737fa9adae7bacf523..d1e920b009111d42f40f565bda2413beadc452d1 100644 (file)
@@ -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 onStartQueueDaemonIoManagers(&$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)