[bugs] [Bug 1028] New - Cyrus IMAP server quota buglet

bugs@bugs.horde.org bugs@bugs.horde.org
Wed, 21 Aug 2002 15:33:01 -0300


http://bugs.horde.org/show_bug.cgi?id=1028

*** shadow/1028	Wed Aug 21 15:33:01 2002
--- shadow/1028.tmp.17822	Wed Aug 21 15:33:01 2002
***************
*** 0 ****
--- 1,68 ----
+ Bug#: 1028
+ Product: Horde
+ Version: 2.3 Unstable
+ Platform: Mozilla 5.x
+ OS/Version: Linux
+ Status: NEW   
+ Resolution: 
+ Severity: normal
+ Priority: P2
+ Component: IMP
+ Area: BUILD
+ AssignedTo: chuck@horde.org                            
+ ReportedBy: kevin_myer@iu13.org               
+ URL: 
+ Summary: Cyrus IMAP server quota buglet
+ 
+ There's a small buglet in the imp/lib/Quota/cyrus.php functions.  Actually its
+ not so much a bug as it is a feature of the Cyrus IMAP daemon that we're using
+ that isn't supported in the current quota code.  Basically, the Cyrus IMAP
+ daemon has the ability to specify an alternate mailbox separator character as
+ listed below (from imapd.conf man page):
+ 
+ 
+ unixhierarchysep: no
+             Use the UNIX separator character '/'  for  delimiting
+             levels  of  mailbox hierarchy.  The default is to use
+             the netnews separator character '.'.
+ 
+ imp/lib/Quota/cyrus.php is hard coded to use a "dot" (.) and I've simply
+ modified that to default to a . but to also except another parameter from
+ servers.php, hiearchysep, which should be the value used as the hierarchy
+ separator (in this case /).
+ 
+ imp/config/servers.php would have something like this added:
+ 
+     'quota' => array(
+         'driver' => 'cyrus',
+         'params' => array(
+             'login' => 'username',
+             'password' => 'password',
+             'hierarchysep' => '/'
+      )
+ 
+ Patch:
+ --- cyrusold.php	Thu Aug  1 05:03:07 2002
+ +++ cyrus.php	Wed Aug 21 14:27:55 2002
+ @@ -42,6 +42,9 @@
+          if (!array_key_exists('password', $this->params)) {
+              $this->params['password'] = '';
+          }
+ +        if (!array_key_exists('hierarchysep', $this->params)) {
+ +            $this->params['hierarchysep'] = '.';
+ +        }
+      }
+  
+      /**
+ @@ -58,7 +61,7 @@
+          $stream = @imap_open(IMP::serverString(), $this->params['login'],
+ $this->params['password'], OP_HALFOPEN);
+  
+          if ($stream !== false) {
+ -            $quota = @imap_get_quota($stream, 'user.' . $imp['user']);
+ +            $quota = @imap_get_quota($stream, 'user' .
+ $this->params['hierarchysep'] . $imp['user']);
+              @imap_close($stream);
+              if (is_array($quota)) {
+                  if ($quota['limit'] != 0) {
+