Trans.: Re: quota hook and IMAP c-Client version (SOLVED)

mail@berata.fr mail@berata.fr
Mon, 18 Feb 2002 09:15:41 +0100



----- Message transféré de mail@berata.fr -----
    Date: Mon, 18 Feb 2002 09:09:20 +0100
    De: mail@berata.fr
En réponse à: mail@berata.fr
 Sujet: Re: quota hook and IMAP c-Client version (SOLVED)
      A: Roman Serbski <libser@manas.kg>

Surlignage Roman Serbski <libser@manas.kg>:

> Hi list
> 
> Finally the problem with imap_get_quota was solved! Now quota hook works 
> excellent.
> My problem had nothing to do neither with version of c-Client nor with 
> some tricks/hints during Courier-IMAP/c-Client installation.
> I just had to add QUOTA (Section: IMAP_CAPABILITY) in Courier-IMAP's 
> imapd config file:
> 
> IMAP_CAPABILITY="IMAP4rev1 QUOTA etc........."
> 
> Hope it will help someone.
> 
> Thank you.
> Roman

Hi Roman,

I try your tricks didn't work for me :
In imapd config file the IMAP-CAPABILITY is as follow

IMAP_CAPABILITY="IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT
THREAD=REFERENCES SORT QUOTA"

And in conf.php the files is as follow :

// If this is set to a function name, that function will be used
// to show the user's quota usage on the mailbox page.
// See the 'imp_show_quota' function below for an example.
$conf['hooks']['quota'] = 'imp_show_quota';

/* Gets the quota usage from the imap server. $imap_admin &
 * $imap_passwd must be set to fit your own settings. This works
 * with the Cyrus imap server and the Courier imap server > 1.3.12.
 * Note the necessary changes for the Courier server in the comments.
 */
 if (!function_exists('imp_show_quota')) {
    function imp_show_quota ($imp) {
         //$imap_admin = 'admin';
         //$imap_passwd = 'password';
         // Use the following two lines instead for Courier.
         $imap_admin = $imp['user'];
         $imap_passwd = Secret::read(Secret::getKey('imp'), $imp['pass']);

         $stream = @imap_open(IMP::serverString(), $imap_admin, $imap_passwd,
OP_HALFOPEN);
         //$quota = @imap_get_quota($stream, 'user.' . $imp['user']);
         // Use the following line instead for Courier.
         $quota = @imap_get_quota($stream, 'ROOT');
         imap_close($stream);

         if (!empty($quota)) {
             $taken   = $quota['usage'] / 100000000.0;
             $total   = $quota['limit'] / 100000000.0;
             $percent = $taken * 100 / $total;

             echo '<table width="100%" border="0" cellpadding="0"
cellspacing="0"><tr><td class="item"><table
border="0" cellspacing="2" cellpadding="2" width="100%"><tr><td align="center"
class="control">';
             echo sprintf("%.2fMB / %.2fMB  (%.2f%%)", $taken, $total, 
$percent);
             echo '</td></tr></table></td></tr></table>';
         }
     }
 }


The message list is still invisible. It didn't change anything ...
I have a installed the Atif Ghaffar's multi-panel patch. But I don't think it is
comming from this patch.

Thanks for this trick

José HERBRECHT

----- Fin du message transféré -----