Remove fetchmail code.
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 18 Jun 2009 20:29:49 +0000 (14:29 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 15 Aug 2009 18:13:03 +0000 (12:13 -0600)
Although the new accounts code has not yet been completed, there have
been significant changes in IMP for which the fetchmail code has not
been updated. So best just to remove it now since it probably isn't
working properly anyway.

17 files changed:
imp/ajax.php
imp/config/conf.xml
imp/config/hooks.php.dist
imp/config/prefs.php.dist
imp/docs/INSTALL
imp/docs/UPGRADING
imp/fetchmailprefs.php [deleted file]
imp/js/DimpBase.js
imp/js/fetchmailprefs.js [deleted file]
imp/lib/Fetchmail.php [deleted file]
imp/lib/Fetchmail/Account.php [deleted file]
imp/lib/Fetchmail/imap.php [deleted file]
imp/lib/IMP.php
imp/mailbox.php
imp/templates/index/index-dimp.inc
imp/templates/mailbox/mailbox.html
imp/themes/screen.css

index 38782da..d526aa8 100644 (file)
@@ -160,7 +160,7 @@ if (empty($action)) {
 // The following actions do not need write access to the session and
 // should be opened read-only for performance reasons.
 $session_control = null;
-if (in_array($action, array('chunkContent', 'Html2Text', 'Text2Html', 'GetReplyData', 'FetchmailDialog'))) {
+if (in_array($action, array('chunkContent', 'Html2Text', 'Text2Html', 'GetReplyData'))) {
     $session_control = 'readonly';
 }
 
@@ -768,28 +768,6 @@ case 'SMIMEPersonal':
     }
 
     break;
-
-case 'Fetchmail':
-    $fetch_list = Horde_Util::getFormData('accounts');
-    if (empty($fetch_list)) {
-        $result->error = _("No accounts selected.");
-    } else {
-        IMP_Fetchmail::fetchmail($fetch_list);
-        $result->success = 1;
-    }
-
-    /* Don't send dimp notifications via this response since the listener
-     * on the browser (dialog.js) doesn't know what to do with them. Instead,
-     * notifications will be picked up via the PollFolders() call that is
-     * done on success. */
-    $notify = false;
-
-    break;
-
-case 'FetchmailDialog':
-    $result = IMP_Fetchmail::fetchmailDialogForm();
-    $notify = false;
-    break;
 }
 
 // Clear the output buffer that we started above, and log any unexpected
index 16a1173..16e446b 100644 (file)
@@ -77,7 +77,7 @@
   </configsection>
  </configtab>
 
- <configtab name="mailbox" desc="Mailbox and Fetchmail">
+ <configtab name="mailbox" desc="Mailbox">
   <configsection name="mailbox">
    <configheader>Mailbox Settings</configheader>
    <configboolean name="show_preview" desc="Should we allow users to display
    are allowed to show previews - each user can still turn previews on
    or off in their preferences.">false</configboolean>
   </configsection>
-
-  <configsection name="fetchmail">
-   <configheader>Fetchmail Settings</configheader>
-   <configboolean name="show_account_colors" desc="Should we display colors for
-   messages fetched from other accounts in the mailbox index? This is a
-   performance hit unless mailbox caching is enabled.">false</configboolean>
-   <configinteger name="size_limit" desc="What is the maximum total size of
-   mails to be fetched (in bytes)? (Remember you need more than the double of
-   this value for 'memory_limit' in php.ini.) Set this value to 0 for no
-   limit.">4000000</configinteger>
-  </configsection>
  </configtab>
 
  <configtab name="msgsettings" desc="Message and Spam">
index 975ca1e..ecaace2 100644 (file)
@@ -353,7 +353,7 @@ class IMP_Hooks
 //        }
 //
 //        return $msg;
-//     }
+//    }
 
 
     /**
index 4f57a7b..cf3397f 100644 (file)
@@ -136,13 +136,6 @@ if (!$is_pop3) {
         'desc' => _("Configure flag highlighting."),
         'members' => array('flagmanagement')
     );
-
-    $prefGroups['fetchmail'] = array(
-        'column' => _("Message Options"),
-        'label' => _("Fetch Mail"),
-        'desc' => _("Configure accounts for fetching mail from other accounts."),
-        'members' => array('fetchmail_link', 'fetchmail_menu')
-    );
 }
 
 $prefGroups['display'] = array(
@@ -1251,41 +1244,6 @@ $_prefs['msgflags_color'] = array(
 
 // End IMAP Flag preferences
 
-
-// Fetch Mail preferences
-
-// Change this if you want to customize how fetchmailprefs.php works.
-$_prefs['fetchmail_link'] = array(
-    'type' => 'link',
-    'url' => 'fetchmailprefs.php',
-    'img' => 'fetchmail.png',
-    'desc' => _("Edit your preferences for accessing other mail accounts."));
-
-// Show the Fetch mail icon on the menubar?
-$_prefs['fetchmail_menu'] = array(
-    'value' => 0,
-    'locked' => false,
-    'shared' => false,
-    'type' => 'checkbox',
-    'desc' => _("Show the Fetch Mail icon on the menubar?"));
-
-// Don't change anything here.
-$_prefs['fm_accounts'] = array(
-    // value = serialize(array())
-    'value' => 'a:0:{}',
-    'locked' => false,
-    'shared' => false,
-    'type' => 'implicit');
-
-$_prefs['fetchmail_login'] = array(
-    'value' => 0,
-    'locked' => false,
-    'shared' => false,
-    'type' => 'implicit');
-
-// End Fetch Mail preferences
-
-
 // Display Options preferences
 
 // Where to start when opening mailbox?
index 59a8773..768d125 100644 (file)
@@ -415,7 +415,7 @@ Configuring IMP
 
    To use this caching, you must have a ``Cache System`` configured in Horde's
    ``Administration/Setup`` screen and have the relevant settings enabled in
-   IMP's setup screen (``Administration/Setup/Webmail/Mailbox and Fetchmail``).
+   IMP's setup screen (``Administration/Setup/Webmail/Mailbox``).
 
 
 Dynamic View Troubleshooting
index 9aa0ee7..7467fc7 100644 (file)
@@ -35,6 +35,7 @@ TODO
 * maintenance tasks
 * tos_agreement, gnupg, openssl, spellchecking (moved to Horde)
 * conf: alternate_login, redirect_on_logout moved to Horde.
+* fetchmail removed
 
 
 Upgrading IMP From 4.1.x To 4.2.x
diff --git a/imp/fetchmailprefs.php b/imp/fetchmailprefs.php
deleted file mode 100644 (file)
index b73c218..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-<?php
-/**
- * Copyright 2002-2009 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  Nuno Loureiro <nuno@co.sapo.pt>
- * @author  Michael Slusarz <slusarz@horde.org>
- * @package IMP
- */
-
-require_once dirname(__FILE__) . '/lib/Application.php';
-new IMP_Application(array('init' => true));
-
-/* Initialize Fetchmail libraries. */
-$fm_account = new IMP_Fetchmail_Account();
-
-$driver = Horde_Util::getFormData('fm_driver');
-$fetch_url = Horde::applicationUrl('fetchmailprefs.php');
-$prefs_url = Horde_Util::addParameter(Horde::getServiceLink('options', 'imp'), array('group' => 'fetchmail'), null, false);
-$to_edit = null;
-
-/* Handle clients without javascript. */
-$actionID = Horde_Util::getFormData('actionID');
-if ($actionID === null) {
-    if (Horde_Util::getPost('edit')) {
-        $actionID = 'fetchmail_prefs_edit';
-    } elseif (Horde_Util::getPost('save')) {
-        $actionID = 'fetchmail_prefs_save';
-    } elseif (Horde_Util::getPost('delete')) {
-        $actionID = 'fetchmail_prefs_delete';
-    } elseif (Horde_Util::getPost('back')) {
-        header('Location: ' . $prefs_url);
-        exit;
-    } elseif (Horde_Util::getPost('select')) {
-        header('Location: ' . $fetch_url);
-        exit;
-    }
-}
-
-/* Run through the action handlers */
-switch ($actionID) {
-case 'fetchmail_create':
-    if ($driver) {
-        $fetchmail = IMP_Fetchmail::factory($driver, array());
-    }
-    break;
-
-case 'fetchmail_prefs_edit':
-    $to_edit = Horde_Util::getFormData('account');
-    $driver = $fm_account->getValue('driver', $to_edit);
-    $fetchmail = IMP_Fetchmail::factory($driver, array());
-    break;
-
-case 'fetchmail_prefs_save':
-    $to_edit = Horde_Util::getFormData('edit_account');
-    if ($to_edit == '') {
-        $to_edit = $fm_account->add();
-    }
-
-    $fetchmail = IMP_Fetchmail::factory($driver, array());
-
-    $id = Horde_Util::getFormData('fm_id');
-    if (empty($id)) {
-        $id = _("Unnamed");
-    }
-
-    foreach ($fetchmail->getParameterList() as $val) {
-        $fm_account->setValue($val, ($val == 'id') ? $id : Horde_Util::getFormData('fm_' . $val), $to_edit);
-    }
-
-    $prefs->setValue('fetchmail_login', (bool)array_sum($fm_account->getAll('loginfetch')));
-
-    $notification->push(sprintf(_("The account \"%s\" has been saved."), $id), 'horde.success');
-    break;
-
-case 'fetchmail_prefs_delete':
-    $to_delete = Horde_Util::getFormData('edit_account');
-    if ($to_delete !== null) {
-        $deleted_account = $fm_account->delete($to_delete);
-        $notification->push(sprintf(_("The account \"%s\" has been deleted."), $deleted_account['id']), 'horde.success');
-        $prefs->setValue('fetchmail_login', (bool)array_sum($fm_account->getAll('loginfetch')));
-        $actionID = null;
-    } else {
-        $notification->push(_("You must select an account to be deleted."), 'horde.warning');
-    }
-    break;
-}
-
-require_once 'Horde/Prefs/UI.php';
-extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp'));
-
-$app = 'imp';
-$chunk = Horde_Util::nonInputVar('chunk');
-
-/* Prepare template. */
-$t = new Horde_Template();
-$t->setOption('gettext', true);
-$t->set('navcell', Horde_Util::bufferOutput(array('Prefs_UI', 'generateNavigationCell'), 'fetchmail'));
-$t->set('fetchurl', $fetch_url);
-$t->set('prefsurl', $prefs_url);
-$t->set('forminput', Horde_Util::formInput());
-
-if (empty($actionID)) {
-    /* If actionID is still empty, we haven't selected an account yet. */
-    $accountselect = true;
-    $t->set('accountselect', true);
-    $t->set('formname', 'fm_switch');
-    $t->set('actionid', 'fetchmail_prefs_edit');
-
-    $accounts = $fm_account->getAll('id');
-    $accountsval = array();
-    for ($i = 0, $iMax = count($accounts); $i < $iMax; $i++) {
-        $accountsval[] = array(
-            'i' => $i,
-            'val' => htmlspecialchars($accounts[$i])
-        );
-    }
-    $t->set('accounts', $accountsval);
-} elseif (($actionID == 'fetchmail_create') && empty($driver)) {
-    /* We are creating an account and need to select the type. */
-    $t->set('driverselect', true);
-    $t->set('formname', 'fm_driver_form');
-    $t->set('actionid', 'fetchmail_create');
-
-    $drivers = array();
-    foreach (IMP_Fetchmail::listDrivers() as $key => $val) {
-        $drivers[] = array(
-            'key' => $key,
-            'val' => htmlspecialchars($val)
-        );
-    }
-    $t->set('drivers', $drivers);
-} else {
-    $t->set('manage', true);
-    $t->set('formname', 'accounts');
-    $t->set('actionid', 'fetchmail_prefs_save');
-    $t->set('allowfolders', $conf['user']['allow_folders']);
-    if ($t->get('allowfolders')) {
-        $t->set('fmlmailbox', IMP::flistSelect(array('abbrev' => false, 'selected' => is_null($to_edit) ? '' : $fm_account->getValue('lmailbox', $to_edit))));
-    }
-
-    $protocol_list = array();
-    foreach ($fetchmail->getProtocolList() as $key => $val) {
-        $protocol_list[] = array(
-            'key' => $key,
-            'selected' => ($fm_account->getValue('protocol', $to_edit) == $key),
-            'val' => $val
-        );
-    }
-    $t->set('protocol_list', $protocol_list);
-
-    $t->set('to_edit', ($to_edit !== null));
-    if ($t->get('to_edit')) {
-        $t->set('edit_account', intval($to_edit));
-        $t->set('fmid', $fm_account->getValue('id', $to_edit));
-        $t->set('fmusername', $fm_account->getValue('username', $to_edit));
-        $t->set('fmpassword', $fm_account->getValue('password', $to_edit));
-        $t->set('fmserver', $fm_account->getValue('server', $to_edit));
-        if ($t->get('allowfolders')) {
-            $t->set('fmrmailbox', $fm_account->getValue('rmailbox', $to_edit));
-        }
-        $t->set('fmonlynew', $fm_account->getValue('onlynew', $to_edit));
-        $t->set('fmmarkseen', $fm_account->getValue('markseen', $to_edit));
-        $t->set('fmdel', $fm_account->getValue('del', $to_edit));
-        $t->set('fmloginfetch', $fm_account->getValue('loginfetch', $to_edit));
-    }
-    $t->set('driver', $driver);
-    $t->set('colors', $conf['fetchmail']['show_account_colors']);
-    if ($t->get('colors')) {
-        $fm_colors = array();
-        foreach (IMP_Fetchmail::listColors() as $val) {
-            $fm_colors[] = array(
-                'val' => $val,
-                'checked' => (($to_edit !== null) && ($fm_account->getValue('acctcolor', $to_edit) == $val))
-            );
-        }
-        $t->set('fm_colors', $fm_colors);
-    }
-    $t->set('fm_create', ($actionID == 'fetchmail_create'));
-}
-
-Prefs_UI::generateHeader(null, $chunk);
-Horde::addScriptFile('fetchmailprefs.js', 'imp', true);
-
-$charset = Horde_Nls::getCharset();
-Horde::addInlineScript(array(
-    'ImpFetchmailprefs.fetchurl = ' . Horde_Serialize($fetch_url, Horde_Serialize::JSON, $charset),
-    'ImpFetchmailprefs.prefsurl = ' . Horde_Serialize($prefs_url, Horde_Serialize::JSON, $charset)
-));
-
-echo $t->fetch(IMP_TEMPLATES . '/fetchmail/fetchmailprefs.html');
-if (!$chunk) {
-    require $registry->get('templates', 'horde') . '/common-footer.inc';
-}
index 34d678e..35a5c39 100644 (file)
@@ -1582,11 +1582,6 @@ var DimpBase = {
                 e.stop();
                 return;
 
-            case 'fetchmaillink':
-                IMPDialog.display({ dialog_load: DIMP.conf.URI_AJAX + '/FetchmailDialog' });
-                e.stop();
-                return;
-
             case 'applyfilterlink':
                 if (this.viewport) {
                     this.viewport.reload({ applyfilter: 1 });
diff --git a/imp/js/fetchmailprefs.js b/imp/js/fetchmailprefs.js
deleted file mode 100644 (file)
index 9fe20e3..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Provides the javascript for the fetchmailprefs.php script.
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- */
-
-var ImpFetchmailprefs = {
-
-    // The following variables are defined in fetchmailprefs.php:
-    //   fetchurl, prefsurl
-    fmprefs_loading: false,
-
-    _accountSubmit: function(isnew)
-    {
-        if (!this.fmprefs_loading &&
-            ((isnew != null) || !$F('account').empty())) {
-            this.fmprefs_loading = true;
-            $('fm_switch').submit();
-        }
-    },
-
-    _driverSubmit: function()
-    {
-        if (!this.fmprefs_loading && $F('fm_driver')) {
-            this.fmprefs_loading = true;
-            $('fm_driver_form').submit();
-        }
-    },
-
-    onDomLoad: function()
-    {
-        document.observe('change', this._changeHandler.bindAsEventListener(this));
-        document.observe('click', this._clickHandler.bindAsEventListener(this));
-    },
-
-    _changeHandler: function(e)
-    {
-        switch (e.element().readAttribute('id')) {
-        case 'account':
-            this._accountSubmit();
-            break;
-
-        case 'fm_driver':
-            this._driverSubmit();
-            break;
-        }
-    },
-
-    _clickHandler: function(e)
-    {
-        if (e.isRightClick()) {
-            return;
-        }
-
-        var elt = e.element();
-
-        while (Object.isElement(elt)) {
-            switch (elt.readAttribute('id')) {
-            case 'btn_delete':
-                $('actionID').setValue('fetchmail_prefs_delete');
-                break;
-
-            case 'btn_create':
-                $('actionID').setValue('fetchmail_create');
-                this._accountSubmit(true);
-                break;
-
-            case 'btn_return':
-                document.location.href = this.prefsurl;
-                break;
-
-            case 'btn_save':
-                $('actionID').setValue('fetchmail_prefs_save');
-                break;
-
-            case 'btn_select':
-                document.location.href = this.fetchurl;
-                break;
-            }
-
-            elt = elt.up();
-        }
-    }
-
-};
-
-document.observe('dom:loaded', ImpFetchmailprefs.onDomLoad.bind(ImpFetchmailprefs));
diff --git a/imp/lib/Fetchmail.php b/imp/lib/Fetchmail.php
deleted file mode 100644 (file)
index b0b9bf0..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-/**
- * The IMP_Fetchmail:: class provides an interface to download mail from
- * remote mail servers.
- *
- * Copyright 2002-2009 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  Nuno Loureiro <nuno@co.sapo.pt>
- * @author  Michael Slusarz <slusarz@horde.org>
- * @package IMP
- */
-abstract class IMP_Fetchmail
-{
-    /**
-     * Parameters used by the driver.
-     *
-     * @var array
-     */
-    protected $_params = array();
-
-    /**
-     * The list of active fetchmail parameters for the current driver.
-     * ALL DRIVERS SHOULD UNSET ANY FETCHMAIL PARAMETERS THEY DO NOT USE
-     * OR ELSE THEY WILL APPEAR IN THE PREFERENCES PAGE.
-     * The following parameters are available:
-     *   'id'          --  The account name.
-     *   'driver'      --  The driver to use.
-     *   'protocol'    --  The protocol type.
-     *   'username'    --  The username on the remote server.
-     *   'password'    --  The password on the remote server.
-     *   'server'      --  The remote server name/address.
-     *   'rmailbox'    --  The remote mailbox name.
-     *   'lmailbox'    --  The local mailbox to download messages to.
-     *   'onlynew'     --  Only retrieve new messages?
-     *   'markseen'    --  Mark messages as seen?
-     *   'del'         --  Delete messages after fetching?
-     *   'loginfetch'  --  Fetch mail from other accounts on login?
-     *   'acctcolor'   --  Should these messages be colored differently
-     *                     in mailbox view?
-     *
-     * @var array
-     */
-    protected $_activeparams = array(
-        'id', 'driver', 'type', 'protocol', 'username', 'password', 'server',
-        'rmailbox', 'lmailbox', 'onlynew', 'markseen', 'del', 'loginfetch',
-        'acctcolor'
-    );
-
-    /**
-     * Attempts to return a concrete IMP_Fetchmail instance based on $driver.
-     *
-     * @param string $driver  The type of concrete IMP_Fetchmail subclass to
-     *                        return, based on the driver indicated. The code
-     *                        is dynamically included.
-     *
-     * @param array $params   The configuration parameter array.
-     *
-     * @return mixed  The newly created concrete IMP_Fetchmail instance, or
-     *                false on error.
-     */
-    static public function factory($driver, $params = array())
-    {
-        $class = 'IMP_Fetchmail_' . basename($driver);
-        return class_exists($class)
-            ? new $class($params)
-            : false;
-    }
-
-    /**
-     * Returns a list of available drivers, with a description of each.
-     *
-     * @return array  The list of available drivers, with the driver name as
-     *                the key and the description as the value.
-     */
-    static public function listDrivers()
-    {
-        $drivers = array();
-
-        if (($dir = opendir(dirname(__FILE__) . '/Fetchmail'))) {
-            while (false !== ($file = readdir($dir))) {
-                if (!is_dir($file)) {
-                    $driver = basename($file, '.php');
-                    $class = 'IMP_Fetchmail_' . $driver;
-                    if (is_callable(array($class, 'description')) &&
-                        ($descrip = call_user_func(array($class, 'description')))) {
-                        $drivers[$driver] = $descrip;
-                    }
-                }
-            }
-            closedir($dir);
-        }
-
-        return $drivers;
-    }
-
-    /**
-     * List the colors available for coloring fetched messages.
-     *
-     * @return array  The list of available colors;
-     */
-    static public function listColors()
-    {
-        return array(
-            'purple', 'lime', 'teal', 'blue', 'olive', 'fuchsia', 'navy',
-            'aqua'
-        );
-    }
-
-    /**
-     * Returns a description of the driver.
-     *
-     * @return string  The description of the driver.
-     */
-    abstract static public function description();
-
-    /**
-     * Perform fetchmail on the list of accounts given. Outputs informaton
-     * to the global notification driver.
-     *
-     * @param array $accounts  The list of account identifiers to fetch mail
-     *                         for.
-     */
-    static public function fetchmail($accounts)
-    {
-        $fm_account = new IMP_Fetchmail_Account();
-
-        foreach ($accounts as $val) {
-            $params = $fm_account->getAllValues($val);
-            $driver = self::factory($params['driver'], $params);
-            if ($driver === false) {
-                continue;
-            }
-
-            try {
-                $res = $driver->getMail();
-                if ($res == 1) {
-                    $GLOBALS['notification']->push(_("Fetchmail: ") . sprintf(_("Fetched 1 message from %s"), $fm_account->getValue('id', $val)), 'horde.success');
-                } elseif ($res >= 0) {
-                    $GLOBALS['notification']->push(_("Fetchmail: ") . sprintf(_("Fetched %d messages from %s"), $res, $fm_account->getValue('id', $val)), 'horde.success');
-                } else {
-                    $GLOBALS['notification']->push(_("Fetchmail: no new messages."), 'horde.success');
-                }
-            } catch (Horde_Exception $e) {
-                $GLOBALS['notification']->push(_("Fetchmail: ") . $e->getMessage(), 'horde.warning');
-            }
-        }
-    }
-
-    /**
-     * Generate the form code necessary for the dialog screen.
-     *
-     * @return stdClass  The generated params to pass to the dialog.js script.
-     */
-    static public function fetchmailDialogForm()
-    {
-        $fm_account = new IMP_Fetchmail_Account();
-
-        $accounts = $fm_account->getAll('id');
-        if ($accounts) {
-            $form = '<ul>';
-            foreach (array_keys($accounts) as $key) {
-                $form .= '<li><label><input type="checkbox" name="accounts[]" checked="checked" value="' . $key . '" /> ' . htmlspecialchars($fm_account->getValue('id', $key)) . '</label></li>';
-            }
-            $form .= '</ul>';
-            $text = _("Select accounts to fetch mail from:");
-        } else {
-            $text = _("You have not configured any external mail accounts.");
-            $form = -1;
-        }
-
-        $is_dimp = ($_SESSION['imp']['view'] == 'dimp');
-
-        $res = new stdClass;
-        $res->action = $is_dimp ? 'DimpBase.pollFolders.bind(DimpBase)' : '';
-        $res->uri = Horde::applicationUrl('ajax.php', true, -1) . '/Fetchmail';
-        $res->params = array();
-        $res->text = $text;
-        $res->form = $form;
-        $res->ok_text = ($form == -1) ? '' : _("Fetch Mail");
-        $res->cancel_text = _("Cancel");
-
-        return $res;
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param array $params  The configuration parameter array.
-     */
-    public function __construct($params)
-    {
-        /* Check for missing params. */
-        $paramlist = $this->getParameterList();
-        /* if (array_diff($paramlist, array_keys($params))) {
-         *     TODO: Error message here
-         * } */
-
-        $this->_params = $params;
-    }
-
-    /**
-     * Return the list of parameters valid for this driver.
-     *
-     * @return array  The list of active parameters.
-     */
-    public function getParameterList()
-    {
-        return $this->_activeparams;
-    }
-
-    /**
-     * Return a list of protocols supported by this driver.
-     *
-     * @return array  The list of protocols.
-     *                KEY: protocol ID
-     *                VAL: protocol description
-     */
-    abstract public function getProtocolList();
-
-    /**
-     * Gets the mail using the data in this object.
-     *
-     * @return integer  Returns the number of messages retrieved on success.
-     * @throws Horde_Exception
-     */
-    abstract public function getMail();
-
-    /**
-     * Checks the message size to see if it exceeds the maximum value
-     * allowable in the configuration file.
-     *
-     * @param integer $size    The size of the message.
-     * @param string $subject  The subject of the message.
-     * @param string $from     The message sender.
-     *
-     * @return boolean  False if message is too large, true if OK.
-     */
-    protected function _checkMessageSize($size, $subject, $from)
-    {
-        if (!empty($GLOBALS['conf']['fetchmail']['size_limit']) &&
-            ($size > $GLOBALS['conf']['fetchmail']['size_limit'])) {
-            $GLOBALS['notification']->push(sprintf(_("The message \"%s\" from \"%s\" (%d bytes) exceeds fetch size limit."), Horde_Mime::decode($subject), Horde_Mime::decode($from), $size), 'horde.warning');
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Add the message to the requested local mailbox, performing any
-     * necessary processing.
-     *
-     * @param string $header  The message header text.
-     * @param string $body    The message body text.
-     * @param array $flags    The IMAP flags to add.
-     *
-     * @return boolean  True on success, false on failure.
-     */
-    protected function _addMessage($header, $body, $flags)
-    {
-        $msg = rtrim($header);
-
-        if (empty($this->_params['acctcolor'])) {
-            $msg .= "\nX-color: " . $this->_params['acctcolor'];
-        }
-        $msg .= "\n\n" . $body;
-
-        try {
-            $GLOBALS['imp_imap']->ob->append($this->_params['lmailbox'], array(array('data' => $msg, 'flags' => $flags)));
-            return true;
-        } catch (Horde_Imap_Client_Exception $e) {
-            return false;
-        }
-    }
-}
diff --git a/imp/lib/Fetchmail/Account.php b/imp/lib/Fetchmail/Account.php
deleted file mode 100644 (file)
index 0934aed..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/**
- * The IMP_Fetchmail_Account:: class provides an interface to accessing
- * fetchmail preferences for all mail accounts a user might have.
- *
- * @author  Nuno Loureiro <nuno@co.sapo.pt>
- * @package IMP
- */
-class IMP_Fetchmail_Account
-{
-    /**
-     * Array containing all the user's accounts.
-     *
-     * @var array
-     */
-    protected $_accounts = array();
-
-    /**
-     * Constructor.
-     */
-    public function __construct()
-    {
-        /* Read all the user's accounts from the prefs object or build
-         * a new account from the standard values given in prefs.php. */
-        $accounts = @unserialize($GLOBALS['prefs']->getValue('fm_accounts'));
-        if (is_array($accounts)) {
-            $this->_accounts = $accounts;
-        }
-    }
-
-    /**
-     * Return the number of accounts.
-     *
-     * @return integer  Number of active accounts.
-     */
-    public function count()
-    {
-        return count($this->_accounts);
-    }
-
-    /**
-     * Saves all accounts in the prefs backend.
-     */
-    protected function _save()
-    {
-        $GLOBALS['prefs']->setValue('fm_accounts', serialize($this->_accounts));
-    }
-
-    /**
-     * Adds a new empty account to the array of accounts.
-     *
-     * @return integer  The pointer to the created account.
-     */
-    public function add()
-    {
-        $this->_accounts[] = array();
-        $this->_save();
-        return count($this->_accounts) - 1;
-    }
-
-    /**
-     * Remove an account from the array of accounts
-     *
-     * @param integer $account  The pointer to the account to be removed.
-     *
-     * @return array  The removed account.
-     */
-    public function delete($account)
-    {
-        $deleted = $this->_accounts[$account];
-        unset($this->_accounts[$account]);
-        $this->_accounts = array_values($this->_accounts);
-        $this->_save();
-        return $deleted;
-    }
-
-    /**
-     * Returns a property from one of the accounts.
-     *
-     * @param string $key       The property to retrieve.
-     * @param integer $account  The account to retrieve the property from.
-     *
-     * @return mixed  The value of the property or false if the property
-     *                doesn't exist.
-     */
-    public function getValue($key, $account)
-    {
-        return isset($this->_accounts[$account][$key])
-            ? $this->_accounts[$account][$key]
-            : false;
-    }
-
-    /**
-     * Returns all properties from the requested accounts.
-     *
-     * @param integer $account  The account to retrieve the properties from.
-     *
-     * @return array  The entire properties array, or false on error.
-     */
-    public function getAllValues($account)
-    {
-        return isset($this->_accounts[$account])
-            ? $this->_accounts[$account]
-            : false;
-    }
-
-    /**
-     * Returns an array with the specified property from all existing accounts.
-     *
-     * @param string $key  The property to retrieve.
-     *
-     * @return array  The array with the values from all accounts.
-     */
-    public function getAll($key)
-    {
-        $list = array();
-
-        foreach (array_keys($this->_accounts) as $account) {
-            $list[$account] = $this->getValue($key, $account);
-        }
-
-        return $list;
-    }
-
-    /**
-     * Sets a property with a specified value.
-     *
-     * @param string $key       The property to set.
-     * @param mixed $val        The value the property should be set to.
-     * @param integer $account  The account to set the property in.
-     */
-    public function setValue($key, $val, $account)
-    {
-        /* These parameters are checkbox items - make sure they are stored
-         * as boolean values. */
-        $list = array('del', 'onlynew', 'markseen', 'loginfetch');
-
-        $this->_accounts[$account][$key] =
-            (in_array($key, $list) && !is_bool($val) &&
-             (($val == 'yes') || (intval($val) != 0)));
-
-        $this->_save();
-    }
-
-    /**
-     * Returns true if the pair key/value is already in the accounts array.
-     *
-     * @param string $key  The account key to search.
-     * @param string $val  The value to search for in $key.
-     *
-     * @return boolean  True if the value was found in $key.
-     */
-    public function hasValue($key, $val)
-    {
-        $list = $this->getAll($key);
-        foreach ($list as $val2) {
-            if (strpos(Horde_String::lower($val), Horde_String::lower($val2)) !== false) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
diff --git a/imp/lib/Fetchmail/imap.php b/imp/lib/Fetchmail/imap.php
deleted file mode 100644 (file)
index 70abefd..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-/**
- * The IMP_Fetchmail_imap driver implements the IMAP_Fetchmail class for use
- * with IMAP/POP3 servers.
- *
- * Copyright 2002-2009 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  Nuno Loureiro <nuno@co.sapo.pt>
- * @author  Michael Slusarz <slusarz@horde.org>
- * @package IMP
- */
-class IMP_Fetchmail_imap extends IMP_Fetchmail
-{
-    /**
-     * The Horde_Imap_Client object.
-     *
-     * @var Horde_Imap_Client
-     */
-    protected $_ob = null;
-
-    /**
-     * Returns a description of the driver.
-     *
-     * @see IMP_Fetchmail::description()
-     */
-    static public function description()
-    {
-        return _("IMAP/POP3 Mail Servers");
-    }
-
-    /**
-     * Return a list of protocols supported by this driver.
-     *
-     * @see IMP_Fetchmail::getProtocolList()
-     */
-    public function getProtocolList()
-    {
-        $output = array();
-        foreach ($this->_protocolList() as $key => $val) {
-            $output[$key] = $val['name'];
-        }
-        return $output;
-    }
-
-    /**
-     * Returns the list of IMAP/POP3 protocols that this driver supports, and
-     * associated configuration options.
-     * This needs to be in a separate function because PHP will not allow
-     * gettext strings to appear in member variables.
-     *
-     * @return array  The protocol configuration list.
-     */
-    protected function _protocolList()
-    {
-        return array(
-            'pop3' => array(
-                'name' => _("POP3"),
-                'string' => 'pop3',
-                'port' => 110,
-                'base' => 'POP3',
-                'secure' => false
-            ),
-            'pop3tls' => array(
-                'name' => _("POP3 over TLS"),
-                'string' => 'pop3',
-                'port' => 110,
-                'base' => 'POP3',
-                'secure' => 'tls'
-            ),
-            'pop3ssl' => array(
-                'name' => _("POP3 over SSL"),
-                'string' => 'pop3',
-                'port' => 995,
-                'base' => 'POP3',
-                'secure' => 'ssl'
-            ),
-            'imap' => array(
-                'name' => _("IMAP"),
-                'string' => 'imap',
-                'port' => 143,
-                'base' => 'IMAP',
-                'secure' => false
-            ),
-            'imaptls' => array(
-                'name' => _("IMAP"),
-                'string' => 'imap over TLS',
-                'port' => 143,
-                'base' => 'IMAP',
-                'secure' => 'tls'
-            ),
-            'imapsslvalid' => array(
-                'name' => _("IMAP over SSL"),
-                'string' => 'imap',
-                'port' => 993,
-                'base' => 'IMAP',
-                'secure' => 'ssl'
-            )
-        );
-    }
-
-    /**
-     * Attempts to connect to the mail server
-     *
-     * @throws Horde_Exception
-     */
-    protected function _connect()
-    {
-        if (!is_null($this->_ob)) {
-            return;
-        }
-
-        $protocols = $this->_protocolList();
-
-        /* Create the server string now. */
-        $imap_config = array(
-            'hostspec' => $this->_params['server'],
-            'password' => $this->_params['password'],
-            'port' => $protocols[$this->_params['protocol']]['port'],
-            'username' => $this->_params['username'],
-            'secure' => $protocols[$this->_params['protocol']]['secure']
-        );
-
-        try {
-            $this->_ob = Horde_Imap_Client::factory(($protocols[$this->_params['protocol']]['string'] == 'imap') ? 'Socket' : 'Socket_Pop3', $imap_config);
-        } catch (Horde_Imap_Client_Exception $e) {
-            throw new Horde_Exception(_("Cannot connect to the remote mail server: ") . $e->getMessage());
-        }
-    }
-
-    /**
-     * Gets the mail using the data in this object.
-     *
-     * @see IMP_Fetchmail::getMail()
-     * @throws Horde_Exception
-     */
-    public function getMail()
-    {
-        $to_store = array();
-        $numMsgs = 0;
-
-        $stream = $this->_connect();
-
-        /* Check to see if remote mailbox exists. */
-        $mbox = $this->_params['rmailbox'];
-
-        /* INBOX always exists and is a special case. */
-        if ($mbox && strcasecmp($mbox, 'INBOX') !== 0) {
-            try {
-                $res = $this->_ob->listMailboxes($mbox, array('flat' => true));
-                if (!count($res)) {
-                    $mbox = false;
-                }
-            } catch (Horde_Imap_Client_Exception $e) {
-                $mbox = false;
-            }
-        }
-
-        if (!$mbox) {
-            throw new Horde_Exception(_("Invalid Remote Mailbox"));
-        }
-
-        $query = new Horde_Imap_Client_Search_Query();
-        $query->flag('\\deleted', false);
-        if ($this->_params['onlynew']) {
-            $query->flag('\\seen', false);
-        }
-
-        try {
-            $search_res = $this->_ob->search($mbox, $query);
-            if (empty($search_res['match'])) {
-                return 0;
-            }
-            $fetch_res = $this->_ob->fetch($mbox, array(
-                Horde_Imap_Client::FETCH_ENVELOPE => true,
-                Horde_Imap_Client::FETCH_SIZE => true
-
-            ), array('ids' => $search_res['match']));
-        } catch (Horde_Imap_Client_Exception $e) {
-            return 0;
-        }
-
-        /* Mark message seen if 'markseen' is set. */
-        $peek = !$this->_params['markseen'];
-
-        reset($fetch_res);
-        while (list($id, $ob) = each($fetch_res)) {
-            /* Check message size. */
-            if (!$this->_checkMessageSize($ob['size'], $ob['envelope']['subject'], Horde_Mime_Address::addrArray2String($ob['envelope']['from']))) {
-                continue;
-            }
-
-            try {
-                $res = $this->_ob->fetch($mbox, array(
-                    Horde_Imap_Client::FETCH_HEADERTEXT => array(array('peek' => $peek)),
-                    Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true)),
-                    Horde_Imap_Client::FETCH_FLAGS => true
-                ), array('ids' => array($id)));
-            } catch (Horde_Imap_Client_Exception $e) {
-                continue;
-            }
-
-            /* Append to the server. */
-            if ($this->_addMessage($res[$id]['headertext'][0], $res[$id]['bodytext'][0], $res[$id]['flags'])) {
-                ++$numMsgs;
-                $to_store[] = $id;
-            }
-        }
-
-        /* Remove the mail if 'del' is set. */
-        if ($numMsgs && $this->_params['del']) {
-            try {
-                $imp_imap->ob->store($mbox, array('add' => array('\\deleted'), 'ids' => $to_store));
-                $imp_imap->ob->expunge($mbox, array('ids' => $to_store));
-            } catch (Horde_Imap_Client_Exception $e) {}
-        }
-
-        return $numMsgs;
-    }
-
-}
index 569fb77..dacb0a7 100644 (file)
@@ -591,18 +591,6 @@ class IMP
             $menu->add($menu_search_url, _("_Search"), 'search.png');
         }
 
-        if (($_SESSION['imp']['protocol'] != 'pop') &&
-            $prefs->getValue('fetchmail_menu')) {
-            Horde::addScriptFile('effects.js', 'horde', true);
-            Horde::addScriptFile('redbox.js', 'horde', true);
-            Horde::addScriptFile('dialog.js', 'imp', true);
-
-            $js_params = array(
-                'dialog_load' => Horde::applicationUrl('ajax.php', true, -1) . '/FetchmailDialog'
-            );
-            $menu->add('javascript:IMPDialog.display(' . Horde::escapeJson($js_params, array('urlencode' => true)) . ')', _("Fetch Mail"), 'fetchmail.png');
-        }
-
         if ($prefs->getValue('filter_menuitem')) {
             $menu->add(Horde::applicationUrl('filterprefs.php'), _("Fi_lters"), 'filters.png');
         }
index 0087a66..d8467c9 100644 (file)
@@ -234,12 +234,6 @@ $pageOb = $imp_mailbox->buildMailboxPage(Horde_Util::getFormData('page'), $start
 $show_preview = ($conf['mailbox']['show_preview'] && $prefs->getValue('preview_enabled'));
 
 $overview_headers = array('x-priority');
-if (empty($conf['fetchmail']['show_account_colors'])) {
-    $fetchmail = false;
-} else {
-    $fetchmail = true;
-    $overview_headers[] = 'x-color';
-}
 $mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('preview' => $show_preview, 'headers' => $overview_headers, 'structure' => $prefs->getValue('atc_flag')));
 
 /* Determine sorting preferences. */
@@ -723,7 +717,6 @@ while (list(,$ob) = each($mbox_info['overview'])) {
     $msg = array(
         'bg' => '',
         'class' => '',
-        'color' => '',
         'date' => htmlspecialchars($imp_ui->getDate($ob['envelope']['date'])),
         'number' => $ob['seq'],
         'preview' => '',
@@ -768,14 +761,6 @@ while (list(,$ob) = each($mbox_info['overview'])) {
         }
     }
 
-    /* Show colors for fetchmail messages? */
-    if ($fetchmail) {
-        $color = $ob['headers']->getValue('x-color');
-        if ($color) {
-            $msg['color'] = htmlspecialchars($color);
-        }
-    }
-
     /* Show message preview? */
     if ($show_preview && isset($ob['preview'])) {
         if (empty($ob['preview'])) {
index d12bc57..4c4664a 100644 (file)
@@ -60,9 +60,6 @@ function _simpleButton($id, $text, $image, $imagedir = null)
    <ul id="dimpbarActions">
     <?php echo _simpleButton('composelink', _("_New Message"), 'compose.png') ?>
     <?php echo _simpleButton('checkmaillink', _("_Get Mail"), 'checkmail.png') ?>
-<?php if (($_SESSION['imp']['protocol'] != 'pop') && $prefs->getValue('fetchmail_menu')): ?>
-    <?php echo _simpleButton('fetchmaillink', _("_Fetch Mail"), 'fetchmail.png') ?>
-<?php endif; ?>
     <?php echo _simpleButton('alertsloglink', _("Alerts _Log"), 'info_icon.png', $hordeimg) ?>
 <?php if (!empty($_SESSION['imp']['filteravail'])): ?>
     <?php echo _simpleButton('applyfilterlink', _("Apply Filter"), 'filters.png') ?>
index bac3885..39eb619 100644 (file)
@@ -3,7 +3,7 @@
   <td>
    <tag:overflow_begin /><label><input type="checkbox" class="checkbox" name="indices[]" value="<tag:messages.uid />" /><tag:messages.status />&nbsp;</label><tag:overflow_end />
   </td>
-  <td<if:messages.color> style="background:<tag:messages.color />"</if:messages.color>>
+  <td>
    <tag:overflow_begin /><tag:messages.number /><tag:overflow_end />
   </td>
   <td><tag:overflow_begin /><tag:messages.date />&nbsp;<tag:overflow_end /></td>
index 9384246..0634841 100644 (file)
     margin-bottom: 1em;
 }
 
-/* Fetchmail styling. */
-#fetchmail {
-    padding: 1em;
-}
-#fetchmail ul {
-    list-style: none;
-}
-
 /* Navbar action styling. */
 ul.msgactions, ul.msgactions ul {
     list-style: none;