[imp] Show users quota on mailbox view! How?

redd@cefet-al.br redd@cefet-al.br
Fri, 15 Mar 2002 00:09:02 -0300


Hi, I collected the following information about my IMAP server software:

Imap 4.7 (imap-4.7c2-1cl.rpm)
IMAP Toolkit Environment
    27 October 1999
University of Washington
     Mark Crispin

Is there some problem with this version to use IMP mailbox quota??

Thanks...

Leandro Melo.

Citando Joshua E Warchol <jwarchol@dsl.net>:

> What IMAP server software are you trying to connect to? 
> 
> On Wed, Mar 13, 2002 at 06:16:13PM -0300, Leandro Melo wrote:
> > Hi.. How can I configure IMP to show user quota on mailbox view?
> > After configure the conf.php file and open mailbox.php on the browser, the
> 
> > following error appear:
> > 
> > Warning: Supplied argument is not a valid imap resource 
> > in /home/httpd/html/horde/imp/config/conf.php on line 341
> > 
> > The 341 line is:         imap_close($stream);
> >   
> > What do I have to do? Thanks...
> >  
> > the part of my conf.php file is:
> > 
> > $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 = 'myuser';
> >          $imap_passwd = 'mypassword';
> >          // 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'] / 1024.0;
> >              $total   = $quota['limit'] / 1024.0;
> >              $percent = $taken * 100 / $total;
> > 
> >              echo '<table width="100%" border="0" cellpadding="0" 
> > cellspacing="0"><tr><td class="item"><table b
> > order="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>';
> >          }
> >      }
> >  }
> > 
> > Leandro Melo
> > CEFET/AL
> > Adm. de Redes - GTI
> > 
> > 
> > 
> > 
> > -- 
> > IMP mailing list: http://horde.org/imp/
> > Archive: http://marc.theaimsgroup.com/?l=imp&r=1&w=2
> > Frequently Asked Questions: http://horde.org/faq/
> > To unsubscribe, mail: imp-unsubscribe@lists.horde.org
> 
> -- 
> Joshua Warchol
> UNIX Systems Administrator
> DSL.net
> 
> -- 
> IMP mailing list: http://horde.org/imp/
> Archive: http://marc.theaimsgroup.com/?l=imp&r=1&w=2
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe@lists.horde.org
> 




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/