Remove unneeded IMP_Imap binder
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:45:45 +0000 (13:45 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 4 Oct 2010 19:45:45 +0000 (13:45 -0600)
40 files changed:
imp/compose-mimp.php
imp/compose.php
imp/folders.php
imp/lib/Ajax/Application.php
imp/lib/Api.php
imp/lib/Application.php
imp/lib/Auth.php
imp/lib/Block/Newmail.php
imp/lib/Compose.php
imp/lib/Contents.php
imp/lib/Filter.php
imp/lib/Folder.php
imp/lib/IMP.php
imp/lib/Imap/Acl.php
imp/lib/Imap/Flags.php
imp/lib/Imap/Tree.php
imp/lib/Imap/Tree/Element.php
imp/lib/Indices.php
imp/lib/Injector/Binder/Imap.php [deleted file]
imp/lib/Injector/Binder/Mail.php
imp/lib/Injector/Binder/Quota.php
imp/lib/Injector/Factory/Imap.php
imp/lib/LoginTasks/SystemTask/UpgradeFromImp4.php
imp/lib/Mailbox/List.php
imp/lib/Message.php
imp/lib/Notification/Handler/Decorator/Imap.php
imp/lib/Prefs/Ui.php
imp/lib/Search.php
imp/lib/Spam.php
imp/lib/Ui/Block.php
imp/lib/Ui/Message.php
imp/lib/Views/ListMessages.php
imp/lib/Views/ShowMessage.php
imp/mailbox-mimp.php
imp/mailbox.php
imp/message-dimp.php
imp/message-mimp.php
imp/message.php
imp/scripts/query-imap-cache.php
imp/thread.php

index a700544..d974fe9 100644 (file)
@@ -64,7 +64,7 @@ $sent_mail_folder = $identity->getValue('sent_mail_folder');
 
 /* Determine if mailboxes are readonly. */
 $readonly_drafts = false;
-$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
 if (!empty($draft)) {
     $draft = IMP::folderPref($draft, true);
     $readonly_drafts = $imp_folder->exists($draft) &&
index a8e71c2..5cefdfb 100644 (file)
@@ -98,7 +98,7 @@ $compose_disable = !IMP::canCompose();
 $imp_folder = $injector->getInstance('IMP_Folder');
 $readonly_drafts = $readonly_sentmail = false;
 $draft = $prefs->getValue('drafts_folder');
-$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
 if (!empty($draft)) {
     $draft = IMP::folderPref($draft, true);
     $readonly_drafts = $imp_folder->exists($draft) &&
index fe02376..b71398a 100644 (file)
@@ -166,7 +166,7 @@ case 'rename_folder':
     if (!empty($new_names) &&
         !empty($old_names) &&
         ($iMax == count($old_names))) {
-        $imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
         for ($i = 0; $i < $iMax; ++$i) {
             $old_name = IMP::formMbox($old_names[$i], false);
             $old_ns = $imp_imap->getNamespace($old_name);
@@ -246,7 +246,7 @@ case 'folders_empty_mailbox_confirm':
             }
 
             try {
-                $elt_info = $injector->getInstance('IMP_Imap')->getOb()->status($val, Horde_Imap_Client::STATUS_MESSAGES);
+                $elt_info = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->status($val, Horde_Imap_Client::STATUS_MESSAGES);
             } catch (Horde_Imap_Client_Exception $e) {
                 $elt_info = null;
             }
@@ -415,7 +415,7 @@ if (!empty($imaptree->recent)) {
     /* Open the mailbox R/W so we ensure the 'recent' flags are cleared from
      * the current mailbox. */
     foreach ($imaptree->recent as $mbox => $nm) {
-        $injector->getInstance('IMP_Imap')->getOb()->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE);
+        $injector->getInstance('IMP_Injector_Factory_Imap')->create()->openMailbox($mbox, Horde_Imap_Client::OPEN_READWRITE);
     }
 
     IMP::newmailAlerts($imaptree->recent);
index 2e756c3..c07533c 100644 (file)
@@ -452,7 +452,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $result = new stdClass;
         $result->poll = array();
 
-        foreach ($GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->statusMultiple($GLOBALS['injector']->getInstance('IMP_Imap_Tree')->getPollList(), Horde_Imap_Client::STATUS_UNSEEN) as $key => $val) {
+        foreach ($GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->statusMultiple($GLOBALS['injector']->getInstance('IMP_Imap_Tree')->getPollList(), Horde_Imap_Client::STATUS_UNSEEN) as $key => $val) {
             $result->poll[$key] = intval($val['unseen']);
         }
 
@@ -506,7 +506,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         if ($this->_vars->add) {
             $imptree->addPollList($this->_vars->mbox);
             try {
-                if ($info = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->_vars->mbox, Horde_Imap_Client::STATUS_UNSEEN)) {
+                if ($info = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->_vars->mbox, Horde_Imap_Client::STATUS_UNSEEN)) {
                     $result->poll = array($this->_vars->mbox => intval($info['unseen']));
                 }
             } catch (Horde_Imap_Client_Exception $e) {}
@@ -1444,7 +1444,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         }
 
         try {
-            $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_vars->view, array(
+            $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_vars->view, array(
                 Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false))
             ), array('ids' => array($this->_vars->uid)));
         } catch (Horde_Imap_Client_Exception $e) {
@@ -1875,7 +1875,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
     protected function _checkUidvalidity($result = false)
     {
         try {
-            $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->checkUidvalidity($this->_vars->view);
+            $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->checkUidvalidity($this->_vars->view);
         } catch (IMP_Exception $e) {
             if (!is_object($result)) {
                 $result = new stdClass;
@@ -1967,7 +1967,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
          * on the IMAP server (saves some STATUS calls). */
         if (!is_null($rw)) {
             try {
-                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->openMailbox($this->_vars->view, $rw ? Horde_Imap_Client::OPEN_READWRITE : Horde_Imap_Client::OPEN_AUTO);
+                $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->openMailbox($this->_vars->view, $rw ? Horde_Imap_Client::OPEN_READWRITE : Horde_Imap_Client::OPEN_AUTO);
             } catch (Horde_Imap_Client_Exception $e) {
                 if ($e->getCode() == Horde_Imap_Client_Exception::MAILBOX_NOOPEN) {
                     $GLOBALS['notification']->push(sprintf(_("Could not open mailbox \"%s\"."), $this->_vars->view), 'horde.error');
index 908cfa0..234694a 100644 (file)
@@ -88,7 +88,7 @@ class IMP_Api extends Horde_Registry_Api
      */
     public function createFolder($folder)
     {
-        $fname = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($folder);
+        $fname = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->appendNamespace($folder);
         return $GLOBALS['injector']->getInstance('IMP_Folder')->create($fname, $GLOBALS['prefs']->getValue('subscribe'))
             ? $fname
             : false;
@@ -213,7 +213,7 @@ class IMP_Api extends Horde_Registry_Api
      */
     public function imapOb()
     {
-        return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->ob;
+        return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->ob;
     }
 
     /**
index 10c333d..7f27a6d 100644 (file)
@@ -94,7 +94,6 @@ class IMP_Application extends Horde_Registry_Application
             'IMP_Crypt_Pgp' => new IMP_Injector_Binder_Pgp(),
             'IMP_Crypt_Smime' => new IMP_Injector_Binder_Smime(),
             'IMP_Identity' => new IMP_Injector_Binder_Identity(),
-            'IMP_Imap' => new IMP_Injector_Binder_Imap(),
             'IMP_Imap_Tree' => new IMP_Injector_Binder_Imaptree(),
             'IMP_Mail' => new IMP_Injector_Binder_Mail(),
             'IMP_Mailbox_List' => new IMP_Injector_Binder_MailboxList(),
@@ -244,7 +243,7 @@ class IMP_Application extends Horde_Registry_Application
                 $trash_folder = IMP::folderPref($trash_folder, true);
 
                 if ($injector->getInstance('IMP_Search')->isVTrash($trash_folder) ||
-                    !$injector->getInstance('IMP_Imap')->getOb()->isReadOnly($trash_folder)) {
+                    !$injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly($trash_folder)) {
                     $menu->addArray(array(
                         'class' => '__noselection',
                         'icon' => 'empty_trash.png',
index 9970aec..74ea49a 100644 (file)
@@ -43,7 +43,7 @@ class IMP_Auth
             throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         // Check for valid IMAP Client object.
         if (!$imp_imap->ob) {
@@ -153,7 +153,7 @@ class IMP_Auth
         }
 
         $auth_id = $GLOBALS['registry']->getAuth();
-        $imap_ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imap_ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         $msg = sprintf(
             $msg . ' %s [%s]%s to {%s:%s%s}',
@@ -218,7 +218,7 @@ class IMP_Auth
         );
 
         /* Load the server configuration. */
-        $ptr = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->loadServerConfig($credentials['server']);
+        $ptr = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->loadServerConfig($credentials['server']);
         if ($ptr === false) {
             throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
         }
@@ -300,7 +300,7 @@ class IMP_Auth
      */
     static protected function _canAutoLogin($server_key = null, $force = false)
     {
-        if (($servers = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->loadServerConfig()) === false) {
+        if (($servers = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->loadServerConfig()) === false) {
             return false;
         }
 
@@ -385,7 +385,7 @@ class IMP_Auth
 
         $sess = &$_SESSION['imp'];
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         $ptr = $imp_imap->loadServerConfig($sess['server_key']);
         if ($ptr === false) {
             throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
index 83a2098..2375eda 100644 (file)
@@ -39,7 +39,7 @@ class IMP_Block_Newmail extends Horde_Block
                 : $this->_params['msgs_shown'];
 
             try {
-                $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch('INBOX', array(
+                $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch('INBOX', array(
                     Horde_Imap_Client::FETCH_ENVELOPE => true
                 ), array('ids' => array_slice($indices, 0, $shown)));
                 reset($fetch_ret);
index cffb590..c18c6ce 100644 (file)
@@ -215,7 +215,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         /* Add information necessary to log replies/forwards when finally
          * sent. */
         if ($this->getMetadata('reply_type')) {
-            $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+            $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
             try {
                 $imap_url = $imp_imap->getUtils()->createUrl(array(
                     'type' => $_SESSION['imp']['protocol'],
@@ -283,7 +283,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
         /* Add the message to the mailbox. */
         try {
-            $ids = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags)));
+            $ids = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->append($drafts_mbox, array(array('data' => $data, 'flags' => $append_flags)));
 
             if ($old_uid) {
                 $GLOBALS['injector']->getInstance('IMP_Message')->delete($old_uid, array('nuke' => true));
@@ -399,7 +399,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         }
 
         if ($val) {
-            $imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+            $imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->crerate();
             $imap_url = $imp_imap->getUtils()->parseUrl(rtrim(ltrim($val, '<'), '>'));
 
             try {
@@ -685,7 +685,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             }
 
             try {
-                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->append($opts['sent_folder'], array(array('data' => $fcc, 'flags' => $flags)));
+                $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->append($opts['sent_folder'], array(array('data' => $fcc, 'flags' => $flags)));
             } catch (Horde_Imap_Client_Exception $e) {
                 $notification->push(sprintf(_("Message sent successfully, but not saved to %s"), IMP::displayFolder($opts['sent_folder'])));
                 $sent_saved = false;
@@ -1316,7 +1316,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $subject = $h->getValue('subject');
         $header['subject'] = empty($subject)
             ? 'Re: '
-            : 'Re: ' . $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->getBaseSubject($subject, array('keepblob' => true));
+            : 'Re: ' . $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->getBaseSubject($subject, array('keepblob' => true));
 
         $force = false;
         if (in_array($type, array('reply', 'reply_auto', '*'))) {
@@ -1595,7 +1595,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
 
         $header['subject'] = $h->getValue('subject');
         if (!empty($header['subject'])) {
-            $subject = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->getBaseSubject($header['subject'], array('keepblob' => true));
+            $subject = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->getBaseSubject($header['subject'], array('keepblob' => true));
             $header['title'] = _("Forward") . ': ' . $subject;
             $header['subject'] = 'Fwd: ' . $subject;
         } else {
@@ -1812,7 +1812,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
             } else {
                 $name = Horde_String::truncate($name, 80);
             }
-            return 'Fwd: ' . $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->getBaseSubject($name, array('keepblob' => true));
+            return 'Fwd: ' . $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->getBaseSubject($name, array('keepblob' => true));
         }
 
         return 'Fwd: ' . sprintf(_("%u Forwarded Messages"), $attached);
index 3c7a7cd..6a4ada1 100644 (file)
@@ -99,7 +99,7 @@ class IMP_Contents
 
             /* Get the Horde_Mime_Part object for the given UID. */
             try {
-                $ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array(
+                $ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array(
                     Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true)
                 ), array('ids' => array($this->_uid)));
             } catch (Horde_Imap_Client_Exception $e) {
@@ -153,7 +153,7 @@ class IMP_Contents
         }
 
         try {
-            $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array(
+            $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array(
                 Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream'])))
             ), array('ids' => array($this->_uid)));
             return $res[$this->_uid]['bodytext'][0];
@@ -212,7 +212,7 @@ class IMP_Contents
         }
 
         try {
-            $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, $query, array('ids' => array($this->_uid)));
+            $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, $query, array('ids' => array($this->_uid)));
             if (empty($options['mimeheaders'])) {
                 if (!empty($res[$this->_uid]['bodypartdecode'][$id])) {
                     $this->lastBodyPartDecode = $res[$this->_uid]['bodypartdecode'][$id];
@@ -250,7 +250,7 @@ class IMP_Contents
         }
 
         try {
-            $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array(
+            $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array(
                 Horde_Imap_Client::FETCH_HEADERTEXT => array(array('peek' => true)),
                 Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true, 'stream' => !empty($options['stream'])))
             ), array('ids' => array($this->_uid)));
@@ -284,7 +284,7 @@ class IMP_Contents
         }
 
         try {
-            $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($this->_mailbox, array(
+            $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($this->_mailbox, array(
                 Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => $parse, 'peek' => true))
             ), array('ids' => array($this->_uid)));
             return $res[$this->_uid]['headertext'][0];
index 3d74d77..2e06206 100644 (file)
@@ -111,7 +111,7 @@ class IMP_Filter
         }
 
         $addr = array();
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         foreach (array_keys($indices) as $mbox) {
             $imp_imap->checkUidvalidity($mbox);
index 9ca4050..10b947e 100644 (file)
@@ -55,7 +55,7 @@ class IMP_Folder
             }
 
             try {
-                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->deleteMailbox($folder);
+                $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->deleteMailbox($folder);
                 $notification->push(sprintf(_("The folder \"%s\" was successfully deleted."), IMP::displayFolder($folder)), 'horde.success');
                 $deleted[] = $folder;
             } catch (Horde_Imap_Client_Exception $e) {
@@ -144,7 +144,7 @@ class IMP_Folder
 
         /* Attempt to create the mailbox. */
         try {
-            $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->createMailbox($folder, array('special_use' => $special_use));
+            $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->createMailbox($folder, array('special_use' => $special_use));
         } catch (Horde_Imap_Client_Exception $e) {
             $notification->push(sprintf(_("The folder \"%s\" was not created. This is what the server said"), IMP::displayFolder($folder)) . ': ' . $e->getMessage(), 'horde.error');
             return false;
@@ -178,7 +178,7 @@ class IMP_Folder
         }
 
         try {
-            $ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listMailboxes($folder, array('flat' => true));
+            $ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listMailboxes($folder, array('flat' => true));
             return !empty($ret);
         } catch (Horde_Imap_Client_Exception $e) {
             return false;
@@ -219,7 +219,7 @@ class IMP_Folder
         $all_folders = array_merge(array($old), array_keys(iterator_to_array($imaptree)));
 
         try {
-            $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->renameMailbox($old, $new);
+            $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->renameMailbox($old, $new);
         } catch (Horde_Imap_Client_Exception $e) {
             $GLOBALS['notification']->push(sprintf(_("Renaming \"%s\" to \"%s\" failed. This is what the server said"), IMP::displayFolder($old), IMP::displayFolder($new)) . ': ' . $e->getMessage(), 'horde.error');
             return false;
@@ -263,7 +263,7 @@ class IMP_Folder
 
         foreach (array_filter($folders) as $folder) {
             try {
-                $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->subscribeMailbox($folder, true);
+                $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->subscribeMailbox($folder, true);
                 $notification->push(sprintf(_("You were successfully subscribed to \"%s\""), IMP::displayFolder($folder)), 'horde.success');
                 $subscribed[] = $folder;
             } catch (Horde_Imap_Client_Exception $e) {
@@ -303,7 +303,7 @@ class IMP_Folder
                 $notification->push(sprintf(_("You cannot unsubscribe from \"%s\"."), IMP::displayFolder($folder)), 'horde.error');
             } else {
                 try {
-                    $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->subscribeMailbox($folder, false);
+                    $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->subscribeMailbox($folder, false);
                     $notification->push(sprintf(_("You were successfully unsubscribed from \"%s\""), IMP::displayFolder($folder)), 'horde.success');
                     $unsubscribed[] = $folder;
                 } catch (Horde_Imap_Client_Exception $e) {
@@ -344,7 +344,7 @@ class IMP_Folder
 
         foreach ($folder_list as $folder) {
             try {
-                $status = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($folder, Horde_Imap_Client::STATUS_MESSAGES);
+                $status = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($folder, Horde_Imap_Client::STATUS_MESSAGES);
             } catch (Horde_Imap_Client_Exception $e) {
                 continue;
             }
@@ -352,7 +352,7 @@ class IMP_Folder
                 /* Download one message at a time to save on memory
                  * overhead. */
                 try {
-                    $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($folder, array(
+                    $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($folder, array(
                         Horde_Imap_Client::FETCH_FULLMSG => array('peek' => true, 'stream' => true),
                         Horde_Imap_Client::FETCH_ENVELOPE => true,
                         Horde_Imap_Client::FETCH_DATE => true,
@@ -397,7 +397,7 @@ class IMP_Folder
     {
         $message = '';
         $msgcount = 0;
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         $fd = fopen($mbox, 'r');
         while (!feof($fd)) {
index 97f54ff..b946aad 100644 (file)
@@ -356,7 +356,7 @@ class IMP
             return $cache[$folder];
         }
 
-        $ns_info = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getNamespace($folder);
+        $ns_info = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespace($folder);
         $delimiter = is_null($ns_info) ? '' : $ns_info['delimiter'];
 
         /* Substitute any translated prefix text. */
@@ -556,7 +556,7 @@ class IMP
      */
     static public function folderPref($folder, $append)
     {
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         $def_ns = $imp_imap->defaultNamespace();
         $empty_ns = $imp_imap->getNamespace('');
 
index bdc4d30..8a3da2f 100644 (file)
@@ -45,7 +45,7 @@ class IMP_Imap_Acl
             throw new IMP_Exception(_("ACLs not configured for this server."));
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         if (!$imp_imap->queryCapability('ACL')) {
             throw new IMP_Exception(_("IMAP server does not support ACLs."));
         }
@@ -129,7 +129,7 @@ class IMP_Imap_Acl
     public function getACL($mbox)
     {
         try {
-            return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getACL($mbox);
+            return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getACL($mbox);
         } catch (Horde_Imap_Client_Exception $e) {
             throw new IMP_Exception(_("Could not retrieve ACL"));
         }
@@ -147,7 +147,7 @@ class IMP_Imap_Acl
     public function editACL($mbox, $user, $acl)
     {
         try {
-            $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->setACL($mbox, $user, array('remove' => empty($acl), 'rights' => implode('', $acl)));
+            $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->setACL($mbox, $user, array('remove' => empty($acl), 'rights' => implode('', $acl)));
         } catch (Horde_Imap_Client_Exception $e) {
             throw new IMP_Exception(sprintf(_("Couldn't give user \"%s\" the following rights for the folder \"%s\": %s"), $user, $mbox, implode('', $acl)));
         }
@@ -164,7 +164,7 @@ class IMP_Imap_Acl
     public function canEdit($mbox, $user)
     {
         try {
-            $rights = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listACLRights($mbox, $user);
+            $rights = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listACLRights($mbox, $user);
             $rights = array_merge($rights['required'], $rights['optional']);
             foreach ($rights as $val) {
                 if (strpos($val, 'a') !== false) {
index c6eacb4..d80fe42 100644 (file)
@@ -97,7 +97,7 @@ class IMP_Imap_Flags
             try {
                 /* Make sure we are in R/W mailbox mode (SELECT). No flags are
                  * allowed in EXAMINE mode. */
-                $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+                $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
                 $imp_imap->openMailbox($options['mailbox'], Horde_Imap_Client::OPEN_READWRITE);
                 $status = $imp_imap->status($options['mailbox'], Horde_Imap_Client::STATUS_PERMFLAGS);
 
@@ -181,7 +181,7 @@ class IMP_Imap_Flags
 
         /* IMAP keywords must conform to RFC 3501 [9] (flag-keyword). Convert
          * whitespace to underscore. */
-        $key = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), 'UTF-8', 'UTF7-IMAP'));
+        $key = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), 'UTF-8', 'UTF7-IMAP'));
         if (!isset($this->_flags[$key])) {
             $entry = $this->_createEntry($label);
 
index 5413948..b9318b2 100644 (file)
@@ -165,7 +165,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable
     public function __construct()
     {
         if ($_SESSION['imp']['protocol'] == 'imap') {
-            $ns = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getNamespaceList();
+            $ns = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespaceList();
             $ptr = reset($ns);
             $this->_delimiter = $ptr['delimiter'];
             $this->_namespaces = empty($GLOBALS['conf']['user']['allow_folders'])
@@ -261,7 +261,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable
         }
 
         try {
-            $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+            $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
             $result = $imp_imap->listMailboxes($searches, $showunsub ? Horde_Imap_Client::MBOX_ALL : Horde_Imap_Client::MBOX_SUBSCRIBED_EXISTS, array('attributes' => true, 'delimiter' => true, 'sort' => true));
 
             /* INBOX must always appear. */
@@ -467,7 +467,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable
 
         if (!empty($id)) {
             try {
-                $this->_insert($GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listMailboxes($id, Horde_Imap_Client::MBOX_ALL, array('attributes' => true, 'delimiter' => true, 'sort' => true)));
+                $this->_insert($GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listMailboxes($id, Horde_Imap_Client::MBOX_ALL, array('attributes' => true, 'delimiter' => true, 'sort' => true)));
             } catch (Horde_Imap_Client_Exception $e) {}
         }
     }
@@ -1259,7 +1259,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable
     {
         if (!in_array($mailbox, array(self::OTHER_KEY, self::SHARED_KEY, self::VFOLDER_KEY)) &&
             (strpos($mailbox, self::VFOLDER_KEY . $this->_delimiter) !== 0)) {
-            return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getNamespace($mailbox);
+            return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getNamespace($mailbox);
         }
         return null;
     }
@@ -1426,7 +1426,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable
     public function createMailboxName($parent, $new)
     {
         $ns_info = empty($parent)
-            ? $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->defaultNamespace()
+            ? $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->defaultNamespace()
             : $this->_getNamespace($parent);
 
         if (is_null($ns_info)) {
index f4b9284..e1cbff3 100644 (file)
@@ -155,7 +155,7 @@ class IMP_Imap_Tree_Element
             $info->unseen = 0;
 
             try {
-                if ($msgs_info = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->value, Horde_Imap_Client::STATUS_RECENT | Horde_Imap_Client::STATUS_UNSEEN | Horde_Imap_Client::STATUS_MESSAGES)) {
+                if ($msgs_info = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->value, Horde_Imap_Client::STATUS_RECENT | Horde_Imap_Client::STATUS_UNSEEN | Horde_Imap_Client::STATUS_MESSAGES)) {
                     if (!empty($msgs_info['recent'])) {
                         $info->recent = intval($msgs_info['recent']);
                     }
index c620498..9179c81 100644 (file)
@@ -81,7 +81,7 @@ class IMP_Indices implements Countable, Iterator
                     }
                 }
             } elseif (is_string($data)) {
-                $indices = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->fromSequenceString($data);
+                $indices = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->fromSequenceString($data);
             } elseif ($data instanceof IMP_Compose) {
                 $indices = array(
                     $data->getMetadata('mailbox') => array($data->getMetadata('uid'))
@@ -178,7 +178,7 @@ class IMP_Indices implements Countable, Iterator
      */
     public function __toString()
     {
-        return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getUtils()->toSequenceString($this->_indices, array('mailbox' => true));
+        return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getUtils()->toSequenceString($this->_indices, array('mailbox' => true));
     }
 
     /* Iterator methods. */
diff --git a/imp/lib/Injector/Binder/Imap.php b/imp/lib/Injector/Binder/Imap.php
deleted file mode 100644 (file)
index ab9fa5d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Binder for IMP_Imap::.
- *
- * Copyright 2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author   Michael Slusarz <slusarz@horde.org>
- * @category Horde
- * @license  http://www.fsf.org/copyleft/gpl.html GPL
- * @package  IMP
- */
-class IMP_Injector_Binder_Imap implements Horde_Injector_Binder
-{
-    /**
-     */
-    public function create(Horde_Injector $injector)
-    {
-        return new IMP_Injector_Factory_Imap($injector);
-    }
-
-    /**
-     */
-    public function equals(Horde_Injector_Binder $binder)
-    {
-        return false;
-    }
-
-}
index 265b38b..b8d104b 100644 (file)
@@ -36,7 +36,7 @@ class IMP_Injector_Binder_Mail implements Horde_Injector_Binder
          * current IMAP / POP3 connection are valid for SMTP authentication as
          * well. */
         if (!empty($params['auth']) && empty($params['username'])) {
-            $imap_ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+            $imap_ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
             $params['username'] = $imap_ob->getParam('username');
             $params['password'] = $imap_ob->getParam('password');
         }
index e28c16a..af77695 100644 (file)
@@ -32,14 +32,14 @@ class IMP_Injector_Binder_Quota implements Horde_Injector_Binder
 
         switch (Horde_String::lower($driver)) {
         case 'imap':
-            $params['imap_ob'] = $injector->getInstance('IMP_Imap')->getOb();
+            $params['imap_ob'] = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
             $params['mbox'] = $injector->getInstance('IMP_Search')->isSearchMbox(IMP::$mailbox)
                 ? 'INBOX'
                 : IMP::$mailbox;
             break;
 
         case 'maildir':
-            $params['username'] = $injector->getInstance('IMP_Imap')->getOb()->getParam('username');
+            $params['username'] = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->getParam('username');
             break;
 
         case 'sql':
index f9115bb..a8b9de9 100644 (file)
@@ -35,31 +35,14 @@ class IMP_Injector_Factory_Imap
     private $_instances = array();
 
     /**
-     * The injector.
-     *
-     * @var Horde_Injector
-     */
-    private $_injector;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Injector $injector  The injector to use.
-     */
-    public function __construct(Horde_Injector $injector)
-    {
-        $this->_injector = $injector;
-    }
-
-    /**
      * Return the IMP_Imap:: instance.
      *
      * @param string $id  The server ID.
      *
-     * @return IMP_Imap  The singleton contents instance.
+     * @return IMP_Imap  The singleton instance.
      * @throws IMP_Exception
      */
-    public function getOb($id = null)
+    public function create($id = null)
     {
         if (is_null($id)) {
             $id = isset($_SESSION['imp'])
index 5e8748d..fdf02c0 100644 (file)
@@ -73,7 +73,7 @@ class IMP_LoginTasks_SystemTask_UpgradeFromImp4 extends Horde_LoginTasks_SystemT
     protected function _upgradeExpireImapCache()
     {
         try {
-            $ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->ob;
+            $ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->ob;
             $ob->login();
 
             $mboxes = $ob->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array('flat' => true));
index d2a9b2b..f93ff29 100644 (file)
@@ -157,7 +157,7 @@ class IMP_Mailbox_List implements Countable, Serializable
             $fetch_criteria[Horde_Imap_Client::FETCH_STRUCTURE] = array('parse' => true);
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         if (empty($options['preview'])) {
             $cache = null;
@@ -345,7 +345,7 @@ class IMP_Mailbox_List implements Countable, Serializable
         }
 
         $criteria = new Horde_Imap_Client_Search_Query();
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         if (IMP::hideDeletedMsgs($this->_mailbox)) {
             $criteria->flag('\\deleted', false);
@@ -448,7 +448,7 @@ class IMP_Mailbox_List implements Countable, Serializable
         $ret['anymsg'] = true;
         if (!$ret['msgcount'] && !$this->_searchmbox) {
             try {
-                $status = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->_mailbox, Horde_Imap_Client::STATUS_MESSAGES);
+                $status = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->_mailbox, Horde_Imap_Client::STATUS_MESSAGES);
                 $ret['anymsg'] = (bool)$status['messages'];
             } catch (Horde_Imap_Client_Exception $e) {
                 $ret['anymsg'] = false;
@@ -489,7 +489,7 @@ class IMP_Mailbox_List implements Countable, Serializable
              * information is returned via a SELECT/EXAMINE call. */
             if ($sortpref['by'] == Horde_Imap_Client::SORT_SEQUENCE) {
                 try {
-                    $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN);
+                    $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN);
                     if (!is_null($res['firstunseen'])) {
                         return $res['firstunseen'];
                     }
@@ -521,7 +521,7 @@ class IMP_Mailbox_List implements Countable, Serializable
     {
         if (is_null($this->_threadob)) {
             try {
-                $this->_threadob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->thread($this->_mailbox, array('criteria' => $_SESSION['imp']['imap']['thread']));
+                $this->_threadob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->thread($this->_mailbox, array('criteria' => $_SESSION['imp']['imap']['thread']));
             } catch (Horde_Imap_Client_Exception $e) {
                 $GLOBALS['notification']->push($e);
                 return new Horde_Imap_Client_Thread(array(), 'uid');
@@ -658,7 +658,7 @@ class IMP_Mailbox_List implements Countable, Serializable
         if (!$this->_searchmbox) {
             $sortpref = IMP::getSort($this->_mailbox, true);
             try {
-                return $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->getCacheId($this->_mailbox, array($sortpref['by'], $sortpref['dir']));
+                return $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->getCacheId($this->_mailbox, array($sortpref['by'], $sortpref['dir']));
             } catch (Horde_Imap_Client_Exception $e) {}
         }
 
index f86d7e8..73ead06 100644 (file)
@@ -105,7 +105,7 @@ class IMP_Message
             break;
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         foreach ($indices->indices() as $mbox => $msgIndices) {
             $error = null;
@@ -211,7 +211,7 @@ class IMP_Message
             }
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         foreach ($indices->indices() as $mbox => $msgIndices) {
             $error = null;
@@ -486,7 +486,7 @@ class IMP_Message
             return;
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         if ($imp_imap->isReadOnly($mbox)) {
             throw new IMP_Exception(_("Cannot strip the MIME part as the mailbox is read-only."));
@@ -624,7 +624,7 @@ class IMP_Message
         $action_array = $action
             ? array('add' => $flags)
             : array('remove' => $flags);
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         foreach ($indices->indices() as $mbox => $msgIndices) {
             $error = null;
@@ -679,7 +679,7 @@ class IMP_Message
         $action_array = $action
             ? array('add' => $flags)
             : array('remove' => $flags);
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         foreach ($mboxes as $val) {
             try {
@@ -719,7 +719,7 @@ class IMP_Message
             return $msg_list ? new IMP_Indices() : null;
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         $imp_search = $GLOBALS['injector']->getInstance('IMP_Search');
         $process_list = $update_list = array();
 
@@ -770,7 +770,7 @@ class IMP_Message
     {
         global $notification, $prefs;
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         $imp_search = $GLOBALS['injector']->getInstance('IMP_Search');
         $trash_folder = ($prefs->getValue('use_trash'))
             ? IMP::folderPref($prefs->getValue('trash_folder'), true)
@@ -824,7 +824,7 @@ class IMP_Message
     public function sizeMailbox($mbox, $formatted = true)
     {
         try {
-            $res = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($mbox, array(Horde_Imap_Client::FETCH_SIZE => true), array('sequence' => true));
+            $res = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mbox, array(Horde_Imap_Client::FETCH_SIZE => true), array('sequence' => true));
 
             $size = 0;
             reset($res);
index 36d9e34..bc090cc 100644 (file)
@@ -25,7 +25,7 @@ extends Horde_Notification_Handler_Decorator_Base
     public function notify($options)
     {
         if (in_array('status', $options['listeners']) &&
-            ($ob = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()) &&
+            ($ob = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()) &&
             $ob->ob) {
             /* Display IMAP alerts. */
             foreach ($ob->alerts() as $alert) {
index f86c855..611074d 100644 (file)
@@ -1473,7 +1473,7 @@ class IMP_Prefs_Ui
             $sent_mail_folder = $sm_default;
         }
 
-        $sent_mail_folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($sent_mail_folder);
+        $sent_mail_folder = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->appendNamespace($sent_mail_folder);
 
         if ($sent_mail_folder) {
             $imp_folder = $GLOBALS['injector']->getInstance('IMP_Folder');
@@ -1962,7 +1962,7 @@ class IMP_Prefs_Ui
             $folder = substr($folder, strlen(self::PREF_SPECIALUSE));
         } elseif (!empty($new)) {
             $new = Horde_String::convertCharset($new, 'UTF-8', 'UTF7-IMAP');
-            $folder = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->appendNamespace($new);
+            $folder = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->appendNamespace($new);
             if (!$GLOBALS['injector']->getInstance('IMP_Folder')->create($folder, $prefs->getValue('subscribe'), array($type => true))) {
                 $folder = null;
             }
@@ -1983,7 +1983,7 @@ class IMP_Prefs_Ui
     protected function _getSpecialUse($use)
     {
         if (is_null($this->_cache)) {
-            $this->_cache = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array(
+            $this->_cache = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array(
                 'attributes' => true,
                 'special_use' => true,
                 'sort' => true
index b2cf488..7ab1fea 100644 (file)
@@ -157,7 +157,7 @@ class IMP_Search implements ArrayAccess, Iterator, Serializable
      */
     public function imapSearch($mailbox, $query, $opts = array())
     {
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         /* If doing a from/to search, use display sorting if possible.
          * Although there is a fallback to a PHP-based display sort, for
index 0436b37..11af755 100644 (file)
@@ -43,7 +43,7 @@ class IMP_Spam
             return 0;
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         $report_count = $result = 0;
 
         foreach ($indices->indices() as $mbox => $msgIndices) {
index 0942ebd..5c7c64b 100644 (file)
@@ -32,7 +32,7 @@ class IMP_Ui_Block
             $GLOBALS['injector']->getInstance('IMP_Filter')->filter('INBOX');
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         /* Get list of mailboxes to poll. */
         $poll = $GLOBALS['injector']->getInstance('IMP_Imap_Tree')->getPollList(true);
index a2be22a..ac51080 100644 (file)
@@ -70,7 +70,7 @@ class IMP_Ui_Message
      */
     public function MDNCheck($mailbox, $uid, $headers, $confirmed = false)
     {
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
         $pref_val = $GLOBALS['prefs']->getValue('disposition_send_mdn');
 
         if (!$pref_val || $imp_imap->isReadOnly($mailbox)) {
index 53b0f9a..92cc980 100644 (file)
@@ -167,7 +167,7 @@ class IMP_Views_ListMessages
             }
         }
 
-        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb();
+        $imp_imap = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create();
 
         /* These entries may change during a session, so always need to
          * update them. */
index 41f8735..a28e333 100644 (file)
@@ -109,7 +109,7 @@ class IMP_Views_ShowMessage
         /* Get envelope/header information. We don't use flags in this
          * view. */
         try {
-            $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb()->fetch($mailbox, array(
+            $fetch_ret = $GLOBALS['injector']->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox, array(
                 Horde_Imap_Client::FETCH_ENVELOPE => true,
                 Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false))
             ), array('ids' => array($uid)));
index 3027c5f..ce742e9 100644 (file)
@@ -37,7 +37,7 @@ $t = $injector->createInstance('Horde_Template');
 $t->setOption('gettext', true);
 
 /* Determine if mailbox is readonly. */
-$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
 $readonly = $imp_imap->isReadOnly(IMP::$mailbox);
 
 /* Get the base URL for this page. */
index 10ad07f..a2bbbfd 100644 (file)
@@ -63,7 +63,7 @@ if (!Horde_Util::nonInputVar('from_message_page')) {
 
 $do_filter = false;
 $imp_flags = $injector->getInstance('IMP_Imap_Flags');
-$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
 $indices = new IMP_Indices($vars->indices);
 
 /* Run through the action handlers */
index 7f11c2c..1c32a13 100644 (file)
@@ -23,7 +23,7 @@ if (!$vars->uid || !$vars->folder) {
 
 $imp_ui = new IMP_Ui_Message();
 $js_onload = $js_vars = array();
-$readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly($vars->folder);
+$readonly = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly($vars->folder);
 
 switch ($vars->actionID) {
 case 'strip_attachment':
index 3be720e..0f317b9 100644 (file)
@@ -34,7 +34,7 @@ if (!$imp_mailbox->isValidIndex()) {
     IMP::generateIMPUrl('mailbox-mimp.php', IMP::$mailbox)->add('a', 'm')->redirect();
 }
 
-$readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly(IMP::$mailbox);
+$readonly = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly(IMP::$mailbox);
 
 $imp_ui_mimp = $injector->getInstance('IMP_Ui_Mimp');
 $imp_hdr_ui = new IMP_Ui_Headers();
@@ -100,10 +100,10 @@ $uid = $index_ob['uid'];
 try {
     /* Need to fetch flags before HEADERTEXT, because SEEN flag might be set
      * before we can grab it. */
-    $flags_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array(
+    $flags_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array(
         Horde_Imap_Client::FETCH_FLAGS => true,
     ), array('ids' => array($uid)));
-    $fetch_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array(
+    $fetch_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array(
         Horde_Imap_Client::FETCH_ENVELOPE => true,
         Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $readonly))
     ), array('ids' => array($uid)));
index a7086e2..6dd13f6 100644 (file)
@@ -30,7 +30,7 @@ $registry->setTimeZone();
  * select it on the IMAP server (saves some STATUS calls). Open R/W to clear
  * the RECENT flag. */
 if (!($search_mbox = $injector->getInstance('IMP_Search')->isSearchMbox(IMP::$mailbox))) {
-    $injector->getInstance('IMP_Imap')->getOb()->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE);
+    $injector->getInstance('IMP_Injector_Factory_Imap')->create()->openMailbox(IMP::$mailbox, Horde_Imap_Client::OPEN_READWRITE);
 }
 
 /* Make sure we have a valid index. */
@@ -59,7 +59,7 @@ if ($vars->actionID) {
 }
 
 /* Determine if mailbox is readonly. */
-$peek = $readonly = $injector->getInstance('IMP_Imap')->getOb()->isReadOnly(IMP::$mailbox);
+$peek = $readonly = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->isReadOnly(IMP::$mailbox);
 if ($readonly &&
     in_array($vars->actionID, array('delete_message', 'undelete_message', 'move_message', 'flag_message', 'strip_attachment', 'strip_all'))) {
     $vars->actionID = null;
@@ -219,10 +219,10 @@ try {
 try {
     /* Need to fetch flags before HEADERTEXT, because SEEN flag might be set
      * before we can grab it. */
-    $flags_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array(
+    $flags_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array(
         Horde_Imap_Client::FETCH_FLAGS => true,
     ), array('ids' => array($uid)));
-    $fetch_ret = $injector->getInstance('IMP_Imap')->getOb()->fetch($mailbox_name, array(
+    $fetch_ret = $injector->getInstance('IMP_Injector_Factory_Imap')->create()->fetch($mailbox_name, array(
         Horde_Imap_Client::FETCH_ENVELOPE => true,
         Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => $peek))
     ), array('ids' => array($uid)));
index 32b1440..cacf1bc 100755 (executable)
@@ -42,7 +42,7 @@ foreach ($options[0] as $val) {
     }
 }
 
-$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
 
 if (is_null($server)) {
     /* Set first entry to 1, not 0. */
index 039d657..01b40bc 100644 (file)
@@ -27,7 +27,7 @@ $mode = $vars->mode
     ? $vars->mode
     : 'thread';
 
-$imp_imap = $injector->getInstance('IMP_Imap')->getOb();
+$imp_imap = $injector->getInstance('IMP_Injector_Factory_Imap')->create();
 $imp_mailbox = $injector->getInstance('IMP_Mailbox_List')->getListTrack(IMP::$mailbox, new IMP_Indices(IMP::$thismailbox, IMP::$uid));
 
 $error = false;