[dev] [PATCH] More IMP quota patches ...

Etienne Goyer etienne.goyer at linuxquebec.com
Fri Sep 26 12:36:16 PDT 2003


Hi list,

I have a patch that fix three issue with IMP_Quota :

1. Typo in function documentation (kB -> bytes).

2. Bug with an earlier patch of mine in templates/quota/quota.inc
regarding error display.

3. Wrong assumption regarding mailbox name in imp/lib/Quota/cyrus.php.
The code was assuming a standard namespace (user<sep><mailbox>) and
break on Cyrus server that use altnamespace.  I tested my patch with
both standard namespace and altnamespace, and it worked for me.
However, since my system have the imap_get_quotaroot function available,
I did no tried the alternate path of using the imap_get_quota function
instead so I don't know how it react in this circumstance.  To be
checked, I suppose.

Thanks for considering this patch.

-- 
Etienne Goyer                    Linux Québec Technologies Inc.
http://www.LinuxQuebec.com       etienne.goyer at linuxquebec.com
-------------- next part --------------
--- lib/Quota.php.orig.1	Fri Sep 26 15:00:35 2003
+++ lib/Quota.php	Fri Sep 26 15:01:05 2003
@@ -104,7 +104,7 @@
     }
 
     /**
-     * Get quota information (used/allocated), in kB.
+     * Get quota information (used/allocated), in bytes.
      *
      * @access public
      *
--- lib/Quota/command.php.orig.1	Fri Sep 26 14:59:42 2003
+++ lib/Quota/command.php	Fri Sep 26 15:01:19 2003
@@ -51,7 +51,7 @@
     }
 
     /**
-     * Get quota information (allocated/used), in kB.
+     * Get quota information (allocated/used), in bytes.
      *
      * @access public
      *
--- lib/Quota/courier.php.orig.1	Fri Sep 26 14:59:52 2003
+++ lib/Quota/courier.php	Fri Sep 26 15:01:34 2003
@@ -17,7 +17,7 @@
 class IMP_Quota_courier extends IMP_Quota {
 
     /**
-     * Get quota information (used/allocated), in kB.
+     * Get quota information (used/allocated), in bytes.
      *
      * @access public
      *
--- lib/Quota/cyrus.php.orig.1	Fri Sep 26 14:59:18 2003
+++ lib/Quota/cyrus.php	Fri Sep 26 15:02:46 2003
@@ -41,7 +41,7 @@
     }
 
     /**
-     * Get quota information (used/allocated), in kB.
+     * Get quota information (used/allocated), in bytes.
      *
      * @access public
      *
@@ -52,16 +52,14 @@
      */
     function getQuota()
     {
-        $mbox = 'user' . $this->_params['delimiter'] . $_SESSION['imp']['user'];
-
         $quota = null;
 
         if (function_exists('imap_get_quotaroot')) {
-            @$quota = imap_get_quotaroot($_SESSION['imp']['stream'], $mbox);
+            @$quota = imap_get_quotaroot($_SESSION['imp']['stream'], "INBOX");
         } else {
             $stream = @imap_open(IMP::serverString(), $this->_params['login'], $this->_params['password'], OP_HALFOPEN);
             if ($stream !== false) {
-                $quota = @imap_get_quota($stream, $mbox);
+                $quota = @imap_get_quota($stream, "INBOX");
                 @imap_close($stream);
             }
         }
--- lib/Quota/logfile.php.orig.1	Fri Sep 26 15:00:05 2003
+++ lib/Quota/logfile.php	Fri Sep 26 15:03:00 2003
@@ -62,7 +62,7 @@
     }
 
     /**
-     * Get quota information (used/allocated), in kB.
+     * Get quota information (used/allocated), in bytes.
      *
      * @access public
      *
--- lib/Quota/mdaemon.php.orig.1	Fri Sep 26 15:00:17 2003
+++ lib/Quota/mdaemon.php	Fri Sep 26 15:03:26 2003
@@ -20,7 +20,7 @@
 class IMP_Quota_mdaemon extends IMP_Quota {
 
     /**
-     * Get quota information (used/allocated), in kB.
+     * Get quota information (used/allocated), in bytes.
      *
      * @access public
      *
--- templates/quota/quota.inc.orig.1	Fri Sep 26 14:29:59 2003
+++ templates/quota/quota.inc	Fri Sep 26 14:36:38 2003
@@ -18,7 +18,7 @@
     }
 } else {
     $class = 'quotawarn';
-    $message = $quota;
+    $message = _("Unable to retrieve quota");
 }
 ?>
 <table width="100%" border="0" cellpadding="3" cellspacing="0">


More information about the dev mailing list