Index: /trunk/plugins/managesieve/Changelog
===================================================================
--- /trunk/plugins/managesieve/Changelog	(revision 3807)
+++ /trunk/plugins/managesieve/Changelog	(revision 3808)
@@ -1,2 +1,6 @@
+* version 2.8 [2010-07-08]
+-----------------------------------------------------------
+- Added managesieve_auth_type option (#1486731)
+
 * version 2.7 [2010-07-06]
 -----------------------------------------------------------
Index: /trunk/plugins/managesieve/config.inc.php.dist
===================================================================
--- /trunk/plugins/managesieve/config.inc.php.dist	(revision 3807)
+++ /trunk/plugins/managesieve/config.inc.php.dist	(revision 3808)
@@ -11,4 +11,8 @@
 // For example %n = mail.domain.tld, %d = domain.tld
 $rcmail_config['managesieve_host'] = 'localhost';
+
+// authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
+// or none. Optional, defaults to best method supported by server.
+$rcmail_config['managesieve_auth_type'] = null;
 
 // use or not TLS for managesieve server connection
@@ -40,3 +44,2 @@
 
 ?>
-
Index: /trunk/plugins/managesieve/lib/rcube_sieve.php
===================================================================
--- /trunk/plugins/managesieve/lib/rcube_sieve.php	(revision 3807)
+++ /trunk/plugins/managesieve/lib/rcube_sieve.php	(revision 3808)
@@ -37,25 +37,29 @@
      * Object constructor
      *
-     * @param  string  Username (to managesieve login)
-     * @param  string  Password (to managesieve login)
-     * @param  string  Managesieve server hostname/address
-     * @param  string  Managesieve server port number
-     * @param  string  Enable/disable TLS use
-     * @param  array   Disabled extensions
+     * @param string  Username (for managesieve login)
+     * @param string  Password (for managesieve login)
+     * @param string  Managesieve server hostname/address
+     * @param string  Managesieve server port number
+     * @param string  Managesieve authentication method 
+     * @param boolean Enable/disable TLS use
+     * @param array   Disabled extensions
+     * @param boolean Enable/disable debugging
      */
     public function __construct($username, $password='', $host='localhost', $port=2000,
-                $usetls=true, $disabled=array(), $debug=false)
+        $auth_type=null, $usetls=true, $disabled=array(), $debug=false)
     {
         $this->sieve = new Net_Sieve();
 
-        if ($debug)
+        if ($debug) {
             $this->sieve->setDebug(true, array($this, 'debug_handler'));
-
-        if (PEAR::isError($this->sieve->connect($host, $port, NULL, $usetls)))
+        }
+        if (PEAR::isError($this->sieve->connect($host, $port, NULL, $usetls))) {
             return $this->_set_error(SIEVE_ERROR_CONNECTION);
-
-        if (PEAR::isError($this->sieve->login($username, $password)))
+        }
+        if (PEAR::isError($this->sieve->login($username, $password,
+            $auth_type ? strtoupper($auth_type) : null))
+        ) {
             return $this->_set_error(SIEVE_ERROR_LOGIN);
-
+        }
         $this->disabled = $disabled;
     }
Index: /trunk/plugins/managesieve/managesieve.php
===================================================================
--- /trunk/plugins/managesieve/managesieve.php	(revision 3807)
+++ /trunk/plugins/managesieve/managesieve.php	(revision 3808)
@@ -8,5 +8,5 @@
  * with server using managesieve protocol. Adds Filters tab in Settings.
  *
- * @version 2.6
+ * @version 2.8
  * @author Aleksander 'A.L.E.C' Machniak <alec@alec.pl>
  *
@@ -69,4 +69,5 @@
         $this->sieve = new rcube_sieve($_SESSION['username'],
             $this->rc->decrypt($_SESSION['password']), $host, $port,
+            $this->rc->config->get('managesieve_auth_type'),
             $this->rc->config->get('managesieve_usetls', false),
             $this->rc->config->get('managesieve_disabled_extensions'),
@@ -1091,4 +1092,2 @@
     }
 }
-
-?>
